-
나의 아카이브 현황
-
-
+ if (!myArchives?.data || isPending) {
+ return
;
+ }
+ return (
+
-
-
-);
+ );
+};
const dummyGatherings: GatheringItem[] = Array.from({ length: 9 }, (_, i) => ({
gatheringId: i,
diff --git a/src/widgets/WriteArchive/ColorChips.tsx b/src/widgets/WriteArchive/ColorChips.tsx
index 2437956..b4a4a58 100644
--- a/src/widgets/WriteArchive/ColorChips.tsx
+++ b/src/widgets/WriteArchive/ColorChips.tsx
@@ -9,8 +9,8 @@ export const ColorChips = ({
selectedColor,
onSelectColor,
}: {
- selectedColor: Color | null;
- onSelectColor: ((color: Color | null) => void) | ((color: Color) => void);
+ selectedColor: Color;
+ onSelectColor: (color: Color) => void;
}) => {
const handleChipClick = (colorName: Color) => {
onSelectColor(colorName);
diff --git a/src/widgets/WriteArchive/ColorChoiceStep.tsx b/src/widgets/WriteArchive/ColorChoiceStep.tsx
index 2bbcd71..c4f9c1f 100644
--- a/src/widgets/WriteArchive/ColorChoiceStep.tsx
+++ b/src/widgets/WriteArchive/ColorChoiceStep.tsx
@@ -9,8 +9,8 @@ export const ColorChoiceStep = ({
onSelectColor,
}: {
onClick: () => void;
- selectedColor: Color | null;
- onSelectColor: ((color: Color | null) => void) | ((color: Color) => void);
+ selectedColor: Color;
+ onSelectColor: (color: Color) => void;
}) => {
return (
<>
diff --git a/src/widgets/WriteArchive/WriteStep.tsx b/src/widgets/WriteArchive/WriteStep.tsx
index a430773..6f10bc8 100644
--- a/src/widgets/WriteArchive/WriteStep.tsx
+++ b/src/widgets/WriteArchive/WriteStep.tsx
@@ -7,7 +7,7 @@ import styles from './WriteStep.module.scss';
import type { Color, PostArchiveApiResponse } from '@/features';
import { ColorMap, useArchiveStore, useCreateArchive, useUpdateArchive } from '@/features';
-import { Button, MarkdownEditor, ScrollToTop, Switch, Tag } from '@/shared/ui';
+import { Button, customToast, MarkdownEditor, ScrollToTop, Switch, Tag } from '@/shared/ui';
export const WriteStep = ({
onClick,
@@ -18,6 +18,7 @@ export const WriteStep = ({
isEdit?: boolean;
}) => {
const navigate = useNavigate();
+ const [isComposing, setIsComposing] = useState(false);
const { archiveData, archiveId, resetArchiveData, setArchiveId, updateArchiveData } =
useArchiveStore();
@@ -25,13 +26,18 @@ export const WriteStep = ({
const handleTagAddition = () => {
if (tag.trim()) {
- updateArchiveData('tags', [...archiveData.tags, { content: tag }]);
- setTag('');
+ const isDuplicate = archiveData.tags.some(existingTag => existingTag.tag === tag.trim());
+ if (!isDuplicate) {
+ updateArchiveData('tags', [...archiveData.tags, { tag: tag.trim() }]);
+ setTag('');
+ } else {
+ customToast({ text: '이미 추가된 태그입니다.', timer: 3000, icon: 'info' });
+ }
}
};
const handleTagRemoval = (tagContent: string) => {
- const updatedTags = archiveData.tags.filter(t => t.content !== tagContent);
+ const updatedTags = archiveData.tags.filter(t => t.tag !== tagContent);
updateArchiveData('tags', updatedTags);
};
@@ -44,9 +50,7 @@ export const WriteStep = ({
resetArchiveData();
navigate(`/archive/${archiveId}`);
setArchiveId(0);
- },
- onError: err => {
- console.error(err);
+ customToast({ text: '아카이브가 수정되었어요!', timer: 3000, icon: 'success' });
},
});
};
@@ -56,9 +60,7 @@ export const WriteStep = ({
onSuccess: (data: PostArchiveApiResponse) => {
resetArchiveData();
navigate(`/archive/${data.data?.archiveId}`);
- },
- onError: err => {
- console.error(err);
+ customToast({ text: '아카이브가 만들어졌어요!', timer: 3000, icon: 'success' });
},
});
};
@@ -71,9 +73,9 @@ export const WriteStep = ({
-
{ColorMap[archiveData.type].name}
+
{ColorMap[archiveData.colorType].name}