Skip to content

The open source AI video agent: turns any coding agent into a video agent, with an editor to change anything it makes.

Studio: Export in the top bar, the cover and folder in the tab's menu; the preview axis starts off (#124)

riverisbuildinga7f0a1ef461f
diff --git a/.changeset/tab-menu-cover.md b/.changeset/tab-menu-cover.md
new file mode 100644
index 0000000..e9e67a4
--- /dev/null
+++ b/.changeset/tab-menu-cover.md
@@ -0,0 +1,7 @@
+---
+"@openfilm/desktop": patch
+"openfilm": patch
+---
+
+On Windows, Open in Settings → General → Storage shows the projects folder again, and the button no longer looks greyed out. In the app, the top bar's "…" menu is now one Export button with an export icon; "Use this frame as the cover" and "Reveal in Finder" (Explorer on Windows) are in the project tab's right-click menu. A tab's close button shows a background when pointed at, without a tooltip.
+The timeline's preview axis starts off: the picture stays at the playhead until you turn it on.
diff --git a/packages/openfilm/studio/server/server.mjs b/packages/openfilm/studio/server/server.mjs
index 8cfbbf5..f466e8b 100644
--- a/packages/openfilm/studio/server/server.mjs
+++ b/packages/openfilm/studio/server/server.mjs
@@ -1125,7 +1125,8 @@ async function clipPoster(root, base, clip, durationMs) {
/** A file in the app the system opens it with. */
function openFile(/** @type {string} */ file) {
const [cmd, ...args] = opener(file);
- try { spawn(cmd, args, { stdio: 'ignore', detached: true, windowsHide: true }).on('error', () => {}).unref(); } catch { /* nothing opens it */ }
+ /* never `windowsHide`: Explorer opens the folder's window, or the file's app, hidden as it was asked to start */
+ try { spawn(cmd, args, { stdio: 'ignore', detached: true }).on('error', () => {}).unref(); } catch { /* nothing opens it */ }
}
/** The person's browser, at `url`. */
diff --git a/packages/openfilm/studio/ui/src/components/ProjectMenu.tsx b/packages/openfilm/studio/ui/src/components/ProjectMenu.tsx
index eb28c98..5e22124 100644
--- a/packages/openfilm/studio/ui/src/components/ProjectMenu.tsx
+++ b/packages/openfilm/studio/ui/src/components/ProjectMenu.tsx
@@ -1,5 +1,5 @@
import React from 'react';
-import { CheckSquare, Download, FolderInput, FolderOpen, FolderSearch, Image, ImageOff, ImagePlus, ListX, MoreHorizontal, Pencil, Trash2 } from 'lucide-react';
+import { CheckSquare, FolderInput, FolderOpen, FolderSearch, Image, ImageOff, ImagePlus, ListX, MoreHorizontal, Pencil, Trash2 } from 'lucide-react';
import { ContextMenu, type ContextMenuEntry } from './ContextMenu';
import { Tooltip } from './Tooltip';
import { useT } from '@/i18n';
@@ -7,10 +7,10 @@ import { useT } from '@/i18n';
/**
* A project's "…" menu.
*
- * Each item shows only when its callback is passed: the editor's top bar passes the current frame as the cover, Export
- * and Reveal in Finder; a card in the Projects popover passes Open / Rename / Select / Move to folder / Change cover /
- * Restore cover / Reveal / Delete, or Locate… and Remove from list when the
- * project's folder is gone. The order is fixed here, not by the props, so the same menu looks the same wherever it
+ * Each item shows only when its callback is passed: the editor's top bar, when it has no tabs (in tabs they are in the
+ * tab's menu), passes the current frame as the cover and Reveal in Finder; a card in the Projects popover passes Open /
+ * Rename / Select / Move to folder / Change cover / Restore cover / Reveal / Delete, or Locate… and Remove from list
+ * when the project's folder is gone. The order is fixed here, not by the props, so the same menu looks the same wherever it
* appears. It is a ContextMenu hanging from the button: it flips above it near the bottom of the window, and Esc
* closes only the menu.
*/
@@ -22,7 +22,6 @@ export function ProjectMenu({
onChangeCover,
onRestoreCover,
onCoverFromFrame,
- onExport,
onReveal,
onLocate,
onRemove,
@@ -43,7 +42,6 @@ export function ProjectMenu({
onRestoreCover?: () => void;
/** The film as the viewer shows it now made the project's cover. */
onCoverFromFrame?: () => void;
- onExport?: () => void;
/** Show the project's folder in Finder / Explorer. */
onReveal?: () => void;
/** Pick the folder a project whose folder is gone is in now. */
@@ -76,7 +74,6 @@ export function ProjectMenu({
add('cover', <ImagePlus size={15} />, t('projects.changeCover'), onChangeCover);
add('coverFrame', <Image size={15} />, t('projects.coverFromFrame'), onCoverFromFrame);
add('coverReset', <ImageOff size={15} />, t('projects.restoreCover'), onRestoreCover);
- add('export', <Download size={15} />, t('projectMenu.export'), onExport);
add('reveal', <FolderOpen size={15} />, t('projects.revealFolder'), onReveal);
add('locate', <FolderSearch size={15} />, t('projects.locate'), onLocate);
add('remove', <ListX size={15} />, t('projects.removeFromList'), onRemove);
diff --git a/packages/openfilm/studio/ui/src/components/ProjectView.tsx b/packages/openfilm/studio/ui/src/components/ProjectView.tsx
index f14523d..f2adf9a 100644
--- a/packages/openfilm/studio/ui/src/components/ProjectView.tsx
+++ b/packages/openfilm/studio/ui/src/components/ProjectView.tsx
@@ -7,7 +7,7 @@
* are written one at a time (see editor/use-film.ts); the agent's writes come in through the folder's events.
*/
import * as React from 'react';
-import { BookmarkPlus, ClipboardCopy, ClipboardPaste, GalleryVerticalEnd, Layers, LibraryBig, MessageSquarePlus, MonitorDown, Settings2, TriangleAlert } from 'lucide-react';
+import { BookmarkPlus, ClipboardCopy, ClipboardPaste, GalleryVerticalEnd, Layers, LibraryBig, MessageSquarePlus, MonitorDown, Settings2, Share, TriangleAlert } from 'lucide-react';
import { applyOps } from '../../../server/ops.mjs';
import { api, ApiError, PREFS_EVENT, projectEvents, type Clip, type Film, type Listing, type Op, type ProjectFilm, type ProjectSettings } from '@/api';
import { useT } from '@/i18n';
@@ -2481,6 +2481,12 @@ export function ProjectView({ projectId, onProject, onLeave }: {
const startRename = () => { setTitleEditWidth(titleBoxRef.current?.offsetWidth ?? null); setTitleDraft(title); setRenaming(true); };
/* in an app with tabs: the tab says this project's title; the tabs are where the projects button and the title are */
const inTabs = Boolean(studioHost?.tabs);
+ /* the film at the playhead, drawn by Studio as the projects list will show it */
+ const coverFromFrame = () => {
+ if (previewError || totalMs <= 0) { toast.show(t('project.filmNotReady')); return; }
+ void api.setCover(projectId, { ms: Math.max(0, Math.min(totalMs - 1, timeRef.current)) })
+ .then(() => toast.show(t('projects.coverSet')), () => toast.showError(t('projects.coverFailed')));
+ };
/* the app's "New Tab" (its menu): the projects, to pick what the new tab shows */
React.useEffect(() => studioHost?.tabs?.onPick(() => setProjectsOpen(true)), []);
React.useEffect(() => { if (title) studioHost?.tabs?.report({ title }); }, [title]);
@@ -2641,7 +2647,7 @@ export function ProjectView({ projectId, onProject, onLeave }: {
</Tooltip>}
</div>
{inTabs ? (
- <TabStrip onRename={renameTab} onNew={() => setProjectsOpen(true)} maxLength={TITLE_MAX_CHARS} />
+ <TabStrip onRename={renameTab} onNew={() => setProjectsOpen(true)} onCoverFromFrame={coverFromFrame} maxLength={TITLE_MAX_CHARS} />
) : <div className="min-w-0 flex-1" />}
<div ref={headerOpsRef} className="pointer-events-auto flex min-w-0 items-center justify-end gap-1">
<ProjectLayoutMenu className={TOP_BTN}
@@ -2652,19 +2658,18 @@ export function ProjectView({ projectId, onProject, onLeave }: {
onTimeline={setTimelineOpen} onInspector={setInspectorOpen}
hostPanel={hostPanel ? { label: hostPanel.label, open: hostPanel.open, onChange: hostPanel.setOpen } : null} />
<ProjectHistoryButton open={historyOpen} onClick={openHistory} className={TOP_BTN} />
- <ProjectMenu className={TOP_BTN}
- /* the film at the playhead, drawn by Studio as the projects list will show it */
- onCoverFromFrame={() => {
- if (previewError || totalMs <= 0) { toast.show(t('project.filmNotReady')); return; }
- void api.setCover(projectId, { ms: Math.max(0, Math.min(totalMs - 1, timeRef.current)) })
- .then(() => toast.show(t('projects.coverSet')), () => toast.showError(t('projects.coverFailed')));
- }}
- onExport={() => {
- if (previewError) toast.showError(`${t('project.filmCannotExport')} ${previewError}`);
- else if (totalMs > 0) setExportOpen(true);
- else toast.show(t('project.filmNotReady'));
- }}
- onReveal={() => reveal('')} />
+ <Tooltip label={t('projectMenu.export')} side="bottom">
+ <button type="button" aria-label={t('projectMenu.export')} aria-haspopup="dialog" aria-expanded={exportOpen} className={TOP_BTN}
+ onClick={() => {
+ if (previewError) toast.showError(`${t('project.filmCannotExport')} ${previewError}`);
+ else if (totalMs > 0) setExportOpen(true);
+ else toast.show(t('project.filmNotReady'));
+ }}>
+ <Share size={16} />
+ </button>
+ </Tooltip>
+ {/* in an app's tabs these are in the tab's menu */}
+ {inTabs ? null : <ProjectMenu className={TOP_BTN} onCoverFromFrame={coverFromFrame} onReveal={() => reveal('')} />}
</div>
<div aria-hidden className="shrink-0 self-stretch" style={{ width: 'var(--titlebar-right-x)' }} />
</div>
diff --git a/packages/openfilm/studio/ui/src/components/TabStrip.tsx b/packages/openfilm/studio/ui/src/components/TabStrip.tsx
index 720625f..85fa424 100644
--- a/packages/openfilm/studio/ui/src/components/TabStrip.tsx
+++ b/packages/openfilm/studio/ui/src/components/TabStrip.tsx
@@ -5,8 +5,9 @@
* spinner), a question waiting for the person (a dot), an export (its percent). A tab is shown by a click, closed by
* its × or a middle click, moved by dragging. Any tab renames its project in place (`onRename`), double-clicked or from
* its menu: its title becomes a field, its words selected. A tab behind takes the double-click's first click to come to
- * front, so its page renames on the second. A right-click opens a tab's menu: rename it, show its project's folder,
- * close it, the others or those to its right.
+ * front, so its page renames on the second. A right-click opens a tab's menu: rename it, make the frame under the
+ * playhead its project's cover (`onCoverFromFrame`, this page's tab only), show its project's folder, close it, the
+ * others or those to its right.
*/
import React from 'react';
import { Loader2, Plus, X } from 'lucide-react';
@@ -37,12 +38,13 @@ export function useHostTabs() {
}
/**
- * `onRename`: a tab's project renamed (this page's own or another's); resolves whether it was. `maxLength`: a name's
- * longest.
+ * `onRename`: a tab's project renamed (this page's own or another's); resolves whether it was. `onCoverFromFrame`:
+ * this page's film as the viewer shows it now made its project's cover. `maxLength`: a name's longest.
*/
-export function TabStrip({ onRename, onNew, maxLength }: {
+export function TabStrip({ onRename, onNew, onCoverFromFrame, maxLength }: {
onRename?: (projectId: string, name: string) => Promise<boolean>;
onNew?: () => void;
+ onCoverFromFrame?: () => void;
maxLength?: number;
}) {
const t = useT();
@@ -93,6 +95,7 @@ export function TabStrip({ onRename, onNew, maxLength }: {
const right = tabsToClose(tabs, id, 'right');
return [
{ id: 'rename', label: t('projectMenu.rename'), disabled: !onRename, onSelect: () => startRename(tab) },
+ ...(onCoverFromFrame && id === self ? [{ id: 'cover-frame', label: t('projects.coverFromFrame'), onSelect: onCoverFromFrame }] : []),
{ id: 'reveal', label: t('projects.revealFolder'), onSelect: () => { void api.revealProject(tab.projectId).catch(() => {}); } },
{ id: 'sep', separator: true },
{ id: 'close', label: t('tabs.close'), onSelect: () => host.close(id) },
@@ -156,11 +159,13 @@ export function TabStrip({ onRename, onNew, maxLength }: {
/>
) : <span className="min-w-0 flex-1 truncate font-medium">{titleOf(tab)}</span>}
{tab.exporting != null ? <span className="shrink-0 font-mono text-[10.5px] text-[var(--text-faint)]">{Math.round(tab.exporting * 100)}%</span> : null}
+ {/* no tooltip of its own, nor the tab's title over it; pointed at, a background shows what a click hits */}
<button
type="button"
aria-label={t('tabs.close')}
+ title=""
onClick={(e) => { e.stopPropagation(); host.close(tab.id); }}
- className={`flex h-[18px] w-[18px] shrink-0 items-center justify-center rounded-[5px] text-[var(--text-faint)] transition hover:bg-[var(--bg-hover)] hover:text-[var(--text)] ${tab.active ? 'opacity-100' : 'opacity-0 group-hover:opacity-100'}`}
+ className={`flex h-[18px] w-[18px] shrink-0 items-center justify-center rounded-[5px] text-[var(--text-faint)] transition hover:bg-[var(--bg-active)] hover:text-[var(--text)] ${tab.active ? 'opacity-100' : 'opacity-0 group-hover:opacity-100'}`}
>
<X size={12} />
</button>
diff --git a/packages/openfilm/studio/ui/src/components/settings/StorageGroup.tsx b/packages/openfilm/studio/ui/src/components/settings/StorageGroup.tsx
index db6faa3..a8331fd 100644
--- a/packages/openfilm/studio/ui/src/components/settings/StorageGroup.tsx
+++ b/packages/openfilm/studio/ui/src/components/settings/StorageGroup.tsx
@@ -92,7 +92,7 @@ export function StorageGroup() {
{place.chosen ? (
<SettingsButton variant="quiet" disabled={busy === which} onClick={() => keep(which, null)} title={place.default}>{t('settings.storage.reset')}</SettingsButton>
) : null}
- <SettingsButton variant="quiet" onClick={() => void api.openLocation(which).catch(() => {})}>{t('settings.storage.show')}</SettingsButton>
+ <SettingsButton onClick={() => void api.openLocation(which).catch(() => {})}>{t('settings.storage.show')}</SettingsButton>
<SettingsButton disabled={busy === which} onClick={() => void change(which)}>{t('settings.storage.change')}</SettingsButton>
</>
)}
diff --git a/packages/openfilm/studio/ui/src/lib/timeline-prefs.test.ts b/packages/openfilm/studio/ui/src/lib/timeline-prefs.test.ts
new file mode 100644
index 0000000..35c0c51
--- /dev/null
+++ b/packages/openfilm/studio/ui/src/lib/timeline-prefs.test.ts
@@ -0,0 +1,7 @@
+import { test } from 'node:test';
+import assert from 'node:assert/strict';
+import { readTimelinePrefs } from './timeline-prefs.ts';
+
+test('the switches start on, but the preview axis', () => {
+ assert.deepEqual(readTimelinePrefs(), { snap: true, magnet: true, linkage: true, previewAxis: false });
+});
diff --git a/packages/openfilm/studio/ui/src/lib/timeline-prefs.ts b/packages/openfilm/studio/ui/src/lib/timeline-prefs.ts
index 768a7a4..548c814 100644
--- a/packages/openfilm/studio/ui/src/lib/timeline-prefs.ts
+++ b/packages/openfilm/studio/ui/src/lib/timeline-prefs.ts
@@ -1,11 +1,13 @@
/**
- * The timeline's switches, kept on this machine across projects, in the toolbar's order and all on by default:
+ * The timeline's switches, kept on this machine across projects, in the toolbar's order, on by default but the preview
+ * axis:
* · `magnet` (主轨磁吸): the main track (the lowest picture track) stays closed up — a clip put on it goes in between,
* one deleted or taken off it closes up after it, a trim or a new speed there moves what follows. Off, the main
* track is like the others (lib/timeline-edit);
* · `snap` (自动吸附): drags line up with edges and the playhead; off means "it lands exactly where I let go";
* · `linkage` (联动): titles, overlays and sounds riding on a main-track clip move with it and go with it;
- * · `previewAxis` (预览轴): the picture follows the pointer over the timeline, the playhead staying where it is.
+ * · `previewAxis` (预览轴): the picture follows the pointer over the timeline, the playhead staying where it is. Off
+ * by default: the picture stays at the playhead until it is turned on.
*
* Clips sharing a `data-link` (a video and its detached sound) are always selected and edited together; ⌥-click picks
* one alone. The inspector reads the switches too (a slower speed pushes the next clip only with the magnet on), so a
@@ -18,7 +20,7 @@ import type { Switches } from './timeline-edit.ts';
export type TimelinePrefs = { snap: boolean; magnet: boolean; linkage: boolean; previewAxis: boolean };
type Pref = keyof TimelinePrefs;
-const DEFAULTS: TimelinePrefs = { snap: true, magnet: true, linkage: true, previewAxis: true };
+const DEFAULTS: TimelinePrefs = { snap: true, magnet: true, linkage: true, previewAxis: false };
const KEY: Record<Pref, string> = {
snap: 'openfilm.timeline.snap',
/* new keys: the main track came back on 10-19 with its magnet and linkage, so choices made for the switches before