| 1 | export interface Input { |
| 2 | file: MediaFile; |
| 3 | hasCotyledonCookie: boolean; |
| 4 | } |
| 5 | |
| 6 | export { theme } from "../theme.ts"; |
| 7 | |
| 8 | export function meta({ file }: { file: MediaFile }) { |
| 9 | if (file.path === "/") return { title: "clo's files" }; |
| 10 | return { title: file.basename + " - clo's files" }; |
| 11 | } |
| 12 | |
| 13 | <const/{ file, hasCotyledonCookie }=input> |
| 14 | <const/dirs=(() => { |
| 15 | const dirs: MediaFile[] = []; |
| 16 | let dir: MediaFile | null = file; |
| 17 | ASSERT(dir); |
| 18 | do { |
| 19 | dirs.unshift(dir); |
| 20 | dir = dir.getParent(); |
| 21 | } while (dir); |
| 22 | return dirs; |
| 23 | })()> |
| 24 | |
| 25 | <const/parts=file.path.split("/")> |
| 26 | <const/isCotyledon=parseInt(parts[1]) < 2025> |
| 27 | |
| 28 | <div class=["files", isCotyledon && ["ctld", "ctld-" + parts[1]]]> |
| 29 | <for|entry, i| of=dirs> |
| 30 | <const/isLast=i === dirs.length - 1> |
| 31 | <media-panel |
| 32 | file=entry |
| 33 | activeFilename=parts[i + 1] ?? null |
| 34 | ...{ hasCotyledonCookie, isLast } |
| 35 | /> |
| 36 | </for> |
| 37 | </div> |
| 38 | |
| 39 | import { ASSERT } from "@clo/lib/assert"; |