Skip to content

Give the app a sidebar, and the media library a screen of its own - #8

Open
pallaoro wants to merge 1 commit into
mainfrom
appnav-host-bridge
Open

Give the app a sidebar, and the media library a screen of its own#8
pallaoro wants to merge 1 commit into
mainfrom
appnav-host-bridge

Conversation

@pallaoro

Copy link
Copy Markdown
Member

The editor had no navigation at all — one top header — and the global footage
library sat in a tab inside a single composition. The library is not
per-composition state, so it becomes a screen of its own next to the gallery.

What changed

  • /media route rendering the existing MediaPanel, moved rather than
    rewritten. The tab is gone from the composition editor; RendersPanel is
    genuinely per-composition and stays.
  • <AppNav> from @clawnify/app defines the navigation once. Opened
    directly it paints the app's own 275px rail; embedded in the Clawnify
    dashboard it paints nothing and hands the same list to the dashboard's
    sidebar, so there is never a second nav.
    • Compositions is home, so it is the brand row rather than a listed item;
      Media is the single row.
    • The Media badge is the asset count. That is why the asset list moved up
      to <App>: MediaPanel now reads it and asks for a reload, so uploading
      or deleting a file moves the number in both sidebars in the same tick —
      no extra endpoint, no polling.
  • reportLocation() on every router change, so a dashboard reload lands back
    on the screen you were on.

Two details worth a second look

  • The rail override block in styles.css keeps only geometry inside
    @media (min-width: 768px). aside.cn-nav outranks the SDK's own
    .cn-nav, and specificity is resolved before source order, so an unguarded
    width: 275px would be a 275px column on a 390px phone that no ordering
    could fix. Paint and type stay global, and they map onto this app's tokens
    (the SDK's fallbacks assume a --sunken this app calls --surface-sunken,
    and a --primary that is ink here).
  • The shell takes a definite h-dvh rather than a min-height. With a
    min-height every descendant height is indefinite, and the editor's
    resizable group — which sizes off a percentage height — collapses to a
    4px seam below 768px. Verified against main to confirm it was my
    regression and not pre-existing.

Verified

  • vite build clean, tsc --noEmit clean.
  • Rendered at two viewports against a live dev server: 1280px → rail is a
    275px column, 800px tall, no page overflow; 390px → rail is a full-width
    390 x 45 horizontal strip, scrollWidth === clientWidth, no sideways scroll.
  • /media renders the library (dropzone, seeded asset, assets/<key> paths)
    with the Media row active; / still renders the gallery; the composition
    editor still opens with its timeline/compose/renders switcher and a
    full-height panel group at both widths.

The editor had no navigation: one top header, and the global footage library
buried in a tab inside a single composition, where it did not belong. It is
not per-composition state, so it is now a screen next to the gallery.

Navigation is defined once with <AppNav> from @clawnify/app, which paints the
app's own rail when it is opened directly and hands the same list to the
Clawnify dashboard's sidebar when it is embedded there, so there is never a
second nav. The gallery is home (the app's name opens it) and Media is the one
row; its badge is the asset count, which is why the list moved up to <App> —
uploading or deleting a file now moves the number in both sidebars in the same
tick, with no extra endpoint and no polling.

Two details worth keeping:

- The rail override block puts only geometry inside `@media (min-width: 768px)`.
  Our `aside.cn-nav` outranks the SDK's own `.cn-nav`, and specificity is
  resolved before source order, so an unguarded width would be a 275px column
  on a phone that no ordering could fix.
- The shell takes a definite `h-dvh`. A min-height leaves descendant heights
  indefinite, and the editor's resizable group, which sizes off a percentage
  height, collapses to a 4px seam below 768px.

Measured: 275px column at 1280px, full-width 45px strip at 390px with no
sideways scroll on either.
Sign up for free to 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.

1 participant