1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
4f267d Tucker McKnight
4f267d Tucker McKnight
4f267d Tucker McKnight
6c4e86 Tucker McKnight
c945a9 Tucker McKnight
c945a9 Tucker McKnight
c945a9 Tucker McKnight
c945a9 Tucker McKnight
c945a9 Tucker McKnight
c945a9 Tucker McKnight
c945a9 Tucker McKnight
c945a9 Tucker McKnight
c945a9 Tucker McKnight
4f267d Tucker McKnight
4f267d Tucker McKnight
4f267d Tucker McKnight
4f267d Tucker McKnight
4f267d Tucker McKnight
4f267d Tucker McKnight
4f267d Tucker McKnight
4f267d Tucker McKnight
4f267d Tucker McKnight
4f267d Tucker McKnight
4f267d Tucker McKnight
c945a9 Tucker McKnight
c945a9 Tucker McKnight
c945a9 Tucker McKnight
c945a9 Tucker McKnight
4f267d Tucker McKnight
7db57c Tucker McKnight
7db57c Tucker McKnight
7db57c Tucker McKnight
4f267d Tucker McKnight
c945a9 Tucker McKnight
4f267d Tucker McKnight
1a487a Tucker McKnight
c945a9 Tucker McKnight
4f267d Tucker McKnight
4f267d Tucker McKnight
4f267d Tucker McKnight
import { type ReposConfiguration } from "../../src/configTypes.ts"
export const NavHelper = (reposConfig: ReposConfiguration, slugify: Function, repoName: string, branchName: string) => {
const reposPath = reposConfig.path || ""
// These two aren't actually used by any pages, but they're in almost
// every page URL. E.g. all of them start with 'repos/my-repo-name'
// or 'repos/my-repo-name/branches.'
const repoBasePath = `${reposPath}/${slugify(repoName)}`
const rootBasePathBranches = `${repoBasePath}/branches`
const currentBranchPath = `${rootBasePathBranches}/${slugify(branchName)}`
return {
rootPath: () => {
if (reposPath === "") {
return "/"
}
else {
return reposPath
}
},
repoHomePath: () => {
return `${rootBasePathBranches}/${slugify(reposConfig.repos[repoName].defaultBranch)}`
},
repoCurrentBranchHome: () => {
return currentBranchPath
},
repoBranchHome: (branchName: string) => {
return `${rootBasePathBranches}/${slugify(branchName)}`
},
repoCurrentBranchFiles: () => {
return `${currentBranchPath}/files`
},
repoCurrentBranchCommits: () => `${currentBranchPath}/commits/page1`,
repoCurrentBranchBranches: () => `${currentBranchPath}/branches`,
}
}