Skip to content

Commit

Permalink
fix: context 파일 제거
Browse files Browse the repository at this point in the history
  • Loading branch information
namdaeun committed Nov 14, 2024
1 parent 56d14f5 commit fb317bf
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 65 deletions.
48 changes: 23 additions & 25 deletions src/page/archiving/index/ArchivingPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ import { useInteractTimeline } from '@/page/archiving/index/hook/common/useInter
import { Block } from '@/page/archiving/index/type/blockType';

import ContentBox from '@/shared/component/ContentBox/ContentBox';
import TeamProvider, { useTeamContext } from '@/shared/hook/common/useTeamContext';
import { useDrawerAction } from '@/shared/store/drawer';
import { useOpenModal } from '@/shared/store/modal';
import { useTeamId } from '@/shared/store/team';

const ArchivingPage = () => {
const { selectedBlock, handleBlockClick } = useInteractTimeline();
Expand Down Expand Up @@ -43,30 +43,28 @@ const ArchivingPage = () => {
openModal('create-block');
};
return (
<TeamProvider>
<DateProvider teamId={useTeamContext()}>
<Flex css={pageStyle}>
<ContentBox
variant="timeline"
title="타임라인"
headerOption={
<Button variant="secondary" onClick={handleOpenBlockModal}>
타임블록 추가
</Button>
}>
<section css={timelineStyle}>
<TimeLineHeader />
<Flex css={contentStyle}>
<Suspense>
{/** fallback UI 디자인 나올 시에 TimeLine 크기만큼 채워서 Layout 안움직이도록 */}
<TimeLine selectedBlock={finalSelectedBlock} onBlockClick={handleBlockClick} />
</Suspense>
</Flex>
</section>
</ContentBox>
</Flex>
</DateProvider>
</TeamProvider>
<DateProvider teamId={Number(useTeamId())}>
<Flex css={pageStyle}>
<ContentBox
variant="timeline"
title="타임라인"
headerOption={
<Button variant="secondary" onClick={handleOpenBlockModal}>
타임블록 추가
</Button>
}>
<section css={timelineStyle}>
<TimeLineHeader />
<Flex css={contentStyle}>
<Suspense>
{/** fallback UI 디자인 나올 시에 TimeLine 크기만큼 채워서 Layout 안움직이도록 */}
<TimeLine selectedBlock={finalSelectedBlock} onBlockClick={handleBlockClick} />
</Suspense>
</Flex>
</section>
</ContentBox>
</Flex>
</DateProvider>
);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@ import { formatDatePost } from '@/page/archiving/index/component/TimeBlockModal/
import { Files } from '@/shared/api/time-blocks/team/time-block/type';
import WorkSapceInfo from '@/shared/component/WorkSpaceModal/info/WorkSpaceInfo';
import { useBlockContext } from '@/shared/hook/common/useBlockContext';
import { useTeamContext } from '@/shared/hook/common/useTeamContext';
import { useCloseModal } from '@/shared/store/modal';
import { useTeamId } from '@/shared/store/team';
import { useToastAction } from '@/shared/store/toast';

interface UploadModalProps {
isVisible: boolean;
}

const UploadModal = ({ isVisible }: UploadModalProps) => {
const teamId = useTeamContext();
const teamId = useTeamId();

const { formData, reset } = useBlockContext();
const closeModal = useCloseModal();
Expand Down
6 changes: 3 additions & 3 deletions src/page/archiving/index/component/TimeLine/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,19 @@ import { useGetTimeBlockQuery } from '@/page/archiving/index/hook/api/useGetTime
import { Block } from '@/page/archiving/index/type/blockType';
import { alignBlocks, createTimeBlock } from '@/page/archiving/index/util/block';

import { useTeamContext } from '@/shared/hook/common/useTeamContext';
import { useDrawerIsOpen } from '@/shared/store/drawer';
import { useTeamId } from '@/shared/store/team';

interface TimeLineProps {
selectedBlock?: Block;
onBlockClick?: (e: React.MouseEvent<HTMLDivElement> | React.KeyboardEvent<HTMLDivElement>, block: Block) => void;
}

const TimeLine = ({ selectedBlock, onBlockClick }: TimeLineProps) => {
const teamId = useTeamContext();
const teamId = useTeamId();
const { currentYear, currentMonth, endDay } = useDateContext();

const { data } = useGetTimeBlockQuery(teamId, 'executive', currentYear, currentMonth);
const { data } = useGetTimeBlockQuery(+teamId, 'executive', currentYear, currentMonth);

const timeBlocks: Block[] = data.timeBlocks;
const blockFloors = alignBlocks(timeBlocks, endDay, currentMonth, currentYear);
Expand Down
4 changes: 2 additions & 2 deletions src/page/dashboard/component/Timeline/TimelineSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ import { alignBlocks, createTimeBlock } from '@/page/archiving/index/util/block'
import { timelineContentStyle } from '@/page/dashboard/component/Timeline/TimelineSection.style';

import { PATH } from '@/shared/constant/path';
import { useTeamContext } from '@/shared/hook/common/useTeamContext';
import { useTeamId } from '@/shared/store/team';

const TimelineSection = () => {
const navigate = useNavigate();

const teamId = useTeamContext();
const teamId = useTeamId();
const { currentYear, currentMonth, endDay } = useDate(+teamId);

const { data } = useGetTimeBlockQuery(+teamId, 'executive', currentYear, currentMonth);
Expand Down
33 changes: 0 additions & 33 deletions src/shared/hook/common/useTeamContext.tsx

This file was deleted.

0 comments on commit fb317bf

Please sign in to comment.