From d1b7e973d36512506413bc2073c31d026e20d33e Mon Sep 17 00:00:00 2001 From: Chris Wanstrath Date: Fri, 30 Jan 2026 20:30:07 -0800 Subject: [PATCH] fix things --- apps/code/20260130-000000/bun.lock | 1 + .../code/20260130-000000/src/server/index.tsx | 187 +++++++++++++++++- apps/todo/20260130-181927/bun.lock | 1 + apps/todo/20260130-181927/pub/img/bite1.png | Bin 1981657 -> 1098289 bytes apps/todo/20260130-181927/pub/img/bite2.png | Bin 2255362 -> 1253997 bytes apps/todo/20260130-181927/pub/img/burger.png | Bin 2417757 -> 1332714 bytes apps/versions/20260130-000000/bun.lock | 1 + src/client/state.ts | 3 +- src/server/index.tsx | 5 +- 9 files changed, 194 insertions(+), 4 deletions(-) diff --git a/apps/code/20260130-000000/bun.lock b/apps/code/20260130-000000/bun.lock index e68c61a..bbc0c74 100644 --- a/apps/code/20260130-000000/bun.lock +++ b/apps/code/20260130-000000/bun.lock @@ -5,6 +5,7 @@ "": { "name": "code", "dependencies": { + "@because/forge": "*", "@because/howl": "*", "@because/hype": "*", "@because/toes": "*", diff --git a/apps/code/20260130-000000/src/server/index.tsx b/apps/code/20260130-000000/src/server/index.tsx index 7a9fc7b..89bd590 100644 --- a/apps/code/20260130-000000/src/server/index.tsx +++ b/apps/code/20260130-000000/src/server/index.tsx @@ -127,6 +127,69 @@ const BreadcrumbCurrent = define('BreadcrumbCurrent', { fontWeight: 500, }) +const MediaContainer = define('MediaContainer', { + margin: '20px 0', + border: `1px solid ${theme('colors-border')}`, + borderRadius: theme('radius-md'), + overflow: 'hidden', + backgroundColor: theme('colors-bgSubtle'), +}) + +const MediaHeader = define('MediaHeader', { + padding: '10px 15px', + backgroundColor: theme('colors-bgElement'), + borderBottom: `1px solid ${theme('colors-border')}`, + fontWeight: 'bold', + fontSize: '14px', + display: 'flex', + justifyContent: 'space-between', + alignItems: 'center', +}) + +const MediaContent = define('MediaContent', { + padding: '20px', + display: 'flex', + justifyContent: 'center', + alignItems: 'center', +}) + +const ImagePreview = define('ImagePreview', { + base: 'img', + maxWidth: '100%', + maxHeight: '600px', + objectFit: 'contain', +}) + +const AudioPlayer = define('AudioPlayer', { + base: 'audio', + width: '100%', + maxWidth: '500px', +}) + +const VideoPlayer = define('VideoPlayer', { + base: 'video', + maxWidth: '100%', + maxHeight: '600px', +}) + +const DownloadButton = define('DownloadButton', { + base: 'a', + display: 'inline-flex', + alignItems: 'center', + gap: '6px', + padding: '8px 16px', + backgroundColor: theme('colors-primary'), + color: 'white', + textDecoration: 'none', + borderRadius: theme('radius-md'), + fontSize: '14px', + states: { + ':hover': { + opacity: 0.9, + }, + }, +}) + const FolderIcon = () => ( @@ -145,6 +208,28 @@ interface LayoutProps { highlight?: boolean } +const fileMemoryScript = ` +(function() { + var params = new URLSearchParams(window.location.search); + var app = params.get('app'); + var file = params.get('file'); + var version = params.get('version') || 'current'; + if (!app) return; + var key = 'code-app:' + app + ':' + version + ':file'; + if (file) { + localStorage.setItem(key, file); + } else { + var saved = localStorage.getItem(key); + if (saved) { + var url = '/?app=' + encodeURIComponent(app); + if (version !== 'current') url += '&version=' + encodeURIComponent(version); + url += '&file=' + encodeURIComponent(saved); + window.location.replace(url); + } + } +})(); +` + function Layout({ title, children, highlight }: LayoutProps) { return ( @@ -162,6 +247,7 @@ function Layout({ title, children, highlight }: LayoutProps) { )} +