diff options
| author | iza <59828082+izadoesdev@users.noreply.github.com> | 2025-07-16 17:06:36 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-07-16 17:06:36 +0300 |
| commit | 3b93fd6b68980b5c6d9264486d062845597fb5d7 (patch) | |
| tree | 3614e23d183aa31879cce7ac4b2251778f2d653b | |
| parent | 3371a6889634f326063351295faca9a56c566706 (diff) | |
| parent | 20f73bf7050f91bafd499c58b85667393cf647b4 (diff) | |
| download | opencut-3b93fd6b68980b5c6d9264486d062845597fb5d7.tar.gz | |
Merge pull request #315 from OpenCut-app/staging
Staging
| -rw-r--r-- | apps/web/src/components/icons.tsx | 8 | ||||
| -rw-r--r-- | apps/web/src/components/keyboard-shortcuts-help.tsx | 98 | ||||
| -rw-r--r-- | apps/web/src/components/landing/hero.tsx | 14 | ||||
| -rw-r--r-- | apps/web/src/components/ui/dialog.tsx | 12 | ||||
| -rw-r--r-- | apps/web/src/components/ui/sponsor-button.tsx | 42 | ||||
| -rw-r--r-- | apps/web/src/hooks/use-keyboard-shortcuts.ts | 15 |
6 files changed, 133 insertions, 56 deletions
diff --git a/apps/web/src/components/icons.tsx b/apps/web/src/components/icons.tsx index 4f3986e3..68e8f0ff 100644 --- a/apps/web/src/components/icons.tsx +++ b/apps/web/src/components/icons.tsx @@ -38,6 +38,14 @@ export function GithubIcon({ className }: { className?: string }) { ); } +export function VercelIcon({ className }: { className?: string }) { + return ( + <svg className={className} width="20" height="18" viewBox="0 0 76 65" fill="none" xmlns="http://www.w3.org/2000/svg"> + <path d="M37.5274 0L75.0548 65H0L37.5274 0Z" fill="currentColor"/> + </svg> + ); +} + export function BackgroundIcon({ className }: { className?: string }) { return ( <svg diff --git a/apps/web/src/components/keyboard-shortcuts-help.tsx b/apps/web/src/components/keyboard-shortcuts-help.tsx index 9f0d1e57..936254be 100644 --- a/apps/web/src/components/keyboard-shortcuts-help.tsx +++ b/apps/web/src/components/keyboard-shortcuts-help.tsx @@ -15,41 +15,73 @@ import { Keyboard } from "lucide-react"; import { useKeyboardShortcuts } from "@/hooks/use-keyboard-shortcuts"; const KeyBadge = ({ keyName }: { keyName: string }) => { - // Replace common key names with symbols + // Replace common key names with symbols or friendly names const displayKey = keyName .replace("Cmd", "⌘") - .replace("Shift", "⇧") + .replace("Shift", "Shift") + .replace("ArrowLeft", "Arrow Left") + .replace("ArrowRight", "Arrow Right") + .replace("ArrowUp", "Arrow Up") + .replace("ArrowDown", "Arrow Down") .replace("←", "◀") .replace("→", "▶") - .replace("Space", "⎵"); + .replace("Space", "Space"); return ( - <Badge variant="secondary" className="font-mono text-xs px-2 py-1"> + <Badge variant="secondary" className="font-mono text-xs px-1 py-1"> {displayKey} </Badge> ); }; -const ShortcutItem = ({ shortcut }: { shortcut: any }) => ( - <div className="flex items-center justify-between py-2 px-3 rounded-lg hover:bg-muted/50"> - <div className="flex items-center gap-3"> - {shortcut.icon && ( - <div className="text-muted-foreground">{shortcut.icon}</div> - )} - <span className="text-sm">{shortcut.description}</span> - </div> - <div className="flex items-center gap-1"> - {shortcut.keys.map((key: string, index: number) => ( - <div key={index} className="flex items-center gap-1"> - <KeyBadge keyName={key} /> - {index < shortcut.keys.length - 1 && ( - <span className="text-xs text-muted-foreground">+</span> - )} - </div> - ))} +const ShortcutItem = ({ shortcut }: { shortcut: any }) => { + // Filter out lowercase duplicates for display - if both "j" and "J" exist, only show "J" + const displayKeys = shortcut.keys.filter((key: string) => { + const lowerKey = key.toLowerCase(); + const upperKey = key.toUpperCase(); + + // If this is a lowercase letter and the uppercase version exists, skip it + if ( + key === lowerKey && + key !== upperKey && + shortcut.keys.includes(upperKey) + ) { + return false; + } + + return true; + }); + + return ( + <div className="flex items-center justify-between"> + <div className="flex items-center gap-3"> + {shortcut.icon && ( + <div className="text-muted-foreground">{shortcut.icon}</div> + )} + <span className="text-sm">{shortcut.description}</span> + </div> + <div className="flex items-center gap-1"> + {displayKeys.map((key: string, index: number) => ( + <div key={index} className="flex items-center gap-1"> + <div className="flex items-center"> + {key.split("+").map((keyPart: string, partIndex: number) => ( + <div key={partIndex} className="flex items-center gap-1"> + <KeyBadge keyName={keyPart} /> + {partIndex < key.split("+").length - 1 && ( + <span className="text-xs text-muted-foreground">+</span> + )} + </div> + ))} + </div> + {index < displayKeys.length - 1 && ( + <span className="text-xs text-muted-foreground">or</span> + )} + </div> + ))} + </div> </div> - </div> -); + ); +}; export const KeyboardShortcutsHelp = () => { const [open, setOpen] = useState(false); @@ -67,7 +99,7 @@ export const KeyboardShortcutsHelp = () => { Shortcuts </Button> </DialogTrigger> - <DialogContent className="max-w-2xl max-h-[80vh] overflow-y-auto"> + <DialogContent className="max-w-2xl max-h-[80vh] overflow-y-hidden flex"> <DialogHeader> <DialogTitle className="flex items-center gap-2"> <Keyboard className="w-5 h-5" /> @@ -81,11 +113,11 @@ export const KeyboardShortcutsHelp = () => { <div className="space-y-6"> {categories.map((category) => ( - <div key={category}> - <h3 className="font-semibold text-sm text-muted-foreground uppercase tracking-wide mb-3"> + <div key={category} className="flex flex-col gap-1"> + <h3 className="text-xs text-muted-foreground uppercase tracking-wide font-medium"> {category} </h3> - <div className="space-y-1"> + <div className="space-y-0.5"> {shortcuts .filter((shortcut) => shortcut.category === category) .map((shortcut, index) => ( @@ -95,18 +127,6 @@ export const KeyboardShortcutsHelp = () => { </div> ))} </div> - - <div className="mt-6 p-4 bg-muted/30 rounded-lg"> - <h4 className="font-medium text-sm mb-2">Tips:</h4> - <ul className="text-sm text-muted-foreground space-y-1"> - <li> - • Shortcuts work when the editor is focused (not typing in inputs) - </li> - <li>• J/K/L are industry-standard video editing shortcuts</li> - <li>• Use arrow keys for frame-perfect positioning</li> - <li>• Hold Shift with arrow keys for larger jumps</li> - </ul> - </div> </DialogContent> </Dialog> ); diff --git a/apps/web/src/components/landing/hero.tsx b/apps/web/src/components/landing/hero.tsx index 6e6a45cb..4a66e433 100644 --- a/apps/web/src/components/landing/hero.tsx +++ b/apps/web/src/components/landing/hero.tsx @@ -3,6 +3,8 @@ import { motion } from "motion/react"; import { Button } from "../ui/button"; import { Input } from "../ui/input"; +import { SponsorButton } from "../ui/sponsor-button"; +import { VercelIcon } from "../icons"; import { ArrowRight } from "lucide-react"; import { useState, useEffect } from "react"; import { toast } from "sonner"; @@ -116,6 +118,18 @@ export function Hero() { <motion.div initial={{ opacity: 0, y: 20 }} animate={{ opacity: 1, y: 0 }} + transition={{ delay: 0.6, duration: 0.8 }} + className="mb-4 flex justify-center" + > + <SponsorButton + href="https://vercel.com/?utm_source=opencut" + logo={VercelIcon} + companyName="Vercel" + /> + </motion.div> + <motion.div + initial={{ opacity: 0, y: 20 }} + animate={{ opacity: 1, y: 0 }} transition={{ delay: 0.2, duration: 0.8 }} className="inline-block font-bold tracking-tighter text-4xl md:text-[4rem]" > diff --git a/apps/web/src/components/ui/dialog.tsx b/apps/web/src/components/ui/dialog.tsx index 0a487d0a..ebfd8907 100644 --- a/apps/web/src/components/ui/dialog.tsx +++ b/apps/web/src/components/ui/dialog.tsx @@ -22,7 +22,7 @@ const DialogOverlay = React.forwardRef< <DialogPrimitive.Overlay ref={ref} className={cn( - "fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0", + "fixed inset-0 z-[100] bg-black/20 backdrop-blur-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0", className )} {...props} @@ -39,9 +39,17 @@ const DialogContent = React.forwardRef< <DialogPrimitive.Content ref={ref} className={cn( - "fixed left-[50%] top-[50%] z-50 grid w-[calc(100%-2rem)] max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg", + "fixed left-[50%] top-[50%] z-[150] grid w-[calc(100%-2rem)] max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-popover shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg", className )} + onCloseAutoFocus={(e) => { + e.stopPropagation(); + e.preventDefault(); + }} + onOpenAutoFocus={(e) => { + e.stopPropagation(); + e.preventDefault(); + }} {...props} > <ScrollArea className="max-h-[85vh]"> diff --git a/apps/web/src/components/ui/sponsor-button.tsx b/apps/web/src/components/ui/sponsor-button.tsx new file mode 100644 index 00000000..fdfaa0b0 --- /dev/null +++ b/apps/web/src/components/ui/sponsor-button.tsx @@ -0,0 +1,42 @@ +import { motion } from "motion/react"; +import { ComponentType } from "react"; + +interface SponsorButtonProps { + href: string; + logo: ComponentType<{ className?: string }>; + companyName: string; + className?: string; +} + +export function SponsorButton({ + href, + logo: Logo, + companyName, + className = "", +}: SponsorButtonProps) { + + return ( + <motion.a + href={href} + target="_blank" + rel="noopener noreferrer" + className={`inline-flex items-center gap-2 px-3 py-2 rounded-full border border-white/10 bg-white/5 backdrop-blur-sm hover:bg-white/10 hover:border-white/20 transition-all duration-200 group shadow-lg ${className}`} + whileHover={{ scale: 1.02 }} + whileTap={{ scale: 0.98 }} + > + <span className="text-xs font-medium text-zinc-400 group-hover:text-zinc-300 transition-colors"> + Sponsored by + </span> + + <div className="flex items-center gap-1.5"> + <div className="text-zinc-100 group-hover:text-white transition-colors"> + <Logo className="w-4 h-4" /> + </div> + + <span className="text-xs font-medium text-zinc-100 group-hover:text-white transition-colors"> + {companyName} + </span> + </div> + </motion.a> + ); +} diff --git a/apps/web/src/hooks/use-keyboard-shortcuts.ts b/apps/web/src/hooks/use-keyboard-shortcuts.ts index 86190c94..84cb78f8 100644 --- a/apps/web/src/hooks/use-keyboard-shortcuts.ts +++ b/apps/web/src/hooks/use-keyboard-shortcuts.ts @@ -66,7 +66,6 @@ export const useKeyboardShortcuts = ( category: "Playback",
action: () => {
toggle();
- toast.info(isPlaying ? "Paused" : "Playing", { duration: 1000 });
},
},
{
@@ -76,7 +75,6 @@ export const useKeyboardShortcuts = ( category: "Playback",
action: () => {
seek(Math.max(0, currentTime - 1));
- toast.info("Rewind 1s", { duration: 1000 });
},
},
{
@@ -86,7 +84,6 @@ export const useKeyboardShortcuts = ( category: "Playback",
action: () => {
toggle();
- toast.info(isPlaying ? "Paused" : "Playing", { duration: 1000 });
},
},
{
@@ -96,7 +93,6 @@ export const useKeyboardShortcuts = ( category: "Playback",
action: () => {
seek(Math.min(duration, currentTime + 1));
- toast.info("Forward 1s", { duration: 1000 });
},
},
@@ -146,7 +142,6 @@ export const useKeyboardShortcuts = ( category: "Navigation",
action: () => {
seek(0);
- toast.info("Start of timeline", { duration: 1000 });
},
},
{
@@ -156,7 +151,6 @@ export const useKeyboardShortcuts = ( category: "Navigation",
action: () => {
seek(duration);
- toast.info("End of timeline", { duration: 1000 });
},
},
@@ -185,7 +179,6 @@ export const useKeyboardShortcuts = ( if (currentTime > effectiveStart && currentTime < effectiveEnd) {
splitElement(trackId, elementId, currentTime);
- toast.success("Element split at playhead");
} else {
toast.error("Playhead must be within selected element");
}
@@ -218,9 +211,6 @@ export const useKeyboardShortcuts = ( category: "Editing",
action: () => {
toggleSnapping();
- toast.info(`Snapping ${snappingEnabled ? "disabled" : "enabled"}`, {
- duration: 1000,
- });
},
},
@@ -238,9 +228,6 @@ export const useKeyboardShortcuts = ( }))
);
setSelectedElements(allElements);
- toast.info(`Selected ${allElements.length} elements`, {
- duration: 1000,
- });
},
},
{
@@ -270,8 +257,6 @@ export const useKeyboardShortcuts = ( ...elementWithoutId,
startTime: newStartTime,
});
-
- toast.success("Element duplicated");
}
},
},
|
