From 49941a166aac44eb457509b39611d0094d7eeb97 Mon Sep 17 00:00:00 2001 From: Ben Zelnick <34197604+ZelnickB@users.noreply.github.com> Date: Mon, 11 Mar 2024 21:32:15 -0400 Subject: [PATCH 1/2] Fixed typos --- app/renderer/src/config.ts | 2 +- app/renderer/src/contexts/CounterContext.tsx | 26 +++++++++---------- .../src/routes/Config/ConfigSlider.tsx | 2 +- .../src/routes/Config/SliderSection.tsx | 12 ++++----- .../src/store/config/defaultConfig.ts | 2 +- app/renderer/src/store/config/index.ts | 6 ++--- app/renderer/src/store/config/types.ts | 2 +- 7 files changed, 26 insertions(+), 26 deletions(-) diff --git a/app/renderer/src/config.ts b/app/renderer/src/config.ts index 14962304..063686a7 100644 --- a/app/renderer/src/config.ts +++ b/app/renderer/src/config.ts @@ -65,7 +65,7 @@ export const compactRoutes: NavItemTypes[] = [ export const rangeConfig: ConfigSliderProps[] = [ { - label: "Stay focus", + label: "Stay focused", valueType: "mins", minValue: 0, maxValue: 60, diff --git a/app/renderer/src/contexts/CounterContext.tsx b/app/renderer/src/contexts/CounterContext.tsx index 9e9f9c96..0f76c46a 100644 --- a/app/renderer/src/contexts/CounterContext.tsx +++ b/app/renderer/src/contexts/CounterContext.tsx @@ -50,9 +50,9 @@ const CounterProvider: React.FC = ({ children }) => { const [shouldFullscreen, setShouldFullscreen] = useState(false); - const [count, setCount] = useState(config.stayFocus * 60); + const [count, setCount] = useState(config.stayFocused * 60); - const [duration, setDuration] = useState(config.stayFocus * 60); + const [duration, setDuration] = useState(config.stayFocused * 60); const setTimerDuration = useCallback((time: number) => { setDuration(time * 60); @@ -62,7 +62,7 @@ const CounterProvider: React.FC = ({ children }) => { const resetTimerAction = useCallback(() => { switch (timer.timerType) { case TimerStatus.STAY_FOCUS: - setTimerDuration(config.stayFocus); + setTimerDuration(config.stayFocused); break; case TimerStatus.SHORT_BREAK: setTimerDuration(config.shortBreak); @@ -77,7 +77,7 @@ const CounterProvider: React.FC = ({ children }) => { } }, [ config.longBreak, - config.stayFocus, + config.stayFocused, config.shortBreak, timer.timerType, duration, @@ -192,7 +192,7 @@ const CounterProvider: React.FC = ({ children }) => { useEffect(() => { switch (timer.timerType) { case TimerStatus.STAY_FOCUS: - setTimerDuration(config.stayFocus); + setTimerDuration(config.stayFocused); break; case TimerStatus.SHORT_BREAK: setTimerDuration(config.shortBreak); @@ -204,7 +204,7 @@ const CounterProvider: React.FC = ({ children }) => { }, [ setTimerDuration, timer.timerType, - config.stayFocus, + config.stayFocused, config.shortBreak, config.longBreak, ]); @@ -302,9 +302,9 @@ const CounterProvider: React.FC = ({ children }) => { "Break time finished.", { body: `Stay focused as much as possible for ${ - config.stayFocus + config.stayFocused } ${ - isEqualToOne(config.stayFocus) ? "minute" : "minutes" + isEqualToOne(config.stayFocused) ? "minute" : "minutes" }.`, }, settings.enableVoiceAssistance && breakFinishedWav @@ -325,9 +325,9 @@ const CounterProvider: React.FC = ({ children }) => { "Break time finished.", { body: `Stay focused as much as possible for ${ - config.stayFocus + config.stayFocused } ${ - isEqualToOne(config.stayFocus) ? "minute" : "minutes" + isEqualToOne(config.stayFocused) ? "minute" : "minutes" }.`, }, settings.enableVoiceAssistance && breakFinishedWav @@ -348,9 +348,9 @@ const CounterProvider: React.FC = ({ children }) => { "Break time finished.", { body: `Stay focused as much as possible for ${ - config.stayFocus + config.stayFocused } ${ - isEqualToOne(config.stayFocus) ? "minute" : "minutes" + isEqualToOne(config.stayFocused) ? "minute" : "minutes" }.`, }, settings.enableVoiceAssistance && breakFinishedWav @@ -372,7 +372,7 @@ const CounterProvider: React.FC = ({ children }) => { timer.timerType, dispatch, notification, - config.stayFocus, + config.stayFocused, config.shortBreak, config.longBreak, config.sessionRounds, diff --git a/app/renderer/src/routes/Config/ConfigSlider.tsx b/app/renderer/src/routes/Config/ConfigSlider.tsx index 1dab9840..d64ab35f 100644 --- a/app/renderer/src/routes/Config/ConfigSlider.tsx +++ b/app/renderer/src/routes/Config/ConfigSlider.tsx @@ -57,7 +57,7 @@ const ConfigSlider: React.FC = ({ }; ConfigSlider.defaultProps = { - label: "Stay focus", + label: "Stay focused", valueType: "mins", }; diff --git a/app/renderer/src/routes/Config/SliderSection.tsx b/app/renderer/src/routes/Config/SliderSection.tsx index c93fd12b..f41839f2 100644 --- a/app/renderer/src/routes/Config/SliderSection.tsx +++ b/app/renderer/src/routes/Config/SliderSection.tsx @@ -1,7 +1,7 @@ import React, { useCallback } from "react"; import { useAppSelector, useAppDispatch } from "hooks/storeHooks"; import { - setStayFocus, + setStayFocused, setSessionRounds, setShorBreak, setLongBreak, @@ -12,9 +12,9 @@ import ConfigSlider, { ConfigSliderProps } from "./ConfigSlider"; const SliderSection: React.FC = () => { const dispatch = useAppDispatch(); - const { stayFocus, shortBreak, longBreak, sessionRounds } = + const { stayFocused, shortBreak, longBreak, sessionRounds } = useAppSelector(({ config }) => ({ - stayFocus: config.stayFocus, + stayFocused: config.stayFocused, shortBreak: config.shortBreak, longBreak: config.longBreak, sessionRounds: config.sessionRounds, @@ -22,13 +22,13 @@ const SliderSection: React.FC = () => { const sliderRangeList: ConfigSliderProps[] = [ { - label: "Stay focus", + label: "Stay focused", valueType: "mins", minValue: 1, maxValue: 120, - value: stayFocus, + value: stayFocused, handleConfigChange: useCallback( - (value) => dispatch(setStayFocus(parseInt(value))), + (value) => dispatch(setStayFocused(parseInt(value))), [dispatch] ), }, diff --git a/app/renderer/src/store/config/defaultConfig.ts b/app/renderer/src/store/config/defaultConfig.ts index 162251e5..0d0b25db 100644 --- a/app/renderer/src/store/config/defaultConfig.ts +++ b/app/renderer/src/store/config/defaultConfig.ts @@ -1,7 +1,7 @@ import { ConfigTypes } from "./types"; export const defaultConfig: Readonly = Object.freeze({ - stayFocus: 25, + stayFocused: 25, shortBreak: 5, longBreak: 15, sessionRounds: 4, diff --git a/app/renderer/src/store/config/index.ts b/app/renderer/src/store/config/index.ts index a8bfa87a..9352fabc 100644 --- a/app/renderer/src/store/config/index.ts +++ b/app/renderer/src/store/config/index.ts @@ -13,8 +13,8 @@ const configSlice = createSlice({ name: "config", initialState, reducers: { - setStayFocus(state, action: ConfigPayload<"stayFocus">) { - state.stayFocus = action.payload; + setStayFocused(state, action: ConfigPayload<"stayFocused">) { + state.stayFocused = action.payload; }, setShorBreak(state, action: ConfigPayload<"shortBreak">) { @@ -70,7 +70,7 @@ export const { setSecondSpecialBreak, setSessionRounds, setShorBreak, - setStayFocus, + setStayFocused, setThirdSpecialBreak, setFirstSpecialBreak, } = configSlice.actions; diff --git a/app/renderer/src/store/config/types.ts b/app/renderer/src/store/config/types.ts index ee613583..a47a00ff 100644 --- a/app/renderer/src/store/config/types.ts +++ b/app/renderer/src/store/config/types.ts @@ -7,7 +7,7 @@ export type SpecialBreakTypes = { }; export type ConfigTypes = { - stayFocus: number; + stayFocused: number; shortBreak: number; longBreak: number; sessionRounds: number; From 574a2a44c8a18bc9723c5c5ce9177e631068ba4a Mon Sep 17 00:00:00 2001 From: Benjamin Zelnick <34197604+ZelnickB@users.noreply.github.com> Date: Mon, 18 Mar 2024 22:52:08 -0400 Subject: [PATCH 2/2] Revert variable names Variable names have been reverted to pre-49941a16. --- app/renderer/src/contexts/CounterContext.tsx | 26 +++++++++---------- .../src/routes/Config/SliderSection.tsx | 10 +++---- .../src/store/config/defaultConfig.ts | 2 +- app/renderer/src/store/config/index.ts | 6 ++--- app/renderer/src/store/config/types.ts | 2 +- 5 files changed, 23 insertions(+), 23 deletions(-) diff --git a/app/renderer/src/contexts/CounterContext.tsx b/app/renderer/src/contexts/CounterContext.tsx index 0f76c46a..9e9f9c96 100644 --- a/app/renderer/src/contexts/CounterContext.tsx +++ b/app/renderer/src/contexts/CounterContext.tsx @@ -50,9 +50,9 @@ const CounterProvider: React.FC = ({ children }) => { const [shouldFullscreen, setShouldFullscreen] = useState(false); - const [count, setCount] = useState(config.stayFocused * 60); + const [count, setCount] = useState(config.stayFocus * 60); - const [duration, setDuration] = useState(config.stayFocused * 60); + const [duration, setDuration] = useState(config.stayFocus * 60); const setTimerDuration = useCallback((time: number) => { setDuration(time * 60); @@ -62,7 +62,7 @@ const CounterProvider: React.FC = ({ children }) => { const resetTimerAction = useCallback(() => { switch (timer.timerType) { case TimerStatus.STAY_FOCUS: - setTimerDuration(config.stayFocused); + setTimerDuration(config.stayFocus); break; case TimerStatus.SHORT_BREAK: setTimerDuration(config.shortBreak); @@ -77,7 +77,7 @@ const CounterProvider: React.FC = ({ children }) => { } }, [ config.longBreak, - config.stayFocused, + config.stayFocus, config.shortBreak, timer.timerType, duration, @@ -192,7 +192,7 @@ const CounterProvider: React.FC = ({ children }) => { useEffect(() => { switch (timer.timerType) { case TimerStatus.STAY_FOCUS: - setTimerDuration(config.stayFocused); + setTimerDuration(config.stayFocus); break; case TimerStatus.SHORT_BREAK: setTimerDuration(config.shortBreak); @@ -204,7 +204,7 @@ const CounterProvider: React.FC = ({ children }) => { }, [ setTimerDuration, timer.timerType, - config.stayFocused, + config.stayFocus, config.shortBreak, config.longBreak, ]); @@ -302,9 +302,9 @@ const CounterProvider: React.FC = ({ children }) => { "Break time finished.", { body: `Stay focused as much as possible for ${ - config.stayFocused + config.stayFocus } ${ - isEqualToOne(config.stayFocused) ? "minute" : "minutes" + isEqualToOne(config.stayFocus) ? "minute" : "minutes" }.`, }, settings.enableVoiceAssistance && breakFinishedWav @@ -325,9 +325,9 @@ const CounterProvider: React.FC = ({ children }) => { "Break time finished.", { body: `Stay focused as much as possible for ${ - config.stayFocused + config.stayFocus } ${ - isEqualToOne(config.stayFocused) ? "minute" : "minutes" + isEqualToOne(config.stayFocus) ? "minute" : "minutes" }.`, }, settings.enableVoiceAssistance && breakFinishedWav @@ -348,9 +348,9 @@ const CounterProvider: React.FC = ({ children }) => { "Break time finished.", { body: `Stay focused as much as possible for ${ - config.stayFocused + config.stayFocus } ${ - isEqualToOne(config.stayFocused) ? "minute" : "minutes" + isEqualToOne(config.stayFocus) ? "minute" : "minutes" }.`, }, settings.enableVoiceAssistance && breakFinishedWav @@ -372,7 +372,7 @@ const CounterProvider: React.FC = ({ children }) => { timer.timerType, dispatch, notification, - config.stayFocused, + config.stayFocus, config.shortBreak, config.longBreak, config.sessionRounds, diff --git a/app/renderer/src/routes/Config/SliderSection.tsx b/app/renderer/src/routes/Config/SliderSection.tsx index f41839f2..e2dd4ce5 100644 --- a/app/renderer/src/routes/Config/SliderSection.tsx +++ b/app/renderer/src/routes/Config/SliderSection.tsx @@ -1,7 +1,7 @@ import React, { useCallback } from "react"; import { useAppSelector, useAppDispatch } from "hooks/storeHooks"; import { - setStayFocused, + setStayFocus, setSessionRounds, setShorBreak, setLongBreak, @@ -12,9 +12,9 @@ import ConfigSlider, { ConfigSliderProps } from "./ConfigSlider"; const SliderSection: React.FC = () => { const dispatch = useAppDispatch(); - const { stayFocused, shortBreak, longBreak, sessionRounds } = + const { stayFocus, shortBreak, longBreak, sessionRounds } = useAppSelector(({ config }) => ({ - stayFocused: config.stayFocused, + stayFocus: config.stayFocus, shortBreak: config.shortBreak, longBreak: config.longBreak, sessionRounds: config.sessionRounds, @@ -26,9 +26,9 @@ const SliderSection: React.FC = () => { valueType: "mins", minValue: 1, maxValue: 120, - value: stayFocused, + value: stayFocus, handleConfigChange: useCallback( - (value) => dispatch(setStayFocused(parseInt(value))), + (value) => dispatch(setStayFocus(parseInt(value))), [dispatch] ), }, diff --git a/app/renderer/src/store/config/defaultConfig.ts b/app/renderer/src/store/config/defaultConfig.ts index 0d0b25db..162251e5 100644 --- a/app/renderer/src/store/config/defaultConfig.ts +++ b/app/renderer/src/store/config/defaultConfig.ts @@ -1,7 +1,7 @@ import { ConfigTypes } from "./types"; export const defaultConfig: Readonly = Object.freeze({ - stayFocused: 25, + stayFocus: 25, shortBreak: 5, longBreak: 15, sessionRounds: 4, diff --git a/app/renderer/src/store/config/index.ts b/app/renderer/src/store/config/index.ts index 9352fabc..a8bfa87a 100644 --- a/app/renderer/src/store/config/index.ts +++ b/app/renderer/src/store/config/index.ts @@ -13,8 +13,8 @@ const configSlice = createSlice({ name: "config", initialState, reducers: { - setStayFocused(state, action: ConfigPayload<"stayFocused">) { - state.stayFocused = action.payload; + setStayFocus(state, action: ConfigPayload<"stayFocus">) { + state.stayFocus = action.payload; }, setShorBreak(state, action: ConfigPayload<"shortBreak">) { @@ -70,7 +70,7 @@ export const { setSecondSpecialBreak, setSessionRounds, setShorBreak, - setStayFocused, + setStayFocus, setThirdSpecialBreak, setFirstSpecialBreak, } = configSlice.actions; diff --git a/app/renderer/src/store/config/types.ts b/app/renderer/src/store/config/types.ts index a47a00ff..ee613583 100644 --- a/app/renderer/src/store/config/types.ts +++ b/app/renderer/src/store/config/types.ts @@ -7,7 +7,7 @@ export type SpecialBreakTypes = { }; export type ConfigTypes = { - stayFocused: number; + stayFocus: number; shortBreak: number; longBreak: number; sessionRounds: number;