Skip to content

Commit

Permalink
Update timer initialization and autostart logic
Browse files Browse the repository at this point in the history
  • Loading branch information
mikumino committed Dec 18, 2023
1 parent c58f03a commit b16c56c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/components/FlowtimeBreak.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ interface FlowtimeBreakProps {

const FlowtimeBreak = ({ breakTime, handleEndBreak }: FlowtimeBreakProps) => {
const [timeRemaining, setTimeRemaining] = useState(breakTime);
const [endTime, setEndTime] = useState(0);
const [isRunning, setIsRunning] = useState(false);
const [endTime, setEndTime] = useState(Date.now() + breakTime);
const [isRunning, setIsRunning] = useState(localStorage.getItem('autostartTimers') === 'true' ? true : false);

useEffect(() => {
let interval: NodeJS.Timeout | null = null;
Expand Down
4 changes: 2 additions & 2 deletions src/components/FlowtimeFocus.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ interface FlowTimeFocusProps {

const FlowtimeFocus = ({ handleEndFocus }: FlowTimeFocusProps) => {
const [time, setTime] = useState(0);
const [startTime, setStartTime] = useState(0);
const [isRunning, setIsRunning] = useState(false);
const [startTime, setStartTime] = useState(Date.now() - time);
const [isRunning, setIsRunning] = useState(localStorage.getItem('autostartTimers') === 'true' ? true : false);

useEffect(() => {
let interval: NodeJS.Timeout | null = null;
Expand Down

0 comments on commit b16c56c

Please sign in to comment.