Skip to content

Commit 06a63cd

Browse files
authored
Merge pull request #36 from LinkyBoard/dev
[WEB] 배포 최신화
2 parents e037c90 + 2e05abe commit 06a63cd

23 files changed

Lines changed: 182 additions & 145 deletions

File tree

apps/web/src/app/(with-side-bar)/topic/[id]/@modal/(.)sticker/page.tsx

Lines changed: 0 additions & 23 deletions
This file was deleted.

apps/web/src/app/(with-side-bar)/topic/[id]/@modal/default.tsx

Lines changed: 0 additions & 3 deletions
This file was deleted.
Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,14 @@
1+
import TopicStickerDetailModal from "@/components/(with-side-bar)/topic/sticker/topic-sticker-detail-modal";
2+
13
interface TopicStickerDetailLayoutProps {
24
children: React.ReactNode;
3-
modal: React.ReactNode;
45
}
56

6-
export default function TopicStickerDetailLayout({
7-
children,
8-
modal,
9-
}: TopicStickerDetailLayoutProps) {
7+
export default function TopicStickerDetailLayout({ children }: TopicStickerDetailLayoutProps) {
108
return (
119
<>
1210
{children}
13-
{modal}
14-
<div id="modal-root" />
11+
<TopicStickerDetailModal />
1512
</>
1613
);
1714
}

apps/web/src/app/globals.css

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ div.customHandle {
2626
/* Tiptap 에디터 */
2727
.ProseMirror {
2828
height: 100%;
29+
overflow-y: auto;
2930
}
3031

3132
.tiptap {
@@ -34,7 +35,7 @@ div.customHandle {
3435

3536
/* BlockNote 에디터 */
3637
.bn-editor {
37-
padding: 12px 16px !important;
38+
padding: 0 !important;
3839
background-color: var(--background) !important;
3940
color: var(--foreground) !important;
4041
outline: none !important;

apps/web/src/components/(with-side-bar)/dashboard/my-activity.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import Link from "next/link";
44

5-
import { useDashboardStore } from "@/lib/zustand/dashboard-store";
5+
import { useDashboardStore } from "@/lib/zustand/dashboard";
66
import { cn } from "@linkyboard/utils";
77

88
import { Bookmark, Lightbulb, Star } from "lucide-react";

apps/web/src/components/(with-side-bar)/layout/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import Link from "next/link";
44
import { usePathname } from "next/navigation";
55

66
import Logo from "@/assets/logo.svg";
7-
import { useMobileMenuStore } from "@/lib/zustand/mobile-menu-store";
7+
import { useMobileMenuStore } from "@/lib/zustand/mobile-menu";
88
import { cn } from "@linkyboard/utils";
99

1010
import type { LucideIcon } from "lucide-react";

apps/web/src/components/(with-side-bar)/layout/recent-topic-list.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { useRouter } from "next/navigation";
44

55
import SentinelSpinner from "@/components/common/sentinel-spinner";
66
import { useGetAllTopics } from "@/lib/tanstack/query/topic";
7-
import { useDashboardStore } from "@/lib/zustand/dashboard-store";
7+
import { useDashboardStore } from "@/lib/zustand/dashboard";
88
import type { TopicDTO } from "@/models/topic";
99

1010
import { Loader2 } from "lucide-react";

apps/web/src/components/(with-side-bar)/library/content-list.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { useRouter } from "next/navigation";
66
import type { ContentTypeOptions } from "@/constants/content";
77
import { CONTENT_TYPE_OPTIONS } from "@/constants/content";
88
import { useGetCategoryContentById } from "@/lib/tanstack/query/content";
9-
import { useContentSidebarStore } from "@/lib/zustand/content-sidebar-store";
9+
import { useContentSidebarStore } from "@/lib/zustand/content-sidebar";
1010
import { Button } from "@linkyboard/components";
1111
import type { CategoryContentDTO } from "@linkyboard/types";
1212

apps/web/src/components/(with-side-bar)/library/content-sidebar.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ import { invalidateMany } from "@/lib/tanstack";
1010
import { useRemoveContentById, useUpdateContent } from "@/lib/tanstack/mutation/content";
1111
import { useGetCategories } from "@/lib/tanstack/query/category";
1212
import { useGetContentById } from "@/lib/tanstack/query/content";
13-
import { useContentSidebarStore } from "@/lib/zustand/content-sidebar-store";
14-
import { useDashboardStore } from "@/lib/zustand/dashboard-store";
13+
import { useContentSidebarStore } from "@/lib/zustand/content-sidebar";
14+
import { useDashboardStore } from "@/lib/zustand/dashboard";
1515
import type { ContentDetailDTO } from "@/models/content";
1616
import { contentSchema, type ContentSchemaType } from "@/schemas/content";
1717
import { zodResolver } from "@hookform/resolvers/zod";

apps/web/src/components/(with-side-bar)/topic/sticker/block-note.tsx

Lines changed: 59 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import {
1717
import { useRemoveTopic, useUpdateTopic } from "@/lib/tanstack/mutation/topic";
1818
import { useGetCustomStickerById } from "@/lib/tanstack/query/custom-sticker";
1919
import { useGetTopicById } from "@/lib/tanstack/query/topic";
20+
import { useTopicStore } from "@/lib/zustand/topic";
2021
import { uploadImage } from "@/services/image";
2122
import { containsMarkdown } from "@/utils/markdown";
2223
import { revalidatePath } from "@/utils/revalidate";
@@ -33,8 +34,8 @@ import ToggleBlock from "./toggle-block";
3334
import RemoveDialogContent from "../remove-dialog-content";
3435

3536
interface BlockNoteProps {
36-
topicId: string;
37-
stickerId: string;
37+
topicId: string | null;
38+
stickerId: string | null;
3839
}
3940

4041
const blockNoteSchema = BlockNoteSchema.create({
@@ -58,6 +59,8 @@ export default function BlockNote({ topicId, stickerId }: BlockNoteProps) {
5859
const { data: customSticker, isLoading: isCustomStickerLoading } =
5960
useGetCustomStickerById(stickerId);
6061

62+
const topicStore = useTopicStore();
63+
6164
const [title, setTitle] = useState(topic?.title || customSticker?.title || "");
6265

6366
const editor = useCreateBlockNote({
@@ -86,6 +89,7 @@ export default function BlockNote({ topicId, stickerId }: BlockNoteProps) {
8689
isDeleteCustomStickerPending;
8790

8891
const onSave = async () => {
92+
if (!topicId) return;
8993
try {
9094
const content = editor.blocksToHTMLLossy();
9195
if (!isCustomSticker) {
@@ -98,67 +102,78 @@ export default function BlockNote({ topicId, stickerId }: BlockNoteProps) {
98102
{
99103
onSuccess: async () => {
100104
successToast("토픽이 성공적으로 수정되었어요.");
101-
await invalidateMany([
102-
[TOPIC.GET_ALL_TOPICS],
103-
[TOPIC.GET_TOPIC_BOARD_BY_ID, topicId],
104-
]);
105-
router.back();
106-
},
107-
}
108-
);
109-
} else {
110-
await updateCustomSticker(
111-
{
112-
customStickerId: stickerId,
113-
topicId,
114-
title,
115-
content,
116-
},
117-
{
118-
onSuccess: async () => {
119-
successToast("스티커가 성공적으로 수정되었어요.");
120-
await invalidateMany([
121-
[TOPIC.GET_TOPIC_BOARD_BY_ID, topicId],
122-
[CUSTOM_STICKER.GET_CUSTOM_STICKER_BY_ID, stickerId],
123-
]);
124-
router.back();
105+
invalidateQueries([TOPIC.GET_ALL_TOPICS]);
106+
invalidateQueries([TOPIC.GET_TOPIC_BY_ID, topicId, stickerId]);
107+
invalidateQueries([TOPIC.GET_TOPIC_BOARD_BY_ID, topicId]);
108+
109+
if (!topicStore.isOpen) {
110+
router.back();
111+
}
112+
topicStore.reset();
125113
},
126114
}
127115
);
116+
return;
128117
}
118+
if (!stickerId) return;
119+
await updateCustomSticker(
120+
{
121+
customStickerId: stickerId,
122+
topicId,
123+
title,
124+
content,
125+
},
126+
{
127+
onSuccess: async () => {
128+
successToast("스티커가 성공적으로 수정되었어요.");
129+
invalidateQueries([CUSTOM_STICKER.GET_CUSTOM_STICKER_BY_ID, stickerId]);
130+
invalidateQueries([TOPIC.GET_TOPIC_BOARD_BY_ID, topicId]);
131+
if (!topicStore.isOpen) {
132+
router.back();
133+
}
134+
topicStore.reset();
135+
},
136+
}
137+
);
129138
} catch {
130139
errorToast("토픽 수정에 실패했어요.");
131140
}
132141
};
133142

134143
const onDelete = async () => {
135-
if (!isCustomSticker) {
144+
if (!isCustomSticker && topicId) {
136145
await removeTopic(topicId, {
137146
onSuccess: () => {
138147
successToast("토픽이 성공적으로 삭제되었어요.");
139148
invalidateQueries([TOPIC.GET_ALL_TOPICS]);
140149
revalidatePath(`/topic/${topicId}`);
150+
revalidatePath(`/topic/${topicId}/sticker`);
141151
router.push("/topic");
152+
topicStore.reset();
142153
},
143154
onError: () => {
144155
errorToast("토픽 삭제에 실패했어요.");
145156
},
146157
});
147-
} else {
148-
await removeCustomSticker(stickerId, {
149-
onSuccess: () => {
150-
successToast("스티커가 성공적으로 삭제되었어요.");
151-
invalidateMany([
152-
[TOPIC.GET_TOPIC_BOARD_BY_ID, topicId],
153-
[CUSTOM_STICKER.GET_CUSTOM_STICKER_BY_ID, stickerId],
154-
]);
155-
router.back();
156-
},
157-
onError: () => {
158-
errorToast("스티커 삭제에 실패했어요.");
159-
},
160-
});
158+
return;
161159
}
160+
if (!stickerId) return;
161+
await removeCustomSticker(stickerId, {
162+
onSuccess: () => {
163+
successToast("스티커가 성공적으로 삭제되었어요.");
164+
invalidateMany([
165+
[TOPIC.GET_TOPIC_BOARD_BY_ID, topicId],
166+
[CUSTOM_STICKER.GET_CUSTOM_STICKER_BY_ID, stickerId],
167+
]);
168+
if (!topicStore.isOpen) {
169+
router.back();
170+
}
171+
topicStore.reset();
172+
},
173+
onError: () => {
174+
errorToast("스티커 삭제에 실패했어요.");
175+
},
176+
});
162177
};
163178

164179
useEffect(() => {
@@ -197,14 +212,14 @@ export default function BlockNote({ topicId, stickerId }: BlockNoteProps) {
197212
<Loader2 size={24} className="animate-spin" />
198213
</div>
199214
) : (
200-
<>
215+
<div className="h-full space-y-2">
201216
<input
202217
className="border-border w-full border-b pb-3 text-3xl font-bold outline-none"
203218
placeholder="제목을 입력해주세요"
204219
value={title}
205220
onChange={(e) => setTitle(e.target.value)}
206221
/>
207-
<BlockNoteView className="h-[calc(100%-8rem)]" editor={editor} />
222+
<BlockNoteView className="h-[calc(100%-9.25rem)]" editor={editor} />
208223
<div className="flex gap-3">
209224
<Button
210225
onClick={onSave}
@@ -237,7 +252,7 @@ export default function BlockNote({ topicId, stickerId }: BlockNoteProps) {
237252
/>
238253
</Dialog>
239254
</div>
240-
</>
255+
</div>
241256
)}
242257
</div>
243258
);

0 commit comments

Comments
 (0)