Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/components/FileUpload.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ export default function FileUpload({
<div
id="upload-zone"
role="button"
suppressHydrationWarning
tabIndex={0}
aria-label="Video upload area. Drag and drop a video file or press Enter to browse."
onDragOver={(e) => {
Expand Down
25 changes: 25 additions & 0 deletions src/components/ThemeToggle.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,34 @@
"use client";

import { useEffect, useState } from "react";
import { useTheme } from "./ThemeProvider";

export function ThemeToggle() {
const { theme, toggleTheme } = useTheme();
const [mounted, setMounted] = useState(false);

useEffect(() => {
setMounted(true);
}, []);

if (!mounted) {
return (
<button
type="button"
aria-label="Toggle theme"
className="
relative flex items-center justify-center
w-9 h-9 rounded-full
bg-[var(--surface)]
text-[var(--text)]
border border-[var(--border)]
"
>
<div className="w-4 h-4" />
</button>
);
}

const isDark = theme === "dark";

return (
Expand Down
22 changes: 22 additions & 0 deletions vitest.setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,25 @@ Object.defineProperty(window, 'matchMedia', {
dispatchEvent: () => false,
}),
})

const localStorageMock = (function () {
let store: Record<string, string> = {}
return {
getItem(key: string) {
return store[key] || null
},
setItem(key: string, value: string) {
store[key] = value.toString()
},
clear() {
store = {}
},
removeItem(key: string) {
delete store[key]
},
}
})()

Object.defineProperty(window, 'localStorage', {
value: localStorageMock,
})