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
53 changes: 20 additions & 33 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 3 additions & 11 deletions src/features/Nav/v1/components/CommandPalette.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { useNavbar } from '../hooks/useNavbar';
import React, { useEffect, useRef, useState } from 'react';
import { useNavigate } from 'react-router-dom';
import { motion, AnimatePresence } from 'framer-motion';
Expand Down Expand Up @@ -39,6 +40,7 @@ export const CommandPalette: React.FC<CommandPaletteProps> = ({
onSearch,
}) => {
const navigate = useNavigate();
const { theme, setTheme } = useNavbar();
const overlayRef = useRef<HTMLDivElement>(null);
const inputRef = useRef<HTMLInputElement>(null);
const listRef = useRef<HTMLDivElement>(null);
Expand Down Expand Up @@ -109,17 +111,7 @@ export const CommandPalette: React.FC<CommandPaletteProps> = ({
id: 'action-theme',
label: 'Toggle Theme',
category: 'Actions',
action: () => {
const theme = localStorage.getItem('theme');
const nextTheme = theme === 'dark' ? 'light' : 'dark';
const root = window.document.documentElement;
root.classList.remove('light', 'dark');
root.classList.add(nextTheme);
root.setAttribute('data-theme', nextTheme);
localStorage.setItem('theme', nextTheme);
// Force state update by triggering reload/refresh or custom event if needed
window.dispatchEvent(new Event('storage'));
},
action: () => setTheme(theme === 'light' ? 'dark' : 'light'),
icon: Laptop,
description: 'Switch between light and dark mode',
},
Expand Down