Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

Refactor player layout and improve timeline resizing

Richie McIlroyb8ad65e61048
diff --git a/apps/desktop/src/routes/editor/Editor.tsx b/apps/desktop/src/routes/editor/Editor.tsx
index e88e178d7..c5ea0e97c 100644
--- a/apps/desktop/src/routes/editor/Editor.tsx
+++ b/apps/desktop/src/routes/editor/Editor.tsx
@@ -42,14 +42,14 @@ import {
} from "./context";
import { ExportDialog } from "./ExportDialog";
import { Header } from "./Header";
-import { Player } from "./Player";
+import { PlayerContent } from "./Player";
import { Timeline } from "./Timeline";
import { Dialog, DialogContent, EditorButton, Input, Subfield } from "./ui";
const DEFAULT_TIMELINE_HEIGHT = 260;
const MIN_PLAYER_CONTENT_HEIGHT = 320;
const MIN_TIMELINE_HEIGHT = 240;
-const RESIZE_HANDLE_HEIGHT = 16;
+const RESIZE_HANDLE_HEIGHT = 8;
const MIN_PLAYER_HEIGHT = MIN_PLAYER_CONTENT_HEIGHT + RESIZE_HANDLE_HEIGHT;
export function Editor() {
@@ -125,7 +125,7 @@ function Inner() {
const handleMove = (moveEvent: MouseEvent) => {
const delta = moveEvent.clientY - startY;
- setStoredTimelineHeight(clampTimelineHeight(startHeight + delta));
+ setStoredTimelineHeight(clampTimelineHeight(startHeight - delta));
};
const handleUp = () => {
@@ -212,31 +212,32 @@ function Inner() {
class="flex overflow-hidden flex-col flex-1 min-h-0"
>
<div
- class="flex overflow-y-hidden flex-row flex-1 min-h-0 gap-2 px-2 relative"
+ class="flex overflow-y-hidden flex-row flex-1 min-h-0 gap-2 px-2"
style={{
"min-height": `${MIN_PLAYER_HEIGHT}px`,
- "padding-bottom": `${RESIZE_HANDLE_HEIGHT}px`,
}}
>
- <Player />
- <ConfigSidebar />
- <div
- role="separator"
- aria-orientation="horizontal"
- class="absolute inset-x-0 bottom-0"
- style={{ height: `${RESIZE_HANDLE_HEIGHT}px` }}
- >
+ <div class="flex flex-col flex-1 rounded-xl border bg-gray-1 dark:bg-gray-2 border-gray-3 overflow-hidden">
+ <PlayerContent />
<div
- class="flex items-center h-full px-3 cursor-row-resize select-none group"
- classList={{ "bg-gray-3": isResizingTimeline() }}
- onMouseDown={handleTimelineResizeStart}
+ role="separator"
+ aria-orientation="horizontal"
+ class="flex-none transition-colors hover:bg-gray-3/30"
+ style={{ height: `${RESIZE_HANDLE_HEIGHT}px` }}
>
<div
- class="h-1 w-full rounded-full bg-gray-5 transition-colors group-hover:bg-gray-7"
- classList={{ "bg-gray-8": isResizingTimeline() }}
- />
+ class="flex justify-center items-center h-full cursor-row-resize select-none group"
+ classList={{ "bg-gray-3/50": isResizingTimeline() }}
+ onMouseDown={handleTimelineResizeStart}
+ >
+ <div
+ class="h-1 w-12 rounded-full bg-gray-4 transition-colors group-hover:bg-gray-6"
+ classList={{ "bg-gray-7": isResizingTimeline() }}
+ />
+ </div>
</div>
</div>
+ <ConfigSidebar />
</div>
<div
class="flex-none min-h-0 px-2 pb-0.5 overflow-hidden relative"
diff --git a/apps/desktop/src/routes/editor/Player.tsx b/apps/desktop/src/routes/editor/Player.tsx
index 3b7fcc7ef..f8fc1fc71 100644
--- a/apps/desktop/src/routes/editor/Player.tsx
+++ b/apps/desktop/src/routes/editor/Player.tsx
@@ -27,7 +27,7 @@ import {
import { useEditorShortcuts } from "./useEditorShortcuts";
import { formatTime } from "./utils";
-export function Player() {
+export function PlayerContent() {
const {
project,
editorInstance,
@@ -84,6 +84,8 @@ export function Player() {
outlineColor: captionsStore.state.settings.outlineColor,
exportWithSubtitles:
captionsStore.state.settings.exportWithSubtitles,
+ highlightColor: captionsStore.state.settings.highlightColor,
+ fadeDuration: captionsStore.state.settings.fadeDuration,
},
};
@@ -247,7 +249,7 @@ export function Player() {
]);
return (
- <div class="flex flex-col flex-1 rounded-xl border bg-gray-1 dark:bg-gray-2 border-gray-3">
+ <div class="flex flex-col flex-1 min-h-0">
<div class="flex items-center justify-between gap-3 p-3">
<div class="flex items-center gap-3">
<AspectRatioSelect />