Skip to content

Conversation

@orpheuslummis
Copy link

@orpheuslummis orpheuslummis commented Feb 4, 2026

Summary

Adds a "Paste Text" tab to the InputBar so users can paste raw text directly for reading and translation, without needing a URL from a supported website. Useful for classical texts, poetry, sutras, or anything not hosted online.

How it works

The InputBar gains two tabs: From URL (existing behavior, unchanged) and Paste Text (new). The paste tab has fields for title, source language, and a textarea for content. The landing page heading and divider text are updated to be mode-neutral.

Under the hood, importCustomText constructs an ImportedChapter with a synthetic URL (custom.lexiconforge.local/text/{timestamp}) and feeds it into the existing transformImportedChaptersImportOps.importStableSessionData → Zustand store merge pipeline. No changes to adapters, navigation service, stable ID generation, or persistence layer.

Files changed

  • components/InputBar.tsx — Tabbed UI: "From URL" / "Paste Text". All existing URL-mode behavior preserved identically.
  • components/LandingPage.tsx — Updated heading, subtitle, and divider to be mode-neutral ("Translate Any Text", "OR START FROM SCRATCH").
  • store/slices/chaptersSlice.ts — New importCustomText action on ChaptersActions interface + implementation.
  • services/telemetryService.ts — Unrelated bugfix: crypto.randomUUID() fallback for non-HTTPS contexts.

What doesn't change

  • services/adapters.ts — custom text bypasses adapters entirely
  • services/navigationService.ts — the store action handles everything directly
  • services/stableIdService.tstransformImportedChapters works as-is with synthetic URLs
  • services/db/operations/imports.tsimportStableSessionData works as-is
  • types.tsImportedChapter, EnhancedChapter already have all needed fields

Test plan

  • vite build passes
  • TypeScript: no errors in changed files
  • All 822 existing tests pass (0 regressions)
  • Manual: open app → Paste Text tab → paste text → Import Text → chapter appears in reader
  • Manual: translation works on pasted text
  • Manual: page reload preserves the chapter (IndexedDB persistence)

@vercel
Copy link

vercel bot commented Feb 4, 2026

@orpheuslummis is attempting to deploy a commit to the Aditya's projects Team on Vercel.

A member of the Team first needs to authorize it.

crypto.randomUUID() requires a secure context (HTTPS or localhost).
Add a typeof check with Date.now + Math.random fallback so the app
loads when accessed via plain HTTP on a network IP.
Add a "Paste Text" tab to InputBar alongside the existing "From URL"
tab. Users can paste raw text with a title and source language for
reading and translation, bypassing the URL fetch pipeline entirely.

The new importCustomText store action constructs an ImportedChapter
with a synthetic URL (custom.lexiconforge.local), runs it through
the existing transformImportedChapters pipeline, persists to IndexedDB,
and merges into the Zustand store — same path as URL-fetched chapters.
@orpheuslummis orpheuslummis force-pushed the feat/opus-custom-text-input branch from 1218e0e to c4133c1 Compare February 4, 2026 17:16
@orpheuslummis orpheuslummis changed the title feat: add custom text input for direct text pasting feat: add custom text input via tabbed InputBar Feb 4, 2026
The heading, subtitle, and divider were all URL-specific, which
doesn't make sense when the Paste Text tab is active.

- "OR START FROM A URL" → "OR START FROM SCRATCH"
- "Translate Any Web Novel Chapter" → "Translate Any Text"
- "Paste a URL from supported sites..." → "Fetch from a supported
  site or paste your own text"
The default viewMode is 'english', which shows translationResult.translation.
Since freshly imported custom text has no translation yet, the content area
appeared empty. Now we switch to 'original' view after import so the user
immediately sees their pasted text.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant