feat: add custom text input via tabbed InputBar#25
Open
orpheuslummis wants to merge 4 commits intoanantham:mainfrom
Open
feat: add custom text input via tabbed InputBar#25orpheuslummis wants to merge 4 commits intoanantham:mainfrom
orpheuslummis wants to merge 4 commits intoanantham:mainfrom
Conversation
|
@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.
1218e0e to
c4133c1
Compare
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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,
importCustomTextconstructs anImportedChapterwith a synthetic URL (custom.lexiconforge.local/text/{timestamp}) and feeds it into the existingtransformImportedChapters→ImportOps.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— NewimportCustomTextaction onChaptersActionsinterface + implementation.services/telemetryService.ts— Unrelated bugfix:crypto.randomUUID()fallback for non-HTTPS contexts.What doesn't change
services/adapters.ts— custom text bypasses adapters entirelyservices/navigationService.ts— the store action handles everything directlyservices/stableIdService.ts—transformImportedChaptersworks as-is with synthetic URLsservices/db/operations/imports.ts—importStableSessionDataworks as-istypes.ts—ImportedChapter,EnhancedChapteralready have all needed fieldsTest plan