Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: 뽀모도로 껏켰 대응을 위한 리팩토링 #50

Merged
merged 15 commits into from
Sep 6, 2024

Conversation

young-do
Copy link
Collaborator

계기

작업을 해보게 된 계기는 몇가지가 있음

  1. 새로고침 or 껏켰을때 mode만 저장되어있음
    • 즉, 20분 설정하고 10분만 하다가 껏켰했을때 다시 20분부터 카운트 시작 ㅠ
    • 새로고침을 원래 대응안하자고 말하긴 했었는데, 껏켰할때 다시 시작되는게 큰 문제라고 생각했음..!
    • 실수로 끈걸수도 있으니깐 시간을 유지될 수 있을때까지 유자해주고 싶었음
  2. timer 에서 기능 확장이 되다보니 비즈니스 로직이 분산되어감 ㅜ
    • 로직이 타이머가 끝나면, 지금이 어떤 모드인지에 따라 로직을 작성하는게 살짝 아쉬웠음
    • ex) onStop > if (mode === ) 이런게 살짝 아쉬웠음
    • 그리고 비즈니스 로직이 더 복잡해지면 뽀모도로 페이지 쪽 코드도 더 복잡해질 것 같았음
  3. 아예 비즈니스 로직이 통채로 담긴(=뽀모도로 로직) 하나의 hook을 만들수 없을까 싶었음
    • 타이머, 모드를 분리하지 않고, 뽀모도로 전체 데이터를 한번에 관리할 수 있게..!
    • 그래서 이전에 내가 언급했던 방법론이 가능하지 않을까 궁금함

그래서 한번 만들어봤는데, 잘 작동하는 것 같아 올려봄..!!!!

작업 내용

  • main
    • usePomodoro 훅 구현
    • 위의 hook을 pomodoro 및 하위 screen에 적용
  • etc

체크리스트

  • Code Review 요청
  • Label 설정

@young-do young-do added the 🔨 Refactor 리팩토링 label Aug 23, 2024
@young-do young-do self-assigned this Aug 23, 2024
@young-do young-do requested a review from haryung-lee as a code owner August 23, 2024 09:08
Copy link
Member

@haryung-lee haryung-lee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

수고하셨습니다!

Comment on lines 101 to 105
const [pomodoroTime, setPomodoroTime] = useLocalStorage<PomodoroTime>(
'pomodoro-time',
defaultPomodoroTime,
);
const [calledOnceExceedGoalTime, setCalledOnceExceedGoalTime] = useLocalStorage<boolean>(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

타입추론으로 해도 되겠네영

@young-do young-do merged commit 142a1b6 into main Sep 6, 2024
@young-do young-do deleted the feature/new-timer branch September 6, 2024 07:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔨 Refactor 리팩토링
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants