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

Feature/fe/#301 header refactoring #355

Merged
merged 9 commits into from
Dec 2, 2024

Conversation

leedongyull
Copy link
Collaborator

@leedongyull leedongyull commented Dec 1, 2024

๐Ÿ“ PR ๊ฐœ์š”

  • indexRouter add-channel ์ˆ˜์ •
  • header๋ฅผ Context ์‚ฌ์šฉํ•˜์ง€ ์•Š๊ณ , url์— ๋”ฐ๋ผ ๋ณ€๊ฒฝ๋˜๋„๋ก ๊ตฌํ˜„
  • ํฐํŠธ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ ์ œ๊ฑฐ

โœ… ์ฒดํฌ๋ฆฌ์ŠคํŠธ (Checklist)

  • ์ฝ”๋“œ๊ฐ€ ๋นŒ๋“œ ์˜ค๋ฅ˜ ์—†์ด ์ž˜ ์ž‘๋™ํ•˜๋Š”์ง€ ํ™•์ธ
  • ํ…Œ์ŠคํŠธ๊ฐ€ ํ†ต๊ณผํ•˜๋Š”์ง€ ํ™•์ธ
  • ์Šคํƒ€์ผ ๊ฐ€์ด๋“œ์™€ ์ผ๊ด€์„ฑ์„ ์œ ์ง€ํ–ˆ๋Š”์ง€ ํ™•์ธ
  • ๊ด€๋ จ ๋ฌธ์„œ๊ฐ€ ์—…๋ฐ์ดํŠธ๋˜์—ˆ๋Š”์ง€ ํ™•์ธ (์„ ํƒ ์‚ฌํ•ญ)
  • ๋ฆฌ๋ทฐ์–ด๊ฐ€ ์ดํ•ดํ•  ์ˆ˜ ์žˆ๋„๋ก ์ฃผ์„์ด๋‚˜ ์„ค๋ช…์„ ์ถ”๊ฐ€ํ–ˆ๋Š”์ง€ ํ™•์ธ

๐Ÿ”„ ๊ด€๋ จ ์ด์Šˆ (Linked Issues)

#301


๐Ÿ“š ์ƒ๊ธด ์ด์Šˆ ๋ฐ ๊ตฌํ˜„ ๋ฐฉ๋ฒ•

  • ์šฐ์„  ํ•ฉ์„ฑ ์ปดํฌ๋„ŒํŠธ ํ˜•ํƒœ๋ฅผ ๊ตฌ์„ฑ ์ปดํฌ๋„ŒํŠธ ํ˜•ํƒœ๋กœ ๋ฐ”๊ฟจ์Šต๋‹ˆ๋‹ค.
import { useLocation, useParams } from 'react-router-dom';
import { getHeaderInfo } from '@/utils/mapping/HeaderMapping';
import { HeaderLayout } from '@/component/header/HeaderLayout';

export const LayoutHeader = () => {
  const params = useParams<Record<string, string | undefined>>();
  const urlPath = useLocation();
  const headerOption = getHeaderInfo(urlPath.pathname);
  return (
    <HeaderLayout
      className="z-[5000]"
      userName={`${params.user || ''}`}
      title={`${headerOption.title}`}
      subtitle={`${headerOption.subtitle}`}
      leftItems={headerOption.leftItems}
      rightItems={headerOption.rightItems}
    />
  );
};

  • ๋˜ํ•œ ํ™•์žฅ์„ฑ์„ ์œ„ํ•ด BackButton,DropDown ๋“ฑ์ด ์•„๋‹Œ left,right Items๋กœ ๊ตฌ์กฐ๋ฅผ ๋ณ€๊ฒฝํ•˜์˜€์Šต๋‹ˆ๋‹ค.
  • ๋ฒ„ํŠผ์˜ Onclick๊ณผ Dropdown ๋“ฑ ๋กœ์ง์ด ํ•„์š”ํ•œ ๊ฒฝ์šฐ๊ฐ€ ์žˆ์–ด, Items์— ReactNode ์ž์ฒด๋ฅผ ๋ฐ›์•„์™€ createํ•ด์ฃผ๋Š” ๋ฐฉ์‹์œผ๋กœ ๊ตฌํ˜„ํ•˜์˜€์Šต๋‹ˆ๋‹ค
    • ์ด๋กœ ์ธํ•ด ๋น„์šฉ์ด ์กฐ๊ธˆ ๋Š˜์–ด๋‚ฌ์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
export const HEADER_LEFTITEMS: Record<string, ReactNode[]> = {
  '/add-channel': [React.createElement(HeaderBackButton)],
  '/add-channel/:user': [React.createElement(HeaderBackButton)],
  '/add-channel/:user/draw': [React.createElement(HeaderBackButton)],
  '/channel/:channelId/host': [React.createElement(HeaderBackButton)],
  '/update-channel': [React.createElement(HeaderBackButton)],
  '/register': [React.createElement(HeaderBackButton)],
  '/channelInfo/:channelId': [React.createElement(HeaderBackButton)],
  '/guest-add-channel/:channelId': [React.createElement(HeaderBackButton)],
};

export const HEADER_RIGHTITEMS: Record<string, ReactNode[]> = {
  '/channel/:channelId/host': [React.createElement(HeaderDropdown)],
};

  • ๋งˆ์ง€๋ง‰์œผ๋กœ ์ƒ๊ฐํ•ด๋ด์•ผ ํ•  ์ด์Šˆ๋กœ๋Š” ๋ฉ”์ธ ํŽ˜์ด์ง€ ํ—ค๋”์˜ ๋กœ๊ทธ์•„์›ƒ ๋ฒ„ํŠผ์ž…๋‹ˆ๋‹ค.
  • LogoutButton์„ ์ปดํฌ๋„ŒํŠธ๋กœ ๋นผ์„œ HeaderItems์— ๋„ฃ์œผ๋ ค ํ–ˆ์œผ๋‚˜, setIsLoggedIn ํ•จ์ˆ˜๊ฐ€ mainํŽ˜์ด์ง€์— ์ข…์†๋˜์–ด ์žˆ์–ด ์˜๊ฒฌ์ด ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค.
    1. Login ์ƒํƒœ๋ฅผ Context๋ฅผ ํ†ตํ•ด ๊ณต์œ ํ•œ๋‹ค.
    1. ํ˜„์žฌ main ํŽ˜์ด์ง€ ์ฒ˜๋Ÿผ ํ•˜๋“œ์ฝ”๋”ฉ์œผ๋กœ ํ•œ๋‹ค.

ํ˜น์‹œ ์ด์™ธ์—๋„ ๋‹ค๋ฅธ ๋ฐฉ๋ฒ•์ด ์žˆ์œผ๋ฉด ๊ณต์œ  ๋ถ€ํƒ ๋“œ๋ฆฝ๋‹ˆ๋‹ค!

@github-actions github-actions bot added the ํ™•์ธ ์š”์ฒญ ๋ฆฌ๋ทฐ์–ด์—๊ฒŒ ๋ฆฌ๋ทฐ ์š”์ฒญ PR ๋‚ ๋ฆฐ ์ƒํƒœ (PR ๋จธ์ง€ ์ „) label Dec 1, 2024
@github-actions github-actions bot requested review from effozen and happyhyep December 1, 2024 22:41
effozen
effozen previously approved these changes Dec 2, 2024
happyhyep
happyhyep previously approved these changes Dec 2, 2024
frontend/src/pages/AddGuestPage.tsx Outdated Show resolved Hide resolved
@effozen effozen requested a review from juwon5272 December 2, 2024 02:16
@leedongyull leedongyull dismissed stale reviews from happyhyep and effozen via 5874f03 December 2, 2024 02:41
@leedongyull leedongyull requested a review from effozen December 2, 2024 02:42
Copy link
Collaborator

@effozen effozen left a comment

Choose a reason for hiding this comment

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

๊ณ ์ƒํ•˜์…จ์Šต๋‹ˆ๋‹ค!

@leedongyull leedongyull requested a review from happyhyep December 2, 2024 02:45
Copy link
Member

@happyhyep happyhyep left a comment

Choose a reason for hiding this comment

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

๊ณ ์ƒํ•˜์…จ์Šต๋‹ˆ๋‹ค!!!

@leedongyull leedongyull merged commit b6c1259 into frontend Dec 2, 2024
6 checks passed
@leedongyull leedongyull deleted the feature/fe/#301-headerRefactoring branch December 5, 2024 07:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ํ™•์ธ ์š”์ฒญ ๋ฆฌ๋ทฐ์–ด์—๊ฒŒ ๋ฆฌ๋ทฐ ์š”์ฒญ PR ๋‚ ๋ฆฐ ์ƒํƒœ (PR ๋จธ์ง€ ์ „)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants