Files snapshot from show-tags

0
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
42
43
44
45
da80ba Tucker McKnight
88b515 Tucker McKnight
3700da Tucker McKnight
2a54fe Tucker McKnight
88b515 Tucker McKnight
3700da Tucker McKnight
99f634 Tucker McKnight
7f8822 Tucker McKnight
7f8822 Tucker McKnight
7f8822 Tucker McKnight
2a54fe Tucker McKnight
2a54fe Tucker McKnight
2a54fe Tucker McKnight
2a54fe Tucker McKnight
2a54fe Tucker McKnight
2a54fe Tucker McKnight
2a54fe Tucker McKnight
2a54fe Tucker McKnight
cdb797 Tucker McKnight
7f8822 Tucker McKnight
3700da Tucker McKnight
da80ba Tucker McKnight
da80ba Tucker McKnight
da80ba Tucker McKnight
da80ba Tucker McKnight
99f634 Tucker McKnight
da80ba Tucker McKnight
da80ba Tucker McKnight
da80ba Tucker McKnight
868131 Tucker McKnight
da80ba Tucker McKnight
da80ba Tucker McKnight
da80ba Tucker McKnight
da80ba Tucker McKnight
da80ba Tucker McKnight
0b4cba Tucker McKnight
b97c1a Tucker McKnight
da80ba Tucker McKnight
2a54fe Tucker McKnight
da80ba Tucker McKnight
da80ba Tucker McKnight
da80ba Tucker McKnight
651585 Tucker McKnight
3700da Tucker McKnight
3700da Tucker McKnight
7f8822 Tucker McKnight
import m from 'mithril'
import { type SortedFileList, type Repository } from "../src/dataTypes.ts"
import htmlPage from './common/htmlPage.ts'
import {NavHelper} from './helpers/nav.ts'

export default async (reposConfig: any, eleventyConfig: any, data: any) => {
  const branch: Repository['branches'][0] = data.currentRef
  const topLevelFilesOnly = eleventyConfig.getFilter("topLevelFilesOnly")
  const slugify = eleventyConfig.getFilter("slugify")

  const nav = NavHelper({
    reposConfig,
    slugify,
    currentRepoName: data.currentRepo.name,
    currentRefName: data.currentRef.name,
    currentRefType: data.currentRefType,
  })

  const files: SortedFileList = topLevelFilesOnly(Array.from(branch.fileList.keys()), '')

  const pageContent = [
    m('div', {class: "row mt-3 mb-1"}, [
      m('div', {class: "col"},
        m('p', [
          'Files snapshot from ',
          m('span', {class: "font-monospace"}, data.flatRef.relName)
        ])
      )
    ]),
    m('div', {class: "row my-2"},
      m('div', {class: "col"},
        m('h3', './')
      )
    ),
    m('ul', {class: "list-group"}, files.map((file) => {
      return m('li', {class: 'list-group-item'}, [
        file.isDirectory ? m.trust('<span>&#x1F4C1;&nbsp;</span>') : null,
        m('a', {
          href: nav.file(file)
        }, file.name)
      ])
    }))
  ]

  return await htmlPage(reposConfig, eleventyConfig, data, pageContent)
}