Skip to content

Commit

Permalink
refactor: isMyGoalAtom 위치 이동
Browse files Browse the repository at this point in the history
  • Loading branch information
Doeunnkimm committed Mar 17, 2024
1 parent 07f82d7 commit 501fe23
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 12 deletions.
3 changes: 0 additions & 3 deletions src/features/goal/atom/goalId.ts

This file was deleted.

2 changes: 0 additions & 2 deletions src/features/goal/atom/index.ts

This file was deleted.

1 change: 1 addition & 0 deletions src/features/goal/atoms/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export { goalIdAtom } from './goalId';
export { isMyGoalAtom } from './isMyGoal';
File renamed without changes.
8 changes: 4 additions & 4 deletions src/features/goal/components/detail/GoalDetailContent.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
'use client';

import { Suspense, useEffect, useState } from 'react';
import { useAtom, useSetAtom } from 'jotai';
import { useSetAtom } from 'jotai';

import { Skeleton } from '@/components';
import { useGetGoal } from '@/hooks/reactQuery/goal';

import { goalIdAtom, isMyGoalAtom } from '../../atom';
import { goalIdAtom, isMyGoalAtom } from '../../atoms';

import { AddTaskInput } from './AddTaskInput';
import DetailLayout from './DetailLayout';
Expand All @@ -16,7 +16,7 @@ import { AddSubGoalPrompt, ContentBody, DetailFooterButton, DetailHeader, Sticke

export const GoalDetailContent = ({ id }: { id: number }) => {
const { data: goal } = useGetGoal({ goalId: Number(id) });
const [isMyGoal, setIsMyGoal] = useAtom(isMyGoalAtom);
const setIsMyGoal = useSetAtom(isMyGoalAtom);
const setGoalId = useSetAtom(goalIdAtom);
const [isOpenTaskInput, setOpenTaskInput] = useState(false);

Expand Down Expand Up @@ -47,7 +47,7 @@ export const GoalDetailContent = ({ id }: { id: number }) => {
{goal.tasks.length ? (
<Tasks tasks={goal.tasks} onOpenInput={handleOpenTaskInput(true)} />
) : (
isMyGoal && !isOpenTaskInput && <AddSubGoalPrompt onClick={handleOpenTaskInput(true)} />
goal.isMyGoal && !isOpenTaskInput && <AddSubGoalPrompt onClick={handleOpenTaskInput(true)} />
)}
</div>
)
Expand Down
3 changes: 1 addition & 2 deletions src/features/goal/components/detail/Tasks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ import { Typography } from '@/components';
import type { GoalTasksProps } from '@/hooks/reactQuery/goal/useGetGoal';
import { useUpdateIsDone } from '@/hooks/reactQuery/task';

import { isMyGoalAtom } from '../../atom';
import { goalIdAtom } from '../../atoms';
import { goalIdAtom, isMyGoalAtom } from '../../atoms';

import { Task } from './task';

Expand Down
2 changes: 1 addition & 1 deletion src/features/goal/components/detail/task/Task.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import EllipsisVerticalIcon from '@/assets/icons/ellipsis-vertical.svg';
import CheckedIcon from '@/assets/icons/goal/radio/radio-checked.svg';
import UnCheckedIcon from '@/assets/icons/goal/radio/radio-unchecked.svg';
import { Typography } from '@/components';
import { isMyGoalAtom } from '@/features/goal/atom';
import { isMyGoalAtom } from '@/features/goal/atoms';
import { TaskMoreOptionBottomSheet } from '@/features/goal/components/detail/TaskMoreOptionBottomSheet';
import { useDebounceCall, useInput } from '@/hooks';
import { useUpdateDescription } from '@/hooks/reactQuery/task/useUpdateDescription';
Expand Down

0 comments on commit 501fe23

Please sign in to comment.