Skip to content

Added image_set for correct file pulling on the front end image calls - #490

Merged
ddon merged 12 commits into
BeamLabEU:devfrom
alexdont:dev
Apr 15, 2026
Merged

Added image_set for correct file pulling on the front end image calls#490
ddon merged 12 commits into
BeamLabEU:devfrom
alexdont:dev

Conversation

@alexdont

Copy link
Copy Markdown
Contributor

No description provided.

Alexander Donand others added 8 commits April 13, 2026 23:41
Replace Ecto add_if_not_exists with raw SQL DO block that checks
information_schema before adding the column, avoiding FK constraint
conflicts when the migration runs against an existing schema.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Allow searching media files by UUID in addition to file name, enabling
quick lookup of files by their identifier.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add break-all and overflow constraints to the filename, title, and
description fields in the media detail info panel to prevent long
unbroken strings from overflowing the sidebar.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Display width×height and file size on each variant download button
so users can quickly see the size details of each variant.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Fall back to the main file record's size and dimensions when the
original file instance lacks them.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add alternative_formats field to storage dimensions so admins can
configure additional output formats (WebP, AVIF) per dimension. The
variant generator creates extra file instances for each alternative
format alongside the primary.
Add <.image_set> component that renders a <picture> element with
<source> tags per format and srcset with width descriptors, letting
browsers pick the best supported format and optimal size.
- V97 migration adds alternative_formats column
- Dimension schema validates alternative formats
- Variant generator expands dimensions with alternatives
- Admin UI: checkbox group on dimension form, badges on list
- VariantNaming utility for parsing variant names
- Storage helpers for bulk-loading variant data
- Component groups by actual mime_type to handle failed conversions
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
When a different user uploads a file with the same checksum, clone
the File record and instances to reuse the existing storage path
instead of re-storing. On deletion, only remove physical files when
no other File records share the same path.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

@ddonddon 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.

Pincer review — Approve (with one item to confirm)

Clean, production-quality PR. The responsive <.image_set> component, VariantNaming utility, V97 migration, and V95 idempotency fix are all well-implemented. Blocking issue is minor.

Confirm before merging:

  • Storage.list_image_set_variants/1 is referenced in ImageSet.load_variants/1 but doesn't appear in this diff. If it's missing, the component will silently return no variants for every auto-load call. Please confirm it exists (or is being added in a companion commit).

Non-blocking notes:

  • Enum.map_join in dimensions.html.heex produces "JPEG +WEBP +AVIF" with a leading + separator — check the rendered output matches intent. Switching to Enum.join(..., " + ") with the + outside the map_join would read more cleanly.
  • prefix_str/1 in V97 is duplicated from other migrations — pre-existing pattern, just flagging for future cleanup.
  • PNG <source> entries: all browsers support PNG natively, so a <source type="image/png"> is redundant. Low priority but worth knowing.

Ready to merge once list_image_set_variants/1 is confirmed.

Add an All Files button in the sidebar that shows every file across
all folders in a flat grid/list without folder cards. Rename the
previous All Files button to Root for clarity.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@ddon

ddon commented Apr 14, 2026

Copy link
Copy Markdown
Contributor

Hi @alexdont — thanks for the updates! Reviewed again and it looks like no new commits have landed since our last round of feedback in dev_docs/pull_requests/2026/490-image-set-alternative-formats/CLAUDE_REVIEW.md. Still waiting on a few items before we can merge:

  • BUG — MEDIUM: Please confirm Storage.list_image_set_variants/1 actually exists. The ImageSet component's auto-load guard (Code.ensure_loaded?/1 + function_exported?/3) will silently return no variants if the function isn't defined, so if it's missing we'd like it added in this PR (or a companion commit referenced here).
  • IMPROVEMENT — MEDIUM: The Enum.map_join in the dimensions table leaks the separator — renders as "JPEG +WEBP" with a stray leading " +". Please adjust the join so the primary format and alternatives render cleanly.
  • IMPROVEMENT — MEDIUM: Move the <% current_alternatives = ... %> computation out of the HEEx template and into an assign/3 in the LiveView — cleaner and easier to test.
  • NITPICK: Consider omitting PNG from <picture><source> entries (keep as <img> fallback only), and adding a guard for the empty-srcset case when fallback_variants is empty.

The rest of the PR looks great — migration idempotency, component design, and VariantNaming utility are all solid. Just need these polished and we're good to merge. Thanks!

Pass the current folder UUID when reloading files after upload so
the view stays in the current folder and new files appear there.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@ddon

ddon commented Apr 15, 2026

Copy link
Copy Markdown
Contributor

@alexdont waiting for your fixed and and now looks like there are conflicts as well to resolve

Alexander Donand others added 2 commits April 15, 2026 16:57
- Fix stray separator in dimensions table format display
- Move alternative_formats template computation into LiveView assigns
- Omit PNG from <picture><source> entries (keep as <img> fallback)
- Guard empty srcset case when fallback_variants is empty
- Bump migration from V97 to V98 with V97 as reserved placeholder
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@alexdont

Copy link
Copy Markdown
ContributorAuthor

fixed the issues

@ddonddon 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.

Follow-up review: all prior findings addressed in 5d0dcc7. Ready to merge.

@ddon
ddon merged commit 1ddcc07 into BeamLabEU:devApr 15, 2026
ddon pushed a commit that referenced this pull request Apr 15, 2026
- Bump version 1.7.96 → 1.7.97
- CHANGELOG: remove duplicate 1.7.96 block, add 1.7.97 entry covering V97
per-item markup, V98 alternative_formats, ImageSet component, VariantNaming,
multi-format variants, V95 idempotency fix, UI polish
- Add PR #490 follow-up review section confirming all prior findings resolved
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for freeto 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.

2 participants

@alexdont@ddon