|
| 1 | +import type { Metadata } from 'next'; |
| 2 | +import { TopNav } from '@/components/TopNav'; |
| 3 | +import { Footer } from '@/components/Footer'; |
| 4 | +import { LucideIcon } from '@/components/ui/LucideIcon'; |
| 5 | +import { GITHUB_URL } from '@/lib/version'; |
| 6 | +import { |
| 7 | + loadAppcastItems, |
| 8 | + formatBytes, |
| 9 | + formatPubDate, |
| 10 | + type AppcastItem, |
| 11 | +} from '@/lib/appcast'; |
| 12 | +import styles from './history.module.css'; |
| 13 | + |
| 14 | +export const metadata: Metadata = { |
| 15 | + title: 'Version History · Dao Browser', |
| 16 | + description: |
| 17 | + 'Every shipped release of Dao Browser, with direct download links for the macOS Apple Silicon build.', |
| 18 | +}; |
| 19 | + |
| 20 | +// Resolve at request time so a redeployed appcast.xml is picked up |
| 21 | +// without rebuilding the page. |
| 22 | +export const dynamic = 'force-dynamic'; |
| 23 | + |
| 24 | +export default async function HistoryPage() { |
| 25 | + const items = await loadAppcastItems(); |
| 26 | + return ( |
| 27 | + <> |
| 28 | + <TopNav /> |
| 29 | + <main className={styles.root}> |
| 30 | + <header className={styles.header}> |
| 31 | + <div className={styles.eyebrow}> |
| 32 | + <LucideIcon name="package" size={14} aria-hidden /> |
| 33 | + Version history |
| 34 | + </div> |
| 35 | + <h1 className={styles.heading}>All releases</h1> |
| 36 | + <p className={styles.subhead}> |
| 37 | + Every Dao Browser build we've shipped, newest first. Each link |
| 38 | + points at the signed .dmg on our release CDN. |
| 39 | + </p> |
| 40 | + </header> |
| 41 | + |
| 42 | + {items.length === 0 ? ( |
| 43 | + <div className={styles.empty}> |
| 44 | + No releases found in appcast.xml. |
| 45 | + </div> |
| 46 | + ) : ( |
| 47 | + <ol className={styles.list}> |
| 48 | + {items.map((item, idx) => ( |
| 49 | + <ReleaseRow key={item.shortVersion} item={item} isLatest={idx === 0} /> |
| 50 | + ))} |
| 51 | + </ol> |
| 52 | + )} |
| 53 | + </main> |
| 54 | + <Footer /> |
| 55 | + </> |
| 56 | + ); |
| 57 | +} |
| 58 | + |
| 59 | +function ReleaseRow({ item, isLatest }: { item: AppcastItem; isLatest: boolean }) { |
| 60 | + const fileName = item.downloadUrl.split('/').pop() ?? 'download.dmg'; |
| 61 | + const commitShort = item.gitCommit ? item.gitCommit.slice(0, 7) : null; |
| 62 | + return ( |
| 63 | + <li className={`${styles.item} ${isLatest ? styles.itemLatest : ''}`}> |
| 64 | + <div className={styles.meta}> |
| 65 | + <div className={styles.versionRow}> |
| 66 | + <span className={styles.version}>v{item.shortVersion}</span> |
| 67 | + {isLatest && <span className={styles.latestBadge}>Latest</span>} |
| 68 | + </div> |
| 69 | + <div className={styles.detailRow}> |
| 70 | + {item.pubDate && ( |
| 71 | + <span className={styles.detail}> |
| 72 | + <LucideIcon name="calendar" size={14} aria-hidden /> |
| 73 | + {formatPubDate(item.pubDate)} |
| 74 | + </span> |
| 75 | + )} |
| 76 | + <span className={styles.detail}> |
| 77 | + <LucideIcon name="hard-drive" size={14} aria-hidden /> |
| 78 | + {formatBytes(item.sizeBytes)} |
| 79 | + </span> |
| 80 | + {item.minimumSystemVersion && ( |
| 81 | + <span className={styles.detail}> |
| 82 | + <LucideIcon name="apple" size={14} aria-hidden /> |
| 83 | + macOS {item.minimumSystemVersion}+ |
| 84 | + </span> |
| 85 | + )} |
| 86 | + {commitShort && ( |
| 87 | + <a |
| 88 | + className={styles.commitLink} |
| 89 | + href={`${GITHUB_URL}/commit/${item.gitCommit}`} |
| 90 | + target="_blank" |
| 91 | + rel="noopener noreferrer" |
| 92 | + title={item.gitCommit ?? undefined} |
| 93 | + > |
| 94 | + {commitShort} |
| 95 | + </a> |
| 96 | + )} |
| 97 | + </div> |
| 98 | + </div> |
| 99 | + <a |
| 100 | + href={item.downloadUrl} |
| 101 | + className={`${styles.downloadBtn} ${isLatest ? styles.downloadBtnPrimary : ''}`} |
| 102 | + download={fileName} |
| 103 | + > |
| 104 | + <LucideIcon name="download" size={16} aria-hidden /> |
| 105 | + Download |
| 106 | + </a> |
| 107 | + </li> |
| 108 | + ); |
| 109 | +} |
0 commit comments