feat(convert): show supported source formats when picking a target - #594
feat(convert): show supported source formats when picking a target#594OrbanGergo wants to merge 10 commits into
Conversation
There was a problem hiding this comment.
1 issue found across 4 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="src/pages/convertSources.tsx">
<violation number="1" location="src/pages/convertSources.tsx:8">
P0: The whole feature is non-functional as submitted: `convertSources` is defined and exported but never registered on the server. Every other page plugin in `src/index.tsx` is mounted with `.use(...)`, but this one is missing, so the frontend `fetch('/convert-sources')` returns a 404 and the `.catch` handler always clears the new “Supported source types” element. Add the import and `.use(convertSources)` in `src/index.tsx` alongside the other routes (e.g. next to `.use(chooseConverter)`).</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
| // Place this next to (or inside the same file as) the existing | ||
| // `/conversions` route, so it shares whatever auth/db conventions | ||
| // that route already uses. | ||
| export const convertSources = new Elysia().use(userService).post( |
There was a problem hiding this comment.
P0: The whole feature is non-functional as submitted: convertSources is defined and exported but never registered on the server. Every other page plugin in src/index.tsx is mounted with .use(...), but this one is missing, so the frontend fetch('/convert-sources') returns a 404 and the .catch handler always clears the new “Supported source types” element. Add the import and .use(convertSources) in src/index.tsx alongside the other routes (e.g. next to .use(chooseConverter)).
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At src/pages/convertSources.tsx, line 8:
<comment>The whole feature is non-functional as submitted: `convertSources` is defined and exported but never registered on the server. Every other page plugin in `src/index.tsx` is mounted with `.use(...)`, but this one is missing, so the frontend `fetch('/convert-sources')` returns a 404 and the `.catch` handler always clears the new “Supported source types” element. Add the import and `.use(convertSources)` in `src/index.tsx` alongside the other routes (e.g. next to `.use(chooseConverter)`).</comment>
<file context>
@@ -0,0 +1,19 @@
+// Place this next to (or inside the same file as) the existing
+// `/conversions` route, so it shares whatever auth/db conventions
+// that route already uses.
+export const convertSources = new Elysia().use(userService).post(
+ "/convert-sources",
+ ({ body }) => {
</file context>
There was a problem hiding this comment.
All reported issues were addressed across 5 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
There was a problem hiding this comment.
All reported issues were addressed across 5 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
There was a problem hiding this comment.
All reported issues were addressed across 5 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
There was a problem hiding this comment.
All reported issues were addressed across 5 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
6be183a to
0cf5af5
Compare
Closes #515.
Changes
Show supported source formats for a chosen target
Adds a
getPossibleSources(to)helper inconverters/main.ts— the reverseof the existing
getPossibleTargets(from)— that looks up, for a givenoutput extension, every input extension (across all converters) capable of
producing it.
A new
POST /convert-sourcesendpoint exposes this lookup to the frontend,following the same request/response pattern as the existing
/conversionsendpoint.
On the frontend, clicking a target format now shows the list of supported
source formats directly below the Convert button.
Implementation notes
getPossibleSourcesmirrors the existingpossibleTargetsconstructionin
converters/main.ts, just inverted, and returns results grouped byconverter (same shape as
getPossibleTargets)./convert-sourcesright aftera target button is clicked; the upload/convert flow itself is unchanged.
Summary by cubic
Show supported source formats when a target is selected, so users know valid inputs before converting. Adds a reverse lookup, exposes it via
POST /convert-sources, and avoids stale UI results.New Features
getPossibleSources(to)returns source formats grouped by converter, keyed by the raw target string (no normalization) to avoid merging distinct targets.POST /convert-sourcesadded insrc/pages/convertSources.tsx, registered insrc/index.tsxwith request schema validation.Bug Fixes
extension::converter; clear the list on errors, empty results, and when the search bar is cleared.Written for commit 96eee23. Summary will update on new commits.