diff --git a/AGENTS.md b/AGENTS.md index 224b715e8c..25ef6674d7 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -34,7 +34,6 @@ artcraft-services/ ├── frontend/ │ ├── apps/artcraft-webapp/ # Browser application at app.getartcraft.com │ ├── apps/artcraft-website-next/ # Current public website at getartcraft.com (Next.js) -│ ├── apps/artcraft-website/ # Legacy product website (Vite) │ ├── apps/artcraft-desktop-website/ # Static landing page at desktop.getartcraft.com (Vite) │ └── libs/ # Shared React components and TypeScript libraries └── Cargo.toml # Rust workspace @@ -42,9 +41,9 @@ artcraft-services/ ## Updating Desktop Download Links -Desktop release links are configured independently in **three places**. When +Desktop release links are configured independently in **two places**. When updating the advertised ArtCraft release, update both `WINDOWS_VERSION` and -`MAC_VERSION` in all three unless the request explicitly targets one platform or +`MAC_VERSION` in both unless the request explicitly targets one platform or app: 1. **Current public website (Next.js):** @@ -52,11 +51,7 @@ app: This controls the installer links and visible version at `https://getartcraft.com/download`. Add the release to `DOWNLOAD_HISTORY` (newest first), then update both version selectors. -2. **Legacy website (Vite):** - [frontend/apps/artcraft-website/src/config/github_download_links.ts](frontend/apps/artcraft-website/src/config/github_download_links.ts). - Add the release to `DOWNLOAD_HISTORY` and update both version selectors. - Updating only this file does **not** update the current public website. -3. **Browser webapp:** +2. **Browser webapp:** [frontend/apps/artcraft-webapp/src/config/github_download_links.ts](frontend/apps/artcraft-webapp/src/config/github_download_links.ts). Update both version constants; these links are used by the welcome and checkout-success pages at `app.getartcraft.com`. @@ -65,7 +60,7 @@ Keep previous releases for rollback. The Next.js download page reads its visible version from `DOWNLOAD_VERSIONS`, which uses the same selectors as the URLs; do not hardcode a separate version in the page component. -Check that all three configs produce the requested release tag and installer +Check that both configs produce the requested release tag and installer filenames for Windows (`ArtCraft__x64-setup.exe`) and macOS (`ArtCraft__universal.dmg`). Run `npm run typecheck` from `frontend/apps/artcraft-website-next` after changing its config. Repository edits diff --git a/README.md b/README.md index 5943f2a8be..469cbee9ac 100644 --- a/README.md +++ b/README.md @@ -104,7 +104,7 @@ and signals for state, Three.js for 3D scenes, and shared UI and generation tool | Path | Purpose | |----------------------------------|-----------------------------------------------| | `frontend/apps/artcraft-webapp` | Browser application at `app.getartcraft.com` | -| `frontend/apps/artcraft-website` | Product website at `getartcraft.com` | +| `frontend/apps/artcraft-website-next` | Product website at `getartcraft.com` (Next.js) | | `frontend/libs/api` | HTTP clients, API host selection, and models | | `frontend/libs/omni-gen` | Shared generation logic | | `frontend/libs/components` | Reusable UI, editors, and generation controls | @@ -190,14 +190,11 @@ The browser app runs at `http://localhost:4201`. `VITE_USE_LOCAL_API=true` selec the hosted API. API host selection lives in [`StorytellerApiHostStore`](./frontend/libs/api/src/lib/config/StorytellerApiHostStore.ts). -From `frontend`, build the web app or run the product website with: +From `frontend`, build the web app with `npx nx build artcraft-webapp`. The +product website is a standalone Next.js app (not part of the Nx workspace); run it +from the repository root with `./script/website/unix_frontend_website_dev.sh`. -```bash -npx nx build artcraft-webapp -npx nx dev artcraft-website -``` - -The website runs at `http://localhost:4200`. Repository-root launchers are in +The website runs at `http://localhost:3000`. Repository-root launchers are in [`script/website`](./script/website). For desktop development, use the [ArtCraft desktop repository](https://github.com/storytold/artcraft). diff --git a/_database/sql/user_login_challenges.md b/_database/sql/user_login_challenges.md index 608970c576..96f1ae9369 100644 --- a/_database/sql/user_login_challenges.md +++ b/_database/sql/user_login_challenges.md @@ -255,7 +255,6 @@ From the services repository: SQLX_OFFLINE=true cargo test --offline -p storyteller-web --bin storyteller-web login_challenges cd frontend npm exec vitest -- run --config apps/artcraft-webapp/vite.config.ts src/pages/login/desktop-login.spec.tsx src/pages/login/login-bridge-continuation.spec.tsx -npm exec vitest -- run --config apps/artcraft-website/vite.config.ts src/pages/login/desktop-login.spec.tsx ``` `SQLX_OFFLINE` controls compile-time query metadata only. These tests still execute diff --git a/_docs/dev_setup.md b/_docs/dev_setup.md index 9e1de59128..7d5846a239 100644 --- a/_docs/dev_setup.md +++ b/_docs/dev_setup.md @@ -35,6 +35,6 @@ VITE_USE_LOCAL_API=true npx nx dev artcraft-webapp The web app runs at `http://localhost:4201`, using the local backend. To develop against the hosted API, omit `VITE_USE_LOCAL_API=true`. -For the product website, run `npx nx dev artcraft-website` from `frontend`; it uses -`http://localhost:4200`. Repository-root launchers live under [`script/website`](../script/website). +For the product website, run `./script/website/unix_frontend_website_dev.sh` from the +repository root; it is a standalone Next.js app on `http://localhost:3000`. Repository-root launchers live under [`script/website`](../script/website). See the [frontend README](../frontend/README.md) for builds and troubleshooting. diff --git a/frontend/README.md b/frontend/README.md index 2e018b2201..bc1a631031 100644 --- a/frontend/README.md +++ b/frontend/README.md @@ -31,7 +31,7 @@ From the **repository root**, the launcher scripts (these preflight your environment, install dependencies, and free the dev port first): ```bash -./script/website/unix_frontend_website_dev.sh # artcraft-website (marketing site), port 4200 +./script/website/unix_frontend_website_dev.sh # artcraft-website-next (marketing site), port 3000 ./script/website/unix_frontend_webapp_dev.sh # artcraft-webapp (user dashboard), port 4201 ``` @@ -46,14 +46,12 @@ by its full or relative path: Or directly from this directory: ```bash -nx dev artcraft-website npx nx dev @frontend/artcraft-webapp ``` ## Building ```bash -npx nx build artcraft-website npx nx build artcraft-webapp ``` diff --git a/frontend/apps/artcraft-webapp/vite.config.ts b/frontend/apps/artcraft-webapp/vite.config.ts index e653514dcd..0955ddb0e8 100644 --- a/frontend/apps/artcraft-webapp/vite.config.ts +++ b/frontend/apps/artcraft-webapp/vite.config.ts @@ -4,8 +4,6 @@ import react from '@vitejs/plugin-react'; import wasm from 'vite-plugin-wasm'; import topLevelAwait from 'vite-plugin-top-level-await'; import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin'; -import { execSync } from 'child_process'; -import path from 'path'; // Dev-only CDN proxy. Media assets (splats, GLBs, images) are fetched with // fetch(), but the CDNs only send CORS headers for the production origin — @@ -71,21 +69,6 @@ function cdnProxyPlugin() { }; } -// Custom plugin to generate news.json on dev server start -function generateNewsPlugin() { - return { - name: 'generate-news', - buildStart() { - try { - const scriptPath = path.resolve(__dirname, '../../scripts/generate-news-json.mjs'); - execSync(`node "${scriptPath}"`, { stdio: 'inherit' }); - } catch (e) { - console.warn('Failed to generate news.json:', e); - } - }, - }; -} - export default defineConfig(() => ({ root: __dirname, cacheDir: '../../node_modules/.vite/apps/artcraft-webapp', @@ -110,7 +93,7 @@ export default defineConfig(() => ({ port: 4301, host: 'localhost', }, - plugins: [cdnProxyPlugin(), generateNewsPlugin(), nxViteTsPaths(), react(), wasm(), topLevelAwait()], + plugins: [cdnProxyPlugin(), nxViteTsPaths(), react(), wasm(), topLevelAwait()], // Uncomment this if you are using workers. // worker: { // plugins: [ nxViteTsPaths() ], diff --git a/frontend/apps/artcraft-website/.env.example b/frontend/apps/artcraft-website/.env.example deleted file mode 100644 index fcbd1e317e..0000000000 --- a/frontend/apps/artcraft-website/.env.example +++ /dev/null @@ -1,4 +0,0 @@ -# Google OAuth Configuration -# Get the Client ID from the Google Cloud Console: -# https://console.cloud.google.com/apis/credentials -VITE_GOOGLE_CLIENT_ID=YOUR_CLIENT_ID.apps.googleusercontent.com diff --git a/frontend/apps/artcraft-website/WEBAPP_MIGRATION.md b/frontend/apps/artcraft-website/WEBAPP_MIGRATION.md deleted file mode 100644 index 2c6b540fac..0000000000 --- a/frontend/apps/artcraft-website/WEBAPP_MIGRATION.md +++ /dev/null @@ -1,143 +0,0 @@ -# Website → Webapp Migration - -The marketing site (`artcraft-website`) is being split apart from the app -(`artcraft-webapp`). Anything that isn't pure marketing content belongs in -the webapp at `app.getartcraft.com`. - -The migration is **gated by a single boolean** so it can be reverted while -we soak the new redirect behavior in production. When we're confident the -webapp is handling everything cleanly, do the **cleanup pass** below to -permanently delete everything that's only kept around for the rollback path. - ---- - -## The switch - -`src/config/links.ts`: - -```ts -export const USE_WEBAPP_FOR_APP_FEATURES = true; -``` - -- `true` (default): legacy paths redirect to the webapp; navbar shows - "Launch App"; in-page links go cross-origin to `app.getartcraft.com`. -- `false`: everything runs locally on the marketing site (the original - pre-split behavior). - -In dev, `WEBAPP_URL` auto-switches to `http://localhost:4201/` so cross-app -links work against the local webapp Vite server. - ---- - -## What's behind the flag - -### Pages that exist locally only as a fallback - -When `USE_WEBAPP_FOR_APP_FEATURES = true`, these routes mount -`` instead of the page component. The page files -are kept on disk so we can roll back by flipping the flag. - -- `src/pages/login/` -- `src/pages/signup/` -- `src/pages/forgot-password/` -- `src/pages/create-image/` -- `src/pages/create-video/` -- `src/pages/create-vfx/` (the `/background-change` route) -- `src/pages/library/` -- `src/pages/referrals/` -- `src/pages/welcome/` -- `src/pages/onboarding/` -- `src/pages/checkout/` (success + cancel) - -### Components only used by the above - -- `src/components/auth/` (SignupForm, GoogleLoginButton) -- `src/components/credits-modal.tsx` -- `src/components/generation-gallery/` -- `src/components/lightbox/lightbox.tsx` (the modal `Lightbox`; the - `LightboxDetails` + `shared.ts` files in the same folder are still used - by the public `/media` page and must be kept) -- `src/components/navbar/task-queue.tsx` -- `src/components/prompt-box/` -- `src/components/settings-modal/` - -### Lib files only used by the above - -- `src/lib/cost-estimate-api.ts` -- `src/lib/enter-to-generate-store.ts` -- `src/lib/omni-gen-hooks.ts` -- `src/lib/prompts-cache.ts` -- `src/lib/recreate.ts` - -### Files with conditional flag branches (need cleanup, not deletion) - -- `src/app/app.tsx` — drop the `appOrWebapp()` helper, drop the local route - imports, leave only the `` routes -- `src/components/navbar/navbar.tsx` — drop the `!USE_WEBAPP_FOR_APP_FEATURES` - branches (Login + Sign up buttons in desktop and mobile); keep only Launch - App for logged-in users and the Pricing + Launch App combo for logged-out - users -- `src/components/footer/footer.tsx` — drop the conditional Image/Video - links in the Pages column -- `src/components/download-modal.tsx` — drop the inline `SignupForm` flow - and the `view`/`navigate` state; keep only the webapp `/signup` and - `/login` link buttons -- `src/pages/landing3/landing3.tsx` — `appLink("/create-image")` / - `appLink("/create-video")` can become bare `webappUrl("…")` calls (or - inline `${WEBAPP_URL}create-image`) -- `src/pages/media/media.tsx` — drop the local - `applyRecreateFromMediaToken` branch and the `useNavigate` import; keep - only the `window.location.href = …` webapp redirect -- `src/pages/pricing/pricing.tsx` — the "Buy Credits" section + `CreditsModal` - is currently shown unconditionally; once `credits-modal.tsx` is deleted, - remove the section, the `creditsModalOpen` state, the `isLoggedIn` state, - and the session-check `useEffect` - -### The flag itself - -`src/config/links.ts` — drop `USE_WEBAPP_FOR_APP_FEATURES`, drop the -`appLink()` helper (use `webappUrl()` directly everywhere). Keep -`WEBAPP_URL`, `webappUrl()`, `SOCIAL_LINKS`, `SUPPORT_EMAIL`, and the dev -override. - ---- - -## Cleanup pass — what to do when we're ready to commit to the webapp split - -1. **Confirm the flag has been `true` in production for long enough** that - we're sure no real users hit the local routes. -2. **Delete** every directory and file listed under "Pages that exist - locally only as a fallback", "Components only used by the above", and - "Lib files only used by the above". -3. **Strip the flag branches** from each file under "Files with conditional - flag branches". -4. **Remove `USE_WEBAPP_FOR_APP_FEATURES`** and `appLink()` from - `src/config/links.ts`. -5. **Run** `npx tsc -p tsconfig.app.json --noEmit` from - `frontend/apps/artcraft-website` and fix any references the cleanup - exposed. (Pre-existing errors in `download-button.tsx` `LINUX` and - `pricing-table.tsx` `maybeReferralUsername` are unrelated and can be - ignored.) -6. **Verify** in dev with `nx serve @frontend/artcraft-website` that every - navbar/footer/landing/media flow still works and that legacy URLs still - redirect to the webapp via `WebappRedirect`. - ---- - -## What stays on the marketing site no matter what - -These are pure marketing content and are **not** behind the flag: - -- `/` → `landing3` -- `/landing3` -- `/seedance-2` → `landing-sd2` -- `/download` -- `/media`, `/media/:id` (public viewer; the lightbox's "Recreate" button - does cross-origin to the webapp, but the viewer itself stays here) -- `/press-kit` -- `/tutorials`, `/tutorials/:slug` -- `/faq`, `/faq/:slug` -- `/news`, `/news/:slug` -- `/support` -- `/pricing` — Stripe checkout flow stays here (PricingTable → Stripe → - `/checkout/success` → WebappRedirect → webapp) diff --git a/frontend/apps/artcraft-website/_redirects b/frontend/apps/artcraft-website/_redirects deleted file mode 100644 index 4da1cf839e..0000000000 --- a/frontend/apps/artcraft-website/_redirects +++ /dev/null @@ -1,157 +0,0 @@ -/background-change /index.html 200 -/background-change/ /index.html 200 -/background-change/* /index.html 200 - -/checkout_cancel /index.html 200 -/checkout_cancel/ /index.html 200 -/checkout_cancel/* /index.html 200 - -/onboarding /index.html 200 -/onboarding/ /index.html 200 -/onboarding/* /index.html 200 - -/portal_closed /index.html 200 -/portal_closed/ /index.html 200 -/portal_closed/* /index.html 200 - -/checkout_success /index.html 200 -/checkout_success/ /index.html 200 -/checkout_success/* /index.html 200 - -/checkout* /index.html 200 -/checkout/* /index.html 200 - -/create-image /index.html 200 -/create-image/ /index.html 200 -/create-image/* /index.html 200 - -/create-video /index.html 200 -/create-video/ /index.html 200 -/create-video/* /index.html 200 - -/support /index.html 200 -/support/ /index.html 200 -/support/* /index.html 200 - -/library /index.html 200 -/library/ /index.html 200 -/library/* /index.html 200 - -/download /index.html 200 -/download/ /index.html 200 - -/tutorials /index.html 200 -/tutorials/ /index.html 200 - -/login /index.html 200 -/login/ /index.html 200 -/login/* /index.html 200 - -/media /index.html 200 -/media/ /index.html 200 -/media/* /index.html 200 - -# Prerendered: serve the per-route index.html so social crawlers get the -# correct OG/title tags (see scripts/prerender-meta.mjs). The SPA still boots -# from this file and React Router takes over for users. -/pricing /pricing/index.html 200 -/pricing/ /pricing/index.html 200 -/pricing/* /index.html 200 - -/beta /beta/index.html 200 -/beta/ /beta/index.html 200 -/beta/* /index.html 200 - -/faq /index.html 200 -/faq/ /index.html 200 -/faq/* /index.html 200 - -/news /index.html 200 -/news/ /index.html 200 -/news/* /index.html 200 - -/press-kit /index.html 200 -/press-kit/ /index.html 200 -/press-kit/* /index.html 200 - -/referrals /index.html 200 -/referrals/ /index.html 200 -/referrals/* /index.html 200 - -# Redirects for growth measurement -/reddit /?utm_source=reddit 301 - -/news.json /index.html 200 - -/signup /index.html 200 -/signup/ /index.html 200 -/signup/* /index.html 200 - -/forgot-password /index.html 200 -/forgot-password/ /index.html 200 -/forgot-password/* /index.html 200 - -/welcome /index.html 200 -/welcome/ /index.html 200 -/welcome/* /index.html 200 - -/password-reset /index.html 200 -/password-reset/ /index.html 200 -/password-reset/* /index.html 200 - -# Prerendered: exact paths serve their per-route index.html (correct OG tags -# for social crawlers); deep sub-paths fall back to the SPA shell. See -# scripts/prerender-meta.mjs. NOTE: these exact-match serving rules MUST come -# before the /seedance2* alias below, otherwise that wildcard would 301 -# /seedance2-5 away to /seedance-2 (first match wins in _redirects). -/seedance2-5 /seedance2-5/index.html 200 -/seedance2-5/ /seedance2-5/index.html 200 -/seedance2-5/* /index.html 200 - -/seedance-2 /seedance-2/index.html 200 -/seedance-2/ /seedance-2/index.html 200 -/seedance-2/* /index.html 200 - -/minimax-h3 /minimax-h3/index.html 200 -/minimax-h3/ /minimax-h3/index.html 200 -/minimax-h3/* /index.html 200 - -/creators/jboogxcreative /creators/jboogxcreative/index.html 200 -/creators/jboogxcreative/ /creators/jboogxcreative/index.html 200 -/creators/* /index.html 200 - -# Similar URLs — creator spotlight aliases -/jboogx /creators/jboogxcreative 301 -/jboogx/ /creators/jboogxcreative 301 -/jboogxcreative /creators/jboogxcreative 301 -/jboogxcreative/ /creators/jboogxcreative 301 - -# Similar URLs: MiniMax H3 aliases -/minimax /minimax-h3 301 -/minimax/ /minimax-h3 301 -/minimaxh3 /minimax-h3 301 -/minimaxh3* /minimax-h3 301 -/minimax-h-3 /minimax-h3 301 -/minimax-h-3* /minimax-h3 301 -/hailuo /minimax-h3 301 -/hailuo/ /minimax-h3 301 - -# Google ads breakage -/seedance-2{ignore} /seedance-2 301 -/seedance-2{ignore}* /seedance-2 301 -/seedance-2%7Bignore%7D /seedance-2 301 -/seedance-2%7Bignore%7D* /seedance-2 301 - -# Similar URLs — Seedance 2.5 aliases (kept above the broad /seedance2* rule) -/seedance-2-5 /seedance2-5 301 -/seedance-2-5* /seedance2-5 301 -/seedance-2.5 /seedance2-5 301 -/seedance-2.5* /seedance2-5 301 -/seedance25 /seedance2-5 301 -/seedance25* /seedance2-5 301 - -# Similar URLs — Seedance 2.0 aliases -/seedance2 /seedance-2 301 -/seedance2* /seedance-2 301 -/seedance-2.0 /seedance-2 301 -/seedance-2.0* /seedance-2 301 diff --git a/frontend/apps/artcraft-website/index.html b/frontend/apps/artcraft-website/index.html deleted file mode 100644 index ead2140f5c..0000000000 --- a/frontend/apps/artcraft-website/index.html +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - - - ArtCraft. AI Video and Images. Fast and Open Desktop App. - - - - - - - - - - - - - -
- - - diff --git a/frontend/apps/artcraft-website/netlify.toml b/frontend/apps/artcraft-website/netlify.toml deleted file mode 100644 index f2b990ffd6..0000000000 --- a/frontend/apps/artcraft-website/netlify.toml +++ /dev/null @@ -1,29 +0,0 @@ -# Netlify settings used to discover this file: -# Base directory: frontend -# Package directory: apps/artcraft-website (relative to the base directory) -# Manage the build command and publish directory here; leave those UI fields empty. -# Paths below are relative to the frontend workspace. - -[build] -command = "bash ./apps/artcraft-website/script/netlify_build.sh" -publish = "apps/artcraft-website/dist/" - -[[headers]] -for = "/build/*" - -[headers.values] -"Cache-Control" = "public, max-age=31560000, immutable" - -# [[redirects]] -# from = "/ingest/static/*" -# to = "https://us-assets.i.posthog.com/static/:splat" -# host = "us-assets.i.posthog.com" -# status = 200 -# force = true -# -# [[redirects]] -# from = "/ingest/*" -# to = "https://us.i.posthog.com/:splat" -# host = "us.i.posthog.com" -# status = 200 -# force = true diff --git a/frontend/apps/artcraft-website/package.json b/frontend/apps/artcraft-website/package.json deleted file mode 100644 index 2120a3e47c..0000000000 --- a/frontend/apps/artcraft-website/package.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "name": "@frontend/artcraft-website", - "version": "0.0.1", - "private": true, - "dependencies": { - "react-masonry-css": "^1.0.16" - } -} diff --git a/frontend/apps/artcraft-website/postcss.config.js b/frontend/apps/artcraft-website/postcss.config.js deleted file mode 100644 index 5a8ffc4899..0000000000 --- a/frontend/apps/artcraft-website/postcss.config.js +++ /dev/null @@ -1,15 +0,0 @@ -const { join } = require('path'); - -// Note: If you use library-specific PostCSS/Tailwind configuration then you should remove the `postcssConfig` build -// option from your application's configuration (i.e. project.json). -// -// See: https://nx.dev/guides/using-tailwind-css-in-react#step-4:-applying-configuration-to-libraries - -module.exports = { - plugins: { - tailwindcss: { - config: join(__dirname, 'tailwind.config.js'), - }, - autoprefixer: {}, - }, -} diff --git a/frontend/apps/artcraft-website/public/3d-models/sneaking-forward.fbx b/frontend/apps/artcraft-website/public/3d-models/sneaking-forward.fbx deleted file mode 100644 index 4721ce8928..0000000000 Binary files a/frontend/apps/artcraft-website/public/3d-models/sneaking-forward.fbx and /dev/null differ diff --git a/frontend/apps/artcraft-website/public/3d-models/sneaking-forward.glb b/frontend/apps/artcraft-website/public/3d-models/sneaking-forward.glb deleted file mode 100644 index 9ce6dc6476..0000000000 Binary files a/frontend/apps/artcraft-website/public/3d-models/sneaking-forward.glb and /dev/null differ diff --git a/frontend/apps/artcraft-website/public/artcraft-icon.svg b/frontend/apps/artcraft-website/public/artcraft-icon.svg deleted file mode 100644 index eca1f3f7fc..0000000000 --- a/frontend/apps/artcraft-website/public/artcraft-icon.svg +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/frontend/apps/artcraft-website/public/discord-status-icons/artcraft-a-512x512.png b/frontend/apps/artcraft-website/public/discord-status-icons/artcraft-a-512x512.png deleted file mode 100644 index 90ed8e22dd..0000000000 Binary files a/frontend/apps/artcraft-website/public/discord-status-icons/artcraft-a-512x512.png and /dev/null differ diff --git a/frontend/apps/artcraft-website/public/discord-status-icons/artcraft-a-spin-512x512.webp b/frontend/apps/artcraft-website/public/discord-status-icons/artcraft-a-spin-512x512.webp deleted file mode 100644 index e587be6c66..0000000000 Binary files a/frontend/apps/artcraft-website/public/discord-status-icons/artcraft-a-spin-512x512.webp and /dev/null differ diff --git a/frontend/apps/artcraft-website/public/discord-status-icons/kitsune-mask-512x512.png b/frontend/apps/artcraft-website/public/discord-status-icons/kitsune-mask-512x512.png deleted file mode 100644 index a14ae44b0f..0000000000 Binary files a/frontend/apps/artcraft-website/public/discord-status-icons/kitsune-mask-512x512.png and /dev/null differ diff --git a/frontend/apps/artcraft-website/public/discord-status-icons/link-spin-200x216.webp b/frontend/apps/artcraft-website/public/discord-status-icons/link-spin-200x216.webp deleted file mode 100644 index 5d86bb2aa0..0000000000 Binary files a/frontend/apps/artcraft-website/public/discord-status-icons/link-spin-200x216.webp and /dev/null differ diff --git a/frontend/apps/artcraft-website/public/favicon.ico b/frontend/apps/artcraft-website/public/favicon.ico deleted file mode 100644 index df243d83f7..0000000000 Binary files a/frontend/apps/artcraft-website/public/favicon.ico and /dev/null differ diff --git a/frontend/apps/artcraft-website/public/images/2d-3d.png b/frontend/apps/artcraft-website/public/images/2d-3d.png deleted file mode 100644 index 02e31e7da6..0000000000 Binary files a/frontend/apps/artcraft-website/public/images/2d-3d.png and /dev/null differ diff --git a/frontend/apps/artcraft-website/public/images/3d-interface-preview.jpg b/frontend/apps/artcraft-website/public/images/3d-interface-preview.jpg deleted file mode 100644 index e6a5791961..0000000000 Binary files a/frontend/apps/artcraft-website/public/images/3d-interface-preview.jpg and /dev/null differ diff --git a/frontend/apps/artcraft-website/public/images/apple-logo.png b/frontend/apps/artcraft-website/public/images/apple-logo.png deleted file mode 100644 index 270b8a8495..0000000000 Binary files a/frontend/apps/artcraft-website/public/images/apple-logo.png and /dev/null differ diff --git a/frontend/apps/artcraft-website/public/images/artcraft-logo.png b/frontend/apps/artcraft-website/public/images/artcraft-logo.png deleted file mode 100644 index 8cf2cab819..0000000000 Binary files a/frontend/apps/artcraft-website/public/images/artcraft-logo.png and /dev/null differ diff --git a/frontend/apps/artcraft-website/public/images/blog/fj_gen.png b/frontend/apps/artcraft-website/public/images/blog/fj_gen.png deleted file mode 100644 index 6402a00528..0000000000 Binary files a/frontend/apps/artcraft-website/public/images/blog/fj_gen.png and /dev/null differ diff --git a/frontend/apps/artcraft-website/public/images/blog/fj_nbp.png b/frontend/apps/artcraft-website/public/images/blog/fj_nbp.png deleted file mode 100644 index 3545c944f7..0000000000 Binary files a/frontend/apps/artcraft-website/public/images/blog/fj_nbp.png and /dev/null differ diff --git a/frontend/apps/artcraft-website/public/images/blog/fj_previz.png b/frontend/apps/artcraft-website/public/images/blog/fj_previz.png deleted file mode 100644 index 850a7f38bc..0000000000 Binary files a/frontend/apps/artcraft-website/public/images/blog/fj_previz.png and /dev/null differ diff --git a/frontend/apps/artcraft-website/public/images/blog/island_nbp.png b/frontend/apps/artcraft-website/public/images/blog/island_nbp.png deleted file mode 100644 index 5b4dff7563..0000000000 Binary files a/frontend/apps/artcraft-website/public/images/blog/island_nbp.png and /dev/null differ diff --git a/frontend/apps/artcraft-website/public/images/blog/island_previz.png b/frontend/apps/artcraft-website/public/images/blog/island_previz.png deleted file mode 100644 index 27da9c091b..0000000000 Binary files a/frontend/apps/artcraft-website/public/images/blog/island_previz.png and /dev/null differ diff --git a/frontend/apps/artcraft-website/public/images/blog/ruins_nbp.png b/frontend/apps/artcraft-website/public/images/blog/ruins_nbp.png deleted file mode 100644 index c5f733884f..0000000000 Binary files a/frontend/apps/artcraft-website/public/images/blog/ruins_nbp.png and /dev/null differ diff --git a/frontend/apps/artcraft-website/public/images/blog/ruins_previz.png b/frontend/apps/artcraft-website/public/images/blog/ruins_previz.png deleted file mode 100644 index 060e2d0802..0000000000 Binary files a/frontend/apps/artcraft-website/public/images/blog/ruins_previz.png and /dev/null differ diff --git a/frontend/apps/artcraft-website/public/images/blog/sam4.2.png b/frontend/apps/artcraft-website/public/images/blog/sam4.2.png deleted file mode 100644 index f081e32c1b..0000000000 Binary files a/frontend/apps/artcraft-website/public/images/blog/sam4.2.png and /dev/null differ diff --git a/frontend/apps/artcraft-website/public/images/blog/sam4.png b/frontend/apps/artcraft-website/public/images/blog/sam4.png deleted file mode 100644 index 077bc452f9..0000000000 Binary files a/frontend/apps/artcraft-website/public/images/blog/sam4.png and /dev/null differ diff --git a/frontend/apps/artcraft-website/public/images/blog/sam_gpt_image_1.png b/frontend/apps/artcraft-website/public/images/blog/sam_gpt_image_1.png deleted file mode 100644 index 8f0cd6fa50..0000000000 Binary files a/frontend/apps/artcraft-website/public/images/blog/sam_gpt_image_1.png and /dev/null differ diff --git a/frontend/apps/artcraft-website/public/images/blog/sam_nbp.png b/frontend/apps/artcraft-website/public/images/blog/sam_nbp.png deleted file mode 100644 index b55a97c613..0000000000 Binary files a/frontend/apps/artcraft-website/public/images/blog/sam_nbp.png and /dev/null differ diff --git a/frontend/apps/artcraft-website/public/images/blog/sam_nbp2.png b/frontend/apps/artcraft-website/public/images/blog/sam_nbp2.png deleted file mode 100644 index 9d557c1261..0000000000 Binary files a/frontend/apps/artcraft-website/public/images/blog/sam_nbp2.png and /dev/null differ diff --git a/frontend/apps/artcraft-website/public/images/blog/sam_previz.png b/frontend/apps/artcraft-website/public/images/blog/sam_previz.png deleted file mode 100644 index 8e0703df45..0000000000 Binary files a/frontend/apps/artcraft-website/public/images/blog/sam_previz.png and /dev/null differ diff --git a/frontend/apps/artcraft-website/public/images/blog/snow_nbp.png b/frontend/apps/artcraft-website/public/images/blog/snow_nbp.png deleted file mode 100644 index 6dab12876f..0000000000 Binary files a/frontend/apps/artcraft-website/public/images/blog/snow_nbp.png and /dev/null differ diff --git a/frontend/apps/artcraft-website/public/images/blog/snow_previz.png b/frontend/apps/artcraft-website/public/images/blog/snow_previz.png deleted file mode 100644 index 14ce7d1b1b..0000000000 Binary files a/frontend/apps/artcraft-website/public/images/blog/snow_previz.png and /dev/null differ diff --git a/frontend/apps/artcraft-website/public/images/buy-credits.png b/frontend/apps/artcraft-website/public/images/buy-credits.png deleted file mode 100644 index f6bd102d28..0000000000 Binary files a/frontend/apps/artcraft-website/public/images/buy-credits.png and /dev/null differ diff --git a/frontend/apps/artcraft-website/public/images/creators/jboogx/DXMXQZmBAqW.jpg b/frontend/apps/artcraft-website/public/images/creators/jboogx/DXMXQZmBAqW.jpg deleted file mode 100644 index 9a57f591de..0000000000 Binary files a/frontend/apps/artcraft-website/public/images/creators/jboogx/DXMXQZmBAqW.jpg and /dev/null differ diff --git a/frontend/apps/artcraft-website/public/images/creators/jboogx/DZAO9_LBFw3.jpg b/frontend/apps/artcraft-website/public/images/creators/jboogx/DZAO9_LBFw3.jpg deleted file mode 100644 index 1fb6a9f6bb..0000000000 Binary files a/frontend/apps/artcraft-website/public/images/creators/jboogx/DZAO9_LBFw3.jpg and /dev/null differ diff --git a/frontend/apps/artcraft-website/public/images/creators/jboogx/DcbGmARh2nL.jpg b/frontend/apps/artcraft-website/public/images/creators/jboogx/DcbGmARh2nL.jpg deleted file mode 100644 index 508c85aaa5..0000000000 Binary files a/frontend/apps/artcraft-website/public/images/creators/jboogx/DcbGmARh2nL.jpg and /dev/null differ diff --git a/frontend/apps/artcraft-website/public/images/creators/jboogx/DcdrZI1hauI.jpg b/frontend/apps/artcraft-website/public/images/creators/jboogx/DcdrZI1hauI.jpg deleted file mode 100644 index f63d1aec7f..0000000000 Binary files a/frontend/apps/artcraft-website/public/images/creators/jboogx/DcdrZI1hauI.jpg and /dev/null differ diff --git a/frontend/apps/artcraft-website/public/images/creators/jboogx/DclZyHHBZYW.jpg b/frontend/apps/artcraft-website/public/images/creators/jboogx/DclZyHHBZYW.jpg deleted file mode 100644 index 34376d4df6..0000000000 Binary files a/frontend/apps/artcraft-website/public/images/creators/jboogx/DclZyHHBZYW.jpg and /dev/null differ diff --git a/frontend/apps/artcraft-website/public/images/creators/jboogx/Dcn-hmHh3p-.jpg b/frontend/apps/artcraft-website/public/images/creators/jboogx/Dcn-hmHh3p-.jpg deleted file mode 100644 index 4f47b622fe..0000000000 Binary files a/frontend/apps/artcraft-website/public/images/creators/jboogx/Dcn-hmHh3p-.jpg and /dev/null differ diff --git a/frontend/apps/artcraft-website/public/images/creators/jboogx/Dcvs75lhrn8.jpg b/frontend/apps/artcraft-website/public/images/creators/jboogx/Dcvs75lhrn8.jpg deleted file mode 100644 index 53a58914ff..0000000000 Binary files a/frontend/apps/artcraft-website/public/images/creators/jboogx/Dcvs75lhrn8.jpg and /dev/null differ diff --git a/frontend/apps/artcraft-website/public/images/digital-mountains.png b/frontend/apps/artcraft-website/public/images/digital-mountains.png deleted file mode 100644 index 7510cc9b5b..0000000000 Binary files a/frontend/apps/artcraft-website/public/images/digital-mountains.png and /dev/null differ diff --git a/frontend/apps/artcraft-website/public/images/forest-trees.png b/frontend/apps/artcraft-website/public/images/forest-trees.png deleted file mode 100644 index 601ff15b3e..0000000000 Binary files a/frontend/apps/artcraft-website/public/images/forest-trees.png and /dev/null differ diff --git a/frontend/apps/artcraft-website/public/images/github-logo.png b/frontend/apps/artcraft-website/public/images/github-logo.png deleted file mode 100644 index 6febd5f07b..0000000000 Binary files a/frontend/apps/artcraft-website/public/images/github-logo.png and /dev/null differ diff --git a/frontend/apps/artcraft-website/public/images/linux-logo.png b/frontend/apps/artcraft-website/public/images/linux-logo.png deleted file mode 100644 index f561a77ba5..0000000000 Binary files a/frontend/apps/artcraft-website/public/images/linux-logo.png and /dev/null differ diff --git a/frontend/apps/artcraft-website/public/images/og-image.png b/frontend/apps/artcraft-website/public/images/og-image.png deleted file mode 100644 index 327df147ed..0000000000 Binary files a/frontend/apps/artcraft-website/public/images/og-image.png and /dev/null differ diff --git a/frontend/apps/artcraft-website/public/images/services/alibaba.svg b/frontend/apps/artcraft-website/public/images/services/alibaba.svg deleted file mode 100644 index a4bb382a63..0000000000 --- a/frontend/apps/artcraft-website/public/images/services/alibaba.svg +++ /dev/null @@ -1 +0,0 @@ -Qwen \ No newline at end of file diff --git a/frontend/apps/artcraft-website/public/images/services/artcraft.svg b/frontend/apps/artcraft-website/public/images/services/artcraft.svg deleted file mode 100644 index 3fefcd113e..0000000000 --- a/frontend/apps/artcraft-website/public/images/services/artcraft.svg +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/frontend/apps/artcraft-website/public/images/services/blackforestlabs.svg b/frontend/apps/artcraft-website/public/images/services/blackforestlabs.svg deleted file mode 100644 index 12a4ba1d76..0000000000 --- a/frontend/apps/artcraft-website/public/images/services/blackforestlabs.svg +++ /dev/null @@ -1 +0,0 @@ -Flux \ No newline at end of file diff --git a/frontend/apps/artcraft-website/public/images/services/bytedance.svg b/frontend/apps/artcraft-website/public/images/services/bytedance.svg deleted file mode 100644 index dec27435c1..0000000000 --- a/frontend/apps/artcraft-website/public/images/services/bytedance.svg +++ /dev/null @@ -1 +0,0 @@ -ByteDance \ No newline at end of file diff --git a/frontend/apps/artcraft-website/public/images/services/fal.svg b/frontend/apps/artcraft-website/public/images/services/fal.svg deleted file mode 100644 index c41076f911..0000000000 --- a/frontend/apps/artcraft-website/public/images/services/fal.svg +++ /dev/null @@ -1 +0,0 @@ -Fal \ No newline at end of file diff --git a/frontend/apps/artcraft-website/public/images/services/generic.svg b/frontend/apps/artcraft-website/public/images/services/generic.svg deleted file mode 100644 index 1c8166697d..0000000000 --- a/frontend/apps/artcraft-website/public/images/services/generic.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/frontend/apps/artcraft-website/public/images/services/google.svg b/frontend/apps/artcraft-website/public/images/services/google.svg deleted file mode 100644 index 87736bbe09..0000000000 --- a/frontend/apps/artcraft-website/public/images/services/google.svg +++ /dev/null @@ -1 +0,0 @@ -Gemini \ No newline at end of file diff --git a/frontend/apps/artcraft-website/public/images/services/grok.svg b/frontend/apps/artcraft-website/public/images/services/grok.svg deleted file mode 100644 index efb1a6183c..0000000000 --- a/frontend/apps/artcraft-website/public/images/services/grok.svg +++ /dev/null @@ -1 +0,0 @@ -Grok \ No newline at end of file diff --git a/frontend/apps/artcraft-website/public/images/services/higgsfield.svg b/frontend/apps/artcraft-website/public/images/services/higgsfield.svg deleted file mode 100644 index de89784862..0000000000 --- a/frontend/apps/artcraft-website/public/images/services/higgsfield.svg +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/frontend/apps/artcraft-website/public/images/services/kling.svg b/frontend/apps/artcraft-website/public/images/services/kling.svg deleted file mode 100644 index 32fb6bed29..0000000000 --- a/frontend/apps/artcraft-website/public/images/services/kling.svg +++ /dev/null @@ -1 +0,0 @@ -Kling \ No newline at end of file diff --git a/frontend/apps/artcraft-website/public/images/services/krea.svg b/frontend/apps/artcraft-website/public/images/services/krea.svg deleted file mode 100644 index d112dc3eab..0000000000 --- a/frontend/apps/artcraft-website/public/images/services/krea.svg +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/frontend/apps/artcraft-website/public/images/services/midjourney.svg b/frontend/apps/artcraft-website/public/images/services/midjourney.svg deleted file mode 100644 index e59e3b0709..0000000000 --- a/frontend/apps/artcraft-website/public/images/services/midjourney.svg +++ /dev/null @@ -1 +0,0 @@ -Midjourney \ No newline at end of file diff --git a/frontend/apps/artcraft-website/public/images/services/minimax.svg b/frontend/apps/artcraft-website/public/images/services/minimax.svg deleted file mode 100644 index 1d32449ab8..0000000000 --- a/frontend/apps/artcraft-website/public/images/services/minimax.svg +++ /dev/null @@ -1 +0,0 @@ -Minimax \ No newline at end of file diff --git a/frontend/apps/artcraft-website/public/images/services/openai.svg b/frontend/apps/artcraft-website/public/images/services/openai.svg deleted file mode 100644 index 50d94d6c10..0000000000 --- a/frontend/apps/artcraft-website/public/images/services/openai.svg +++ /dev/null @@ -1 +0,0 @@ -OpenAI \ No newline at end of file diff --git a/frontend/apps/artcraft-website/public/images/services/openart.svg b/frontend/apps/artcraft-website/public/images/services/openart.svg deleted file mode 100644 index f47a86e82d..0000000000 --- a/frontend/apps/artcraft-website/public/images/services/openart.svg +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/frontend/apps/artcraft-website/public/images/services/recraft.svg b/frontend/apps/artcraft-website/public/images/services/recraft.svg deleted file mode 100644 index b4ea390a72..0000000000 --- a/frontend/apps/artcraft-website/public/images/services/recraft.svg +++ /dev/null @@ -1 +0,0 @@ -Recraft \ No newline at end of file diff --git a/frontend/apps/artcraft-website/public/images/services/replicate.svg b/frontend/apps/artcraft-website/public/images/services/replicate.svg deleted file mode 100644 index 48f148af26..0000000000 --- a/frontend/apps/artcraft-website/public/images/services/replicate.svg +++ /dev/null @@ -1 +0,0 @@ -Replicate \ No newline at end of file diff --git a/frontend/apps/artcraft-website/public/images/services/suno.svg b/frontend/apps/artcraft-website/public/images/services/suno.svg deleted file mode 100644 index f73f29cdc2..0000000000 --- a/frontend/apps/artcraft-website/public/images/services/suno.svg +++ /dev/null @@ -1 +0,0 @@ -Suno \ No newline at end of file diff --git a/frontend/apps/artcraft-website/public/images/services/tencent.svg b/frontend/apps/artcraft-website/public/images/services/tencent.svg deleted file mode 100644 index 724a815028..0000000000 --- a/frontend/apps/artcraft-website/public/images/services/tencent.svg +++ /dev/null @@ -1 +0,0 @@ -Hunyuan \ No newline at end of file diff --git a/frontend/apps/artcraft-website/public/images/services/tensorart.svg b/frontend/apps/artcraft-website/public/images/services/tensorart.svg deleted file mode 100644 index d7e32012d4..0000000000 --- a/frontend/apps/artcraft-website/public/images/services/tensorart.svg +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/frontend/apps/artcraft-website/public/images/services/vidu.svg b/frontend/apps/artcraft-website/public/images/services/vidu.svg deleted file mode 100644 index 0cb11823b4..0000000000 --- a/frontend/apps/artcraft-website/public/images/services/vidu.svg +++ /dev/null @@ -1 +0,0 @@ -Vidu \ No newline at end of file diff --git a/frontend/apps/artcraft-website/public/images/services/worldlabs.svg b/frontend/apps/artcraft-website/public/images/services/worldlabs.svg deleted file mode 100644 index 795cf7d000..0000000000 --- a/frontend/apps/artcraft-website/public/images/services/worldlabs.svg +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/frontend/apps/artcraft-website/public/images/try-download.png b/frontend/apps/artcraft-website/public/images/try-download.png deleted file mode 100644 index 69314687da..0000000000 Binary files a/frontend/apps/artcraft-website/public/images/try-download.png and /dev/null differ diff --git a/frontend/apps/artcraft-website/public/images/try-free.png b/frontend/apps/artcraft-website/public/images/try-free.png deleted file mode 100644 index 5e727949c3..0000000000 Binary files a/frontend/apps/artcraft-website/public/images/try-free.png and /dev/null differ diff --git a/frontend/apps/artcraft-website/public/images/tutorial-thumbnails/2D_Editor_Basics.jpg b/frontend/apps/artcraft-website/public/images/tutorial-thumbnails/2D_Editor_Basics.jpg deleted file mode 100644 index 7ad1b1bbf4..0000000000 Binary files a/frontend/apps/artcraft-website/public/images/tutorial-thumbnails/2D_Editor_Basics.jpg and /dev/null differ diff --git a/frontend/apps/artcraft-website/public/images/tutorial-thumbnails/3D_Editor_Basics.jpg b/frontend/apps/artcraft-website/public/images/tutorial-thumbnails/3D_Editor_Basics.jpg deleted file mode 100644 index 304473c988..0000000000 Binary files a/frontend/apps/artcraft-website/public/images/tutorial-thumbnails/3D_Editor_Basics.jpg and /dev/null differ diff --git a/frontend/apps/artcraft-website/public/images/tutorial-thumbnails/Turn_Images_Into_Objects.jpg b/frontend/apps/artcraft-website/public/images/tutorial-thumbnails/Turn_Images_Into_Objects.jpg deleted file mode 100644 index bc3932fca4..0000000000 Binary files a/frontend/apps/artcraft-website/public/images/tutorial-thumbnails/Turn_Images_Into_Objects.jpg and /dev/null differ diff --git a/frontend/apps/artcraft-website/public/images/video-thumbnails/artcraft-commercial.png b/frontend/apps/artcraft-website/public/images/video-thumbnails/artcraft-commercial.png deleted file mode 100644 index 44ea03262b..0000000000 Binary files a/frontend/apps/artcraft-website/public/images/video-thumbnails/artcraft-commercial.png and /dev/null differ diff --git a/frontend/apps/artcraft-website/public/images/video-thumbnails/artcraft-knight-pose.png b/frontend/apps/artcraft-website/public/images/video-thumbnails/artcraft-knight-pose.png deleted file mode 100644 index e3a7104a7d..0000000000 Binary files a/frontend/apps/artcraft-website/public/images/video-thumbnails/artcraft-knight-pose.png and /dev/null differ diff --git a/frontend/apps/artcraft-website/public/images/video-thumbnails/artcraft-pirate.png b/frontend/apps/artcraft-website/public/images/video-thumbnails/artcraft-pirate.png deleted file mode 100644 index c48780d005..0000000000 Binary files a/frontend/apps/artcraft-website/public/images/video-thumbnails/artcraft-pirate.png and /dev/null differ diff --git a/frontend/apps/artcraft-website/public/images/video-thumbnails/artcraft-sci-fi.png b/frontend/apps/artcraft-website/public/images/video-thumbnails/artcraft-sci-fi.png deleted file mode 100644 index 248ba0969d..0000000000 Binary files a/frontend/apps/artcraft-website/public/images/video-thumbnails/artcraft-sci-fi.png and /dev/null differ diff --git a/frontend/apps/artcraft-website/public/images/video-thumbnails/artcraft-worldlabs-ad.png b/frontend/apps/artcraft-website/public/images/video-thumbnails/artcraft-worldlabs-ad.png deleted file mode 100644 index d689ef09c6..0000000000 Binary files a/frontend/apps/artcraft-website/public/images/video-thumbnails/artcraft-worldlabs-ad.png and /dev/null differ diff --git a/frontend/apps/artcraft-website/public/images/windows-logo.png b/frontend/apps/artcraft-website/public/images/windows-logo.png deleted file mode 100644 index 3ac148b52b..0000000000 Binary files a/frontend/apps/artcraft-website/public/images/windows-logo.png and /dev/null differ diff --git a/frontend/apps/artcraft-website/public/model-logos/bytedance.svg b/frontend/apps/artcraft-website/public/model-logos/bytedance.svg deleted file mode 100644 index dec27435c1..0000000000 --- a/frontend/apps/artcraft-website/public/model-logos/bytedance.svg +++ /dev/null @@ -1 +0,0 @@ -ByteDance \ No newline at end of file diff --git a/frontend/apps/artcraft-website/public/model-logos/flux.svg b/frontend/apps/artcraft-website/public/model-logos/flux.svg deleted file mode 100644 index 12a4ba1d76..0000000000 --- a/frontend/apps/artcraft-website/public/model-logos/flux.svg +++ /dev/null @@ -1 +0,0 @@ -Flux \ No newline at end of file diff --git a/frontend/apps/artcraft-website/public/model-logos/google.svg b/frontend/apps/artcraft-website/public/model-logos/google.svg deleted file mode 100644 index 87736bbe09..0000000000 --- a/frontend/apps/artcraft-website/public/model-logos/google.svg +++ /dev/null @@ -1 +0,0 @@ -Gemini \ No newline at end of file diff --git a/frontend/apps/artcraft-website/public/model-logos/kling.svg b/frontend/apps/artcraft-website/public/model-logos/kling.svg deleted file mode 100644 index 32fb6bed29..0000000000 --- a/frontend/apps/artcraft-website/public/model-logos/kling.svg +++ /dev/null @@ -1 +0,0 @@ -Kling \ No newline at end of file diff --git a/frontend/apps/artcraft-website/public/model-logos/midjourney.svg b/frontend/apps/artcraft-website/public/model-logos/midjourney.svg deleted file mode 100644 index e59e3b0709..0000000000 --- a/frontend/apps/artcraft-website/public/model-logos/midjourney.svg +++ /dev/null @@ -1 +0,0 @@ -Midjourney \ No newline at end of file diff --git a/frontend/apps/artcraft-website/public/model-logos/openai.svg b/frontend/apps/artcraft-website/public/model-logos/openai.svg deleted file mode 100644 index 50d94d6c10..0000000000 --- a/frontend/apps/artcraft-website/public/model-logos/openai.svg +++ /dev/null @@ -1 +0,0 @@ -OpenAI \ No newline at end of file diff --git a/frontend/apps/artcraft-website/public/news.json b/frontend/apps/artcraft-website/public/news.json deleted file mode 100644 index 67c71da04a..0000000000 --- a/frontend/apps/artcraft-website/public/news.json +++ /dev/null @@ -1,16 +0,0 @@ -[ - { - "slug": "world-models-for-film", - "title": "Machinima 2.0: World Models for Consistent AI Filmmaking", - "description": "How to use World Models and 3D Rendering to Get Consistent AI Film Locations and better AI Films.", - "date": "2026-01-30", - "body": "\n# The \"AI Film Trailer\" Era\n\nYou've seen a lot of these: \n\n@youtube(pGn-1BKo3nY)\n\nFor the past year, it been relatively easy to make montages, \"clip shows\", and trailers\nlike this. While they serve as fun proof-of-concepts and visual eyecandy, you'd be hard \npressed to get a \"good story\" out of this video style.\n\nGood stories have characters that occupy real spaces. They have room to live, breathe, and interact. \n\nYou don't just fast track everyone through a journey from point A to B and have that be the end of things \n(unless you're Game of Thrones). Characters need to spend time in places, to explore interpersonal relationships, \nto overcome challenges. They need places to think, talk, fight and argue, process emotions, grow, and sometimes \ndo absolutely nothing at all.\n\nStories need locations. They're a first class citizen in storytelling.\n\n# Location and Blocking\n\nWe're all filmmakers at ArtCraft. The old school, photons-on-glass kind.\n\nOne of the biggest problems we've had over the past few years with AI video is giving our characters room to occupy. \nSetting them up on set, precisely controlling what's on screen, and maintaining consistency with their location. \nThe majority of AI video right now looks like a series of disconnected clips, which results in \nAI film having that \"film trailer\" montage feel to it. Lots of jumping around, very little \ncontinuity.\n\nWe've figured out how to overcome this problem. And in the spirit of \"Show, Don't Tell\", \nlet me show you what we've discovered. You'll intuit how this technique works immediately:\n\n@youtube(kzvQMdg66Go)\n\nNow let me break down the rationale and the technique...\n\n# Moving the Camera is Important\n\nIn *\"film language\"*, the camera's relationship to the characters conveys meaning. Sometimes we want to give the \nviewer a warm and friendly perspective, or perhaps frame the relationship between two different characters and \nimply a certain power dynamic.\n\nSometimes it's just important to show the location so the viewer can settle in. So the setting feels lived in and \nthe viewer is immersed in it alongside our characters.\n\n# Text is a Coarse-Grained Representation\n\nHere's a simple Nano Banana Pro prompt:\n\n> Sam Altman in a room. He sits at a desk, looking towards a desktop computer on the left. \n> The room is dimly lit. The glow of a computer terminal, sitting in front of him bathes the room in blue light. \n> Behind him, there is a wall with a poster. There’s an AC/DC poster on the left, and a window on the right. \n> Through the window, there’s a view of moonlit trees. \n\nAnd the results: \n\n![Hi Sam!](./images/blog/sam4.png)\n\nWhat happened to the location here? Why are none of these the same? Why are the locations of the poster, \ncomputer, window, and so forth so imprecise? \n\nMoreover, how do we adjust this? Iteratively prompting?\n\nYou already know the answer: text is a poor serialization of the physical world. Text-to-Image is coarse \ngrained. It lacks the ability to precisely convey physical attributes and spatial relationships. You can try, \nbut you'll only get so much precision, and it'll never match the vision in your head.\n\n# Images are Incomplete\n\nThere are multiple ways to move a camera in an image-to-image workflow. You can use a ControlNet, a LoRA, or even \nask an instructive model nicely:\n\n> Rotate the camera behind Sam Altman to show him from behind. Show the desk, computer screen, \n> and wall behind the desk. Show the door to the room. \n\n![Hi Sam!](./images/blog/sam4.2.png)\n\nWhile the lighting and scene elements remain somewhat consistent, we're still ultimately left with the same \nissues we had with text-to-image. We can iterate on editing with words, but it's slow, tedious, and still \nimprecise.\n\n(Why does the desk block the door? What is it even trying to do with that poster?)\n\n# 3D to the Rescue!\n\nOne of the best tools for consistency is 3D. You can position your characters and props in a \"3D set\" exactly as you want them, \nand then move the \"camera\" to any angle, maintaining strong consistency throughout.\n\n![Hi Sam!](./images/blog/sam_previz.png)\n\nPick a \"smart\" model like GPT Image 1.5 or Nano Banana Pro to convert this previz into a photorealistic render (or any style - anime, sci-fi, whatever): \n\n> Suspense movie - live action - night time. Make a photorealistic picture of Sam Altman sitting at a fancy office desk. \n> Use the previz scene as the layout and posing of the shot. The camera and pose of Sam should match this shot. \n> Nighttime shot, moonlit glow. \n\n![Hi Sam!](./images/blog/sam_gpt_image_1.png)\n\nIf desired, you can also attach additional reference images for character designs, wardrobe choices, etc.\n\nAfter Nano Banana Pro lighting adjustments and upscaling (and showing it the previz again to restore the missing desk pad), we get this:\n\n> Make this look more photorealistic. Suspenseful night in the office\n\n![Hi Sam!](./images/blog/sam_nbp2.png)\n\nIt's a great starting composition before calling \"action\" with a video model. (I'm no Roger Deakins. I would adjust the framing, but I wanted to show under the desk as well as bookcase features. I was also up late writing this.)\n\n# 3D Kit Bashing \n\nYou can use 3D kits found online, many of which are free or low cost, to \"kit bash\" a scene. Synty, CGTrader, ... there are hundreds of sites for locations, objects, characters, and more. With these assets, you can provide exact blocking and layout you want - but more importantly, you can reuse them for additional shots and camera angles. Your characters need to be seen from multiple angles, and your props need to be consistent throughout the scene.\n\n> Action movie - live action - day. Turn this previz scene into a photorealistic desert island. Keep the tree, boxes, and treasure chest in place. \n\n![Island](./images/blog/island_previz.png)\n\nAnd the render, with one extra NBP 4K upscale (I did ask it to change the clouds on the second pass): \n\n![Island](./images/blog/island_nbp.png)\n\nImage editing models are also surprisingly robust at changing the composition controllably if you give it enough structure to start with.\n\n# Greyboxing\n\nBut kit bashing can be slow. You have to find and curate a selection of assets. \nIf you need to go faster, you can use 3D primitive shapes to \"greybox\" a scene:\n\n![Greyboxing](./images/blog/ruins_previz.png)\n\n> Historical epic - live action - sunset. Use this previz scene for the composition. \n> An ancient greek temple with ruined concrete and marble columns. The pink and orange sunset bathes the concrete and marble. \n> In the distance, there are rolling green hills and valleys. Bright pink sky. \n\n![Greyboxing](./images/blog/ruins_nbp.png)\n\nYou can drop 3D assets in alongside the greybox to position existing props or characters. You can even greybox just a single element, like a TV.\n\n# Billboards and Matte Plates\n\nIf you want to add a dramatic backdrop behind characters and a foreground, you can use the old Hollywood technique of creating a background plate (think the \"matte paintings\" used in Star Wars). In video game parlance, this is called using flat or billboard textures. \n\nIt's quick and easy, though you do lose your ability to rotate the camera. Use it for depth and backdrops:\n\n![Billboards](./images/blog/snow_previz.png)\n\n> Sports footage - live action - day. Woman is hiking in the mountains. She is dressed in sporty warm winter wear. \n> She’s standing at the peak, with a mountain forest behind her. Use this previz image to upscale the photo into a \n> fully lifelike and photorealistic cinematic image.\n\n![Billboards](./images/blog/snow_nbp.png)\n\n\n# Object Generation for Props\n\nYou can turn images into 3D prop objects using models such as Hunyuan 3D. This is useful if you need angles and \nprecision posing for a complicated object, or if you intend to use the asset over and over and need consistency.\n\nI generated a quick photo of an FJ Cruiser SUV:\n\n![Object Generation](./images/blog/fj_gen.png)\n\nTurning this into a 3D object and instancing it around all over the place:\n\n![Object Generation](./images/blog/fj_previz.png)\n\nThen prompt, followed by a 4K upscale (with a few more fixes):\n\n> An artistic collage of fj cruiser SUVs floating in a pixelated desert. \n> Match their pose and orientations exactly, including the ones that are flipped and rotated. \n> Make the low poly fj cruisers look photorealistic and high resolution.\n\n![Object Generation](./images/blog/fj_nbp.png)\n\n\n# World Models Make This Easy\n\nThe real stars of the modern 3D compositing workflow are image-to-Gaussian Splat models, such as World Labs' Marble or Apple's Sharp. \n\nYou can very quickly create a pleasing image of an intracate set in MidJourney, edit it in Nano Banana, \nthen turn it into a fully navigable 3D scene. This gives your characters room to move, your camera places \nto go, and your location opportunities to shine. \n\n@loop_autoplay(https://pub-f7441936e5804042a1ea2bdc92e4dc71.r2.dev/Fantasy_Gif_One.mp4)\n@loop_autoplay(https://pub-f7441936e5804042a1ea2bdc92e4dc71.r2.dev/Beach_Gif_One.mp4)\n@loop_autoplay(https://pub-f7441936e5804042a1ea2bdc92e4dc71.r2.dev/SciFi_Gif_One.mp4)\n\nFinally, we have set pieces. And they're easy to build and iterate on.\n\n# Combining Techniques\n\nYou can use MidJourney to quickly generate brilliant scenes with high detail and magazine photoshoot quality layout, or you can draw a sketch or greybox a scene you'd like to build, iterate, then turn that into a world. \n\nThis is less like \"prompting\" and more like \"crafting\", with lots of different visual tools used in quick succession and coordination. \n\nNeed something? Generate it, turn it into 3D, edit, manipulate it. Stick it into something else. Rinse, cycle, repeat. Highly tangible, \nlike an artist molding clay - except now we're moving closer to the speed of thoughts. \n\nWe're still being largely intentional. If there's something we want to see, we now have the tool to make it real. It's *What You See Is What You Get*. \n\nWe're painting with pictures. We're not prompters, but rather auteurs of crafting.\n\n# Machinima 2.0\n\nDo you remember \"Machinima\"? It's a niche, indie genre of filmmaking that was popular in the early 2000's. Creators would pilot video game characters, carefully controlling for the camera, character movements, and on-screen details in order to tell stories. They would then dub over the footage to breathe life into the narrative. \n\nPopular Machinima series include \"Red vs. Blue\", from Rooster Teeth Productions, which was filmed using the Halo video game series. Other notable Machinima include \"The Strangerhood\" (which used The Sims) and \"Skibidi Toilet\" (which leverages Source Filmmaker). \n\nI mention this obscure artform because as a former Machinima creator myself, it feels like Image-to-Video is the new Machinima. There's the character posting, keyframing, and dubbing, of course, but there's also this notion of using pixels created by someone else's engine. And it's very much in the spirit of machinima to carve new creativity out of these engines by operating at a higher level. \n\nImage-to-image, 3D, and World Models make an entirely new form of Machinima possible:\n\n@youtube(tAAiiKteM-U)\n\n\n# ArtCraft: Free and Open 3D Filmmaking\n\nArtCraft is a crafting engine and is available in its entirety on [Github (please star us!)](https://github.com/storytold/artcraft), or try it today on [Mac or Windows](/download).\n\nYou generate images and videos in app using a wide selection of models and providers\nsuch as Midjourney, Google, Sora, Grok, WorldLabs, and more - or you can bring your own keys!\n\nOver the coming weeks, we'll be adding FAL, Replicate, and Google Gemini. Local GPU support and RunPod support \nis also coming soon (subscribe to stay updated, or better yet, [join our Discord](https://discord.gg/artcraft)).\n\nIf you're a blogger, podcaster, or creator we've got a [ton of CC-BY-SA content here](/press-kit#top) if you'd like to help us let people know about ArtCraft.\n\nIf you're a creative, please enjoy ArtCraft. We built it for ourselves and for you. Please join the community and let us know if there's any way we can help. \n\n— Brandon Thomas\n\n" - }, - { - "slug": "welcome", - "title": "Welcome to the ArtCraft Blog", - "description": "We are excited to launch our new blog where we will share updates, tutorials, and behind-the-scenes content.", - "date": "2026-01-16", - "body": "\n# Hello World!\n\nWelcome to the official **ArtCraft Blog**. This is where we'll be posting about:\n\n- **New Features**: Be the first to know about the latest tools and capabilities added to ArtCraft.\n- **Tutorials**: Learn how to get the most out of our AI generation and editing suite.\n- **Community Showcases**: Highlighting amazing work created by our users.\n- **Development Updates**: Insights into what we are building next.\n\n## Stay Tuned\n\nWe have a lot of exciting things in the pipeline. Make sure to check back regularly!\n\nHappy Crafting!\n\nThe ArtCraft Team\n" - } -] \ No newline at end of file diff --git a/frontend/apps/artcraft-website/public/videos/2d_canvas_demo.mp4 b/frontend/apps/artcraft-website/public/videos/2d_canvas_demo.mp4 deleted file mode 100644 index 99c8ed733a..0000000000 Binary files a/frontend/apps/artcraft-website/public/videos/2d_canvas_demo.mp4 and /dev/null differ diff --git a/frontend/apps/artcraft-website/public/videos/3d_canvas_demo.mp4 b/frontend/apps/artcraft-website/public/videos/3d_canvas_demo.mp4 deleted file mode 100644 index 694a76c093..0000000000 Binary files a/frontend/apps/artcraft-website/public/videos/3d_canvas_demo.mp4 and /dev/null differ diff --git a/frontend/apps/artcraft-website/public/videos/artcraft-3d-demo.mp4 b/frontend/apps/artcraft-website/public/videos/artcraft-3d-demo.mp4 deleted file mode 100644 index f0b86eb82b..0000000000 Binary files a/frontend/apps/artcraft-website/public/videos/artcraft-3d-demo.mp4 and /dev/null differ diff --git a/frontend/apps/artcraft-website/public/videos/artcraft-canvas-demo.mp4 b/frontend/apps/artcraft-website/public/videos/artcraft-canvas-demo.mp4 deleted file mode 100644 index 0e98e936a9..0000000000 Binary files a/frontend/apps/artcraft-website/public/videos/artcraft-canvas-demo.mp4 and /dev/null differ diff --git a/frontend/apps/artcraft-website/public/videos/features/Background.webm b/frontend/apps/artcraft-website/public/videos/features/Background.webm deleted file mode 100644 index d03136bfa7..0000000000 Binary files a/frontend/apps/artcraft-website/public/videos/features/Background.webm and /dev/null differ diff --git a/frontend/apps/artcraft-website/public/videos/features/Character-Pose.webm b/frontend/apps/artcraft-website/public/videos/features/Character-Pose.webm deleted file mode 100644 index 566bc5dcda..0000000000 Binary files a/frontend/apps/artcraft-website/public/videos/features/Character-Pose.webm and /dev/null differ diff --git a/frontend/apps/artcraft-website/public/videos/features/Editor.webm b/frontend/apps/artcraft-website/public/videos/features/Editor.webm deleted file mode 100644 index ddab4fcb72..0000000000 Binary files a/frontend/apps/artcraft-website/public/videos/features/Editor.webm and /dev/null differ diff --git a/frontend/apps/artcraft-website/public/videos/features/Leo.webm b/frontend/apps/artcraft-website/public/videos/features/Leo.webm deleted file mode 100644 index 55f0321109..0000000000 Binary files a/frontend/apps/artcraft-website/public/videos/features/Leo.webm and /dev/null differ diff --git a/frontend/apps/artcraft-website/public/videos/features/Make_3D.webm b/frontend/apps/artcraft-website/public/videos/features/Make_3D.webm deleted file mode 100644 index 1b29e8b26a..0000000000 Binary files a/frontend/apps/artcraft-website/public/videos/features/Make_3D.webm and /dev/null differ diff --git a/frontend/apps/artcraft-website/public/videos/features/Mixed.webm b/frontend/apps/artcraft-website/public/videos/features/Mixed.webm deleted file mode 100644 index 069c0e808c..0000000000 Binary files a/frontend/apps/artcraft-website/public/videos/features/Mixed.webm and /dev/null differ diff --git a/frontend/apps/artcraft-website/public/videos/features/Panel.webm b/frontend/apps/artcraft-website/public/videos/features/Panel.webm deleted file mode 100644 index 9cb74ba28e..0000000000 Binary files a/frontend/apps/artcraft-website/public/videos/features/Panel.webm and /dev/null differ diff --git a/frontend/apps/artcraft-website/public/videos/features/Pose_Second_Version.webm b/frontend/apps/artcraft-website/public/videos/features/Pose_Second_Version.webm deleted file mode 100644 index 99c83dcbad..0000000000 Binary files a/frontend/apps/artcraft-website/public/videos/features/Pose_Second_Version.webm and /dev/null differ diff --git a/frontend/apps/artcraft-website/public/videos/features/WorldLabs_Demo_2.webm b/frontend/apps/artcraft-website/public/videos/features/WorldLabs_Demo_2.webm deleted file mode 100644 index 11dec7a820..0000000000 Binary files a/frontend/apps/artcraft-website/public/videos/features/WorldLabs_Demo_2.webm and /dev/null differ diff --git a/frontend/apps/artcraft-website/public/videos/hero-video.mp4 b/frontend/apps/artcraft-website/public/videos/hero-video.mp4 deleted file mode 100644 index b4a048485a..0000000000 Binary files a/frontend/apps/artcraft-website/public/videos/hero-video.mp4 and /dev/null differ diff --git a/frontend/apps/artcraft-website/public/videos/inpainting_demo.mp4 b/frontend/apps/artcraft-website/public/videos/inpainting_demo.mp4 deleted file mode 100644 index 659384ae30..0000000000 Binary files a/frontend/apps/artcraft-website/public/videos/inpainting_demo.mp4 and /dev/null differ diff --git a/frontend/apps/artcraft-website/public/videos/minimax-h3/posters/2k-performance.jpg b/frontend/apps/artcraft-website/public/videos/minimax-h3/posters/2k-performance.jpg deleted file mode 100644 index a3316fde0e..0000000000 Binary files a/frontend/apps/artcraft-website/public/videos/minimax-h3/posters/2k-performance.jpg and /dev/null differ diff --git a/frontend/apps/artcraft-website/public/videos/minimax-h3/posters/advertising-ecommerce.jpg b/frontend/apps/artcraft-website/public/videos/minimax-h3/posters/advertising-ecommerce.jpg deleted file mode 100644 index 802674abc6..0000000000 Binary files a/frontend/apps/artcraft-website/public/videos/minimax-h3/posters/advertising-ecommerce.jpg and /dev/null differ diff --git a/frontend/apps/artcraft-website/public/videos/minimax-h3/posters/animated-poster.jpg b/frontend/apps/artcraft-website/public/videos/minimax-h3/posters/animated-poster.jpg deleted file mode 100644 index 87ce62cb29..0000000000 Binary files a/frontend/apps/artcraft-website/public/videos/minimax-h3/posters/animated-poster.jpg and /dev/null differ diff --git a/frontend/apps/artcraft-website/public/videos/minimax-h3/posters/film-opening-titles.jpg b/frontend/apps/artcraft-website/public/videos/minimax-h3/posters/film-opening-titles.jpg deleted file mode 100644 index 9939601715..0000000000 Binary files a/frontend/apps/artcraft-website/public/videos/minimax-h3/posters/film-opening-titles.jpg and /dev/null differ diff --git a/frontend/apps/artcraft-website/public/videos/minimax-h3/posters/product-website.jpg b/frontend/apps/artcraft-website/public/videos/minimax-h3/posters/product-website.jpg deleted file mode 100644 index 9893ceb4a6..0000000000 Binary files a/frontend/apps/artcraft-website/public/videos/minimax-h3/posters/product-website.jpg and /dev/null differ diff --git a/frontend/apps/artcraft-website/public/videos/minimax-h3/posters/stereo-sound.jpg b/frontend/apps/artcraft-website/public/videos/minimax-h3/posters/stereo-sound.jpg deleted file mode 100644 index 2a982c9f0a..0000000000 Binary files a/frontend/apps/artcraft-website/public/videos/minimax-h3/posters/stereo-sound.jpg and /dev/null differ diff --git a/frontend/apps/artcraft-website/script/netlify_build.sh b/frontend/apps/artcraft-website/script/netlify_build.sh deleted file mode 100755 index 1389c9da12..0000000000 --- a/frontend/apps/artcraft-website/script/netlify_build.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash - -set -euxo pipefail - -echo "Run build script (TODO: Make strict)" -nx build artcraft-website - -echo "Prerender per-route social-share (OG/Twitter) meta tags into dist" -node scripts/prerender-meta.mjs - -echo "Change to project dir" -pushd apps/artcraft-website/ - -echo "Copy netlify configs into dist" -#cp _headers dist/ -cp _redirects dist/ - -#echo "Copy netlify 404.html page into dist" -#cp "404.html" dist/ - -echo "List final files in build" -find dist/ - diff --git a/frontend/apps/artcraft-website/src/app/app.module.css b/frontend/apps/artcraft-website/src/app/app.module.css deleted file mode 100644 index 7b88fbabf8..0000000000 --- a/frontend/apps/artcraft-website/src/app/app.module.css +++ /dev/null @@ -1 +0,0 @@ -/* Your styles goes here. */ diff --git a/frontend/apps/artcraft-website/src/app/app.spec.tsx b/frontend/apps/artcraft-website/src/app/app.spec.tsx deleted file mode 100644 index c19e8c1d14..0000000000 --- a/frontend/apps/artcraft-website/src/app/app.spec.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { render } from '@testing-library/react'; -import { BrowserRouter } from 'react-router-dom'; - -import App from './app'; - -describe('App', () => { - it('should render successfully', () => { - const { baseElement } = render(); - expect(baseElement).toBeTruthy(); - }); - - it('should have a greeting as the title', () => { - const { getAllByText } = render(); - expect(getAllByText(new RegExp('Welcome @frontend/artcraft-website', 'gi')).length > 0).toBeTruthy(); - }); -}); diff --git a/frontend/apps/artcraft-website/src/app/app.tsx b/frontend/apps/artcraft-website/src/app/app.tsx deleted file mode 100644 index 6cf424e06a..0000000000 --- a/frontend/apps/artcraft-website/src/app/app.tsx +++ /dev/null @@ -1,193 +0,0 @@ -import { useEffect, type ReactNode } from "react"; -import { - Route, - Routes, - Navigate, - useLocation, - useNavigationType, -} from "react-router-dom"; -import Download from "../pages/download"; -import Media from "../pages/media"; -import PressKit from "../pages/press-kit"; -import Navbar from "../components/navbar"; -import { ToastContainer } from "../components/toast/toast"; -import { WebappRedirect } from "../components/webapp-redirect"; -import CreateImage from "../pages/create-image"; -import CreateVideo from "../pages/create-video"; -import CreateVFX from "../pages/create-vfx"; -//import Landing2 from "../pages/landing2"; -import Landing3 from "../pages/landing3"; -import LandingSD2 from "../pages/landing-sd2"; -import LandingSD25 from "../pages/landing-sd25"; -import LandingMinimaxH3 from "../pages/landing-minimax-h3"; -import LandingPrototype0 from "../pages/landing-prototype0"; -import CreatorJboogx from "../pages/creator-jboogx"; -import TutorialsPage from "../pages/tutorials"; -import TutorialsArticle from "../pages/tutorials/article"; -import FaqIndex from "../pages/faq/index"; -import FaqArticle from "../pages/faq/article"; -import NewsIndex from "../pages/news/news-index"; -import NewsPost from "../pages/news/news-post"; -import Pricing from "../pages/pricing"; -import Beta from "../pages/beta"; -import Support from "../pages/support/support"; -import Login from "../pages/login"; -import { DesktopLogin } from "../pages/login/desktop-login"; -import Signup from "../pages/signup"; -import ForgotPassword, { VerifyReset } from "../pages/forgot-password"; -import Welcome from "../pages/welcome"; -import Onboarding from "../pages/onboarding"; -import Library from "../pages/library"; -import Referrals from "../pages/referrals"; -import { CheckoutSuccess, CheckoutCancel } from "../pages/checkout"; -import { USE_WEBAPP_FOR_APP_FEATURES } from "../config/links"; - -function ScrollToTop() { - const { pathname } = useLocation(); - const navType = useNavigationType(); - useEffect(() => { - if (navType !== "POP") { - window.scrollTo(0, 0); - } - }, [pathname, navType]); - return null; -} - -// Returns the local page when the feature flag is off, otherwise a redirect -// to the equivalent path on the webapp (preserving query string + hash). -function appOrWebapp(localElement: ReactNode, webappPath: string): ReactNode { - return USE_WEBAPP_FOR_APP_FEATURES ? ( - - ) : ( - localElement - ); -} - -export function App() { - // Prototype landing brings its own navbar (sticky, full-width, sharp). - const { pathname } = useLocation(); - const hideGlobalNavbar = pathname === "/landingp0" || pathname === "/login/desktop"; - - return ( -
- - {!hideGlobalNavbar && } - - - } /> - } /> - } /> - } /> - } /> - } /> - } - /> - } /> - } /> - } /> - } /> - } /> - } /> - } /> - } /> - } /> - } /> - } /> - } /> - } /> - {/* Consent must stay on this origin even when app features redirect. */} - } /> - - {/* App routes — flip USE_WEBAPP_FOR_APP_FEATURES in config/links.ts - to render these locally instead of redirecting to the webapp. */} - , "/login")} /> - , "/signup")} /> - , "/forgot-password")} - /> - , "/forgot-password/verify")} - /> - , "/create-image")} - /> - , "/create-video")} - /> - , "/background-change")} - /> - , "/library")} - /> - , "/library/:filter")} - /> - , "/referrals")} - /> - , "/welcome")} - /> - , "/onboarding")} - /> - , "/checkout/success")} - /> - , "/checkout/cancel")} - /> - {/* Legacy underscore Stripe paths — always redirect to the canonical - slash form, going local or webapp based on the flag. */} - - ) : ( - - ) - } - /> - - ) : ( - - ) - } - /> - - ) : ( - - ) - } - /> - - -
- ); -} - -export default App; diff --git a/frontend/apps/artcraft-website/src/assets/.gitkeep b/frontend/apps/artcraft-website/src/assets/.gitkeep deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/frontend/apps/artcraft-website/src/components/app-download-cta/AppDownloadCta.tsx b/frontend/apps/artcraft-website/src/components/app-download-cta/AppDownloadCta.tsx deleted file mode 100644 index 3c10aa6e3e..0000000000 --- a/frontend/apps/artcraft-website/src/components/app-download-cta/AppDownloadCta.tsx +++ /dev/null @@ -1,37 +0,0 @@ -import { Link } from "react-router-dom"; -import { MonitorIcon, XIcon } from "lucide-react"; -import { useDismissibleBanner } from "../../lib/useDismissibleBanner"; - -const DISMISS_KEY = "artcraft-app-download-cta-dismissed-v1"; - -export function AppDownloadCta() { - const { visible, dismiss } = useDismissibleBanner(DISMISS_KEY); - - if (!visible) return null; - - return ( -
-
- -
- - Get more out of ArtCraft on desktop - 3D Stage, 2D Canvas & more. - - - Download - - -
- ); -} - -export default AppDownloadCta; diff --git a/frontend/apps/artcraft-website/src/components/auth/GoogleLoginButton.tsx b/frontend/apps/artcraft-website/src/components/auth/GoogleLoginButton.tsx deleted file mode 100644 index 7809bf1cfb..0000000000 --- a/frontend/apps/artcraft-website/src/components/auth/GoogleLoginButton.tsx +++ /dev/null @@ -1,112 +0,0 @@ -import { GoogleLogin, CredentialResponse } from "@react-oauth/google"; -import { UsersApi } from "@storyteller/api"; -import { - getLandingUrl, - getReferralCode, - getReferralUsername, - getReferrer, -} from "@storyteller/common"; -import { LoaderCircleIcon } from "lucide-react"; -import { useState } from "react"; - -interface GoogleLoginButtonProps { - onSuccess: (isNewUser: boolean) => void; - onError: (error: string) => void; - mode?: "login" | "signup"; - className?: string; -} - -export function GoogleLoginButton({ - onSuccess, - onError, - mode = "login", - className = "", -}: GoogleLoginButtonProps) { - const [isLoading, setIsLoading] = useState(false); - - const handleGoogleSuccess = async ( - credentialResponse: CredentialResponse, - ) => { - if (!credentialResponse.credential) { - onError("No credential received from Google"); - return; - } - - setIsLoading(true); - try { - const api = new UsersApi(); - const result = await api.GoogleSSO({ - credential: credentialResponse.credential, - maybeReferralUrl: getReferrer(), - maybeLandingUrl: getLandingUrl(), - maybeReferralUsername: getReferralUsername(), - maybeReferralCode: getReferralCode(), - }); - if (result.success) { - window.dispatchEvent(new Event("auth-change")); - onSuccess(result.data?.usernameNotYetCustomized ?? false); - } else { - onError(result.errorMessage || "Authentication failed"); - } - } catch (err) { - onError("Network error"); - } finally { - setIsLoading(false); - } - }; - - return ( -
- {/* Custom visual button - shown behind */} -
- {isLoading ? ( - - ) : ( - <> - - Continue with Google - - )} -
- - {/* Google's actual button - invisible overlay that receives clicks */} -
- onError("Google login failed")} - size="large" - width={400} - text="continue_with" - /> -
-
- ); -} - -function GoogleIcon() { - return ( - - - - - - - ); -} diff --git a/frontend/apps/artcraft-website/src/components/auth/auth-gate-modal.tsx b/frontend/apps/artcraft-website/src/components/auth/auth-gate-modal.tsx deleted file mode 100644 index 801aabcdbf..0000000000 --- a/frontend/apps/artcraft-website/src/components/auth/auth-gate-modal.tsx +++ /dev/null @@ -1,242 +0,0 @@ -import { useState } from "react"; -import { CheckIcon, EyeIcon, EyeOffIcon, LoaderCircleIcon } from "lucide-react"; -import { DynamicIcon } from "@storyteller/icons"; -import { Modal } from "@storyteller/ui-modal"; -import { Button } from "@storyteller/ui-button"; -import { Input } from "@storyteller/ui-input"; -import { UsersApi } from "@storyteller/api"; -import { SignupForm } from "./signup-form"; -import { GoogleLoginButton } from "./GoogleLoginButton"; - -interface AuthGateModalProps { - isOpen: boolean; - onClose: () => void; - /** Called after a successful signup OR login. Session cookie is already set. */ - onAuthed: () => void; - /** Attribution string passed to the signup endpoint. */ - signupSource: string; - headline: string; - subtitle: string; - perks?: string[]; - initialMode?: "signup" | "login"; -} - -/** - * Soft auth gate for marketing pages: keeps the visitor on the page (no - * redirect to the webapp), letting them create an account or log in inline - * and then continue whatever action triggered the gate. - */ -export function AuthGateModal({ - isOpen, - onClose, - onAuthed, - signupSource, - headline, - subtitle, - perks, - initialMode = "signup", -}: AuthGateModalProps) { - const [mode, setMode] = useState<"signup" | "login">(initialMode); - const [googleError, setGoogleError] = useState(null); - - return ( - -
-
-
- -
-

- {headline} -

-

- {subtitle} -

- - {perks && perks.length > 0 && ( -
    - {perks.map((perk) => ( -
  • - - - - {perk} -
  • - ))} -
- )} - -
- {googleError && ( -
- {googleError} -
- )} - - - -
-
-
-
- - or - -
- - {mode === "signup" ? ( - - ) : ( - - )} -
- - -
-
- - ); -} - -// Compact login variant of SignupForm, kept here because the standalone login -// page redirects to the webapp (USE_WEBAPP_FOR_APP_FEATURES) and would pull -// the visitor away from the marketing page mid-action. -function InlineLoginForm({ onSuccess }: { onSuccess: () => void }) { - const [usernameOrEmail, setUsernameOrEmail] = useState(""); - const [password, setPassword] = useState(""); - const [showPassword, setShowPassword] = useState(false); - const [isLoading, setIsLoading] = useState(false); - const [error, setError] = useState(null); - - const handleLogin = async () => { - setError(null); - if (!usernameOrEmail || !password) { - setError("All fields are required"); - return; - } - - setIsLoading(true); - const response = await new UsersApi().Login({ usernameOrEmail, password }); - setIsLoading(false); - - if (response.success) { - window.dispatchEvent(new Event("auth-change")); - onSuccess(); - } else { - setError(response.errorMessage || "Invalid credentials"); - } - }; - - return ( -
{ - e.preventDefault(); - handleLogin(); - }} - > - {error && ( -
- {error} -
- )} - -
- - setUsernameOrEmail(e.target.value)} - placeholder="you@example.com" - autoFocus - inputClassName="w-full bg-black/20 border border-white/10 focus:border-primary/50 px-4 py-3 text-white placeholder-white/20 outline-none transition-colors" - /> -
- -
- -
- setPassword(e.target.value)} - placeholder="Your password" - inputClassName="w-full bg-black/20 border border-white/10 focus:border-primary/50 px-4 py-3 text-white placeholder-white/20 outline-none transition-colors pr-12" - /> - -
-
- -
- -
-
- ); -} diff --git a/frontend/apps/artcraft-website/src/components/auth/index.ts b/frontend/apps/artcraft-website/src/components/auth/index.ts deleted file mode 100644 index c37f1fc50b..0000000000 --- a/frontend/apps/artcraft-website/src/components/auth/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from "./signup-form"; -export * from "./GoogleLoginButton"; -export * from "./auth-gate-modal"; diff --git a/frontend/apps/artcraft-website/src/components/auth/signup-form.tsx b/frontend/apps/artcraft-website/src/components/auth/signup-form.tsx deleted file mode 100644 index 9a92c5c736..0000000000 --- a/frontend/apps/artcraft-website/src/components/auth/signup-form.tsx +++ /dev/null @@ -1,176 +0,0 @@ -import { EyeIcon, EyeOffIcon, LoaderCircleIcon } from "lucide-react"; -import { DynamicIcon } from "@storyteller/icons"; -import { Button } from "@storyteller/ui-button"; -import { Input } from "@storyteller/ui-input"; -import { useState } from "react"; -import { UsersApi } from "@storyteller/api"; -import { - getLandingUrl, - getReferralCode, - getReferralUsername, - getReferrer, -} from "@storyteller/common"; - -interface SignupFormProps { - onSuccess: (isNewUser?: boolean) => void; - signupSource: string; - className?: string; - autoFocus?: boolean; -} - -export const SignupForm = ({ - onSuccess, - signupSource, - className = "", - autoFocus = false, -}: SignupFormProps) => { - const [email, setEmail] = useState(""); - const [password, setPassword] = useState(""); - const [showPassword, setShowPassword] = useState(false); - - const [isLoading, setIsLoading] = useState(false); - const [error, setError] = useState(null); - - const handleSignup = async () => { - setError(null); - - if (!email || !password) { - setError("All fields are required"); - return; - } - - if (password.length < 8) { - setError("Password must be at least 8 characters"); - return; - } - - setIsLoading(true); - - const api = new UsersApi(); - - // Generate a username from the email - const emailPrefix = email.split("@")[0].replace(/[^a-zA-Z0-9]/g, ""); - // Ensure we don't exceed max length (7 chars from email + 3 digits = 10 total) - const truncatedPrefix = emailPrefix.substring(0, 7); - const randomSuffix = Math.floor(Math.random() * 900) + 100; // 100-999 - const generatedUsername = `${truncatedPrefix}${randomSuffix}`; - - const response = await api.Signup({ - username: generatedUsername, - email, - password, - passwordConfirmation: password, - signupSource, - maybeReferralUrl: getReferrer(), - maybeLandingUrl: getLandingUrl(), - maybeReferralUsername: getReferralUsername(), - maybeReferralCode: getReferralCode(), - }); - - setIsLoading(false); - - if (response.success) { - window.dispatchEvent(new Event("auth-change")); - onSuccess(); - } else { - setError(response.errorMessage || "Failed to create account"); - } - }; - - //const handleGoogleSuccess = (isNewUser: boolean) => { - // onSuccess(isNewUser); - //}; - - //const handleGoogleError = (errorMessage: string) => { - // setError(errorMessage); - //}; - - return ( -
- {/* {showGoogleButton && ( - <> - - -
-
-
-
- - or - -
- - )} - */} - -
{ - e.preventDefault(); - handleSignup(); - }} - > - {error && ( -
- {error} -
- )} - -
- - setEmail(e.target.value)} - placeholder="you@example.com" - autoFocus={autoFocus} - inputClassName="w-full bg-black/20 border border-white/10 focus:border-primary/50 px-4 py-3 text-white placeholder-white/20 outline-none transition-colors" - /> -
- -
- -
- setPassword(e.target.value)} - placeholder="Min. 8 characters" - inputClassName="w-full bg-black/20 border border-white/10 focus:border-primary/50 px-4 py-3 text-white placeholder-white/20 outline-none transition-colors pr-12" - /> - -
-
- -
- -
-
-
- ); -}; diff --git a/frontend/apps/artcraft-website/src/components/credits-modal.tsx b/frontend/apps/artcraft-website/src/components/credits-modal.tsx deleted file mode 100644 index 17a8f8932f..0000000000 --- a/frontend/apps/artcraft-website/src/components/credits-modal.tsx +++ /dev/null @@ -1,114 +0,0 @@ -import { useState } from "react"; -import { Modal } from "@storyteller/ui-modal"; -import { Button } from "@storyteller/ui-button"; -import { CoinsIcon } from "lucide-react"; -import { BillingApi } from "@storyteller/api"; -import { toast } from "./toast/toast"; - -interface CreditPack { - id: string; - total: number; - priceUsd: number; - badge?: string; -} - -const CREDIT_PACKS: CreditPack[] = [ - { id: "artcraft_1000", total: 1000, priceUsd: 10 }, - { id: "artcraft_2500", total: 2500, priceUsd: 25 }, - { id: "artcraft_5000", total: 5000, priceUsd: 50, badge: "Popular" }, - { id: "artcraft_10000", total: 10000, priceUsd: 100 }, -]; - -interface CreditsModalProps { - isOpen: boolean; - onClose: () => void; -} - -export function CreditsModal({ isOpen, onClose }: CreditsModalProps) { - const [purchasingId, setPurchasingId] = useState(null); - - const handlePurchase = async (pack: CreditPack) => { - setPurchasingId(pack.id); - try { - const api = new BillingApi(); - const response = await api.CreditsPackCheckout({ - creditsPack: pack.id, - }); - - if (response.success && response.data?.stripeCheckoutRedirectUrl) { - window.location.href = response.data.stripeCheckoutRedirectUrl; - } else { - toast.error(response.errorMessage ?? "Failed to start checkout"); - } - } catch { - toast.error("Something went wrong. Please try again."); - } finally { - setPurchasingId(null); - } - }; - - return ( - -
-
-

- Buy Credits -

-

- One-time credit packs. No subscription required. -

-
- -
- {CREDIT_PACKS.map((pack) => ( - -
- - ))} -
-
- - ); -} diff --git a/frontend/apps/artcraft-website/src/components/discord-button/discord-button.tsx b/frontend/apps/artcraft-website/src/components/discord-button/discord-button.tsx deleted file mode 100644 index d8177c437a..0000000000 --- a/frontend/apps/artcraft-website/src/components/discord-button/discord-button.tsx +++ /dev/null @@ -1,29 +0,0 @@ -import { Button } from "@storyteller/ui-button"; -import { DiscordIcon } from "@storyteller/icons"; -import { SOCIAL_LINKS } from "../../config/links"; - -interface DiscordButtonProps { - className?: string; - small?: boolean; -} - -export const DiscordButton = ({ - className = "", - small = false, -}: DiscordButtonProps) => { - const sizeClasses = small - ? "px-4 py-2 text-sm" - : "text-md px-4 py-2 md:px-6 md:py-3"; - - return ( - - ); -}; diff --git a/frontend/apps/artcraft-website/src/components/discord-button/index.ts b/frontend/apps/artcraft-website/src/components/discord-button/index.ts deleted file mode 100644 index a5d96b7972..0000000000 --- a/frontend/apps/artcraft-website/src/components/discord-button/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./discord-button"; diff --git a/frontend/apps/artcraft-website/src/components/download-button/download-button.tsx b/frontend/apps/artcraft-website/src/components/download-button/download-button.tsx deleted file mode 100644 index 3d49587825..0000000000 --- a/frontend/apps/artcraft-website/src/components/download-button/download-button.tsx +++ /dev/null @@ -1,59 +0,0 @@ -import { Button } from "@storyteller/ui-button"; -import { AppleIcon, LinuxIcon, WindowsIcon } from "@storyteller/icons"; -import { isMobile, isWindows, isMacOs } from "react-device-detect"; -import { - DOWNLOAD_LINKS, - DOWNLOADS_ENABLED, -} from "../../config/github_download_links"; - -interface DownloadButtonProps { - className?: string; -} - -export const DownloadButton = ({ className = "" }: DownloadButtonProps) => { - // Helper function to detect Linux - const isLinux = - !isWindows && - !isMacOs && - navigator.platform.toLowerCase().includes("linux"); - - const getDownloadLink = () => { - if (isWindows) return DOWNLOAD_LINKS.WINDOWS; - if (isMacOs) return DOWNLOAD_LINKS.MACOS; - // No Linux build is published yet. - return null; - }; - - if (!DOWNLOADS_ENABLED) return null; - - const getIcon = () => { - if (isMobile) return undefined; - if (isWindows) return WindowsIcon; - if (isMacOs) return AppleIcon; - if (isLinux) return LinuxIcon; - return undefined; - }; - - const downloadLink = getDownloadLink(); - - return ( - - ); -}; diff --git a/frontend/apps/artcraft-website/src/components/download-button/index.ts b/frontend/apps/artcraft-website/src/components/download-button/index.ts deleted file mode 100644 index 2605d8dabd..0000000000 --- a/frontend/apps/artcraft-website/src/components/download-button/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./download-button"; diff --git a/frontend/apps/artcraft-website/src/components/download-modal.tsx b/frontend/apps/artcraft-website/src/components/download-modal.tsx deleted file mode 100644 index 2266b2d81f..0000000000 --- a/frontend/apps/artcraft-website/src/components/download-modal.tsx +++ /dev/null @@ -1,161 +0,0 @@ -import { ArrowLeftIcon, ArrowRightIcon, MailIcon, XIcon } from "lucide-react"; -import { useEffect, useState } from "react"; -import { createPortal } from "react-dom"; -import { Button } from "@storyteller/ui-button"; -import { useNavigate } from "react-router-dom"; -import { SignupForm } from "./auth"; -import { USE_WEBAPP_FOR_APP_FEATURES, webappUrl } from "../config/links"; - -interface DownloadModalProps { - isOpen: boolean; - onClose: () => void; -} - -export const DownloadModal = ({ isOpen, onClose }: DownloadModalProps) => { - const navigate = useNavigate(); - const [isMounted, setIsMounted] = useState(false); - const [isVisible, setIsVisible] = useState(false); - const [view, setView] = useState<"menu" | "signup">("menu"); - - useEffect(() => { - setIsMounted(true); - }, []); - - useEffect(() => { - if (isOpen) { - setIsVisible(true); - document.body.style.overflow = "hidden"; - return; - } else { - const timer = setTimeout(() => { - setIsVisible(false); - // Reset state after animation - setView("menu"); - }, 300); - document.body.style.overflow = "unset"; - return () => clearTimeout(timer); - } - }, [isOpen]); - - if (!isMounted) return null; - - if (!isVisible && !isOpen) return null; - - return createPortal( -
- {/* Backdrop */} -
- - {/* Modal Content */} -
- - - {!USE_WEBAPP_FOR_APP_FEATURES && view === "signup" && ( - - )} - -
-
- - - -
-

- Downloading ArtCraft... -

-

- Your download has started. -
- While you wait, create an account to store your creations. -

-
- - {USE_WEBAPP_FOR_APP_FEATURES ? ( -
- -
- ) : view === "menu" ? ( -
- -
- ) : ( - { - onClose(); - navigate("/welcome"); - }} - signupSource="artcraft" - autoFocus={true} - /> - )} - -
- {USE_WEBAPP_FOR_APP_FEATURES ? ( - - I already have an account - - ) : ( - - )} -
-
-
, - document.body, - ); -}; diff --git a/frontend/apps/artcraft-website/src/components/footer/footer.tsx b/frontend/apps/artcraft-website/src/components/footer/footer.tsx deleted file mode 100644 index 4f71f6f278..0000000000 --- a/frontend/apps/artcraft-website/src/components/footer/footer.tsx +++ /dev/null @@ -1,185 +0,0 @@ -import { DiscordIcon, GithubAltIcon, InstagramIcon, LinkedinInIcon, RedditAlienIcon, TiktokIcon, YoutubeIcon } from "@storyteller/icons"; -import { - SOCIAL_LINKS, - USE_WEBAPP_FOR_APP_FEATURES, -} from "../../config/links"; -import { getFaqItems, getTutorialItems } from "@storyteller/markdown-content"; -import { Link } from "react-router-dom"; - -// Imports removed. - -const navigation = { - main: [ - { name: "Home", href: "/" }, - { name: "Tutorials", href: "/tutorials" }, - { name: "FAQ", href: "/faq" }, - { name: "Download", href: "/download" }, - ], - social: [ - { - name: "Discord", - href: SOCIAL_LINKS.DISCORD, - icon: (props: any) => , - }, - { - name: "YouTube", - href: SOCIAL_LINKS.YOUTUBE, - icon: (props: any) => , - }, - { - name: "TikTok", - href: SOCIAL_LINKS.TIKTOK, - icon: (props: any) => , - }, - { - name: "GitHub", - href: SOCIAL_LINKS.GITHUB, - icon: (props: any) => , - }, - { - name: "Instagram", - href: SOCIAL_LINKS.INSTAGRAM, - icon: (props: any) => , - }, - { - name: "LinkedIn", - href: SOCIAL_LINKS.LINKEDIN, - icon: (props: any) => , - }, - { - name: "Reddit", - href: SOCIAL_LINKS.REDDIT, - icon: (props: any) => , - }, - ], -}; - -export default function Example() { - return ( -
-
- {/* */} - {/* */} -
-
- {navigation.social.map((item) => ( - - {item.name} - - ))} -
-
-
-
Pages
- - Home - - {!USE_WEBAPP_FOR_APP_FEATURES && ( - <> - - Image - - - Video - - - )} - - Download - - - Pricing - - - News - - - Press Kit - - - Support - -
-
-
Tutorials
- - All Tutorials - - {getTutorialItems().map((item) => { - if (!item.isPublished) return null; - return ( - - {item.title} - - ); - })} -
-
-
FAQ
- - All FAQs - - {getFaqItems().map((item) => { - if (!item.isPublished) return null; - const truncated = - item.title.length > 36 - ? item.title.slice(0, 33) + "…" - : item.title; - return ( - - {truncated} - - ); - })} -
-
-

- © 2026 ArtCraft. All rights reserved. -

-
-
-
- ); -} diff --git a/frontend/apps/artcraft-website/src/components/footer/index.ts b/frontend/apps/artcraft-website/src/components/footer/index.ts deleted file mode 100644 index 7614ec3686..0000000000 --- a/frontend/apps/artcraft-website/src/components/footer/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { default } from "./footer"; diff --git a/frontend/apps/artcraft-website/src/components/generation-gallery/CreateMediaPageShell.tsx b/frontend/apps/artcraft-website/src/components/generation-gallery/CreateMediaPageShell.tsx deleted file mode 100644 index 10b7bfbe9d..0000000000 --- a/frontend/apps/artcraft-website/src/components/generation-gallery/CreateMediaPageShell.tsx +++ /dev/null @@ -1,187 +0,0 @@ -import { type ReactNode } from "react"; -import { Link } from "react-router-dom"; -import { LoaderCircleIcon } from "lucide-react"; -import type { LucideIcon } from "lucide-react"; -import { DynamicIcon } from "@storyteller/icons"; -import { Button } from "@storyteller/ui-button"; -import { type PopoverItem } from "@storyteller/ui-popover"; -import Seo from "../../components/seo"; -import Footer from "../../components/footer"; -import { TruchetPattern } from "../truchet-pattern"; - -interface CreateMediaPageShellProps { - // SEO - title: string; - description: string; - // Auth state - authChecked: boolean; - isLoggedIn: boolean; - // Unauthenticated state - heroIcon: LucideIcon; - heroTitle: string; - heroSubtitle: string; - // Content - hasContent: boolean; - emptyStateTitle: string; - emptyStateSubtitle: string; - bottomOffset: number; - // Model selector - modelItems: PopoverItem[]; - onModelChange: (item: PopoverItem) => void; - // Glow orb overrides (optional - defaults provided) - glowOrbs?: ReactNode; - // Children slots - gridContent: ReactNode; - promptBox: ReactNode; - modals: ReactNode; -} - -export function CreateMediaPageShell({ - title, - description, - authChecked, - isLoggedIn, - heroIcon, - heroTitle, - heroSubtitle, - hasContent, - emptyStateTitle, - emptyStateSubtitle, - bottomOffset, - glowOrbs, - gridContent, - promptBox, - modals, -}: CreateMediaPageShellProps) { - if (!authChecked) { - return ( -
- -
- ); - } - - if (!isLoggedIn) { - return ( -
- -
- -
-
-
-
-
- -

{heroTitle}

-

- {heroSubtitle} -

-
- - - - - - -
-
-
-
- ); - } - - return ( -
- - - {/* Glow orbs — only show on empty state, hide when gallery has content */} - {!hasContent && - (glowOrbs ?? ( -
-
-
-
-
- ))} - - {/* Subtle truchet pattern — only on empty state */} - {!hasContent && ( -
- -
- )} - -
-
- {!hasContent && ( -
-
-

- {emptyStateTitle} -

- - {emptyStateSubtitle} - -
-
- )} - - {hasContent && ( -
-
{gridContent}
-
- )} - - {promptBox} -
-
- - {modals} -
- ); -} diff --git a/frontend/apps/artcraft-website/src/components/generation-gallery/FailedCard.tsx b/frontend/apps/artcraft-website/src/components/generation-gallery/FailedCard.tsx deleted file mode 100644 index 20a716570d..0000000000 --- a/frontend/apps/artcraft-website/src/components/generation-gallery/FailedCard.tsx +++ /dev/null @@ -1,62 +0,0 @@ -import { memo } from "react"; -import { CircleAlertIcon, XIcon } from "lucide-react"; -import { getCreatorIconPathForModelId } from "@storyteller/model-list"; - -export interface FailedCardProps { - id: string; - failureReason?: string; - failureMessage?: string; - prompt: string; - modelId: string; - modelLabel: string; - onDismiss: (id: string) => void; -} - -export const FailedCard = memo(function FailedCard({ - id, - failureReason, - failureMessage, - prompt, - modelId, - modelLabel, - onDismiss, -}: FailedCardProps) { - const iconPath = modelId ? getCreatorIconPathForModelId(modelId) : null; - return ( -
-
- - - {failureReason || "Generation failed"} - - {failureMessage && failureMessage !== failureReason && ( - - {failureMessage} - - )} - -
-
-

{prompt}

-
- {iconPath && ( - - )} -

{modelLabel}

-
-
-
- ); -}); diff --git a/frontend/apps/artcraft-website/src/components/generation-gallery/GalleryCard.tsx b/frontend/apps/artcraft-website/src/components/generation-gallery/GalleryCard.tsx deleted file mode 100644 index 24cdce3dd6..0000000000 --- a/frontend/apps/artcraft-website/src/components/generation-gallery/GalleryCard.tsx +++ /dev/null @@ -1,436 +0,0 @@ -import { memo, useCallback, useEffect, useRef, useState } from "react"; -import { useNavigate } from "react-router-dom"; -import { ArrowDownToLineIcon, BoxIcon, CheckIcon, ImageIcon, LinkIcon, LoaderCircleIcon, RotateCwIcon, VideoIcon } from "lucide-react"; -import { DynamicIcon } from "@storyteller/icons"; -import { PLACEHOLDER_IMAGES } from "@storyteller/common"; -import { Tooltip } from "@storyteller/ui-tooltip"; -import { toast } from "../toast/toast"; -import { downloadMediaFile } from "../../lib/download-media"; -import { - getCreatorIconPathForModelId, - getModelDisplayName, -} from "@storyteller/model-list"; -import { - applyMakeVideoFromImage, - applyRecreateFromMediaToken, - type RecreateMediaClass, -} from "../../lib/recreate"; -import { SHARE_URL_BASE } from "../lightbox/shared"; -import type { GalleryItem } from "./useGalleryData"; - -// ── Persistent aspect ratio cache ───────────────────────────────────────── - -const STORAGE_KEY = "gallery-aspect-ratios"; - -// Cap ratio so tall portraits don't dominate — 1.4 ≈ 5:7 -const MAX_RATIO = 1.4; - -function loadCache(): Map { - const map = new Map(); - try { - const raw = sessionStorage.getItem(STORAGE_KEY); - if (raw) { - const parsed = JSON.parse(raw) as Record; - for (const [k, v] of Object.entries(parsed)) { - map.set(k, v); - } - } - } catch { - // ignore - } - return map; -} - -let persistTimer: ReturnType | null = null; - -function persistCache(cache: Map) { - if (persistTimer) clearTimeout(persistTimer); - persistTimer = setTimeout(() => { - try { - const entries = [...cache.entries()]; - const trimmed = entries.slice(-500); - sessionStorage.setItem( - STORAGE_KEY, - JSON.stringify(Object.fromEntries(trimmed)), - ); - } catch { - // ignore - } - }, 1000); -} - -export const aspectRatioCache = loadCache(); - -// ── Shared visibility listener for video thumbnail retries ──────────────── - -const visibilityCallbacks = new Set<() => void>(); - -function onTabVisible(cb: () => void) { - visibilityCallbacks.add(cb); - if (visibilityCallbacks.size === 1) { - document.addEventListener("visibilitychange", fireVisibilityCallbacks); - } - return () => { - visibilityCallbacks.delete(cb); - if (visibilityCallbacks.size === 0) { - document.removeEventListener( - "visibilitychange", - fireVisibilityCallbacks, - ); - } - }; -} - -function fireVisibilityCallbacks() { - if (document.hidden) return; - visibilityCallbacks.forEach((cb) => cb()); -} - -// ── Video thumbnail retry constants ─────────────────────────────────────── - -const MAX_RETRIES = 20; -const RETRY_INTERVAL = 5000; - -// ── Component ────────────────────────────────────────────────────────────── - -interface GalleryCardProps { - item: GalleryItem; - onClick: (item: GalleryItem) => void; - // "auto" = dynamic aspect ratio from the loaded image (masonry layouts). - // "square" = fixed 1:1; skips the ratio measurement path (uniform grids). - shape?: "auto" | "square"; - // When true, image cards show a "Make Video" quick action that seeds the - // create-video page with the image as a reference. Enabled on the create - // image page only. - enableMakeVideo?: boolean; -} - -export const GalleryCard = memo(function GalleryCard({ - item, - onClick, - shape = "auto", - enableMakeVideo = false, -}: GalleryCardProps) { - const isSquare = shape === "square"; - const navigate = useNavigate(); - const cached = aspectRatioCache.get(item.id); - const [ratio, setRatio] = useState(cached); - const [shareCopied, setShareCopied] = useState(false); - const [isRecreating, setIsRecreating] = useState(false); - const [isDownloading, setIsDownloading] = useState(false); - const isVideo = item.mediaClass === "video"; - const is3D = - item.mediaClass === "dimensional" || - item.mediaClass === "mesh" || - item.mediaClass === "splat"; - const recreateMediaClass: RecreateMediaClass | null = isVideo - ? "video" - : is3D - ? null - : "image"; - - // Video thumbnail retry — "retrying" flips to true only after the first - // error, so videos with ready thumbnails render the normal path - // with zero overhead. While retrying, a hidden loads via ref - // (no re-renders) and the spinner stays stable until success. - const [retrying, setRetrying] = useState(false); - const retryImgRef = useRef(null); - const retryTimerRef = useRef>(undefined); - const retryCountRef = useRef(0); - - const kickRetry = useCallback(() => { - if (!retryImgRef.current || !item.thumbnail) return; - retryImgRef.current.src = `${item.thumbnail}?_r=${Date.now()}`; - }, [item.thumbnail]); - - const scheduleRetry = useCallback(() => { - if (retryCountRef.current >= MAX_RETRIES || !item.thumbnail) return; - if (document.hidden) return; - retryTimerRef.current = setTimeout(() => { - retryCountRef.current++; - kickRetry(); - }, RETRY_INTERVAL); - }, [item.thumbnail, kickRetry]); - - // Subscribe to shared visibility listener for retrying video cards - useEffect(() => { - if (!isVideo || !item.thumbnail || !retrying) return; - const unsubscribe = onTabVisible(() => { - retryCountRef.current = 0; - kickRetry(); - }); - return () => { - unsubscribe(); - if (retryTimerRef.current) clearTimeout(retryTimerRef.current); - }; - }, [isVideo, item.thumbnail, retrying, kickRetry]); - - // Reset retry state when thumbnail URL changes - useEffect(() => { - if (!isVideo) return; - setRetrying(false); - retryCountRef.current = 0; - if (retryTimerRef.current) clearTimeout(retryTimerRef.current); - }, [isVideo, item.thumbnail]); - - const displayRatio = ratio ? Math.min(ratio, MAX_RATIO) : 1; - - // In square mode the wrapper sets the ratio via `aspect-square`; we only - // compute the dynamic aspectRatio for masonry-style layouts. - const outerStyle: React.CSSProperties | undefined = isSquare - ? undefined - : { aspectRatio: `1 / ${displayRatio}` }; - - const modelDisplayName = item.modelId - ? getModelDisplayName(item.modelId) - : null; - const modelIconPath = item.modelId - ? getCreatorIconPathForModelId(item.modelId) - : null; - - const mediaIcon = item.mediaClass === "video" ? VideoIcon : is3D ? BoxIcon : ImageIcon; - const mediaLabel = item.mediaClass === "video" ? "Video" : is3D ? "3D" : "Image"; - - const handleLoad = useCallback( - (e: React.SyntheticEvent) => { - if (isVideo && retrying) { - setRetrying(false); - retryCountRef.current = 0; - if (retryTimerRef.current) clearTimeout(retryTimerRef.current); - } - if (cached != null) return; - const img = e.currentTarget; - if (img.naturalWidth > 0 && img.naturalHeight > 0) { - const r = img.naturalHeight / img.naturalWidth; - aspectRatioCache.set(item.id, r); - persistCache(aspectRatioCache); - setRatio(r); - } - }, - [isVideo, retrying, cached, item.id], - ); - - const handleError = useCallback( - (e: React.SyntheticEvent) => { - if (isVideo) { - setRetrying(true); - scheduleRetry(); - } else { - const target = e.currentTarget; - if (target.dataset.fallback) return; - target.dataset.fallback = "1"; - target.src = PLACEHOLDER_IMAGES.DEFAULT; - target.style.opacity = "0.3"; - } - }, - [isVideo, scheduleRetry], - ); - - const handleRecreate = useCallback( - async (e: React.MouseEvent) => { - e.stopPropagation(); - if (!recreateMediaClass || isRecreating) return; - setIsRecreating(true); - try { - await applyRecreateFromMediaToken(item.id, recreateMediaClass, navigate); - } finally { - setIsRecreating(false); - } - }, - [item.id, recreateMediaClass, navigate, isRecreating], - ); - - const canMakeVideo = enableMakeVideo && !isVideo && !is3D; - const handleMakeVideo = useCallback( - (e: React.MouseEvent) => { - e.stopPropagation(); - const url = item.fullImage || item.thumbnail; - if (!url) return; - applyMakeVideoFromImage(item.id, url, navigate); - }, - [item.id, item.fullImage, item.thumbnail, navigate], - ); - - const handleShare = useCallback( - async (e: React.MouseEvent) => { - e.stopPropagation(); - try { - await navigator.clipboard.writeText(`${SHARE_URL_BASE}${item.id}`); - toast.success("Share link copied"); - setShareCopied(true); - setTimeout(() => setShareCopied(false), 1500); - } catch { - toast.error("Unable to copy link"); - } - }, - [item.id], - ); - - const handleCardClick = useCallback(() => { - onClick(item); - }, [item, onClick]); - - const handleCardKeyDown = useCallback( - (e: React.KeyboardEvent) => { - if (e.key === "Enter" || e.key === " ") { - e.preventDefault(); - onClick(item); - } - }, - [item, onClick], - ); - - const handleDownload = useCallback( - async (e: React.MouseEvent) => { - e.stopPropagation(); - if (!item.fullImage || isDownloading) return; - setIsDownloading(true); - try { - await downloadMediaFile({ - url: item.fullImage, - filename: `artcraft-${item.id}`, - mediaClass: item.mediaClass, - }); - } finally { - setIsDownloading(false); - } - }, - [item.fullImage, item.id, item.mediaClass, isDownloading], - ); - - return ( -
- {/* Media layer — kept in its own overflow-hidden box so the hover - overlay below (including tooltips from the action pill) can render - outside the card's corners without being clipped. */} -
- {retrying ? ( - <> -
- - - Loading thumbnail… - -
- {/* Hidden img retries in background via ref — zero re-renders */} - - - ) : item.thumbnail ? ( - {item.label} - ) : ( -
- -
- )} -
- - {/* Hover overlay with media type + model badges and quick actions */} -
-
-
- - {mediaLabel} -
- {modelDisplayName && modelIconPath && ( -
- - {modelDisplayName} -
- )} -
- -
- {recreateMediaClass && ( - - - - )} - {canMakeVideo && ( - - - - )} - - - - {item.fullImage && ( - - - - )} -
-
-
- ); -}); diff --git a/frontend/apps/artcraft-website/src/components/generation-gallery/GenerationGalleryGrid.tsx b/frontend/apps/artcraft-website/src/components/generation-gallery/GenerationGalleryGrid.tsx deleted file mode 100644 index b72a2998b2..0000000000 --- a/frontend/apps/artcraft-website/src/components/generation-gallery/GenerationGalleryGrid.tsx +++ /dev/null @@ -1,181 +0,0 @@ -import { useEffect, useMemo, useRef } from "react"; -import Masonry from "react-masonry-css"; -import { LoadingSpinner } from "@storyteller/ui-loading-spinner"; -import { PendingCard } from "./PendingCard"; -import { FailedCard } from "./FailedCard"; -import { GalleryCard } from "./GalleryCard"; -import type { InProgressJob, FailedJob } from "./useGenerationJobs"; -import type { GalleryItem } from "./useGalleryData"; - -// ── Grid layout constants ───────────────────────────────────────────────── - -const BREAKPOINT_COLS = { - default: 4, - 1280: 4, - 900: 3, - 640: 2, -}; - -// 12px gap on both axes (≈ Tailwind gap-3). -// ml-[-12px] on container offsets the first column's pl-[8px]. -const MASONRY_CLASS = "flex w-auto ml-[-12px]"; -const COLUMN_CLASS = "pl-[8px]"; - -// ── Types ────────────────────────────────────────────────────────────────── - -interface GenerationGalleryGridProps { - inProgressJobs: InProgressJob[]; - failedJobs: FailedJob[]; - onDismissFailed: (jobToken: string) => void; - newlyCompletedItems: GalleryItem[]; - galleryItems: GalleryItem[]; - newlyCompletedTokens: Set; - hasMore: boolean; - isLoading: boolean; - isInitialLoading: boolean; - onLoadMore: () => void; - onGalleryItemClick: (item: GalleryItem) => void; - enableMakeVideo?: boolean; -} - -// ── Component ────────────────────────────────────────────────────────────── - -export function GenerationGalleryGrid({ - inProgressJobs, - failedJobs, - onDismissFailed, - newlyCompletedItems, - galleryItems, - newlyCompletedTokens, - hasMore, - isLoading, - isInitialLoading, - onLoadMore, - onGalleryItemClick, - enableMakeVideo, -}: GenerationGalleryGridProps) { - const sentinelRef = useRef(null); - - // Infinite scroll - useEffect(() => { - const sentinel = sentinelRef.current; - if (!sentinel || !hasMore) return; - const observer = new IntersectionObserver( - ([entry]) => { - if (entry.isIntersecting) onLoadMore(); - }, - { rootMargin: "400px" }, - ); - observer.observe(sentinel); - return () => observer.disconnect(); - }, [hasMore, onLoadMore]); - - const mergedEntries = useMemo(() => { - type Entry = - | { kind: "pending"; key: string; createdAt: number; job: InProgressJob } - | { kind: "failed"; key: string; createdAt: number; job: FailedJob } - | { - kind: "gallery"; - key: string; - createdAt: number; - item: GalleryItem; - }; - - const entries: Entry[] = []; - - for (const job of inProgressJobs) { - entries.push({ - kind: "pending", - key: job.id, - createdAt: new Date(job.createdAt).getTime(), - job, - }); - } - for (const job of failedJobs) { - entries.push({ - kind: "failed", - key: job.id, - createdAt: new Date(job.createdAt).getTime(), - job, - }); - } - for (const item of newlyCompletedItems) { - entries.push({ - kind: "gallery", - key: `new-${item.id}`, - createdAt: new Date(item.createdAt).getTime(), - item, - }); - } - for (const item of galleryItems) { - if (newlyCompletedTokens.has(item.id)) continue; - entries.push({ - kind: "gallery", - key: item.id, - createdAt: new Date(item.createdAt).getTime(), - item, - }); - } - - entries.sort((a, b) => b.createdAt - a.createdAt); - return entries; - }, [inProgressJobs, failedJobs, newlyCompletedItems, galleryItems, newlyCompletedTokens]); - - if (isInitialLoading) { - return ( -
- -
- ); - } - - return ( - <> - - {mergedEntries.map((entry) => ( -
- {entry.kind === "pending" && ( - - )} - {entry.kind === "failed" && ( - - )} - {entry.kind === "gallery" && ( - - )} -
- ))} -
- - {hasMore && ( -
- -
- )} - - ); -} diff --git a/frontend/apps/artcraft-website/src/components/generation-gallery/PendingCard.tsx b/frontend/apps/artcraft-website/src/components/generation-gallery/PendingCard.tsx deleted file mode 100644 index a9e55fe08a..0000000000 --- a/frontend/apps/artcraft-website/src/components/generation-gallery/PendingCard.tsx +++ /dev/null @@ -1,91 +0,0 @@ -import { memo } from "react"; -import { LoaderCircleIcon } from "lucide-react"; -import { getCreatorIconPathForModelId } from "@storyteller/model-list"; - -export interface PendingCardProps { - id: string; - modelId: string; - modelLabel: string; - prompt: string; - progress?: number; - estimatedTimeLeftMs?: number; - batchCount?: number; -} - -const formatTimeLeft = (ms: number): string => { - const totalSeconds = Math.ceil(ms / 1000); - const hours = Math.floor(totalSeconds / 3600); - const minutes = Math.floor((totalSeconds % 3600) / 60); - const seconds = totalSeconds % 60; - if (hours > 0 && minutes > 0) return `~${hours}h ${minutes}m`; - if (hours > 0) return `~${hours}h`; - if (minutes > 0) return `~${minutes}m`; - return `~${seconds}s`; -}; - -export const PendingCard = memo(function PendingCard({ - modelId, - modelLabel, - prompt, - progress, - estimatedTimeLeftMs, - batchCount, -}: PendingCardProps) { - const progressPercent = - progress != null ? Math.max(0, Math.min(100, Math.round(progress))) : null; - const isAlmostDone = progress != null && progress >= 95; - const timeLabel = isAlmostDone - ? "Almost done..." - : estimatedTimeLeftMs != null && estimatedTimeLeftMs > 0 - ? formatTimeLeft(estimatedTimeLeftMs) - : null; - - const iconPath = getCreatorIconPathForModelId(modelId); - - return ( -
-
- {batchCount != null && batchCount > 1 && ( -
- Generating {batchCount} videos · Results may appear one at a time -
- )} -
- - {progressPercent != null && ( - - {progressPercent}% - - )} - {timeLabel && ( - {timeLabel} - )} -
-
-

- {prompt} -

-
- -

- {modelLabel} -

-
- {progressPercent != null && ( -
-
-
- )} -
-
- ); -}); diff --git a/frontend/apps/artcraft-website/src/components/generation-gallery/index.ts b/frontend/apps/artcraft-website/src/components/generation-gallery/index.ts deleted file mode 100644 index 296decb2ef..0000000000 --- a/frontend/apps/artcraft-website/src/components/generation-gallery/index.ts +++ /dev/null @@ -1,14 +0,0 @@ -export { GenerationGalleryGrid } from "./GenerationGalleryGrid"; -export { GalleryCard } from "./GalleryCard"; -export { PendingCard, type PendingCardProps } from "./PendingCard"; -export { FailedCard, type FailedCardProps } from "./FailedCard"; -export { useGalleryData, type GalleryItem } from "./useGalleryData"; -export { - useGenerationJobs, - type InProgressJob, - type FailedJob, -} from "./useGenerationJobs"; -export { useAuthCheck } from "./useAuthCheck"; -export { usePromptHeight } from "./usePromptHeight"; -export { useLightboxNav } from "./useLightboxNav"; -export { CreateMediaPageShell } from "./CreateMediaPageShell"; diff --git a/frontend/apps/artcraft-website/src/components/generation-gallery/useAuthCheck.ts b/frontend/apps/artcraft-website/src/components/generation-gallery/useAuthCheck.ts deleted file mode 100644 index c3d8f6188c..0000000000 --- a/frontend/apps/artcraft-website/src/components/generation-gallery/useAuthCheck.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { useSession } from "../../lib/session"; - -export function useAuthCheck() { - const { user, authChecked } = useSession(); - return { user, authChecked }; -} diff --git a/frontend/apps/artcraft-website/src/components/generation-gallery/useGalleryData.ts b/frontend/apps/artcraft-website/src/components/generation-gallery/useGalleryData.ts deleted file mode 100644 index f0031a22e2..0000000000 --- a/frontend/apps/artcraft-website/src/components/generation-gallery/useGalleryData.ts +++ /dev/null @@ -1,168 +0,0 @@ -import { useCallback, useEffect, useMemo, useRef, useState } from "react"; -import { - GalleryModalApi, - FilterMediaClasses, - FilterMediaType, -} from "@storyteller/api"; -import { getMediaThumbnail, THUMBNAIL_SIZES } from "@storyteller/common"; - -// ── Types ────────────────────────────────────────────────────────────────── - -export interface GalleryItem { - id: string; - label: string; - thumbnail: string | null; - fullImage: string | null; - createdAt: string; - mediaClass: string; - modelId?: string; - batchImageToken?: string; -} - -const PAGE_SIZE = 40; - -const getLabel = (item: any) => { - if (item.maybe_title) return item.maybe_title; - switch (item.media_class) { - case "image": - return "Image Generation"; - case "video": - return "Video Generation"; - case "dimensional": - case "mesh": - return "3D Mesh"; - case "splat": - return "3D World"; - default: - return "Generation"; - } -}; - -// ── Hook ─────────────────────────────────────────────────────────────────── - -export function useGalleryData(options: { - username: string | null; - filterMediaClasses: FilterMediaClasses[]; - excludeUploads?: boolean; -}) { - const { username, filterMediaClasses, excludeUploads } = options; - - const [items, setItems] = useState([]); - const [isLoading, setIsLoading] = useState(false); - const [isInitialLoading, setIsInitialLoading] = useState(true); - const [pageIndex, setPageIndex] = useState(0); - const [hasMore, setHasMore] = useState(true); - const isLoadingRef = useRef(false); - - const api = useMemo(() => new GalleryModalApi(), []); - - const mapApiItem = useCallback((item: any): GalleryItem => { - // 3D classes: mesh/splat, plus the legacy pre-split "dimensional". - const is3D = - item.media_class === "dimensional" || - item.media_class === "mesh" || - item.media_class === "splat"; - const thumbnail = is3D - ? null - : getMediaThumbnail(item.media_links, item.media_class, { - size: THUMBNAIL_SIZES.LARGE, - }); - - return { - id: item.token, - label: getLabel(item), - thumbnail, - fullImage: item.media_links?.cdn_url || null, - createdAt: item.created_at, - mediaClass: item.media_class || "image", - modelId: item.maybe_model_type || undefined, - batchImageToken: item.maybe_batch_token, - }; - }, []); - - const loadItems = useCallback( - async (reset = false) => { - if (!username) return; - if (isLoadingRef.current) return; - isLoadingRef.current = true; - setIsLoading(true); - - try { - const response = await api.listUserMediaFiles({ - username, - filter_media_classes: filterMediaClasses, - include_user_uploads: !excludeUploads, - page_index: reset ? 0 : pageIndex, - page_size: PAGE_SIZE, - }); - - if (response.success && response.data) { - const newItems = response.data - .filter( - (item: any) => - item.media_type !== FilterMediaType.SCENE_JSON && - !(excludeUploads && item.origin_category === "upload"), - ) - .map(mapApiItem); - - if (reset) { - setItems(newItems); - } else { - setItems((prev) => [...prev, ...newItems]); - } - - const current = response.pagination?.current ?? 0; - const total = response.pagination?.total_page_count ?? 1; - setPageIndex(current + 1); - setHasMore(current + 1 < total); - } - } catch { - // ignore - } - - setIsLoading(false); - setIsInitialLoading(false); - isLoadingRef.current = false; - }, - [username, filterMediaClasses, pageIndex, api, mapApiItem, excludeUploads], - ); - - // Initial load + filter change - useEffect(() => { - if (!username) return; - setItems([]); - setPageIndex(0); - setHasMore(true); - setIsInitialLoading(true); - isLoadingRef.current = false; - loadItems(true); - }, [username, JSON.stringify(filterMediaClasses)]); // eslint-disable-line react-hooks/exhaustive-deps - - const loadMore = useCallback(() => { - if (hasMore && !isLoadingRef.current) { - loadItems(); - } - }, [hasMore, loadItems]); - - const refresh = useCallback(() => { - setItems([]); - setPageIndex(0); - setHasMore(true); - isLoadingRef.current = false; - loadItems(true); - }, [loadItems]); - - const removeItem = useCallback((id: string) => { - setItems((prev) => prev.filter((item) => item.id !== id)); - }, []); - - return { - items, - isLoading, - isInitialLoading, - hasMore, - loadMore, - refresh, - removeItem, - }; -} diff --git a/frontend/apps/artcraft-website/src/components/generation-gallery/useGenerationJobs.ts b/frontend/apps/artcraft-website/src/components/generation-gallery/useGenerationJobs.ts deleted file mode 100644 index ad3cd23f41..0000000000 --- a/frontend/apps/artcraft-website/src/components/generation-gallery/useGenerationJobs.ts +++ /dev/null @@ -1,397 +0,0 @@ -import { useCallback, useEffect, useMemo, useRef, useState } from "react"; -import { JobsApi, JobStatus, MediaFilesApi } from "@storyteller/api"; -import type { Job, Prompts } from "@storyteller/api"; -import { getMediaThumbnail, THUMBNAIL_SIZES } from "@storyteller/common"; -import { - getModelDisplayName, - getProviderDisplayName, - ALL_MODELS_LIST, -} from "@storyteller/model-list"; -import type { GalleryItem } from "./useGalleryData"; -import { getCachedPrompt, usePrompts } from "../../lib/prompts-cache"; - -// ── Types ────────────────────────────────────────────────────────────────── - -export interface InProgressJob { - id: string; - prompt: string; - modelId: string; - modelLabel: string; - progress: number; - estimatedTimeLeftMs?: number; - createdAt: string; - batchCount?: number; -} - -export interface FailedJob { - id: string; - prompt: string; - modelId: string; - modelLabel: string; - failureReason?: string; - failureMessage?: string; - status: string; - createdAt: string; -} - -// ── Constants ────────────────────────────────────────────────────────────── - -const IN_PROGRESS_STATUSES = new Set([JobStatus.PENDING, JobStatus.STARTED]); -const COMPLETED_STATUSES = new Set([JobStatus.COMPLETE_SUCCESS]); -const FAILED_STATUSES = new Set([ - JobStatus.ATTEMPT_FAILED, - JobStatus.COMPLETE_FAILURE, - JobStatus.DEAD, - JobStatus.CANCELLED_BY_USER, - JobStatus.CANCELLED_BY_SYSTEM, -]); - -const FAILURE_REASON_LABEL: Record = { - rule_bans_user_image: "Image violates content policy", - rule_bans_user_image_with_faces: "Images with faces are not allowed", - rule_bans_user_text_prompt: "Text prompt violates content policy", - rule_bans_user_content: "Content violates content policy", - rule_bans_generated_video: "Generated video flagged by content policy", - rule_bans_generated_audio: "Generated audio flagged by content policy", - rule_bans_generated_content: "Generated content flagged by content policy", - generation_failed: "Generation failed", - unknown: "An unknown error occurred", -}; - -// Cache per-task durations -const taskDurationCache = new Map(); - -// ── Helpers ──────────────────────────────────────────────────────────────── - -function getJobMediaType(job: Job): "image" | "video" | "other" { - const cat = job.request.inference_category?.toLowerCase() ?? ""; - if (cat.includes("video")) return "video"; - if (cat.includes("image")) return "image"; - return "other"; -} - -function getModelLabel(job: Job, promptsMap?: Map): string { - const promptToken = job.request.maybe_prompt_token; - const cachedPrompt = promptToken - ? (promptsMap?.get(promptToken) ?? getCachedPrompt(promptToken)) - : undefined; - - const modelType = - cachedPrompt?.maybe_model_type ?? job.request.maybe_model_type ?? ""; - const providerKey = cachedPrompt?.maybe_generation_provider ?? modelType; - - const modelDisplay = modelType ? getModelDisplayName(modelType) : undefined; - const provider = providerKey - ? getProviderDisplayName(providerKey.toLowerCase()) - : undefined; - - if (modelDisplay && provider) return `${modelDisplay} · ${provider}`; - return modelDisplay || provider || "Unknown model"; -} - -function getPrompt(job: Job, promptsMap?: Map): string { - const promptToken = job.request.maybe_prompt_token; - const cached = promptToken - ? (promptsMap?.get(promptToken) ?? getCachedPrompt(promptToken)) - : undefined; - return ( - cached?.maybe_positive_prompt || - job.request.maybe_raw_inference_text || - "" - ); -} - -function getModelId(job: Job, promptsMap?: Map): string { - const promptToken = job.request.maybe_prompt_token; - const cachedPrompt = promptToken - ? (promptsMap?.get(promptToken) ?? getCachedPrompt(promptToken)) - : undefined; - return ( - cachedPrompt?.maybe_model_type ?? job.request.maybe_model_type ?? "" - ); -} - -function jobToInProgress(job: Job, promptsMap: Map): InProgressJob { - const now = Date.now(); - const createdMs = new Date(job.created_at).getTime(); - const modelType = job.request.maybe_model_type; - const isVideo = - job.request.inference_category?.toLowerCase().includes("video") ?? false; - - let duration = taskDurationCache.get(job.job_token); - if (!duration) { - const model = modelType - ? ALL_MODELS_LIST.find( - (m) => m.tauriId === modelType || m.id === modelType, - ) - : undefined; - duration = model?.progressBarTime ?? (isVideo ? 900000 : 30000); - taskDurationCache.set(job.job_token, duration); - } - - const elapsed = now - createdMs; - const progress = Math.min(95, (elapsed / duration) * 100); - const estimatedTimeLeftMs = Math.max(0, duration - elapsed); - - return { - id: job.job_token, - prompt: getPrompt(job, promptsMap), - modelId: getModelId(job, promptsMap), - modelLabel: getModelLabel(job, promptsMap), - progress, - estimatedTimeLeftMs, - createdAt: job.created_at, - }; -} - -function jobToFailed(job: Job, promptsMap: Map): FailedJob { - const failureCategory = - job.status.maybe_failure_category_updated || - job.status.maybe_failure_category; - const rawMessage = - job.status.maybe_failure_message || - job.status.maybe_extra_status_description; - const failureReason = failureCategory - ? FAILURE_REASON_LABEL[failureCategory] || rawMessage || undefined - : rawMessage || undefined; - const failureMessage = - rawMessage && failureCategory !== "unknown" ? rawMessage : undefined; - - return { - id: job.job_token, - prompt: getPrompt(job, promptsMap), - modelId: getModelId(job, promptsMap), - modelLabel: getModelLabel(job, promptsMap), - failureReason, - failureMessage, - status: job.status.status, - createdAt: job.created_at, - }; -} - -function jobToGalleryItem( - job: Job, - promptsMap?: Map, -): GalleryItem | null { - const result = job.maybe_result; - if (!result?.entity_token) return null; - - const mediaType = getJobMediaType(job); - const mediaClass = mediaType === "video" ? "video" : "image"; - const thumbnail = getMediaThumbnail(result.media_links, mediaClass, { - size: THUMBNAIL_SIZES.LARGE, - }); - - return { - id: result.entity_token, - label: getPrompt(job, promptsMap) || "Generation", - thumbnail, - fullImage: result.media_links?.cdn_url || null, - // Sort by job creation time (not completion time) so the completed card - // occupies the same Masonry slot the pending card held — no layout shift. - createdAt: job.created_at, - mediaClass, - modelId: job.request.maybe_model_type ?? undefined, - }; -} - -/** Expand a single GalleryItem into its batch siblings (if any). */ -async function expandBatchItems( - item: GalleryItem, - mediaFilesApi: MediaFilesApi, -): Promise { - try { - const mediaResponse = await mediaFilesApi.GetMediaFileByToken({ - mediaFileToken: item.id, - }); - const batchToken = (mediaResponse.data as any)?.maybe_batch_token; - if (!batchToken) return [item]; - - const batchResponse = await mediaFilesApi.GetMediaFilesByBatchToken({ - batchToken, - }); - if (!batchResponse.success || !batchResponse.data?.length) return [item]; - - return batchResponse.data - .map((file: any): GalleryItem | null => { - const cdnUrl = file.media_links?.cdn_url; - if (!cdnUrl) return null; - const thumbnail = getMediaThumbnail(file.media_links, item.mediaClass, { - size: THUMBNAIL_SIZES.LARGE, - }); - return { - id: file.token, - label: item.label, - thumbnail: thumbnail || cdnUrl, - fullImage: cdnUrl, - createdAt: item.createdAt, - mediaClass: item.mediaClass, - modelId: item.modelId, - batchImageToken: batchToken, - }; - }) - .filter((i): i is GalleryItem => i !== null); - } catch { - return [item]; - } -} - -// ── Hook ─────────────────────────────────────────────────────────────────── - -export function useGenerationJobs(options: { - mediaType: "image" | "video"; - enabled?: boolean; -}) { - const { mediaType, enabled = true } = options; - const apiRef = useRef(new JobsApi()); - const mediaApiRef = useRef(new MediaFilesApi()); - - const [inProgressJobs, setInProgressJobs] = useState([]); - const [failedJobsRaw, setFailedJobsRaw] = useState([]); - const [newlyCompleted, setNewlyCompleted] = useState([]); - - const prevCompletedIdsRef = useRef>(new Set()); - const initialLoadDoneRef = useRef(false); - - const promptTokens = useMemo(() => { - const tokens: string[] = []; - for (const j of inProgressJobs) { - if (j.request.maybe_prompt_token) tokens.push(j.request.maybe_prompt_token); - } - for (const j of failedJobsRaw) { - if (j.request.maybe_prompt_token) tokens.push(j.request.maybe_prompt_token); - } - return tokens; - }, [inProgressJobs, failedJobsRaw]); - const promptsMap = usePrompts(promptTokens); - - const inProgress = useMemo( - () => - inProgressJobs - .slice() - .sort( - (a, b) => - new Date(b.created_at).getTime() - - new Date(a.created_at).getTime(), - ) - .map((j) => jobToInProgress(j, promptsMap)), - [inProgressJobs, promptsMap], - ); - - const failed = useMemo( - () => - failedJobsRaw - .slice() - .sort( - (a, b) => - new Date(b.updated_at).getTime() - - new Date(a.updated_at).getTime(), - ) - .map((j) => jobToFailed(j, promptsMap)), - [failedJobsRaw, promptsMap], - ); - - const load = useCallback(async () => { - try { - const response = await apiRef.current.ListRecentJobs(); - if (!response.success || !response.data) return; - - const jobs: Job[] = response.data; - - // Filter by media type - const filtered = jobs.filter((j) => getJobMediaType(j) === mediaType); - - const newInProgress = filtered.filter((j) => - IN_PROGRESS_STATUSES.has(j.status.status), - ); - const newFailed = filtered.filter((j) => - FAILED_STATUSES.has(j.status.status), - ); - - // Completed - const completedJobs = filtered.filter((j) => - COMPLETED_STATUSES.has(j.status.status), - ); - const completedIdSet = new Set(completedJobs.map((j) => j.job_token)); - - // Detect newly completed (skip on first load to avoid flooding) - let expandedNewItems: GalleryItem[] = []; - if (initialLoadDoneRef.current) { - const newOnes = completedJobs.filter( - (j) => !prevCompletedIdsRef.current.has(j.job_token), - ); - if (newOnes.length > 0) { - const items = newOnes - .map((j) => jobToGalleryItem(j)) - .filter((item): item is GalleryItem => item !== null); - if (items.length > 0) { - // Await expansion so the pending card and its completed replacement - // commit in the same React render — no "remove then add" gap. - const expanded = await Promise.all( - items.map((item) => expandBatchItems(item, mediaApiRef.current)), - ); - expandedNewItems = expanded.flat(); - } - } - } - initialLoadDoneRef.current = true; - prevCompletedIdsRef.current = completedIdSet; - - // Prune duration cache - const activeIds = new Set(newInProgress.map((j) => j.job_token)); - for (const id of taskDurationCache.keys()) { - if (!activeIds.has(id)) taskDurationCache.delete(id); - } - - if (expandedNewItems.length > 0) { - setNewlyCompleted((prev) => { - const existingIds = new Set(prev.map((i) => i.id)); - const fresh = expandedNewItems.filter((i) => !existingIds.has(i.id)); - return [...fresh, ...prev]; - }); - } - setInProgressJobs(newInProgress); - setFailedJobsRaw(newFailed); - } catch { - // ignore - } - }, [mediaType]); - - // Poll every 5 seconds + listen for task-queue-update events. - // Skip entirely when disabled (e.g. user is logged out) — otherwise we'd - // hit an authenticated endpoint every 5s for nothing, which on mobile - // Safari shows up as periodic main-thread jank during the menu animation. - useEffect(() => { - if (!enabled) return; - load(); - const intervalId = setInterval(load, 5000); - - const handleTaskUpdate = () => load(); - window.addEventListener("task-queue-update", handleTaskUpdate); - - return () => { - clearInterval(intervalId); - window.removeEventListener("task-queue-update", handleTaskUpdate); - }; - }, [load, enabled]); - - const dismissFailed = useCallback( - async (jobToken: string) => { - try { - await apiRef.current.DeleteJobByToken(jobToken); - setFailedJobsRaw((prev) => prev.filter((f) => f.job_token !== jobToken)); - } catch { - // ignore - } - }, - [], - ); - - return { - inProgress, - failed, - newlyCompleted, - dismissFailed, - refresh: load, - }; -} diff --git a/frontend/apps/artcraft-website/src/components/generation-gallery/useLightboxNav.ts b/frontend/apps/artcraft-website/src/components/generation-gallery/useLightboxNav.ts deleted file mode 100644 index b5e145e619..0000000000 --- a/frontend/apps/artcraft-website/src/components/generation-gallery/useLightboxNav.ts +++ /dev/null @@ -1,40 +0,0 @@ -import { useCallback, useMemo, useState } from "react"; -import type { GalleryItem } from "./useGalleryData"; - -export function useLightboxNav(flatItems: GalleryItem[]) { - const [lightboxOpen, setLightboxOpen] = useState(false); - const [lightboxItem, setLightboxItem] = useState(null); - - const handleGalleryItemClick = useCallback((item: GalleryItem) => { - setLightboxItem(item); - setLightboxOpen(true); - }, []); - - const closeLightbox = useCallback(() => { - setLightboxOpen(false); - setLightboxItem(null); - }, []); - - const currentIndex = lightboxItem - ? flatItems.findIndex((i) => i.id === lightboxItem.id) - : -1; - - const navigatePrev = - currentIndex > 0 - ? () => setLightboxItem(flatItems[currentIndex - 1]) - : undefined; - - const navigateNext = - currentIndex >= 0 && currentIndex < flatItems.length - 1 - ? () => setLightboxItem(flatItems[currentIndex + 1]) - : undefined; - - return { - lightboxOpen, - lightboxItem, - handleGalleryItemClick, - closeLightbox, - navigatePrev, - navigateNext, - }; -} diff --git a/frontend/apps/artcraft-website/src/components/generation-gallery/usePromptHeight.ts b/frontend/apps/artcraft-website/src/components/generation-gallery/usePromptHeight.ts deleted file mode 100644 index 27d5fca323..0000000000 --- a/frontend/apps/artcraft-website/src/components/generation-gallery/usePromptHeight.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { useEffect, useRef, useState } from "react"; - -export function usePromptHeight() { - const promptBoxRef = useRef(null); - const [promptHeight, setPromptHeight] = useState(138); - - useEffect(() => { - const el = promptBoxRef.current; - if (!el || typeof ResizeObserver === "undefined") return; - const update = () => setPromptHeight(el.offsetHeight); - update(); - const ro = new ResizeObserver(() => update()); - ro.observe(el); - return () => ro.disconnect(); - }, []); - - return { promptBoxRef, promptHeight }; -} diff --git a/frontend/apps/artcraft-website/src/components/index.ts b/frontend/apps/artcraft-website/src/components/index.ts deleted file mode 100644 index c152451d62..0000000000 --- a/frontend/apps/artcraft-website/src/components/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from "./navbar"; -export * from "./footer"; -export * from "./download-button"; diff --git a/frontend/apps/artcraft-website/src/components/knight-cinema.tsx b/frontend/apps/artcraft-website/src/components/knight-cinema.tsx deleted file mode 100644 index c85b6c4be5..0000000000 --- a/frontend/apps/artcraft-website/src/components/knight-cinema.tsx +++ /dev/null @@ -1,242 +0,0 @@ -import { forwardRef, useImperativeHandle, useRef } from "react"; -import gsap from "gsap"; - -export interface KnightCinemaHandle { - cinemaEl: HTMLDivElement | null; - videoEl: HTMLVideoElement | null; - topBarEl: HTMLDivElement | null; - bottomBarEl: HTMLDivElement | null; - progressBarEl: HTMLDivElement | null; - timecodeEl: HTMLSpanElement | null; -} - -interface KnightCinemaProps { - src: string; - topLabel?: string; - bottomLabel?: string; -} - -/** - * Letterbox cinema for the manifesto section: full-bleed scroll-scrubbed - * video framed by black bars carrying meta (brand label, scene label, live - * timecode + progress line). The element refs are exposed via an imperative - * handle so the parent can drive entrance/exit/scrub animations on its own - * GSAP timeline (see `setupKnightCinemaTimeline` below). - */ -export const KnightCinema = forwardRef( - ({ src, topLabel = "SEEDANCE 2.0", bottomLabel = "Knight Sneaking IN THE CASTLE" }, ref) => { - const cinemaRef = useRef(null); - const videoRef = useRef(null); - const topBarRef = useRef(null); - const bottomBarRef = useRef(null); - const progressBarRef = useRef(null); - const timecodeRef = useRef(null); - - useImperativeHandle(ref, () => ({ - get cinemaEl() { - return cinemaRef.current; - }, - get videoEl() { - return videoRef.current; - }, - get topBarEl() { - return topBarRef.current; - }, - get bottomBarEl() { - return bottomBarRef.current; - }, - get progressBarEl() { - return progressBarRef.current; - }, - get timecodeEl() { - return timecodeRef.current; - }, - })); - - return ( -
- {/* Full-bleed video, wrapped so we can scale + round-corner it during - the phase 5 exit. overflow-hidden + GPU-promoted transform layer - = smooth resize. */} -
-
- - {/* Top letterbox bar */} -
- - - {topLabel} - -
- - {/* Bottom letterbox bar */} -
- - {bottomLabel} - -
-
-
-
- - 00:00 / 00:00 - -
-
-
- ); - }, -); -KnightCinema.displayName = "KnightCinema"; - -/** - * Appends the cinema's three animation phases to a GSAP timeline: - * 3. Letterbox bars slide in + cinema fades in - * 4. Scroll-scrubbed video (with live timecode + progress line) - * 5. Bars retract + cinema scales down to navbar width with corners - * - * Call this AFTER you've added the manifesto words / hold / text-fade phases - * to your timeline. The phases are appended at the end (`>`). - * - * Note: the parent timeline's ScrollTrigger should set `invalidateOnRefresh: true` - * so the function-based scale in phase 5 re-evaluates on viewport resize. - */ -export const setupKnightCinemaTimeline = ( - tl: gsap.core.Timeline, - knight: KnightCinemaHandle, -) => { - const { - cinemaEl, - videoEl, - topBarEl, - bottomBarEl, - progressBarEl, - timecodeEl, - } = knight; - - // Initial state — bars off-screen, cinema invisible. Set on the *element* - // (not in CSS) so a hot-reload during dev doesn't leave residual transforms. - if (topBarEl) gsap.set(topBarEl, { yPercent: -100 }); - if (bottomBarEl) gsap.set(bottomBarEl, { yPercent: 100 }); - if (cinemaEl) - gsap.set(cinemaEl, { opacity: 0, scale: 1, borderRadius: 0 }); - - // Phase 3 — bars slide in from off-screen edges, framing the cinema. - // Cinema fades in slightly after the bars start moving so the bars - // register as the framing element first. - if (topBarEl && bottomBarEl) { - tl.to( - [topBarEl, bottomBarEl], - { yPercent: 0, duration: 4, ease: "power3.out" }, - ">", - ); - } - if (cinemaEl) { - tl.to( - cinemaEl, - { opacity: 1, duration: 3, ease: "power2.out" }, - "<+=0.5", - ); - } - - // Phase 4 — scroll-scrub the video. GSAP can't tween a video element - // directly, so we tween a proxy `t` from 0→1 and write currentTime each - // frame. Same onUpdate keeps the bottom-bar timecode + progress line in - // sync. Seek calls are throttled to ~30Hz to avoid saturating the decoder - // on larger paint surfaces (1440p+). - if (videoEl) { - const videoProxy = { t: 0 }; - const formatTC = (s: number) => { - const safe = Number.isFinite(s) ? Math.max(0, s) : 0; - const m = Math.floor(safe / 60); - const sec = Math.floor(safe % 60); - return `${String(m).padStart(2, "0")}:${String(sec).padStart(2, "0")}`; - }; - const SEEK_INTERVAL_MS = 15; - let lastSeekAt = 0; - tl.to( - videoProxy, - { - t: 0.999, - duration: 22, - ease: "none", - onUpdate: () => { - const now = performance.now(); - if (now - lastSeekAt < SEEK_INTERVAL_MS) return; - lastSeekAt = now; - if (!videoEl.duration) return; - const time = videoProxy.t * videoEl.duration; - videoEl.currentTime = time; - if (timecodeEl) { - timecodeEl.textContent = `${formatTC(time)} / ${formatTC(videoEl.duration)}`; - } - if (progressBarEl) { - progressBarEl.style.width = `${videoProxy.t * 100}%`; - } - }, - }, - ">", - ); - } - - // Phase 5 — exit. Bars retract off-screen, cinema scales down to navbar - // width (Tailwind max-w-6xl = 1152px) and rounds its corners. The scale - // is computed from window.innerWidth so the final card is the same - // absolute pixel width on every screen — paired with the parent - // ScrollTrigger's `invalidateOnRefresh: true` it stays exact on resize. - if (topBarEl && bottomBarEl) { - tl.to( - topBarEl, - { yPercent: -100, opacity: 0, duration: 2, ease: "power2.in" }, - ">", - ); - tl.to( - bottomBarEl, - { yPercent: 100, opacity: 0, duration: 2, ease: "power2.in" }, - "<", - ); - } - if (cinemaEl) { - const NAVBAR_WIDTH_PX = 1152; - tl.to( - cinemaEl, - { - scale: () => Math.min(1, NAVBAR_WIDTH_PX / window.innerWidth), - // Border radius is overspecified relative to the post-scale visual - // size (40 × scale ≈ pillowy 20-25px corners on typical desktops). - borderRadius: 40, - duration: 6, - ease: "power2.inOut", - }, - "<+=0.3", - ); - } -}; diff --git a/frontend/apps/artcraft-website/src/components/landing-action-buttons.tsx b/frontend/apps/artcraft-website/src/components/landing-action-buttons.tsx deleted file mode 100644 index c29ab36abe..0000000000 --- a/frontend/apps/artcraft-website/src/components/landing-action-buttons.tsx +++ /dev/null @@ -1,68 +0,0 @@ -import { Button } from "@storyteller/ui-button"; -import { isMobile, isMacOs } from "react-device-detect"; -import { RocketIcon } from "lucide-react"; -import { DynamicIcon, AppleIcon, WindowsIcon } from "@storyteller/icons"; -import { - DOWNLOAD_LINKS, - DOWNLOADS_ENABLED, -} from "../config/github_download_links"; - -interface LandingActionButtonsProps { - onDownloadClick?: (e: React.MouseEvent) => void; - className?: string; - creditsButtonText?: string; -} - -export const LandingActionButtons = ({ - onDownloadClick, - className, - creditsButtonText = "Supercharge Credits", -}: LandingActionButtonsProps) => { - const MAC_LINK = DOWNLOAD_LINKS.MACOS; - const WINDOWS_LINK = DOWNLOAD_LINKS.WINDOWS; - const downloadUrl = isMacOs ? MAC_LINK : WINDOWS_LINK; - - return ( -
- {isMobile ? ( - - ) : ( - <> - - {DOWNLOADS_ENABLED && ( -
- - - More download options - -
- )} - - )} -
- ); -}; diff --git a/frontend/apps/artcraft-website/src/components/lightbox/LightboxDetails.tsx b/frontend/apps/artcraft-website/src/components/lightbox/LightboxDetails.tsx deleted file mode 100644 index b0be879de0..0000000000 --- a/frontend/apps/artcraft-website/src/components/lightbox/LightboxDetails.tsx +++ /dev/null @@ -1,444 +0,0 @@ -import { useEffect, useRef, useState } from "react"; -import dayjs from "dayjs"; -import { Button } from "@storyteller/ui-button"; -import { toast } from "../toast/toast"; -import { Gravatar } from "@storyteller/ui-gravatar"; -import type { UserInfo } from "@storyteller/api"; -import { ArrowDownToLineIcon, CheckIcon, CopyIcon, ImageIcon, InfoIcon, LinkIcon, LoaderCircleIcon, PencilIcon, RotateCwIcon, Trash2Icon, UserIcon, VideoIcon, XIcon } from "lucide-react"; -import { DynamicIcon } from "@storyteller/icons"; -import { - getContextImageThumbnail, - THUMBNAIL_SIZES, -} from "@storyteller/common"; -import { - getCreatorIconPathForModelId, - getModelDisplayName, - getProviderDisplayName, - getProviderIconByName, -} from "@storyteller/model-list"; -import { downloadMediaFile } from "../../lib/download-media"; -import { - formatAspectRatio, - formatDuration, - formatResolution, - SHARE_URL_BASE, - type PromptData, - useCopyFeedback, -} from "./shared"; - -// ── InfoRow (private to this file; other consumers do not need it) ───────── - -function InfoRow({ - label, - value, -}: { - label: string; - value: React.ReactNode; -}) { - return ( -
- {label} - - {value} - -
- ); -} - -// ── Component ────────────────────────────────────────────────────────────── - -export interface LightboxDetailsProps { - promptData: PromptData; - mediaToken?: string | null; - mediaUrl?: string | null; - mediaWidth?: number; - mediaHeight?: number; - createdAt?: string | null; - creator?: UserInfo | null; - onClose?: () => void; - onRecreate?: () => void; - onMakeVideo?: () => void; - onDelete?: () => void; - showDownloadAppCta?: boolean; -} - -export function LightboxDetails({ - promptData, - mediaToken, - mediaUrl, - mediaWidth, - mediaHeight, - createdAt, - creator, - onClose, - onRecreate, - onMakeVideo, - onDelete, - showDownloadAppCta, -}: LightboxDetailsProps) { - const promptCopy = useCopyFeedback(); - const shareCopy = useCopyFeedback(); - const [isDownloading, setIsDownloading] = useState(false); - - const [isPromptExpanded, setIsPromptExpanded] = useState(false); - const [isPromptClamped, setIsPromptClamped] = useState(false); - const promptRef = useRef(null); - - useEffect(() => { - setIsPromptExpanded(false); - setIsDownloading(false); - }, [mediaToken]); - - useEffect(() => { - if (!promptRef.current || !promptData.text || promptData.loading) { - setIsPromptClamped(false); - return; - } - const raf = requestAnimationFrame(() => { - if (promptRef.current) { - setIsPromptClamped( - promptRef.current.scrollHeight > promptRef.current.clientHeight, - ); - } - }); - return () => cancelAnimationFrame(raf); - }, [promptData.text, promptData.loading, isPromptExpanded]); - - const handleCopyPrompt = async () => { - if (!promptData.text) return; - try { - await navigator.clipboard.writeText(promptData.text); - toast.success("Prompt copied"); - promptCopy.trigger(); - } catch { - toast.error("Unable to copy prompt"); - } - }; - - const handleCopyShareLink = async () => { - if (!mediaToken) return; - const shareUrl = `${SHARE_URL_BASE}${mediaToken}`; - try { - await navigator.clipboard.writeText(shareUrl); - toast.success("Share link copied"); - shareCopy.trigger(); - } catch { - toast.error("Unable to copy link"); - } - }; - - const hasInfoSection = - !!promptData.provider || - !!promptData.modelType || - !!promptData.aspectRatio || - !!promptData.resolution || - promptData.durationSeconds != null || - promptData.generateAudio != null || - (!!mediaWidth && !!mediaHeight) || - !!createdAt; - - return ( -
- {onClose && ( - - )} - -
- {promptData.loading ? ( -
-
-
-
-
-
-
-
-
-
-
- ) : ( - <> - {creator && ( -
- {creator.core_info ? ( - - ) : ( -
- -
- )} -
- - {creator.display_name} - - - Author - -
-
- )} - - {promptData.hasToken && ( -
-
-
- - Prompt -
- {promptData.text && ( - - )} -
- -
-
- {promptData.text || ( - No prompt - )} -
-
- - {promptData.text && (isPromptClamped || isPromptExpanded) && ( - - )} -
- )} - - {promptData.contextImages && promptData.contextImages.length > 0 && ( -
-
- - Reference Images -
-
- {promptData.contextImages.map((contextImage, index) => { - const { thumbnail } = getContextImageThumbnail( - contextImage, - { size: THUMBNAIL_SIZES.SMALL }, - ); - return ( - - {`Reference - - ); - })} -
-
- )} - - {hasInfoSection && ( -
-
- - Information -
- -
- {promptData.modelType && ( - - Model creator logo - - {getModelDisplayName(promptData.modelType)} - - - } - /> - )} - {promptData.provider && ( - - {getProviderIconByName( - promptData.provider, - "h-4 w-4 invert", - )} - - {getProviderDisplayName(promptData.provider)} - - - } - /> - )} - {promptData.aspectRatio && ( - - )} - {promptData.resolution && ( - - )} - {promptData.durationSeconds != null && ( - - )} - {promptData.generateAudio != null && ( - - )} - {mediaWidth && mediaHeight && ( - - )} - {createdAt && ( - - )} -
-
- )} - - )} -
- -
-
- - -
- {onMakeVideo && ( - - )} - {onRecreate && promptData.hasToken && ( - - )} - {onDelete && mediaToken && ( - - )} - {showDownloadAppCta && ( - - )} -
-
- ); -} - -export default LightboxDetails; diff --git a/frontend/apps/artcraft-website/src/components/lightbox/lightbox.tsx b/frontend/apps/artcraft-website/src/components/lightbox/lightbox.tsx deleted file mode 100644 index 896f15977f..0000000000 --- a/frontend/apps/artcraft-website/src/components/lightbox/lightbox.tsx +++ /dev/null @@ -1,534 +0,0 @@ -import { Modal } from "@storyteller/ui-modal"; -import { LoadingSpinner } from "@storyteller/ui-loading-spinner"; -import { toast } from "../toast/toast"; -import { useEffect, useState, useMemo, useCallback } from "react"; -import { useNavigate } from "react-router-dom"; -import { MediaFilesApi, PromptsApi, type UserInfo } from "@storyteller/api"; -import { ChevronLeftIcon, ChevronRightIcon, Trash2Icon } from "lucide-react"; -import { addCorsParam, PLACEHOLDER_IMAGES } from "@storyteller/common"; -import { ActionReminderModal } from "@storyteller/ui-action-reminder-modal"; -import { Viewer3D } from "@storyteller/ui-viewer-3d"; -import useEmblaCarousel from "embla-carousel-react"; -import type { EmblaOptionsType } from "embla-carousel"; -import { - createPromptData, - EMPTY_PROMPT, - is3DModelUrl, - isVideoUrl, - type PromptData, -} from "./shared"; -import { LightboxDetails } from "./LightboxDetails"; -import { - applyMakeVideoFromImage, - applyRecreateFromMediaToken, -} from "../../lib/recreate"; - -// ── Types ────────────────────────────────────────────────────────────────── - -export interface LightboxItem { - id: string; - label: string; - thumbnail: string | null; - fullImage?: string | null; - createdAt: string; - mediaClass?: string; - batchImageToken?: string; - mediaTokens?: string[]; - imageUrls?: string[]; -} - -// ── Component ────────────────────────────────────────────────────────────── - -interface LightboxProps { - isOpen: boolean; - onClose: () => void; - mediaToken?: string | null; - cdnUrl?: string | null; - imageUrls?: string[]; - mediaTokens?: string[]; - batchImageToken?: string; - mediaClass?: string; - onNavigatePrev?: () => void; - onNavigateNext?: () => void; - onDeleted?: (id: string) => void; - /** When false, suppress batch carousel (batch siblings shown as separate gallery cards instead). Default true. */ - showBatchCarousel?: boolean; -} - -export function Lightbox({ - isOpen, - onClose, - mediaToken, - cdnUrl, - imageUrls: propImageUrls, - mediaTokens: propMediaTokens, - batchImageToken: propBatchImageToken, - mediaClass: propMediaClass, - onNavigatePrev, - onNavigateNext, - onDeleted, - showBatchCarousel = true, -}: LightboxProps) { - const navigate = useNavigate(); - const [mediaLoaded, setMediaLoaded] = useState(false); - const [promptData, setPromptData] = useState(EMPTY_PROMPT); - const [creator, setCreator] = useState(null); - const [createdAt, setCreatedAt] = useState(null); - const [batchImages, setBatchImages] = useState(null); - const [batchTokens, setBatchTokens] = useState(null); - const [mediaWidth, setMediaWidth] = useState(); - const [mediaHeight, setMediaHeight] = useState(); - const [confirmDeleteOpen, setConfirmDeleteOpen] = useState(false); - const [discoveredBatchToken, setDiscoveredBatchToken] = useState< - string | null - >(null); - - const mediaFilesApi = useMemo(() => new MediaFilesApi(), []); - const promptsApi = useMemo(() => new PromptsApi(), []); - - // Reset on open / mediaToken change - useEffect(() => { - if (isOpen) { - setMediaLoaded(false); - setSelectedIndex(0); - setMediaWidth(undefined); - setMediaHeight(undefined); - setDiscoveredBatchToken(null); - } - }, [isOpen, mediaToken]); - - // Fetch prompt + details when mediaToken changes - useEffect(() => { - if (!mediaToken || !isOpen) { - setPromptData(EMPTY_PROMPT); - setCreator(null); - setCreatedAt(null); - return; - } - - setPromptData({ ...EMPTY_PROMPT, loading: true }); - let cancelled = false; - - const timer = setTimeout(async () => { - try { - const mediaResponse = await mediaFilesApi.GetMediaFileByToken({ - mediaFileToken: mediaToken, - }); - if (cancelled) return; - - if (mediaResponse.success && mediaResponse.data) { - const file = mediaResponse.data; - setCreator(file.maybe_creator_user || null); - setCreatedAt(file.created_at || null); - const batchToken = (file as any)?.maybe_batch_token; - if (batchToken) setDiscoveredBatchToken(batchToken); - - if (file.maybe_prompt_token) { - const promptResponse = await promptsApi.GetPromptsByToken({ - token: file.maybe_prompt_token, - }); - if (cancelled) return; - - const d = promptResponse.success ? promptResponse.data : null; - setPromptData(createPromptData(d, true, false)); - } else { - setPromptData(EMPTY_PROMPT); - } - } else { - setPromptData(EMPTY_PROMPT); - setCreator(null); - setCreatedAt(null); - } - } catch { - if (!cancelled) { - setPromptData(EMPTY_PROMPT); - setCreator(null); - setCreatedAt(null); - } - } - }, 180); - - return () => { - cancelled = true; - clearTimeout(timer); - }; - }, [mediaToken, isOpen, mediaFilesApi, promptsApi]); - - // Fetch batch images (from prop or auto-discovered batch token) - const effectiveBatchToken = showBatchCarousel - ? propBatchImageToken || discoveredBatchToken - : undefined; - - useEffect(() => { - if (!effectiveBatchToken || !isOpen) { - setBatchImages(null); - setBatchTokens(null); - return; - } - - setBatchImages(null); - setBatchTokens(null); - let cancelled = false; - - const timer = setTimeout(async () => { - try { - const response = await mediaFilesApi.GetMediaFilesByBatchToken({ - batchToken: effectiveBatchToken, - }); - if (cancelled) return; - - if (response.success && response.data?.length) { - const items = response.data - .map((file: any) => ({ - url: file.media_links?.cdn_url, - token: file.token, - })) - .filter( - (item: any): item is { url: string; token: string } => - Boolean(item.url) && Boolean(item.token), - ); - - if (items.length > 0) { - const sorted = [...items].sort((a, b) => { - if (mediaToken === a.token) return -1; - if (mediaToken === b.token) return 1; - if (cdnUrl === a.url) return -1; - if (cdnUrl === b.url) return 1; - return 0; - }); - setBatchImages(sorted.map((i) => i.url)); - setBatchTokens(sorted.map((i) => i.token)); - } - } - } catch { - // ignore - } - }, 200); - - return () => { - cancelled = true; - clearTimeout(timer); - }; - }, [effectiveBatchToken, mediaToken, cdnUrl, isOpen, mediaFilesApi]); - - // Effective image URLs - const effectiveImageUrls = useMemo(() => { - if (batchImages && batchImages.length > 0) return batchImages; - if (propImageUrls && propImageUrls.length > 0) return propImageUrls; - return cdnUrl ? [cdnUrl] : []; - }, [batchImages, propImageUrls, cdnUrl]); - - // Carousel - const [selectedIndex, setSelectedIndex] = useState(0); - const carouselOptions: EmblaOptionsType = useMemo(() => ({ loop: true }), []); - const [emblaMainRef, emblaMainApi] = useEmblaCarousel(carouselOptions); - const [emblaThumbsRef, emblaThumbsApi] = useEmblaCarousel({ - containScroll: "keepSnaps", - dragFree: true, - }); - - const onThumbClick = useCallback( - (index: number) => { - if (!emblaMainApi || !emblaThumbsApi) return; - emblaMainApi.scrollTo(index); - }, - [emblaMainApi, emblaThumbsApi], - ); - - const onSelect = useCallback(() => { - if (!emblaMainApi || !emblaThumbsApi) return; - const index = emblaMainApi.selectedScrollSnap(); - setSelectedIndex(index); - emblaThumbsApi.scrollTo(index); - }, [emblaMainApi, emblaThumbsApi]); - - useEffect(() => { - if (!emblaMainApi) return; - onSelect(); - emblaMainApi.on("select", onSelect).on("reInit", onSelect); - }, [emblaMainApi, onSelect]); - - useEffect(() => { - setSelectedIndex(0); - emblaMainApi?.scrollTo(0, true); - emblaThumbsApi?.scrollTo(0, true); - }, [propBatchImageToken, cdnUrl, emblaMainApi, emblaThumbsApi]); - - const selectedImageUrl = effectiveImageUrls[selectedIndex] ?? null; - const selectedMediaToken = useMemo(() => { - return ( - batchTokens?.[selectedIndex] ?? - propMediaTokens?.[selectedIndex] ?? - mediaToken - ); - }, [batchTokens, propMediaTokens, selectedIndex, mediaToken]); - - const isVideo = selectedImageUrl - ? isVideoUrl(selectedImageUrl) - : propMediaClass === "video"; - const is3D = selectedImageUrl - ? is3DModelUrl(selectedImageUrl) - : propMediaClass === "dimensional" || - propMediaClass === "mesh" || - propMediaClass === "splat"; - - // Keyboard navigation - useEffect(() => { - if (!isOpen) return; - const handleKeyDown = (e: KeyboardEvent) => { - const tag = (e.target as HTMLElement)?.tagName; - if (tag === "INPUT" || tag === "TEXTAREA" || tag === "SELECT") return; - - if (e.key === "ArrowLeft" && onNavigatePrev) { - e.preventDefault(); - onNavigatePrev(); - } else if (e.key === "ArrowRight" && onNavigateNext) { - e.preventDefault(); - onNavigateNext(); - } - }; - window.addEventListener("keydown", handleKeyDown); - return () => window.removeEventListener("keydown", handleKeyDown); - }, [isOpen, onNavigatePrev, onNavigateNext]); - - // Delete handler - const handleDelete = useCallback(async () => { - if (!selectedMediaToken) return; - try { - await mediaFilesApi.DeleteMediaFileByToken({ - mediaFileToken: selectedMediaToken, - }); - toast.success("Media deleted"); - onDeleted?.(selectedMediaToken); - onClose(); - } catch { - toast.error("Failed to delete media"); - } finally { - setConfirmDeleteOpen(false); - } - }, [selectedMediaToken, mediaFilesApi, onDeleted, onClose]); - - const recreateMediaClass: "image" | "video" | null = isVideo - ? "video" - : is3D - ? null - : "image"; - - const handleRecreate = useCallback(async () => { - if (!selectedMediaToken || !recreateMediaClass) return; - onClose(); - await applyRecreateFromMediaToken( - selectedMediaToken, - recreateMediaClass, - navigate, - ); - }, [selectedMediaToken, recreateMediaClass, navigate, onClose]); - - const canMakeVideo = !isVideo && !is3D; - const handleMakeVideo = useCallback(() => { - if (!selectedMediaToken || !selectedImageUrl || !canMakeVideo) return; - onClose(); - applyMakeVideoFromImage(selectedMediaToken, selectedImageUrl, navigate); - }, [selectedMediaToken, selectedImageUrl, canMakeVideo, navigate, onClose]); - - return ( - <> - -
- {/* Media preview panel */} -
- {!selectedImageUrl ? ( -
- Media not available -
- ) : is3D ? ( - - ) : isVideo ? ( - - ) : ( -
-
-
- {effectiveImageUrls.map((url, idx) => ( -
-
- {`Image { - if (idx === selectedIndex) { - setMediaLoaded(true); - } - const target = e.currentTarget; - if (target.dataset.fallback) return; - target.dataset.fallback = "1"; - target.src = PLACEHOLDER_IMAGES.DEFAULT; - target.style.opacity = "0.3"; - }} - onLoad={(e) => { - if (idx === selectedIndex) { - setMediaLoaded(true); - const img = e.currentTarget; - setMediaWidth(img.naturalWidth); - setMediaHeight(img.naturalHeight); - } - }} - /> -
-
- ))} -
-
- - {effectiveImageUrls.length > 1 && ( -
-
-
- {effectiveImageUrls.map((url, idx) => ( - - ))} -
-
-
- )} -
- )} - - {!mediaLoaded && selectedImageUrl && !isVideo && !is3D && ( -
- -
- )} - - {/* Gallery navigation arrows */} - {onNavigatePrev && ( - - )} - {onNavigateNext && ( - - )} -
- - setConfirmDeleteOpen(true) - : undefined - } - /> -
-
- - setConfirmDeleteOpen(false)} - title="Delete this media?" - message={ - - This will permanently remove the media from your library. This - action cannot be undone. - - } - onPrimaryAction={handleDelete} - primaryActionText="Delete" - secondaryActionText="Cancel" - primaryActionIcon={Trash2Icon} - primaryActionBtnClassName="bg-red-500/10 hover:bg-red-500/20 text-red-500" - /> - - ); -} - -export default Lightbox; diff --git a/frontend/apps/artcraft-website/src/components/lightbox/shared.ts b/frontend/apps/artcraft-website/src/components/lightbox/shared.ts deleted file mode 100644 index 5c8385ca51..0000000000 --- a/frontend/apps/artcraft-website/src/components/lightbox/shared.ts +++ /dev/null @@ -1,98 +0,0 @@ -import { useCallback, useEffect, useRef, useState } from "react"; -import { - formatAspectRatio, - formatDuration, - formatResolution, -} from "@storyteller/common"; - -export { formatAspectRatio, formatDuration, formatResolution }; - -export const SHARE_URL_BASE = "https://getartcraft.com/media/"; -export const COPY_FEEDBACK_DURATION = 1500; - -const VIDEO_EXTENSIONS = [".mp4", ".webm", ".mov", ".avi", ".mkv", ".m4v"]; -const MODEL_3D_EXTENSIONS = [".glb", ".gltf", ".fbx", ".spz"]; - -export const isVideoUrl = (url: string): boolean => - VIDEO_EXTENSIONS.some((ext) => url.toLowerCase().includes(ext)); - -export const is3DModelUrl = (url: string): boolean => - MODEL_3D_EXTENSIONS.some((ext) => url.toLowerCase().includes(ext)); - -export interface ContextImage { - media_links: { cdn_url: string; maybe_thumbnail_template: string | null }; - media_token: string; - semantic: string; -} - -export interface PromptData { - text: string | null; - loading: boolean; - hasToken: boolean; - provider: string | null; - modelType: string | null; - modelClass: string | null; - contextImages: ContextImage[] | null; - aspectRatio: string | null; - resolution: string | null; - durationSeconds: number | null; - generationMode: string | null; - generateAudio: boolean | null; -} - -export const EMPTY_PROMPT: PromptData = { - text: null, - loading: false, - hasToken: false, - provider: null, - modelType: null, - modelClass: null, - contextImages: null, - aspectRatio: null, - resolution: null, - durationSeconds: null, - generationMode: null, - generateAudio: null, -}; - -export const createPromptData = ( - data: any, - hasToken: boolean, - loading = false, -): PromptData => ({ - text: data?.maybe_positive_prompt || null, - loading, - hasToken, - provider: data?.maybe_generation_provider || null, - modelType: data?.maybe_model_type || null, - modelClass: data?.maybe_model_class || null, - contextImages: data?.maybe_context_images || null, - aspectRatio: data?.maybe_aspect_ratio || null, - resolution: data?.maybe_resolution || null, - durationSeconds: data?.maybe_duration_seconds ?? null, - generationMode: data?.maybe_generation_mode || null, - generateAudio: data?.maybe_generate_audio ?? null, -}); - -export function useCopyFeedback() { - const [copied, setCopied] = useState(false); - const timeoutRef = useRef(null); - - const trigger = useCallback(() => { - setCopied(true); - if (timeoutRef.current) window.clearTimeout(timeoutRef.current); - timeoutRef.current = window.setTimeout(() => { - setCopied(false); - timeoutRef.current = null; - }, COPY_FEEDBACK_DURATION); - }, []); - - useEffect( - () => () => { - if (timeoutRef.current) window.clearTimeout(timeoutRef.current); - }, - [], - ); - - return { copied, trigger }; -} diff --git a/frontend/apps/artcraft-website/src/components/manifesto-three-background.tsx b/frontend/apps/artcraft-website/src/components/manifesto-three-background.tsx deleted file mode 100644 index bd3d2db1fc..0000000000 --- a/frontend/apps/artcraft-website/src/components/manifesto-three-background.tsx +++ /dev/null @@ -1,319 +0,0 @@ -import { useEffect, useRef } from "react"; -import * as THREE from "three"; -import { RoomEnvironment } from "three/examples/jsm/environments/RoomEnvironment.js"; -import { GLTFLoader } from "three/examples/jsm/loaders/GLTFLoader.js"; - -interface ManifestoThreeBackgroundProps { - progressRef: React.RefObject; - /** - * When `true`, the render loop skips the expensive `renderer.render` + - * `mixer.update` calls. Used to halt GPU work once the character has walked - * off screen and the canvas is fully covered by other UI — saves significant - * paint cost on high-DPI / large displays. - */ - pausedRef?: React.RefObject; -} - -export const ManifestoThreeBackground = ({ - progressRef, - pausedRef, -}: ManifestoThreeBackgroundProps) => { - const containerRef = useRef(null); - - useEffect(() => { - if (!containerRef.current) return; - const container = containerRef.current; - - // CAPTURE MODE — disabled. Uncomment this block + the matching sections - // below (search "CAPTURE MODE") to record a self-driven walk video via - // `?capture=manifesto`. Used to produce a motion-reference clip for - // Seedance without depending on smooth manual scrolling. - // const captureMode = - // typeof window !== "undefined" && - // new URLSearchParams(window.location.search).get("capture") === - // "manifesto"; - - const scene = new THREE.Scene(); - // if (captureMode) { - // // Solid background so the recorded video is self-contained (no alpha). - // scene.background = new THREE.Color(0x101014); - // } - // Long-lens (telephoto) feel — narrow FOV + camera pulled further back. - // Flattens perspective distortion so the scene reads as a 2D-ish plane - // instead of a wide-angle bowl. - const camera = new THREE.PerspectiveCamera( - 22, - container.clientWidth / container.clientHeight, - 0.1, - 100, - ); - camera.position.z = 20; - - const renderer = new THREE.WebGLRenderer({ antialias: true, alpha: true }); - renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2)); - renderer.setSize(container.clientWidth, container.clientHeight); - renderer.toneMapping = THREE.ACESFilmicToneMapping; - renderer.toneMappingExposure = 0.7; - renderer.outputColorSpace = THREE.SRGBColorSpace; - renderer.shadowMap.enabled = true; - renderer.shadowMap.type = THREE.PCFSoftShadowMap; - container.appendChild(renderer.domElement); - - // Pre-baked environment for PBR reflections — what makes metals/clearcoat - // actually look like materials instead of flat-shaded primitives. - const pmrem = new THREE.PMREMGenerator(renderer); - pmrem.compileEquirectangularShader(); - const envScene = new RoomEnvironment(); - const envTexture = pmrem.fromScene(envScene, 0.04).texture; - scene.environment = envTexture; - - // Cinematic three-point lighting — softer ambient so shadows read deeper, - // strong key (with shadow casting) for grounding, cool blue rim behind - // for silhouette definition against the dark scene. - scene.add(new THREE.HemisphereLight(0x3d6cb0, 0x06060c, 0.12)); - const keyLight = new THREE.DirectionalLight(0xffffff, 0.85); - keyLight.position.set(6, 8, 5); - keyLight.castShadow = true; - keyLight.shadow.mapSize.set(1024, 1024); - keyLight.shadow.camera.near = 1; - keyLight.shadow.camera.far = 40; - keyLight.shadow.camera.left = -8; - keyLight.shadow.camera.right = 8; - keyLight.shadow.camera.top = 6; - keyLight.shadow.camera.bottom = -6; - keyLight.shadow.bias = -0.0008; - keyLight.shadow.radius = 4; - scene.add(keyLight); - const rimLight = new THREE.DirectionalLight(0x6ba6ff, 0.8); - rimLight.position.set(-6, 3, -4); - scene.add(rimLight); - const fillLight = new THREE.PointLight(0x3a78d6, 0.3, 20); - fillLight.position.set(-3, -2, 5); - scene.add(fillLight); - - // Invisible ground plane — only shows the cast shadow. Sits at the - // character's feet so the contact point reads. - const ground = new THREE.Mesh( - new THREE.PlaneGeometry(40, 20), - new THREE.ShadowMaterial({ opacity: 0.25 }), - ); - ground.rotation.x = -Math.PI / 2; - ground.position.y = -2.5; - ground.receiveShadow = true; - scene.add(ground); - - // Character loaded async from FBX. The mixer is driven by scroll progress - // (not a real-time clock) so the animation scrubs with the user's scroll. - let character: THREE.Group | null = null; - let mixer: THREE.AnimationMixer | null = null; - let action: THREE.AnimationAction | null = null; - let clipDuration = 0; - let cancelled = false; - - // Number of walk cycles played across the full section scroll. >1 keeps - // the legs cycling visibly rather than crawling through a single step. - const WALK_CYCLES = 2; - - const characterMaterial = new THREE.MeshPhysicalMaterial({ - color: 0x07142a, - metalness: 0.35, - roughness: 0.55, - clearcoat: 0.4, - clearcoatRoughness: 0.35, - envMapIntensity: 0.45, - }); - - new GLTFLoader().load( - "/3d-models/sneaking-forward.glb", - (gltf) => { - if (cancelled) return; - - const root = gltf.scene; - - // Mixamo defaults: ~100 unit tall, faces -Z. FBX → GLB conversions - // typically apply a 0.01 cm→m scale, so the GLB lands roughly 100× - // smaller than the FBX. Scale up to match the previous on-screen - // size and rotate so the character faces the direction of travel (+X). - root.scale.setScalar(3.5); - root.rotation.y = Math.PI / 2; - - // Override default materials with the scene's PBR look, and enable - // shadow casting so the figure grounds visually. - root.traverse((child) => { - const mesh = child as THREE.Mesh; - if (mesh.isMesh) { - mesh.material = characterMaterial; - mesh.castShadow = true; - } - }); - - scene.add(root); - character = root; - - if (gltf.animations.length > 0) { - mixer = new THREE.AnimationMixer(root); - const clip = gltf.animations[0]; - clipDuration = clip.duration; - action = mixer.clipAction(clip); - action.play(); - // Pause real-time playback — we'll set action.time manually in tick. - // (For CAPTURE MODE: set this to `!captureMode` instead.) - action.paused = true; - } - - // CAPTURE MODE: if (captureMode) startCaptureRecording(); - }, - undefined, - (err: unknown) => console.error("manifesto character load failed", err), - ); - - const clamp01 = (v: number) => THREE.MathUtils.clamp(v, 0, 1); - - // CAPTURE MODE — disabled. Records the canvas in real time and downloads - // the walk as a video. To re-enable: uncomment, restore the call in the - // GLTF load callback above, and the capture branch in the tick below. - // let recorder: MediaRecorder | null = null; - // let captureStart = 0; - // const captureChunks: Blob[] = []; - // const captureDuration = 6; // seconds of recorded walk - // const startCaptureRecording = () => { - // const stream = ( - // renderer.domElement as HTMLCanvasElement - // ).captureStream(60); - // // Prefer MP4 — MediaRecorder's webm output has a known broken duration - // // header (file contains all frames but most players report ~1s). MP4 - // // writes duration correctly. Fall back to webm where MP4 isn't supported. - // const mimeCandidates = [ - // "video/mp4;codecs=h264", - // "video/mp4;codecs=avc1", - // "video/mp4", - // "video/webm;codecs=vp9", - // "video/webm", - // ]; - // const mimeType = - // mimeCandidates.find((m) => MediaRecorder.isTypeSupported(m)) ?? - // "video/webm"; - // const ext = mimeType.startsWith("video/mp4") ? "mp4" : "webm"; - // recorder = new MediaRecorder(stream, { - // mimeType, - // videoBitsPerSecond: 12_000_000, - // }); - // recorder.ondataavailable = (e) => { - // if (e.data.size > 0) captureChunks.push(e.data); - // }; - // recorder.onstop = () => { - // const blob = new Blob(captureChunks, { type: mimeType }); - // const url = URL.createObjectURL(blob); - // const a = document.createElement("a"); - // a.href = url; - // a.download = `manifesto-walk.${ext}`; - // document.body.appendChild(a); - // a.click(); - // a.remove(); - // setTimeout(() => URL.revokeObjectURL(url), 1000); - // }; - // // Timeslice forces periodic chunk emission instead of buffering - // // everything until stop() — more reliable across browsers. - // recorder.start(100); - // captureStart = performance.now(); - // }; - - let rafId = 0; - // CAPTURE MODE: also track `let lastFrame = performance.now();` and - // `const dt = (now - lastFrame) / 1000; lastFrame = now;` for mixer.update. - const start = performance.now(); - const tick = () => { - // Skip the entire render pass when the parent flags us as paused. - // We still loop rAF (cheap) so resuming is instantaneous, but the - // expensive WebGL render + mixer update are gated. Saves 5-15ms per - // frame on high-DPI / large displays once the character is off-screen. - if (pausedRef?.current) { - rafId = requestAnimationFrame(tick); - return; - } - const now = performance.now(); - const t = (now - start) / 1000; - - if (character && mixer && action && clipDuration > 0) { - // CAPTURE MODE branch (disabled): - // if (captureMode && captureStart > 0) { - // const elapsed = (now - captureStart) / 1000; - // const cp = clamp01(elapsed / captureDuration); - // mixer.update(dt); - // character.position.x = -11 + 25 * cp; - // character.position.y = -2.5 + Math.sin(t * 1.6) * 0.04; - // if (elapsed >= captureDuration && recorder?.state === "recording") { - // recorder.stop(); - // } - // } else { - const cp = clamp01(progressRef.current); - - // Drive animation time from scroll. Multiplier sets how many walk - // cycles play across the full section so the legs cycle visibly. - // Modulo wraps the time so the loop chains together cleanly. - const animTime = (cp * clipDuration * WALK_CYCLES) % clipDuration; - action.time = animTime; - mixer.update(0); - - // Linear scroll-linked traversal. Progress spans the full visible - // duration of the section (top entering viewport → bottom exiting), - // so the text-reveal end falls at ~p=0.55 (sticky duration / total - // visible duration). At that point the character is around mid-frame. - // From p=0.55 → 1.0 the character continues walking and exits to - // the right while the section scrolls away. - character.position.x = -11 + 25 * cp; - character.position.y = -2.5 + Math.sin(t * 1.6) * 0.04; - // } - } - - renderer.render(scene, camera); - rafId = requestAnimationFrame(tick); - }; - rafId = requestAnimationFrame(tick); - - const handleResize = () => { - const w = container.clientWidth; - const h = container.clientHeight; - camera.aspect = w / h; - camera.updateProjectionMatrix(); - renderer.setSize(w, h); - }; - window.addEventListener("resize", handleResize); - - return () => { - cancelled = true; - cancelAnimationFrame(rafId); - // CAPTURE MODE: if (recorder && recorder.state === "recording") recorder.stop(); - window.removeEventListener("resize", handleResize); - if (renderer.domElement.parentNode === container) { - container.removeChild(renderer.domElement); - } - if (mixer) mixer.stopAllAction(); - if (character) { - scene.remove(character); - character.traverse((child) => { - const mesh = child as THREE.Mesh; - if (mesh.isMesh) { - mesh.geometry?.dispose(); - } - }); - } - characterMaterial.dispose(); - ground.geometry.dispose(); - (ground.material as THREE.Material).dispose(); - envTexture.dispose(); - pmrem.dispose(); - renderer.dispose(); - }; - }, [progressRef]); - - return ( -
- ); -}; - -export default ManifestoThreeBackground; diff --git a/frontend/apps/artcraft-website/src/components/model-badge-grid.tsx b/frontend/apps/artcraft-website/src/components/model-badge-grid.tsx deleted file mode 100644 index 688f2f1700..0000000000 --- a/frontend/apps/artcraft-website/src/components/model-badge-grid.tsx +++ /dev/null @@ -1,106 +0,0 @@ -import { - getCreatorIconPath, - IMAGE_MODELS, - VIDEO_MODELS, -} from "@storyteller/model-list"; - -interface BadgeInfo { - id: string; - label: string; - iconSrc: string; -} - -interface ModelBadgeGridProps { - className?: string; -} - -const ROW_COUNT = 3; -// Per-row marquee durations (seconds). Deliberately mismatched so the three -// rows never move in lockstep. -const ROW_DURATIONS = [56, 68, 62]; - -// Transparent border in the base keeps the box size constant when the hover -// highlight border appears, so the marquee doesn't jitter. The chip lights up -// only while the pointer is over it. -const badgeClasses = - " px-6 py-3 text-2xl font-normal flex-shrink-0 bg-[#121212] text-white/90 text-center h-[58px] flex items-center justify-center gap-1.5 border-2 border-transparent transition-all duration-300 hover:bg-primary/30 hover:text-white hover:font-semibold hover:shadow-lg hover:border-primary/60"; - -// Build one badge per unique model (deduped by display name so e.g. an -// image+video pair like "Grok" only shows once), pulling the correct brand -// icon from the canonical model mapping. -const BADGES: BadgeInfo[] = (() => { - const seen = new Set(); - const badges: BadgeInfo[] = []; - for (const model of [...IMAGE_MODELS, ...VIDEO_MODELS]) { - if (seen.has(model.fullName)) continue; - seen.add(model.fullName); - badges.push({ - id: model.id, - label: model.fullName, - iconSrc: getCreatorIconPath(model.creator), - }); - } - return badges; -})(); - -// Distribute badges round-robin across the rows so each row carries a mix of -// brands rather than all of one creator clumping together. -const ROWS: BadgeInfo[][] = Array.from({ length: ROW_COUNT }, () => []); -BADGES.forEach((badge, i) => { - ROWS[i % ROW_COUNT].push(badge); -}); - -export default function ModelBadgeGrid({ - className = "", -}: ModelBadgeGridProps) { - return ( -
- {/* Gradient fade overlays mask the marquee edges */} -
-
- -
- {ROWS.map((row, rowIdx) => ( -
-
- {/* Two identical copies make the loop seamless: translating the - track by -50% lands exactly on the start of the second copy. */} - {[0, 1].map((copy) => ( -
- {row.map((badge) => ( -
- - - - {badge.label} -
- ))} -
- ))} -
-
- ))} -
-
- ); -} diff --git a/frontend/apps/artcraft-website/src/components/navbar/index.ts b/frontend/apps/artcraft-website/src/components/navbar/index.ts deleted file mode 100644 index 8fb3806210..0000000000 --- a/frontend/apps/artcraft-website/src/components/navbar/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { default } from "./navbar"; diff --git a/frontend/apps/artcraft-website/src/components/navbar/navbar.tsx b/frontend/apps/artcraft-website/src/components/navbar/navbar.tsx deleted file mode 100644 index 0125e15d74..0000000000 --- a/frontend/apps/artcraft-website/src/components/navbar/navbar.tsx +++ /dev/null @@ -1,590 +0,0 @@ -import { - Disclosure, - DisclosureButton, - DisclosurePanel, - Menu, - MenuButton, - MenuItem, - MenuItems, - Transition, -} from "@headlessui/react"; -import * as NavigationMenu from "@radix-ui/react-navigation-menu"; -import { twMerge } from "tailwind-merge"; -import { Fragment } from "react"; -import { Link, useLocation, useNavigate } from "react-router-dom"; -import { USER_FEATURE_FLAGS, UsersApi } from "@storyteller/api"; -import { useSession, invalidateSession } from "../../lib/session"; -import { ArrowRightIcon, ChevronDownIcon, GemIcon, GiftIcon, LifeBuoyIcon, MenuIcon, RocketIcon, XIcon } from "lucide-react"; -import { DynamicIcon, DiscordIcon } from "@storyteller/icons"; -import { - appLink, - SOCIAL_LINKS, - USE_WEBAPP_FOR_APP_FEATURES, - WEBAPP_URL, - webappUrl, -} from "../../config/links"; - -type NavLeaf = { name: string; href: string }; -type NavGroup = { name: string; href?: string; children: NavLeaf[] }; -type NavEntry = NavLeaf | NavGroup; - -const NAV_ITEMS: NavEntry[] = [ - { name: "Home", href: "/" }, - { name: "Image", href: appLink("/create-image") }, - { name: "Video", href: appLink("/create-video") }, - { - name: "Resources", - children: [ - { name: "Tutorials", href: "/tutorials" }, - { name: "News", href: "/news" }, - { name: "FAQ", href: "/faq" }, - { name: "Press Kit", href: "/press-kit" }, - ], - }, - { name: "Download", href: "/download" }, - { name: "Support", href: "/support" }, -]; - -const isExternalHref = (href: string) => /^https?:\/\//.test(href); - -function isGroup(entry: NavEntry): entry is NavGroup { - return "children" in entry && Array.isArray(entry.children); -} - -function isPathActive(pathname: string, href: string): boolean { - if (href === "/") return pathname === "/"; - return pathname === href || pathname.startsWith(href + "/"); -} - -function isEntryActive(pathname: string, entry: NavEntry): boolean { - if (isGroup(entry)) { - if (entry.href && isPathActive(pathname, entry.href)) return true; - return entry.children.some((c) => isPathActive(pathname, c.href)); - } - return isPathActive(pathname, entry.href); -} - -export default function Navbar() { - const location = useLocation(); - const navigate = useNavigate(); - const { user, authChecked } = useSession(); - const isLoading = !authChecked; - const hasReferralsFlag = !!user?.maybe_feature_flags?.includes( - USER_FEATURE_FLAGS.REFERRALS, - ); - - const handleLogout = async () => { - const api = new UsersApi(); - await api.Logout(); - invalidateSession(); - window.location.href = "/"; - }; - - return ( - - {({ open }) => ( -
-
-
- {/* Left: Logo + nav items */} -
- - ArtCraft - - - - - {NAV_ITEMS.map((entry) => { - const active = isEntryActive(location.pathname, entry); - const baseClasses = - "px-3 py-1.5 text-sm font-medium transition-all whitespace-nowrap flex items-center gap-1.5"; - const stateClasses = active - ? "text-white bg-white/[0.08]" - : "text-white/60 hover:text-white hover:bg-white/[0.04]"; - - if (!isGroup(entry)) { - return ( - - - {isExternalHref(entry.href) ? ( - - {entry.name} - - ) : ( - - {entry.name} - - )} - - - ); - } - - return ( - - {entry.href ? ( - - - {entry.name} - - - - ) : ( - - {entry.name} - - - )} - -
    - {entry.children.map((child) => { - const childActive = isPathActive( - location.pathname, - child.href, - ); - return ( -
  • - - - {child.name} - - -
  • - ); - })} -
-
-
- ); - })} -
-
-
- - {/* Right: Auth + launch app */} -
- {isLoading ? ( -
- ) : user ? ( -
- - - Pricing - - - {USE_WEBAPP_FOR_APP_FEATURES && ( - - - Launch App - - )} - - - - Open user menu - - - - -
-

- {user.display_name || user.username} -

-
- - {({ active }) => ( - - )} - - {hasReferralsFlag && ( - - {({ active }) => ( - - - Referrals - - )} - - )} - - {({ active }) => ( - - - Join Discord - - )} - - - {({ active }) => ( - - )} - -
-
-
-
- ) : ( -
- - - Pricing - - {USE_WEBAPP_FOR_APP_FEATURES ? ( - - - Launch App - - ) : ( - <> - - Login - - - Sign up - - - - )} -
- )} - - {/* Mobile: hamburger only */} -
- - Open main menu - - -
-
-
- - {/* Mobile slide-down panel */} - - -
- {NAV_ITEMS.map((entry) => { - if (!isGroup(entry)) { - const isCurrent = isPathActive( - location.pathname, - entry.href, - ); - const leafClassName = twMerge( - " px-3 py-2 text-sm font-medium transition-colors", - isCurrent - ? "bg-white/[0.08] text-white" - : "text-white/60 active:bg-white/[0.04]", - ); - return isExternalHref(entry.href) ? ( - - {entry.name} - - ) : ( - - {entry.name} - - ); - } - - const headerActive = - entry.href !== undefined && - isPathActive(location.pathname, entry.href); - - return ( -
- {entry.href ? ( - - {entry.name} - - ) : ( -
- {entry.name} -
- )} -
- {entry.children.map((child) => { - const childActive = isPathActive( - location.pathname, - child.href, - ); - return ( - - {child.name} - - ); - })} -
-
- ); - })} -
- -
- - {!isLoading && user ? ( -
- {USE_WEBAPP_FOR_APP_FEATURES && ( - - - Launch App - - )} -
- - - Pricing - - - - Discord - - {hasReferralsFlag && ( - - - Referrals - - )} -
-
- - - {user.display_name || user.username} - - - Sign out - -
-
- ) : !isLoading ? ( - USE_WEBAPP_FOR_APP_FEATURES ? ( - - - Launch App - - ) : ( -
- - Login - - - Sign up - -
- ) - ) : null} - - -
- -
- )} - - ); -} diff --git a/frontend/apps/artcraft-website/src/components/navbar/task-queue.tsx b/frontend/apps/artcraft-website/src/components/navbar/task-queue.tsx deleted file mode 100644 index d113721211..0000000000 --- a/frontend/apps/artcraft-website/src/components/navbar/task-queue.tsx +++ /dev/null @@ -1,1204 +0,0 @@ -import { Tooltip } from "@storyteller/ui-tooltip"; -import { PopoverMenu } from "@storyteller/ui-popover"; -import { BombIcon, BrushIcon, CheckIcon, CircleAlertIcon, CopyIcon, ListChecksIcon, LoaderCircleIcon, Trash2Icon, TriangleAlertIcon, XIcon } from "lucide-react"; -import { DynamicIcon } from "@storyteller/icons"; -import { Modal } from "@storyteller/ui-modal"; -import { useEffect, useMemo, useRef, useState } from "react"; -import { JobsApi, JobStatus } from "@storyteller/api"; -import type { Job, Prompts } from "@storyteller/api"; -import { getCachedPrompt, usePrompts } from "../../lib/prompts-cache"; -import { Button } from "@storyteller/ui-button"; -import { - getProviderDisplayName, - getModelDisplayName, - getCreatorIconPathForModelId, - findModelByKey, -} from "@storyteller/model-list"; -import { CloseButton } from "@storyteller/ui-close-button"; -import dayjs from "dayjs"; -import { ActionReminderModal } from "@storyteller/ui-action-reminder-modal"; -import { Lightbox } from "../lightbox/lightbox"; -import { showToast } from "../toast/toast"; -import { getMediaThumbnail, THUMBNAIL_SIZES } from "@storyteller/common"; -import { twMerge } from "tailwind-merge"; - -// ── Types ────────────────────────────────────────────────────────────────── - -type InProgressTask = { - id: string; - title: string; - subtitle?: string; - progress: number; - updatedAt?: Date; - canDismiss?: boolean; - estimatedTimeLeftMs?: number; - modelType?: string; - prompt?: string; -}; - -type CompletedTask = { - id: string; - title: string; - subtitle?: string; - thumbnailUrl?: string; - completedAt?: Date; - updatedAt?: Date; - imageUrls?: string[]; - mediaTokens?: string[]; - prompt?: string; -}; - -type FailedTask = { - id: string; - title: string; - subtitle?: string; - failedAt?: Date; - status: string; - failureReason?: string; - failureMessage?: string; - prompt?: string; -}; - -// ── Helpers ──────────────────────────────────────────────────────────────── - -const formatTimeLeft = (ms: number): string => { - const totalSeconds = Math.ceil(ms / 1000); - const hours = Math.floor(totalSeconds / 3600); - const minutes = Math.floor((totalSeconds % 3600) / 60); - const seconds = totalSeconds % 60; - - if (hours > 0 && minutes > 0) return `~ ${hours}h ${minutes}m left`; - if (hours > 0) return `~ ${hours}h left`; - if (minutes > 0) return `~ ${minutes}m left`; - return `~ ${seconds}s left`; -}; - -const FAILED_STATUS_LABEL: Record = { - [JobStatus.COMPLETE_FAILURE]: "Failed", - [JobStatus.ATTEMPT_FAILED]: "Failed", - [JobStatus.DEAD]: "Failed", - [JobStatus.CANCELLED_BY_USER]: "Cancelled", - [JobStatus.CANCELLED_BY_SYSTEM]: "Cancelled", -}; - -const FAILURE_REASON_LABEL: Record = { - rule_bans_user_image: "Image violates content policy", - rule_bans_user_image_with_faces: "Images with faces are not allowed", - rule_bans_user_text_prompt: "Text prompt violates content policy", - rule_bans_user_content: "Content violates content policy", - rule_bans_generated_video: "Generated video flagged by content policy", - rule_bans_generated_audio: "Generated audio flagged by content policy", - rule_bans_generated_content: "Generated content flagged by content policy", - generation_failed: "Generation failed", - unknown: "An unknown error occurred", -}; - -const IN_PROGRESS_STATUSES = new Set([JobStatus.PENDING, JobStatus.STARTED]); -const COMPLETED_STATUSES = new Set([JobStatus.COMPLETE_SUCCESS]); -const FAILED_STATUSES = new Set([ - JobStatus.ATTEMPT_FAILED, - JobStatus.COMPLETE_FAILURE, - JobStatus.DEAD, - JobStatus.CANCELLED_BY_USER, - JobStatus.CANCELLED_BY_SYSTEM, -]); - -// ── Shared sub-components ───────────────────────────────────────────────── - -const PromptLine = ({ - prompt, - className, -}: { - prompt: string; - className?: string; -}) => { - const [marqueePlaying, setMarqueePlaying] = useState(false); - const [promptOverflows, setPromptOverflows] = useState(false); - const promptRef = useRef(null); - useEffect(() => { - const el = promptRef.current; - if (el) setPromptOverflows(el.scrollWidth > el.clientWidth); - }, [prompt]); - - return ( - 300 ? prompt.slice(0, 300) + "\u2026" : prompt} - position="bottom" - strategy="fixed" - className="max-w-[280px] text-wrap text-xs" - zIndex={50} - delay={400} - > -
setMarqueePlaying(true) : undefined - } - onMouseLeave={ - promptOverflows ? () => setMarqueePlaying(false) : undefined - } - > -
- {prompt} -
-
-
- ); -}; - -const CopyPromptButton = ({ prompt }: { prompt: string }) => { - const [copied, setCopied] = useState(false); - return ( - - - - ); -}; - -// ── Card Components ──────────────────────────────────────────────────────── - -const InProgressCard = ({ - task, - onDismiss, -}: { - task: InProgressTask; - onDismiss?: () => void; -}) => { - const progressPercent = Math.max(0, Math.min(100, Math.round(task.progress))); - const isAlmostDone = task.progress >= 95; - const timeLabel = isAlmostDone - ? "Almost done..." - : task.estimatedTimeLeftMs != null && task.estimatedTimeLeftMs > 0 - ? formatTimeLeft(task.estimatedTimeLeftMs) - : null; - const isSeedance2 = task.modelType === "seedance_2p0"; - const modelIconPath = task.modelType - ? getCreatorIconPathForModelId(task.modelType) - : null; - - return ( -
-
-
- -
-
-
-
- {modelIconPath && ( - - )} - {task.title} - {isSeedance2 && ( - - - - )} -
-
- {progressPercent}% -
-
- {task.subtitle && ( -
- {task.subtitle} -
- )} -
-
-
-
-
- {timeLabel && ( -
{timeLabel}
- )} - {task.prompt && } -
-
- {task.prompt && } - {onDismiss && ( - - )} -
-
-
- ); -}; - -const CompletedCard = ({ - task, - onClick, - onDismiss, -}: { - task: CompletedTask; - onClick?: () => void; - onDismiss?: () => void; -}) => { - return ( -
-
- {task.thumbnailUrl ? ( - {task.title} { - e.currentTarget.style.display = "none"; - }} - className="h-full w-full object-cover" - /> - ) : ( -
- Done -
- )} -
-
-
- {task.title} -
- {task.subtitle && ( -
- {task.subtitle} -
- )} - {task.completedAt && ( -
- {dayjs(task.completedAt).format("MMM D, h:mm A")} -
- )} - {task.prompt && } -
-
- {task.prompt && } - {onDismiss && ( - - )} -
-
- ); -}; - -const FailedCard = ({ - task, - onDismiss, -}: { - task: FailedTask; - onDismiss?: () => void; -}) => { - const statusLabel = FAILED_STATUS_LABEL[task.status] || "Failed"; - return ( -
-
-
- -
-
-
-
- {task.title} -
-
- {task.subtitle && ( -
- {task.subtitle} -
- )} -
- - {statusLabel} - - {task.failureReason && ( -
- -
- {task.failureReason} -
-
- {task.failureMessage} -
-
- ) : ( - task.failureReason - ) - } - position="bottom" - strategy="fixed" - className="max-w-[280px] text-wrap bg-danger text-xs" - zIndex={50} - delay={300} - > -
- {task.failureReason} -
- -
- )} -
- {task.prompt && } - {task.failedAt && ( -
- {dayjs(task.failedAt).format("MMM D, h:mm A")} -
- )} -
-
- {task.prompt && } - {onDismiss && ( - - )} -
-
-
- ); -}; - -// ── Job → Task transformers ──────────────────────────────────────────────── - -function getPrompt(job: Job, promptsMap?: Map): string { - const promptToken = job.request.maybe_prompt_token; - const cached = promptToken - ? (promptsMap?.get(promptToken) ?? getCachedPrompt(promptToken)) - : undefined; - return ( - cached?.maybe_positive_prompt || job.request.maybe_raw_inference_text || "" - ); -} - -function formatTitleParts(job: Job, promptsMap?: Map) { - const promptToken = job.request.maybe_prompt_token; - const cachedPrompt = promptToken - ? (promptsMap?.get(promptToken) ?? getCachedPrompt(promptToken)) - : undefined; - - const taskTypeStr = job.request.inference_category?.toLowerCase() ?? ""; - const modelTypeStr = - cachedPrompt?.maybe_model_type ?? job.request.maybe_model_type ?? ""; - const providerKey = cachedPrompt?.maybe_generation_provider ?? modelTypeStr; - - let kind: string | undefined; - if (taskTypeStr.includes("video")) { - kind = "Video"; - } else if (taskTypeStr.includes("image")) { - kind = "Image"; - } else if (taskTypeStr.includes("character")) { - kind = "Character"; - } - - const modelDisplay = modelTypeStr - ? getModelDisplayName(modelTypeStr) - : undefined; - const provider = providerKey - ? getProviderDisplayName(providerKey.toLowerCase()) - : undefined; - - const title = kind || "Task"; - const subtitle = - modelDisplay && provider - ? `${modelDisplay} · ${provider}` - : modelDisplay || provider || undefined; - return { title, subtitle, kind }; -} - -// Cache per-task durations so model changes don't affect existing progress bars -const taskDurationCache = new Map(); - -function jobsToInProgress( - jobs: Job[], - promptsMap: Map, -): InProgressTask[] { - const now = Date.now(); - const activeIds = new Set(); - - const result = jobs - .filter((j) => IN_PROGRESS_STATUSES.has(j.status.status)) - .sort( - (a, b) => - new Date(b.updated_at).getTime() - new Date(a.updated_at).getTime(), - ) - .map((j): InProgressTask => { - activeIds.add(j.job_token); - const createdMs = new Date(j.created_at).getTime(); - const parts = formatTitleParts(j, promptsMap); - const isVideo = - j.request.inference_category?.toLowerCase().includes("video") ?? false; - - const promptToken = j.request.maybe_prompt_token; - const cachedPrompt = promptToken - ? (promptsMap.get(promptToken) ?? getCachedPrompt(promptToken)) - : undefined; - const modelType = - cachedPrompt?.maybe_model_type ?? j.request.maybe_model_type; - - // Look up per-model estimated duration from the model list, cache per - // task. Cache only once `modelType` is resolved so a transient - // "prompt not loaded yet" render doesn't lock in the wrong fallback. - let duration = taskDurationCache.get(j.job_token); - if (duration === undefined) { - const model = findModelByKey(modelType); - duration = model?.progressBarTime ?? (isVideo ? 900000 : 30000); - if (modelType) { - taskDurationCache.set(j.job_token, duration); - } - } - - // Always use time-based fake progress (matching desktop app behavior) - const elapsed = now - createdMs; - const progress = Math.min(95, (elapsed / duration) * 100); - const estimatedTimeLeftMs = Math.max(0, duration - elapsed); - - const canDismiss = now - createdMs > 5 * 60 * 1000; - - return { - id: j.job_token, - title: `Generating ${parts.kind || "Task"}...`, - subtitle: parts.subtitle, - progress, - updatedAt: new Date(j.updated_at), - canDismiss, - estimatedTimeLeftMs, - modelType: modelType ?? undefined, - prompt: getPrompt(j, promptsMap) || undefined, - }; - }); - - // Prune cached durations for tasks no longer in progress - for (const id of taskDurationCache.keys()) { - if (!activeIds.has(id)) taskDurationCache.delete(id); - } - - return result; -} - -function jobsToCompleted( - jobs: Job[], - promptsMap: Map, -): CompletedTask[] { - return jobs - .filter((j) => COMPLETED_STATUSES.has(j.status.status)) - .sort( - (a, b) => - new Date(b.updated_at).getTime() - new Date(a.updated_at).getTime(), - ) - .map((j): CompletedTask => { - const cdnUrl = j.maybe_result?.media_links?.cdn_url; - const mediaClass = j.request.inference_category - ?.toLowerCase() - .includes("video") - ? "video" - : "image"; - const thumbnailUrl = - getMediaThumbnail(j.maybe_result?.media_links, mediaClass, { - size: THUMBNAIL_SIZES.MEDIUM, - }) ?? cdnUrl; - const parts = formatTitleParts(j, promptsMap); - - return { - id: j.job_token, - title: parts.title, - subtitle: parts.subtitle, - thumbnailUrl, - completedAt: j.maybe_result?.maybe_successfully_completed_at - ? new Date(j.maybe_result.maybe_successfully_completed_at) - : new Date(j.updated_at), - updatedAt: new Date(j.updated_at), - imageUrls: cdnUrl ? [cdnUrl] : [], - mediaTokens: j.maybe_result?.entity_token - ? [j.maybe_result.entity_token] - : [], - prompt: getPrompt(j, promptsMap) || undefined, - }; - }); -} - -function jobsToFailed( - jobs: Job[], - promptsMap: Map, -): FailedTask[] { - return jobs - .filter((j) => FAILED_STATUSES.has(j.status.status)) - .sort( - (a, b) => - new Date(b.updated_at).getTime() - new Date(a.updated_at).getTime(), - ) - .map((j): FailedTask => { - const parts = formatTitleParts(j, promptsMap); - const failureCategory = - j.status.maybe_failure_category_updated || - j.status.maybe_failure_category; - const rawMessage = - j.status.maybe_failure_message || - j.status.maybe_extra_status_description; - const failureReason = failureCategory - ? FAILURE_REASON_LABEL[failureCategory] || rawMessage || undefined - : rawMessage || undefined; - const failureMessage = - rawMessage && failureCategory !== "unknown" ? rawMessage : undefined; - - return { - id: j.job_token, - title: parts.title || "Task", - subtitle: parts.subtitle, - failedAt: new Date(j.updated_at), - status: j.status.status, - failureReason, - failureMessage, - prompt: getPrompt(j, promptsMap) || undefined, - }; - }); -} - -// ── Main Component ───────────────────────────────────────────────────────── - -export const TaskQueue = () => { - const [isModalOpen, setModalOpen] = useState(false); - const [jobs, setJobs] = useState([]); - const [isPopoverOpen, setIsPopoverOpen] = useState(false); - const [unreadCompletedIds, setUnreadCompletedIds] = useState([]); - - const promptTokens = useMemo(() => { - const tokens: string[] = []; - for (const j of jobs) { - if (j.request.maybe_prompt_token) - tokens.push(j.request.maybe_prompt_token); - } - return tokens; - }, [jobs]); - const promptsMap = usePrompts(promptTokens); - - const inProgress = useMemo( - () => jobsToInProgress(jobs, promptsMap), - [jobs, promptsMap], - ); - const completed = useMemo( - () => jobsToCompleted(jobs, promptsMap), - [jobs, promptsMap], - ); - const failed = useMemo( - () => jobsToFailed(jobs, promptsMap), - [jobs, promptsMap], - ); - - // Lightbox state - const [lightboxOpen, setLightboxOpen] = useState(false); - const [lightboxMediaToken, setLightboxMediaToken] = useState< - string | undefined - >(); - const [lightboxCdnUrl, setLightboxCdnUrl] = useState(); - const prevCompletedIdsRef = useRef>(new Set()); - const prevFailedIdsRef = useRef>(new Set()); - // On first load we seed the "seen" sets with whatever is already on the - // server so we don't blast the user with toasts for jobs completed during - // a previous session. - const initialLoadDoneRef = useRef(false); - - const [confirmationConfig, setConfirmationConfig] = useState<{ - isOpen: boolean; - title: string; - message: React.ReactNode; - primaryActionText: string; - primaryActionIcon: any; - primaryActionBtnClassName: string; - onConfirm: () => Promise; - }>({ - isOpen: false, - title: "", - message: null, - primaryActionText: "", - primaryActionIcon: Trash2Icon, - primaryActionBtnClassName: "", - onConfirm: async () => {}, - }); - - // ── Confirmation handlers ────────────────────────────────────────── - - const handleClearCompleted = () => { - setConfirmationConfig({ - isOpen: true, - title: "Clear completed tasks?", - message: ( - - This will remove all completed tasks from the task queue. - - ), - primaryActionText: "Clear completed", - primaryActionIcon: BrushIcon, - primaryActionBtnClassName: - "bg-green-500/10 hover:bg-green-500/20 text-green-500", - onConfirm: async () => { - await dismissCompleted(); - }, - }); - }; - - const handleClearStale = () => { - setConfirmationConfig({ - isOpen: true, - title: "Clear stale tasks?", - message: ( - - This will remove all stale/stuck in-progress tasks from the queue. - - ), - primaryActionText: "Clear stale", - primaryActionIcon: Trash2Icon, - primaryActionBtnClassName: - "bg-orange-500/10 hover:bg-orange-500/20 text-orange-500", - onConfirm: async () => { - await dismissStale(); - }, - }); - }; - - const handleClearFailed = () => { - setConfirmationConfig({ - isOpen: true, - title: "Clear failed tasks?", - message: ( - - This will remove all failed/cancelled tasks from the queue. - - ), - primaryActionText: "Clear failed", - primaryActionIcon: Trash2Icon, - primaryActionBtnClassName: - "bg-red-500/10 hover:bg-red-500/20 text-red-500", - onConfirm: async () => { - await dismissFailed(); - }, - }); - }; - - const handleRemoveAll = () => { - setConfirmationConfig({ - isOpen: true, - title: "Remove all tasks?", - message: ( - - This will remove ALL tasks (completed and in-progress) from the queue. - This cannot be undone. - - ), - primaryActionText: "Nuke all", - primaryActionIcon: BombIcon, - primaryActionBtnClassName: - "bg-red-500/10 hover:bg-red-500/20 text-red-500", - onConfirm: async () => { - await dismissAll(); - }, - }); - }; - - // ── Data loading ─────────────────────────────────────────────────── - - useEffect(() => { - let cancelled = false; - const api = new JobsApi(); - - const load = async () => { - try { - const response = await api.ListRecentJobs(); - if (cancelled || !response.success || !response.data) return; - - const fetchedJobs: Job[] = response.data; - setJobs(fetchedJobs); - - // Toast titles use formatTitleParts directly so we don't depend on - // the prompt cache being populated here. - const completedJobs = fetchedJobs.filter((j) => - COMPLETED_STATUSES.has(j.status.status), - ); - const failedJobs = fetchedJobs.filter((j) => - FAILED_STATUSES.has(j.status.status), - ); - const newCompletedIdSet = new Set( - completedJobs.map((j) => j.job_token), - ); - const newFailedIdSet = new Set(failedJobs.map((j) => j.job_token)); - - if (!initialLoadDoneRef.current) { - // First load: seed the "seen" sets without toasting. - prevCompletedIdsRef.current = newCompletedIdSet; - prevFailedIdsRef.current = newFailedIdSet; - initialLoadDoneRef.current = true; - } else { - const newlyCompletedJobs = completedJobs.filter( - (j) => !prevCompletedIdsRef.current.has(j.job_token), - ); - prevCompletedIdsRef.current = newCompletedIdSet; - - if (newlyCompletedJobs.length > 0) { - for (const job of newlyCompletedJobs) { - const parts = formatTitleParts(job); - showToast("success", `${parts.title} creation complete`); - } - if (!isPopoverOpen) { - setUnreadCompletedIds((prev) => - Array.from( - new Set([ - ...(prev ?? []), - ...newlyCompletedJobs.map((j) => j.job_token), - ]), - ), - ); - } - } - - const newlyFailedJobs = failedJobs.filter( - (j) => !prevFailedIdsRef.current.has(j.job_token), - ); - prevFailedIdsRef.current = newFailedIdSet; - - for (const job of newlyFailedJobs) { - const parts = formatTitleParts(job); - const failureCategory = - job.status.maybe_failure_category_updated || - job.status.maybe_failure_category; - const rawMessage = - job.status.maybe_failure_message || - job.status.maybe_extra_status_description; - const failureReason = failureCategory - ? FAILURE_REASON_LABEL[failureCategory] || rawMessage || undefined - : rawMessage || undefined; - showToast( - "error", - `${parts.title} creation failed${failureReason ? ` — ${failureReason}` : ""}`, - ); - } - } - } catch { - // ignore - } - }; - - load(); - const intervalId = setInterval(load, 5000); - - const handleTaskUpdate = () => { - if (!cancelled) load(); - }; - window.addEventListener("task-queue-update", handleTaskUpdate); - - return () => { - cancelled = true; - clearInterval(intervalId); - window.removeEventListener("task-queue-update", handleTaskUpdate); - }; - }, [isPopoverOpen]); - - // ── Derived state ────────────────────────────────────────────────── - - const hasNothing = useMemo( - () => - inProgress.length === 0 && completed.length === 0 && failed.length === 0, - [inProgress.length, completed.length, failed.length], - ); - - const inProgressCount = inProgress.length; - const badgeCount = inProgressCount + (unreadCompletedIds?.length ?? 0); - - const handleOpenChange = (open: boolean) => { - setIsPopoverOpen(open); - if (open) { - setUnreadCompletedIds([]); - } - }; - - // ── Dismiss handlers ────────────────────────────────────────────── - - const dismissTask = async (id: string) => { - try { - const api = new JobsApi(); - await api.DeleteJobByToken(id); - setJobs((prev) => prev.filter((j) => j.job_token !== id)); - setUnreadCompletedIds((prev) => (prev ?? []).filter((x) => x !== id)); - } catch { - // ignore - } - }; - - const dismissCompleted = async () => { - const ids = completed.map((t) => t.id); - try { - await Promise.allSettled( - ids.map((id) => new JobsApi().DeleteJobByToken(id)), - ); - } catch { - // ignore - } finally { - const idSet = new Set(ids); - setJobs((prev) => prev.filter((j) => !idSet.has(j.job_token))); - setUnreadCompletedIds([]); - } - }; - - const dismissFailed = async () => { - const ids = failed.map((t) => t.id); - try { - await Promise.allSettled( - ids.map((id) => new JobsApi().DeleteJobByToken(id)), - ); - } catch { - // ignore - } finally { - const idSet = new Set(ids); - setJobs((prev) => prev.filter((j) => !idSet.has(j.job_token))); - } - }; - - const dismissStale = async () => { - const staleIds = inProgress.filter((t) => t.canDismiss).map((t) => t.id); - try { - await Promise.allSettled( - staleIds.map((id) => new JobsApi().DeleteJobByToken(id)), - ); - const idSet = new Set(staleIds); - setJobs((prev) => prev.filter((j) => !idSet.has(j.job_token))); - } catch { - // ignore - } - }; - - const dismissAll = async () => { - const allIds = [ - ...inProgress.map((t) => t.id), - ...completed.map((t) => t.id), - ...failed.map((t) => t.id), - ]; - try { - await Promise.allSettled( - allIds.map((id) => new JobsApi().DeleteJobByToken(id)), - ); - } catch { - // ignore - } finally { - setJobs([]); - setUnreadCompletedIds([]); - } - }; - - // ── Shared task list renderer ────────────────────────────────────── - - const renderTaskList = (onCloseAction: () => void) => ( - <> - {hasNothing ? ( -
-
- No tasks yet -
-
- ) : ( -
- {inProgress.length > 0 && ( -
-
- In Progress -
- {inProgress.map((t) => ( - dismissTask(t.id) : undefined} - /> - ))} -
- )} - {failed.length > 0 && ( -
-
-
- Failed -
- -
- {failed.map((t) => ( - dismissTask(t.id)} - /> - ))} -
- )} - {completed.length > 0 && ( -
-
-
- Completed -
- -
- {completed.map((t) => ( - { - const mediaToken = t.mediaTokens?.[0]; - const cdnUrl = t.imageUrls?.[0]; - if (mediaToken || cdnUrl) { - setLightboxMediaToken(mediaToken); - setLightboxCdnUrl(cdnUrl); - setLightboxOpen(true); - } - onCloseAction(); - }} - onDismiss={() => dismissTask(t.id)} - /> - ))} -
- )} -
- )} - - ); - - // ── Render ───────────────────────────────────────────────────────── - - return ( - <> - -
- {badgeCount > 0 && ( -
- {badgeCount} -
- )} - 0 ? ( - - ) : ( - - ) - } - onOpenChange={handleOpenChange} - > - {(close: () => void) => ( -
-
- {renderTaskList(close)} -
-
-
- -
-
-
- )} -
-
-
- - setModalOpen(false)} - className="h-[520px] max-w-3xl" - showClose={false} - > -
-
-
-

Task Queue

-
- - - - -
- setModalOpen(false)} /> -
-
-
-
- {renderTaskList(() => setModalOpen(false))} -
-
- - - - setConfirmationConfig((prev) => ({ ...prev, isOpen: false })) - } - title={confirmationConfig.title} - message={confirmationConfig.message} - onPrimaryAction={async () => { - await confirmationConfig.onConfirm(); - setConfirmationConfig((prev) => ({ ...prev, isOpen: false })); - }} - primaryActionText={confirmationConfig.primaryActionText} - secondaryActionText="Cancel" - primaryActionIcon={confirmationConfig.primaryActionIcon} - primaryActionBtnClassName={confirmationConfig.primaryActionBtnClassName} - /> - - { - setLightboxOpen(false); - setLightboxMediaToken(undefined); - setLightboxCdnUrl(undefined); - }} - mediaToken={lightboxMediaToken} - cdnUrl={lightboxCdnUrl} - /> - - {/* On mobile, make the PopoverMenu's wrapper static so the absolute - panel positions against the fixed navbar (full width), then pin - the panel to viewport edges with left/right insets. */} - - - ); -}; - -export default TaskQueue; diff --git a/frontend/apps/artcraft-website/src/components/ownership-comparison/ownership-comparison.tsx b/frontend/apps/artcraft-website/src/components/ownership-comparison/ownership-comparison.tsx deleted file mode 100644 index 1977a8ad64..0000000000 --- a/frontend/apps/artcraft-website/src/components/ownership-comparison/ownership-comparison.tsx +++ /dev/null @@ -1,129 +0,0 @@ -import { BanIcon, CloudIcon, CreditCardIcon, GlobeIcon, ImageIcon, KeyIcon, LockOpenIcon, ServerIcon, XIcon } from "lucide-react"; -import { DynamicIcon, GithubIcon } from "@storyteller/icons"; - -export const OwnershipComparison = () => { - const websiteIcons = [CloudIcon, GlobeIcon, ImageIcon, ServerIcon]; - - return ( -
- -
-
-

- Stop Renting -
- From Websites -

-

- We're artists, not landlords. We're going to give you ArtCraft to have and to hold forever. It's yours. -

-
-

- So you can dump that aggregator subscription rent payment. -

-
- -
- -
-
-
- -
- -
- -
- {websiteIcons.map((icon, i) => { - const transform = `translateX(${(i - 1.5) * 50}px) translateY(${Math.abs(i-1.5) * 10}px) rotate(${(i-1.5) * 10}deg) scale(1.1)`; - - return ( -
- - -
- -
-
- ); - })} -
- -

- The Rental Trap -

- -

- You're paying for permission, not a product. If they shut down, you lose everything. (Ask them about downloading your LoRAs! 🤫) -

- -
-
- NO OWNERSHIP -
-
- MONTHLY FEES -
-
-
-
- -
-
-
- -
- -
- -
-
- ArtCraft -
-
- -
-
- -

- Complete Ownership -

- -

- Download ArtCraft. You own the code, the keys, and the output. You don't even have to pay us to use it. -
-

(Lots of 3rd party logins and API keys supported. Also please pay us. We turn that into coffee and development and movies.)
-

- -
-
- YOURS FOREVER -
-
- BYO KEYS -
-
- -
-
- -
-
- -
- VS -
-
- -
- -
- ); -}; diff --git a/frontend/apps/artcraft-website/src/components/prompt-box/CharactersModal.tsx b/frontend/apps/artcraft-website/src/components/prompt-box/CharactersModal.tsx deleted file mode 100644 index 177f8f83ed..0000000000 --- a/frontend/apps/artcraft-website/src/components/prompt-box/CharactersModal.tsx +++ /dev/null @@ -1,904 +0,0 @@ -import { useState, useRef, useCallback, useEffect } from "react"; -import { Modal } from "@storyteller/ui-modal"; -import { ArrowLeftIcon, LoaderCircleIcon, PenIcon, PlusIcon, Trash2Icon, UploadIcon, UsersIcon, XIcon } from "lucide-react"; -import { twMerge } from "tailwind-merge"; -import { - CharactersApi, - Character, - MediaUploadApi, -} from "@storyteller/api"; -import { toast } from "../toast/toast"; -import { v4 as uuidv4 } from "uuid"; -import { Button } from "@storyteller/ui-button"; -import { useCharactersStore } from "./characters-store"; - -interface CharactersModalProps { - isOpen: boolean; - onClose: () => void; - onSelectCharacter?: (character: Character) => void; -} - -type ModalView = "list" | "create" | "edit"; - -interface UploadedImage { - file: File; - url: string; - mediaToken?: string; -} - -interface PendingCharacter { - name: string; - previewUrl?: string; - createdAt: number; -} - -const POLL_INTERVAL_MS = 5000; -const PENDING_STALE_MS = 3 * 60 * 1000; - -export const CharactersModal = ({ - isOpen, - onClose, - onSelectCharacter, -}: CharactersModalProps) => { - const [view, setView] = useState("list"); - const [editingCharacter, setEditingCharacter] = useState( - null, - ); - const [pendingCharacters, setPendingCharacters] = useState< - PendingCharacter[] - >([]); - const [refreshKey, setRefreshKey] = useState(0); - - const handleClose = () => { - setView("list"); - setEditingCharacter(null); - onClose(); - }; - - const handleEdit = (character: Character) => { - setEditingCharacter(character); - setView("edit"); - }; - - const handleEditDone = () => { - setEditingCharacter(null); - setView("list"); - setRefreshKey((k) => k + 1); - }; - - const handleCreated = (pending: { name: string; previewUrl?: string }) => { - setPendingCharacters((prev) => [ - { ...pending, createdAt: Date.now() }, - ...prev, - ]); - setView("list"); - setRefreshKey((k) => k + 1); - }; - - const removePending = useCallback((name: string) => { - setPendingCharacters((prev) => prev.filter((p) => p.name !== name)); - }, []); - - // Poll the server while any creation is pending (even with the modal - // closed), so the pending card gets cleaned up and — once the character is - // active — the mention store learns its real character token. The create - // response only carries an inference job token, so @-mentions must wait for - // the server list to include the character before it can be referenced. - useEffect(() => { - if (pendingCharacters.length === 0) return; - - const interval = setInterval(async () => { - try { - const api = new CharactersApi(); - const res = await api.ListAllCharacters(); - if (!res.success || !res.data) return; - - const serverNames = new Set(res.data.map((c) => c.name)); - let resolved = false; - setPendingCharacters((prev) => - prev.filter((p) => { - if (serverNames.has(p.name)) { - resolved = true; - return false; - } - return true; - }), - ); - if (resolved) { - const store = useCharactersStore.getState(); - store.setCharacters( - res.data.map((c) => ({ - character_token: c.token, - name: c.name, - avatar_image_url: c.maybe_avatar?.cdn_url, - })), - ); - store.setLoaded(true); - setRefreshKey((k) => k + 1); - } - } catch { - // retry next tick - } - }, POLL_INTERVAL_MS); - - return () => clearInterval(interval); - }, [pendingCharacters.length]); - - // Time out failed creations so the "Creating..." card never sticks forever. - useEffect(() => { - if (pendingCharacters.length === 0) return; - - const timers = pendingCharacters.map((pending) => - setTimeout( - () => { - setPendingCharacters((prev) => { - if (!prev.some((p) => p.name === pending.name)) return prev; - toast.error(`Character "${pending.name}" failed to create`); - return prev.filter((p) => p.name !== pending.name); - }); - }, - Math.max(0, PENDING_STALE_MS - (Date.now() - pending.createdAt)), - ), - ); - - return () => timers.forEach(clearTimeout); - }, [pendingCharacters]); - - return ( - -
- {view === "list" ? ( - setView("create")} - onSelectCharacter={onSelectCharacter} - onEditCharacter={handleEdit} - pendingCharacters={pendingCharacters} - onPendingResolved={removePending} - /> - ) : view === "create" ? ( - setView("list")} - onCreated={handleCreated} - /> - ) : editingCharacter ? ( - { - setEditingCharacter(null); - setView("list"); - }} - onSaved={handleEditDone} - /> - ) : null} -
-
- ); -}; - -// --------------------------------------------------------------------------- -// Character List View -// --------------------------------------------------------------------------- - -const CharacterListView = ({ - onCreateClick, - onSelectCharacter, - onEditCharacter, - pendingCharacters, - onPendingResolved, -}: { - onCreateClick: () => void; - onSelectCharacter?: (character: Character) => void; - onEditCharacter: (character: Character) => void; - pendingCharacters: PendingCharacter[]; - onPendingResolved: (name: string) => void; -}) => { - const [characters, setCharacters] = useState([]); - const [loading, setLoading] = useState(true); - const [confirmDelete, setConfirmDelete] = useState(null); - const [isDeleting, setIsDeleting] = useState(false); - - const storeSetCharacters = useCharactersStore((s) => s.setCharacters); - const storeSetLoaded = useCharactersStore((s) => s.setLoaded); - const storeRemoveCharacter = useCharactersStore((s) => s.removeCharacter); - - const syncToStore = useCallback( - (chars: Character[]) => { - storeSetCharacters( - chars.map((c) => ({ - character_token: c.token, - name: c.name, - avatar_image_url: c.maybe_avatar?.cdn_url, - })), - ); - storeSetLoaded(true); - }, - [storeSetCharacters, storeSetLoaded], - ); - - const fetchCharacters = useCallback(async () => { - try { - const api = new CharactersApi(); - const res = await api.ListAllCharacters(); - if (res.success && res.data) { - setCharacters(res.data); - syncToStore(res.data); - } - } catch { - storeSetLoaded(true); - } finally { - setLoading(false); - } - }, [syncToStore, storeSetLoaded]); - - useEffect(() => { - fetchCharacters(); - }, [fetchCharacters]); - - // Drop pendings already represented in the fetched list (no duplicate cards) - useEffect(() => { - if (pendingCharacters.length === 0) return; - const names = new Set(characters.map((c) => c.name)); - for (const pending of pendingCharacters) { - if (names.has(pending.name)) onPendingResolved(pending.name); - } - }, [characters, pendingCharacters, onPendingResolved]); - - const handleDelete = async (character: Character) => { - setIsDeleting(true); - try { - const api = new CharactersApi(); - const res = await api.DeleteCharacter({ - characterToken: character.token, - }); - - if (res.success) { - setCharacters((prev) => - prev.filter((c) => c.token !== character.token), - ); - storeRemoveCharacter(character.token); - toast.success(`Character "${character.name}" deleted`); - } else { - toast.error(res.errorMessage || "Failed to delete character"); - } - } catch { - toast.error("Failed to delete character"); - } finally { - setIsDeleting(false); - setConfirmDelete(null); - } - }; - - return ( -
- {loading && characters.length === 0 ? ( -
- {Array.from({ length: 8 }).map((_, i) => ( -
-
-
-
-
-
-
-
- ))} - -
- ) : ( -
- {/* Create New card */} - - - {/* Pending (creating) characters */} - {pendingCharacters.map((pending) => ( -
-
- {pending.previewUrl ? ( - {pending.name} - ) : ( -
- -
- )} -
- - - Creating... - -
-
-
-

- {pending.name} -

-
-
- ))} - - {characters.map((character) => { - const isUserCreated = character.is_user_created !== false; - - return ( -
- - - {/* Edit / Delete overlay buttons (user-created only) */} - {isUserCreated && ( -
- - -
- )} -
- ); - })} -
- )} - - {/* Delete confirmation overlay */} - {confirmDelete && ( -
-
-

- Delete character? -

-

- This will permanently delete{" "} - {confirmDelete.name}. This action cannot be - undone. -

-
- - -
-
-
- )} -
- ); -}; - -// --------------------------------------------------------------------------- -// Edit Character View -// --------------------------------------------------------------------------- - -const EditCharacterView = ({ - character, - onBack, - onSaved, -}: { - character: Character; - onBack: () => void; - onSaved: () => void; -}) => { - const updateCharacterInStore = useCharactersStore((s) => s.updateCharacter); - const [name, setName] = useState(character.name); - const [description, setDescription] = useState( - character.maybe_description ?? "", - ); - const [saving, setSaving] = useState(false); - - const hasChanges = - name.trim() !== character.name || - (description.trim() || "") !== (character.maybe_description ?? ""); - - const handleSave = async () => { - if (!name.trim()) { - toast.error("Name cannot be empty"); - return; - } - - setSaving(true); - try { - const api = new CharactersApi(); - const res = await api.EditCharacter({ - token: character.token, - updated_name: name.trim() !== character.name ? name.trim() : undefined, - updated_description: - (description.trim() || "") !== (character.maybe_description ?? "") - ? description.trim() || null - : undefined, - }); - - if (res.success) { - toast.success("Character updated"); - updateCharacterInStore(character.token, { name: name.trim() }); - onSaved(); - } else { - toast.error(res.errorMessage || "Failed to update character"); - } - } catch { - toast.error("Failed to update character"); - } finally { - setSaving(false); - } - }; - - return ( -
-
- {/* Header */} -
- -

Edit Character

-
- - {/* Avatar preview */} - {character.maybe_avatar?.cdn_url && ( -
- {character.name} -
- )} - - {/* Name input */} -
- - setName(e.target.value)} - placeholder="Character name" - autoComplete="off" - className="w-full border border-white/10 bg-white/[0.07] px-3 py-2 text-sm text-white placeholder-white/50 outline-none transition-colors focus:border-primary" - /> -
- - {/* Description input */} -
- -