Skip to content

Commit

Permalink
fix: remove unused vars
Browse files Browse the repository at this point in the history
  • Loading branch information
HereEast committed Oct 6, 2024
1 parent 1ec8357 commit 127ed7d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
9 changes: 3 additions & 6 deletions client/src/components/MonthCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,12 @@ interface MonthCardProps {
}

export function MonthCard({ year, monthData }: MonthCardProps) {
const { userId, today } = useAppContext();
const { today } = useAppContext();

const [monthTasks, setMonthTasks] = useState<ITask[]>(monthData.tasks);
const [monthEntryRatings, setMonthEntryRatings] = useState<Status[]>([]);

const { data: entriesMonthData, isLoading: isEntriesLoading } = useEntries({
userId,
year,
month: monthData.month,
});
Expand Down Expand Up @@ -68,16 +67,14 @@ export function MonthCard({ year, monthData }: MonthCardProps) {
taskId: MongooseId,
deletedTaskRatings: Status[],
) {
const updatedTasks = monthTasks.filter(
(task) => task._id !== taskId,
);
const updatedTasks = monthTasks.filter((task) => task._id !== taskId);

setMonthTasks(updatedTasks);
setMonthEntryRatings((prev) =>
filterDeletedRatings(prev, deletedTaskRatings),
);

await deleteTask(userId, taskId);
await deleteTask(taskId);
}

const isCurrentMonth = today.month === monthData.month;
Expand Down
4 changes: 2 additions & 2 deletions client/src/components/Task.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ interface TaskProps {

// Task
export function Task({ task, year, month, onDelete }: TaskProps) {
const { userId, today } = useAppContext();
const { today } = useAppContext();

const [newTaskTitle, setNewTaskTitle] = useState(task.title);
const [editMode, setEditMode] = useState(false);
Expand All @@ -30,7 +30,7 @@ export function Task({ task, year, month, onDelete }: TaskProps) {
data: entriesData,
isLoading,
error,
} = useEntries({ userId, taskId: task._id, year, month });
} = useEntries({ taskId: task._id, year, month });

const taskRatings = entriesData?.map((entry) => entry.status) || [];
const isCurrentMonth = today.month === month && today.year === year;
Expand Down

0 comments on commit 127ed7d

Please sign in to comment.