From e9600fa7077d1393cdb86e7abcbcb2bfd0d8c0af Mon Sep 17 00:00:00 2001 From: ghaddaditw <40211818-ghaddaditw@users.noreply.replit.com> Date: Sun, 8 Jun 2025 07:36:36 +0000 Subject: [PATCH] Introduce focus mode to help users concentrate on tasks at hand Implements FocusMode component with ambient sounds, distraction blocking and adds FocusPage. Replit-Commit-Author: Agent Replit-Commit-Session-Id: c5f0c281-8dd8-4846-b452-4a07bcd21062 Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/9777c70b-fc38-4831-8d6b-78dfffe041b0/5abfa1d7-294e-4d88-a0a7-e2cbc6cee435.jpg --- client/src/components/focus/FocusMode.tsx | 22 +------ client/src/components/layout/Header.tsx | 4 ++ client/src/pages/FocusPage.tsx | 75 +++++++++++++++++++++++ 3 files changed, 81 insertions(+), 20 deletions(-) create mode 100644 client/src/pages/FocusPage.tsx diff --git a/client/src/components/focus/FocusMode.tsx b/client/src/components/focus/FocusMode.tsx index ba9317e..5ec3267 100644 --- a/client/src/components/focus/FocusMode.tsx +++ b/client/src/components/focus/FocusMode.tsx @@ -93,7 +93,7 @@ export default function FocusMode({ isOpen, onClose }: FocusModeProps) { useEffect(() => { if (ambientSound && audioRef.current) { - audioRef.current.volume = ambientVolume[0] / 100; + audioRef.current.volume = (ambientVolume?.[0] ?? 50) / 100; if (isActive) { audioRef.current.play().catch(console.error); } else { @@ -450,25 +450,7 @@ export default function FocusMode({ isOpen, onClose }: FocusModeProps) { /> )} - {/* Focus Mode Styles */} - + ); } \ No newline at end of file diff --git a/client/src/components/layout/Header.tsx b/client/src/components/layout/Header.tsx index 54d069d..a5b5802 100644 --- a/client/src/components/layout/Header.tsx +++ b/client/src/components/layout/Header.tsx @@ -13,6 +13,7 @@ import { DropdownMenuTrigger, } from "@/components/ui/dropdown-menu"; import { LanguageSwitcher } from "@/components/LanguageSwitcher"; +import FocusButton from "@/components/focus/FocusButton"; import { Moon, Sun, @@ -82,6 +83,9 @@ export default function Header() { {/* Language Switcher */} + {/* Focus Mode */} + {user && } + {/* Theme Toggle */} + + + {t('focus.title', 'Focus Mode')} + + + {t('focus.description', 'Minimize distractions and maximize your productivity with our advanced focus tools.')} + + + + + + + + {t('focus.features.timer', 'Pomodoro Timer')} + + + + {t('focus.features.timerDesc', 'Work in focused intervals with built-in breaks')} + + + + + + + + {t('focus.features.ambient', 'Ambient Sounds')} + + + + {t('focus.features.ambientDesc', 'Choose from nature sounds to enhance concentration')} + + + + + + + + {t('focus.features.blocking', 'Distraction Blocking')} + + + + {t('focus.features.blockingDesc', 'Block notifications and visual distractions')} + + + + + + + + {t('focus.features.tracking', 'Session Tracking')} + + + + {t('focus.features.trackingDesc', 'Monitor your focus patterns and productivity')} + + + + + + + {}} /> + + + ); +} \ No newline at end of file
+ {t('focus.description', 'Minimize distractions and maximize your productivity with our advanced focus tools.')} +