Skip to content

refactor(apps/frontend/awesome): 커스텀 훅 분리 및 공통 부분 분리#106

Merged
99mini merged 2 commits intomainfrom
awesome/feat/element-visibility
Jun 26, 2025
Merged

refactor(apps/frontend/awesome): 커스텀 훅 분리 및 공통 부분 분리#106
99mini merged 2 commits intomainfrom
awesome/feat/element-visibility

Conversation

@99mini
Copy link
Copy Markdown
Owner

@99mini 99mini commented Jun 25, 2025

No description provided.

@99mini 99mini self-assigned this Jun 25, 2025
Copilot AI review requested due to automatic review settings June 25, 2025 07:02
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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) {

@99mini 99mini merged commit 5994a4f into main Jun 26, 2025
1 check passed
@99mini 99mini deleted the awesome/feat/element-visibility branch June 26, 2025 00:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants