Skip to content

AI media harness for planning, generating, and editing locally

TypeScript

Shot tiles take the rendered frame's shape and grow to 360px; bigger reference tiles; the selected reference's icon fills the pane

Bitti5cf0b470720e
diff --git a/src/components/workspace/ShotThumbnail.tsx b/src/components/workspace/ShotThumbnail.tsx
index a5f1fa3..0b960c5 100644
--- a/src/components/workspace/ShotThumbnail.tsx
+++ b/src/components/workspace/ShotThumbnail.tsx
@@ -37,6 +37,9 @@ const PLAY_EVENT = "slopus:play-generated-shot";
/** Drawn frames, keyed by file and time. */
const POSTERS = new Map<string, string>();
+/* Each poster's width / height, so a tile that remounts takes the frame's
+ shape at once instead of starting 16:9 and jumping. */
+const POSTER_SHAPES = new Map<string, string>();
/** Files that opened and would not give up a picture, so the next card does not
* read the whole thing again for the same silence. */
const UNREADABLE = new Set<string>();
@@ -284,6 +287,8 @@ export function ShotThumbnail({ folderPath, job, seconds, endSeconds = sceneDura
const [playing, setPlaying] = useState(false);
const [playFailed, setPlayFailed] = useState(false);
const [estimateNow, setEstimateNow] = useState(() => Date.now());
+ /* Bumped when a poster's shape is first measured, to re-render with it. */
+ const [, setShapeSeen] = useState(0);
const videoRef = useRef<HTMLVideoElement>(null);
const requestRef = useRef(0);
const cutTimerRef = useRef<number | null>(null);
@@ -393,10 +398,14 @@ export function ShotThumbnail({ folderPath, job, seconds, endSeconds = sceneDura
};
if (result.poster) {
+ const poster = result.poster;
+ const shape = POSTER_SHAPES.get(poster);
const action = playFailed ? "Playback unavailable" : loadingPlayback ? "Opening shot" : playing ? "Pause" : "Play";
return <button
type="button"
className="shot-thumb shot-thumb--poster shot-thumb--playable"
+ /* The tile takes the rendered frame's own shape, not a fixed 16:9. */
+ style={shape ? { aspectRatio: shape } : undefined}
aria-label={`${action} shot ${shotNumber} of ${job.title}`}
data-tooltip={`${action} this shot only (${seconds.toFixed(1)}s–${endSeconds.toFixed(1)}s)`}
onClick={(event) => void togglePlayback(event)}
@@ -413,7 +422,12 @@ export function ShotThumbnail({ folderPath, job, seconds, endSeconds = sceneDura
onTimeUpdate={stopAtCut}
onEnded={stopAtCut}
/>
- : <img src={result.poster} alt="" loading="lazy" />}
+ : <img src={poster} alt="" loading="lazy" onLoad={(event) => {
+ const { naturalWidth: width, naturalHeight: height } = event.currentTarget;
+ if (!width || !height || POSTER_SHAPES.get(poster) === `${width} / ${height}`) return;
+ POSTER_SHAPES.set(poster, `${width} / ${height}`);
+ setShapeSeen((count) => count + 1);
+ }} />}
<span className={`shot-thumb__play ${loadingPlayback ? "shot-thumb__play--loading" : ""}`} aria-hidden="true">
{loadingPlayback ? <Spinner20 className="spin" /> : playing ? <Pause20 /> : playFailed ? <Warning20 /> : <Play20Filled />}
</span>
diff --git a/src/styles/generator.css b/src/styles/generator.css
index e5492a2..cd91641 100644
--- a/src/styles/generator.css
+++ b/src/styles/generator.css
@@ -354,14 +354,14 @@
of the shot's words. 4px corners and a hairline edge like any Fluent grid
item; rest, hover and the open shot are the shared selectable-card rule
(.ui-selectable--card: an accent fill and ring). The grid auto-fills
- fixed 280px columns: resizing the inspector wraps tiles onto more rows
+ fixed 360px columns: resizing the inspector wraps tiles onto more rows
rather than growing or shrinking them.
========================================================================== */
.shot-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(0, var(--shot-tile-width)));
- --shot-tile-width: 280px;
+ --shot-tile-width: 360px;
gap: var(--space-2);
margin: 0;
padding: var(--space-2) var(--space-3) var(--space-3);
@@ -523,7 +523,9 @@
/* --- The frame a tile shows ---------------------------------------------------
- A real frame of the shot once the scene has been rendered, and nothing
+ A real frame of the shot once the scene has been rendered, in that frame's
+ own shape (ShotThumbnail sets aspect-ratio from the poster; 16:9 until
+ then), and nothing
invented before that: the placeholder says which state the scene is in
instead. Same rule as the media thumb and the reference card.
========================================================================== */
diff --git a/src/styles/references.css b/src/styles/references.css
index e971586..6e5eaef 100644
--- a/src/styles/references.css
+++ b/src/styles/references.css
@@ -57,14 +57,14 @@
}
/* --- Icons view ---------------------------------------------------------------
- Auto-filling 176px-and-up tiles: a square picture and a 12px name. Rest, hover and
+ Auto-filling 240px-and-up tiles: a square picture and a 12px name. Rest, hover and
selection are the shared selectable-card rule (.ui-selectable--card): a
fill under the mouse, an accent fill and ring when selected.
========================================================================== */
.reference-grid {
display: grid;
- grid-template-columns: repeat(auto-fill, minmax(176px, 1fr));
+ grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
gap: var(--space-2);
padding: var(--space-2) var(--space-3);
}
@@ -115,8 +115,8 @@
}
.reference-art--text svg {
- width: 48px;
- height: 48px;
+ width: 64px;
+ height: 64px;
}
.reference-art--photo img {
@@ -320,8 +320,7 @@
}
.reference-detail-art.reference-detail-art--preset {
- width: 160px;
- max-width: 100%;
+ width: 100%; /* the selected reference's icon fills the pane's width */
height: auto;
aspect-ratio: 1;
justify-self: center;
@@ -345,7 +344,7 @@
display: block;
width: 100%;
height: auto;
- max-height: 160px;
+ max-height: 480px; /* full width, but a tall portrait photo stops short of the whole pane */
padding: 0;
object-fit: contain;
}