Skip to content

Commit

Permalink
fix: 끄적이는 페이지 아카이빙 제거
Browse files Browse the repository at this point in the history
  • Loading branch information
miro-ring committed Feb 24, 2024
1 parent 2c5ec7e commit 4e14085
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/components/Dropdown/FolderDropdown/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const FolderDropdown = ({
return (
<>
{onClickBookmark ? (
<Button onClick={onClickBookmark}>
<Button onClick={onClickBookmark} className={styles.deleteBookmark}>
<Icon icon="bookmark" color={COLORS['Blue/Default']} />
</Button>
) : (
Expand Down
5 changes: 5 additions & 0 deletions src/components/Dropdown/FolderDropdown/style.css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,8 @@ export const icon = style({
position: 'absolute',
marginTop: '2px',
});

export const deleteBookmark = style({
position: 'relative',
zIndex: 1,
});
7 changes: 7 additions & 0 deletions src/domain/끄적이는/components/Card/Today/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import FolderDropdown from '@components/Dropdown/FolderDropdown';
import MenuDropdown from '@components/Dropdown/MenuDropdown';
import SkeletonContent from '@components/Loading/Skeleton/SkeletonContent';
import { TOAST_MESSAGE } from '@constants/toast';
import useDeleteArchive from '@domain/끄적이는/mutations/useDeleteArchive';
import useDeleteTemporalMemo from '@domain/끄적이는/mutations/useDeleteTemporalMemo';
import useEditTemporalMemo from '@domain/끄적이는/mutations/useEditTemporalMemo';
import useSaveTemporalMemo from '@domain/끄적이는/mutations/useSaveTemporalMemo';
Expand Down Expand Up @@ -41,6 +42,7 @@ const WriteTodayCard = ({
const { mutate: updateTemporalMemo } = useEditTemporalMemo();
const { mutate: deleteTemporalMemo } = useDeleteTemporalMemo();
const { mutate: saveTemporalMemo } = useSaveTemporalMemo();
const { mutate: deleteArchive } = useDeleteArchive();

const editInputProps = useInput({
id: 'edit-today-input',
Expand Down Expand Up @@ -76,6 +78,10 @@ const WriteTodayCard = ({
saveTemporalMemo({ temporalMemoId: memo.id, memoFolderId });
};

const handleBookmark = () => {
deleteArchive(memo.id);
};

if (isEditMode) {
return (
<Card color="blue" defaultIsVisibleMenu>
Expand Down Expand Up @@ -112,6 +118,7 @@ const WriteTodayCard = ({
isArchived={memo.isArchived}
memoFolders={memoFolders}
onClickFolder={handleFolderClick}
onClickBookmark={handleBookmark}
/>
<MenuDropdown
onEdit={() => onEditClick(memo.id)}
Expand Down
22 changes: 22 additions & 0 deletions src/domain/끄적이는/mutations/useDeleteArchive.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { useMutation, useQueryClient } from '@tanstack/react-query';

import { http } from '@api/http';

import { TemporalMemoQueryKeys } from '../constants/queryKeys';

const deleteArchive = async (id: number) => {
await http.delete(`/temporal-memos/${id}/archive`);
};

const useDeleteArchive = () => {
const queryClient = useQueryClient();

return useMutation({
mutationFn: deleteArchive,
onSuccess: () => {
queryClient.invalidateQueries({ queryKey: TemporalMemoQueryKeys.all });
},
});
};

export default useDeleteArchive;

0 comments on commit 4e14085

Please sign in to comment.