Skip to content

Updated media browser with better modal, fixed persistant url on login - #519

Merged
ddon merged 7 commits into
BeamLabEU:devfrom
alexdont:dev
May 8, 2026
Merged

Updated media browser with better modal, fixed persistant url on login #519
ddon merged 7 commits into
BeamLabEU:devfrom
alexdont:dev

Conversation

@alexdont

Copy link
Copy Markdown
Contributor

No description provided.

Alexander Donand others added 7 commits May 6, 2026 21:52
Previously, MediaBrowser required an explicit viewer={true} attr to
open the modal on click. Without it, non-admin clicks fell through to
"enter select_mode and toggle the file in" — which is picker behaviour
that surprised callers expecting "click to view what this is."
Drops the viewer attr entirely and folds its branch into the default:
non-admin + not in select_mode → modal opens. Admin still navigates to
the rich detail page; bulk-select is still reachable via the toolbar's
Select button (once on, clicks toggle selection rather than opening the
modal). No parent-app code changes required — viewer={true} is now a
silently-ignored no-op for any caller that still passes it.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Was w-11/12 max-w-7xl (capped at 1280px) and lg:h-[80vh]; now
w-[95vw] max-w-none h-[90vh]. max-w-none clears daisyUI's default
modal-box width cap so the 95vw actually applies on wide screens.
The inner viewer/sidebar row tracks the modal-box height with
lg:h-full instead of its previous fixed 80vh.
On a 1920x1080 screen the modal is now ~1824 x 972px — most of the
viewport, leaving a thin backdrop frame. Plenty of room for the image
preview and a comfortable comments-in-sidebar.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Mobile (<lg): pin modal-box with !fixed !inset-0 so it covers the full
viewport without daisyUI v5's max-width:32rem cap or iOS Safari's
100vh / 100dvh quirks getting in the way. Image gets w-full so it
matches the screen width without a right-edge gap. Close button moves
into the sidebar title row in normal flow with flex-shrink-0, so a
long filename can't squeeze it out and overflow:hidden / iPhone's
rounded corners / DevTools' device-frame chrome can't clip it.
Desktop (lg+): reverts to the previous centred 95vw × 90vh modal with
rounded corners — the !inset-auto / lg:!w-[95vw] / lg:!h-[90vh] rules
unwind the mobile pinning at the lg breakpoint.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Previous bg-base-100/80 blended into light image content, making the
X invisible on photo backgrounds. Solid bg-base-100 + ring-1
ring-base-300 + shadow-lg gives a guaranteed-visible boundary against
any content. Sidebar h2 keeps pr-10 so the filename doesn't run into
the button.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Wheel, double-tap, pinch, and drag-pan zoom on images inside the
MediaBrowser modal. Implemented as a MediaImageZoom LiveView hook
that lazy-loads @panzoom/panzoom@4.6.0 from jsDelivr — mirrors the
existing SortableJS lazy-load pattern, so no JS build step or new
runtime dep on the library side.
The img id is keyed by file_uuid so stepping prev/next forces a
clean Panzoom remount per file (no leaked zoom state). Non-image
files (PDF, video, generic icon) don't render the <img>, so the
hook never attaches there.
Parent apps need `mix phoenix_kit.update` to refresh the vendored
phoenix_kit.js before the hook becomes available client-side.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The prev/next chevrons used `absolute top-1/2 -translate-y-1/2` for
vertical centering, but daisyUI's `:active` state replaces
`transform` with `scale(0.97)` on click — clobbering the translateY
and dropping the button by 50% of its own height for the duration of
the press. Move the absolute positioning + centering translate to a
wrapper div, leaving the button free to apply its own active-state
scale without losing position.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Previously, an unauthenticated user clicking a protected admin /
dashboard link got redirected to /users/log-in and — after signing
in — landed on the home page instead of where they were going. The
return_to plumbing was already wired end-to-end (login form's hidden
input, session.maybe_store_return_to_from_params, log_in_user's
session lookup), but the LiveView on_mount hooks redirected to the
login page without appending the original URL as ?return_to=, so the
chain never started.
Add a login_path_with_return_to/1 helper that reads the request URI
from get_connect_info(socket, :uri) and builds /users/log-in
?return_to=<encoded path+query>. Guards against self-redirect when
the user is already on the login page. Use it from all five
on_mount hooks that gate authenticated content:
- :phoenix_kit_ensure_authenticated
- :phoenix_kit_ensure_authenticated_scope
- :phoenix_kit_ensure_owner
- :phoenix_kit_ensure_admin
- :phoenix_kit_ensure_module_access
Open-redirect protection is already handled downstream by
Login.sanitize_return_to/1, so a malicious return_to=//evil.com is
silently dropped. The plug-level require_authenticated_user/2
already calls maybe_store_return_to/1 — no change there.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@ddon
ddon merged commit 8205e88 into BeamLabEU:devMay 8, 2026
ddon added a commit that referenced this pull request May 8, 2026
Eight post-merge reviews covering V111 PDF tables, the DB-module
extraction, MediaBrowser modal + LV login return_to, external-plugin
admin permissions, dashboard sidebar gettext, live Hex.pm known-packages
fetch, the publishing routing-strategy shim, and the LanguageSwitcher
per_translation_urls attr (plus the bundled DnD work).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
ddon added a commit that referenced this pull request May 8, 2026
…525
Code/doc fixes addressing one finding per PR (or several where
trivial). Each closes a NITPICK or IMPROVEMENT-LOW from the
matching CLAUDE_REVIEW.md; design-level / breaking / risky items
deferred per the FOLLOW_UP.md "Skipped" sections.
- #516: Drop dead `String.to_atom` fallback in OAuth interpolate_url
- #518: Delete stray 0-byte pages_html.ex
- #519: Fix stale `viewer={true}` template comment + login_path
trailing-slash self-loop guard
- #521: Resolution-order doc on permission_key_for_admin_view/1
- #522: Hot-reload safety pitfall in per-module-i18n.md
- #523: KnownPackages — max-pages cap, ensure_table race comment,
Logger-levels operational signals in moduledoc
- #524: __mix_recompile__?/0 note next to apply/3 explanation
- #525: LanguageSwitcher attr doc atom/string keys + DRY resolve_url
per-language + JS sortable:flash defensive status check
Plus FOLLOW_UP.md per PR enumerating closed vs deferred items.
PR #525's FOLLOW_UP also captures the bundled DnD audit trail
(table_default drag-handle scoping, sortable:flash, TR cell-width
preservation) absent from the original PR body.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
ddon added a commit that referenced this pull request May 8, 2026
Three-day window of accumulated work since 1.7.105 (2026-05-05):
PRs #516, #518, #519, #521, #522, #523, #524, #525, plus the
review-doc suite and post-merge triage closing nitpicks across all
eight.
Headline changes — V111 PDF library tables, DB module extracted to
phoenix_kit_db, MediaBrowser modal viewer, sidebar gettext API, live
Hex.pm catalog, publishing routing-strategy shim closing the
/:locale/<literal>/... host-route shadowing bug, LanguageSwitcher
:per_translation_urls, and bundled DnD improvements (drag-handle
scoping, sortable:flash, TR cell-width preservation).
All changes are strictly additive / non-breaking; one transitional
extraction (DB → phoenix_kit_db) requires the paired Hex package
once it ships.
Co-Authored-By: Claude Opus 4.7 (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