Skip to content

feat(convert): show supported source formats when picking a target - #594

Open
OrbanGergo wants to merge 10 commits into
C4illin:mainfrom
OrbanGergo:feat/supported-source-formats-for-targets
Open

feat(convert): show supported source formats when picking a target#594
OrbanGergo wants to merge 10 commits into
C4illin:mainfrom
OrbanGergo:feat/supported-source-formats-for-targets

Conversation

@OrbanGergo

@OrbanGergo OrbanGergo commented Aug 1, 2026

Copy link
Copy Markdown

Closes #515.

Changes

Show supported source formats for a chosen target

Adds a getPossibleSources(to) helper in converters/main.ts — the reverse
of the existing getPossibleTargets(from) — that looks up, for a given
output extension, every input extension (across all converters) capable of
producing it.

A new POST /convert-sources endpoint exposes this lookup to the frontend,
following the same request/response pattern as the existing /conversions
endpoint.

On the frontend, clicking a target format now shows the list of supported
source formats directly below the Convert button.

Implementation notes

  • getPossibleSources mirrors the existing possibleTargets construction
    in converters/main.ts, just inverted, and returns results grouped by
    converter (same shape as getPossibleTargets).
  • No changes to existing converter definitions were needed.
  • The lookup runs client-side via a fetch to /convert-sources right after
    a 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

    • Backend: getPossibleSources(to) returns source formats grouped by converter, keyed by the raw target string (no normalization) to avoid merging distinct targets.
    • API: POST /convert-sources added in src/pages/convertSources.tsx, registered in src/index.tsx with request schema validation.
    • UI: Shows a de-duplicated, sorted list of supported sources under the Convert button.
  • Bug Fixes

    • UI: Prevent race conditions by tagging requests with 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.

Review in cubic

@github-actions github-actions Bot added Feature and removed Feature labels Aug 1, 2026

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>

Comment thread public/script.js
Comment thread src/converters/main.ts
@github-actions github-actions Bot added Feature and removed Feature labels Aug 1, 2026

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 5 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread src/converters/main.ts
Comment thread public/script.js
Comment thread public/script.js Outdated
@github-actions github-actions Bot added Feature and removed Feature labels Aug 1, 2026

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 5 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread public/script.js Outdated
Comment thread public/script.js Outdated
@github-actions github-actions Bot added Feature and removed Feature labels Aug 1, 2026

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 5 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread public/script.js Outdated
Comment thread src/converters/main.ts Outdated
@github-actions github-actions Bot added Feature and removed Feature labels Aug 1, 2026

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 5 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread src/converters/main.ts Outdated
Comment thread public/script.js Outdated
@github-actions github-actions Bot added Feature and removed Feature labels Aug 1, 2026

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 5 files

Re-trigger cubic

@OrbanGergo
OrbanGergo force-pushed the feat/supported-source-formats-for-targets branch from 6be183a to 0cf5af5 Compare August 3, 2026 19:21
@github-actions github-actions Bot removed the Feature label Aug 3, 2026
@github-actions github-actions Bot added Feature and removed Feature labels Aug 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request] Show the list of source formats when I choose the target format.

1 participant