refactor(apps/frontend/awesome): 커스텀 훅 분리 및 공통 부분 분리#106
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This pull request refactors the frontend code by segregating common functionality into reusable components and hooks. The changes include:
- Replacing manual IntersectionObserver logic in the line graph component with the new useElementVisibility hook.
- Refactoring the text clock display into a reusable TextClockContainer component.
- Introducing the useElementVisibility hook to centralize visibility detection.
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| apps/frontend/awesome/src/pages/graph/components/line-graph.tsx | Replaced manual IntersectionObserver setup with the useElementVisibility hook and updated the ref handling. |
| apps/frontend/awesome/src/pages/clock/components/text-clock.tsx | Simplified repetitive markup by extracting common display logic into TextClockContainer. |
| apps/frontend/awesome/src/hooks/use-element-visibility.ts | Added a new custom hook to detect element visibility via IntersectionObserver. |
Comments suppressed due to low confidence (2)
apps/frontend/awesome/src/pages/graph/components/line-graph.tsx:207
- Consider updating the useElementVisibility hook to return a properly typed ref (i.e. React.RefObject) so that the manual casting can be avoided.
ref={ref as React.RefObject<HTMLDivElement>}
apps/frontend/awesome/src/hooks/use-element-visibility.ts:19
- The hook sets isVisible to true when the element becomes visible but does not update isVisible to false if the element subsequently goes out of view; consider handling the false case if dynamic visibility tracking is required.
if (entries[0].isIntersecting) {
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.