make searching word and add branch last committed date to dropdown

600ca76f289cc0435b1d886b44fd49ec46bdf281

Tucker McKnight <tucker@pangolin.lan> | Sun Dec 14 2025

make searching word and add branch last committed date to dropdown
frontend/main.js:79
Before
78
79
80










81
82
  element.addEventListener("click", copyPull)
})

⁣
⁣
⁣
⁣
⁣
⁣
⁣
⁣
⁣
⁣
const bootstrap = window.bootstrap
const jsVars = window.jsVars
After
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
  element.addEventListener("click", copyPull)
})

const dropdownBranchesResults = document.getElementById('dropdown-branches-results')
document.getElementById('dropdownBranchSearch')?.addEventListener('input', (event) => {
  const searchTerm = event.target.value
  console.log(searchTerm)
  let branches = window.branchesWithHrefs.filter((branch) => {
    return branch.name.includes(searchTerm)
  })
  dropdownBranchesResults.innerHTML = branchesListItems(branches, window.defaultBranch)
})

const bootstrap = window.bootstrap
const jsVars = window.jsVars
js_templates/repo.ts:2
Before
1
2
3
4
5
6
7
8
9
import { type ReposConfiguration } from '../src/configTypes.ts'
import { type Repository } from '../src/dataTypes.ts'

export const branchesListItems = (branches: Array<{name: string, href: string}>, defaultBranch: string): string => {
  return branches.map((branch) => {
    const badge = defaultBranch === branch.name ? '<div class="badge rounded-pill bg-primary ms-2">default</div>' : ''
    return `<span class='dropdown-item'><a href='${branch.href}'>${branch.name}</a>${badge}</span>`
  }).join('')
}
After
1
2
3
4
5
6
7
8
9
import { type ReposConfiguration } from '../src/configTypes.ts'
import { type Repository } from '../src/dataTypes.ts'

export const branchesListItems = (branches: Array<{name: string, href: string, date: string}>, defaultBranch: string): string => {
  return branches.map((branch) => {
    const badge = defaultBranch === branch.name ? '<div class="badge rounded-pill bg-primary ms-2">default</div>' : ''
    return `<span class='dropdown-item my-1'><a href='${branch.href}'>${branch.name}</a>${badge}<span class="d-block ms-2">updated ${branch.date}</span></span>`
  }).join('')
}
js_templates/repo.ts:27
Before
26
27
28

29
30
      return {
        name: branch.name,
        href: nav.repoBranchHome(branch.name),
⁣
      }
    })
After
26
27
28
29
30
31
      return {
        name: branch.name,
        href: nav.repoBranchHome(branch.name),
        date: repo.commits.get(branch.head).date.toDateString(),
      }
    })
js_templates/repo.ts:76
Before
75
76
77
78
79
80
                                <div class="sortRadioButton pe-1">
                                  <input class="form-check-input" type="radio" name="branchSort" id="branchSortByDate" checked>
                                  <label class="form-check-label" for="branchSortByDate">
                                    Date
                                  </label>
                                </div>
                                <div class="sortRadioButton ps-1">
After
75
76
77
78
79
80
                                <div class="sortRadioButton pe-1">
                                  <input class="form-check-input" type="radio" name="branchSort" id="branchSortByDate" checked>
                                  <label class="form-check-label" for="branchSortByDate">
                                    Last commit
                                  </label>
                                </div>
                                <div class="sortRadioButton ps-1">
js_templates/repo.ts:89
Before
88
89
90
91
92
93
                            </div>
                          </form>
                          <div class="dropdown-divider"></div>
                          <div class="dropdown-branches">
                            ${branchesListItems(branchesWithHrefs, repo.defaultBranch)}
                          </div>
                        </div>
After
88
89
90
91
92
93
                            </div>
                          </form>
                          <div class="dropdown-divider"></div>
                          <div id="dropdown-branches-results" class="dropdown-branches">
                            ${branchesListItems(branchesWithHrefs, repo.defaultBranch)}
                          </div>
                        </div>