@@ -60,6 +60,11 @@ export function PomodoroControls({ orbitRadius }: PomodoroControlsProps) {
6060 const isAsleep = ! isRunning && ! isPaused && ! isArmed ;
6161 const whiteNoiseVolume = useAudioPrefsStore ( ( s ) => s . whiteNoiseVolume ) ;
6262 const deviceType = useAudioPrefsStore ( ( s ) => s . deviceType ) ;
63+ const whiteNoiseEnabled = useAudioPrefsStore ( ( s ) => s . whiteNoiseEnabled ) ;
64+ const whiteNoiseTrackId = useAudioPrefsStore ( ( s ) => s . whiteNoiseTrackId ) ;
65+ const toggleWhiteNoise = useAudioPrefsStore ( ( s ) => s . toggleWhiteNoise ) ;
66+ const setWhiteNoiseTrack = useAudioPrefsStore ( ( s ) => s . setWhiteNoiseTrack ) ;
67+ const setWhiteNoiseVolume = useAudioPrefsStore ( ( s ) => s . setWhiteNoiseVolume ) ;
6368 const estimated = useEstimatedVolume ( whiteNoiseVolume , deviceType ) ;
6469 const [ trackPickerOpen , setTrackPickerOpen ] = useState ( false ) ;
6570 const pickerRef = useRef < HTMLDivElement > ( null ) ;
@@ -83,15 +88,15 @@ export function PomodoroControls({ orbitRadius }: PomodoroControlsProps) {
8388 < div className = "pointer-events-none" >
8489 { /* ── 白噪音卫星(弧右下)── */ }
8590 < div ref = { pickerRef } className = "pointer-events-auto absolute z-10" style = { satPos ( SAT . noise , orbitRadius ) } >
86- < Tip text = { audioPrefs . whiteNoiseEnabled ? '关闭背景音' : '开启背景音' } >
91+ < Tip text = { whiteNoiseEnabled ? '关闭背景音' : '开启背景音' } >
8792 < motion . button
8893 whileTap = { { scale : 0.9 } }
89- onClick = { audioPrefs . toggleWhiteNoise }
94+ onClick = { toggleWhiteNoise }
9095 className = { satClass ( 'w-9 h-9 rounded-full border border-border/30 bg-bg-elevated/60 backdrop-blur-sm text-text-tertiary hover:text-text-secondary transition-colors' ) }
9196 animate = { { opacity : trackPickerOpen ? 1 : SAT_IDLE_OPACITY } }
9297 whileHover = { { opacity : 1 } }
9398 >
94- { audioPrefs . whiteNoiseEnabled
99+ { whiteNoiseEnabled
95100 ? < Volume2 className = "w-4 h-4" strokeWidth = { 1.5 } />
96101 : < VolumeX className = "w-4 h-4" strokeWidth = { 1.5 } /> }
97102 </ motion . button >
@@ -110,27 +115,27 @@ export function PomodoroControls({ orbitRadius }: PomodoroControlsProps) {
110115 < button
111116 key = { track . id }
112117 onClick = { ( ) => {
113- audioPrefs . setWhiteNoiseTrack ( track . id ) ;
114- if ( ! audioPrefs . whiteNoiseEnabled ) audioPrefs . toggleWhiteNoise ( ) ;
118+ setWhiteNoiseTrack ( track . id ) ;
119+ if ( ! whiteNoiseEnabled ) toggleWhiteNoise ( ) ;
115120 } }
116121 className = { cn (
117122 'w-full flex items-center gap-2 px-3 py-1.5 text-b3 transition-colors' ,
118- track . id === audioPrefs . whiteNoiseTrackId
123+ track . id === whiteNoiseTrackId
119124 ? 'text-brand-500 font-medium'
120125 : 'text-text-secondary hover:text-text-primary hover:bg-bg-tertiary' ,
121126 ) }
122127 >
123128 < span className = "flex-1 text-left" > { track . nameZh } </ span >
124- { track . id === audioPrefs . whiteNoiseTrackId && (
129+ { track . id === whiteNoiseTrackId && (
125130 < span className = "w-1.5 h-1.5 rounded-full bg-brand-500" />
126131 ) }
127132 </ button >
128133 ) ) }
129134 < div className = "px-3 py-2 border-t border-border/20 flex items-center gap-2" >
130135 < input
131136 type = "range" min = { 0 } max = { 1 } step = { 0.05 }
132- value = { audioPrefs . whiteNoiseVolume }
133- onChange = { ( e ) => audioPrefs . setWhiteNoiseVolume ( parseFloat ( e . target . value ) ) }
137+ value = { whiteNoiseVolume }
138+ onChange = { ( e ) => setWhiteNoiseVolume ( parseFloat ( e . target . value ) ) }
134139 className = "w-full h-1 accent-brand-500 cursor-pointer"
135140 />
136141 < span className = "text-[10px] text-text-tertiary/60 tabular-nums shrink-0" >
0 commit comments