Skip to content

Commit 16d6aec

Browse files
authored
Merge pull request #761 from depromeet/feature/760
feat: 템플릿 리스트 관련 플로우 개선
2 parents ef3160a + 6f2468d commit 16d6aec

File tree

3 files changed

+37
-3
lines changed

3 files changed

+37
-3
lines changed

apps/web/src/app/desktop/component/retrospect/template/list/TemplateListConform.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ export function TemplateListConform() {
6161
height: 100%;
6262
`}
6363
>
64-
<Header title={"해당 템플릿으로\n회고를 진행할까요?"} />
64+
<Header title={"추천받은 템플릿 질문들로\n회고를 진행할까요?"} />
6565
<Spacing size={12} />
6666
<div
6767
css={css`

apps/web/src/app/desktop/component/retrospect/template/list/TemplateListItem/index.tsx

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ import { TemplateLottiePicture } from "@/component/template/TemplateLottiePictur
77
import { DESIGN_SYSTEM_COLOR } from "@/style/variable";
88
import { useFunnelModal } from "@/hooks/useFunnelModal";
99
import TemplateListDetailItem from "../TemplateListDetailItem";
10+
import { useSetAtom } from "jotai";
11+
import { retrospectInitialState } from "@/store/retrospect/retrospectInitial";
12+
import { TemplateListConform } from "../TemplateListConform";
13+
import { useSearchParams } from "react-router-dom";
1014

1115
type DesktopTemplateListItemProps = {
1216
id: number;
@@ -18,7 +22,11 @@ type DesktopTemplateListItemProps = {
1822

1923
export function TemplateListItem({ id, title, tag, imageUrl }: DesktopTemplateListItemProps) {
2024
const { readOnly } = useContext(TemplateListPageContext);
21-
const { openFunnelModal } = useFunnelModal();
25+
const { openFunnelModal, closeFunnelModal } = useFunnelModal();
26+
const setRetrospectValue = useSetAtom(retrospectInitialState);
27+
28+
const [searchParams, setSearchParams] = useSearchParams();
29+
const type = searchParams.get("template_type");
2230

2331
const handleClickDetail = () => {
2432
openFunnelModal({
@@ -90,6 +98,27 @@ export function TemplateListItem({ id, title, tag, imageUrl }: DesktopTemplateLi
9098
border-radius: 0.8rem;
9199
border: 0.1rem solid #dfe3ea;
92100
`}
101+
onClick={(event) => {
102+
// 선택하기 버튼 클릭 시, 상위로 이벤트를 전파하지 않고 바로 템플릿 확정 페이지로 이동합니다.
103+
event.stopPropagation();
104+
if (type === "new_space") {
105+
// 새로운 스페이스 생성을 진행할 때 (+ 회고 템플릿 동시 생성)
106+
setSearchParams({ selected_template_id: id.toString() });
107+
closeFunnelModal();
108+
} else {
109+
// 기존 스페이스가 존재할 때, (회고 템플릿 별도 생성)
110+
setRetrospectValue((prev) => ({
111+
...prev,
112+
tempTemplateId: String(id),
113+
saveTemplateId: true,
114+
}));
115+
openFunnelModal({
116+
title: "",
117+
step: "recommendTemplate",
118+
contents: <TemplateListConform />,
119+
});
120+
}
121+
}}
93122
>
94123
<Typography variant={"body12Bold"} color={"gray800"}>
95124
선택하기

apps/web/src/app/desktop/space/add/AddSpacePage.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,11 @@ function SelectRetrospectTemplateFunnel() {
320320
}
321321
}, [searchParams]);
322322

323+
useEffect(() => {
324+
// 컴포넌트 언마운트 시점에 쿼리 스트링을 정리
325+
return () => setSearchParams({});
326+
}, []);
327+
323328
return (
324329
<Fragment>
325330
<Header title={`${title}에 맞는\n회고 템플릿을 찾아볼까요?`} />
@@ -668,7 +673,7 @@ function RecommendRetrospectTemplateConfirmFunnel() {
668673
height: 100%;
669674
`}
670675
>
671-
<Header title={"해당 템플릿으로\n회고를 진행할까요?"} contents="템플릿을 기반으로 질문을 커스텀 할 수 있어요" />
676+
<Header title={"추천받은 템플릿 질문들로\n회고를 진행할까요?"} contents="템플릿을 기반으로 질문을 커스텀 할 수 있어요" />
672677
<Spacing size={10} />
673678
<div
674679
css={css`

0 commit comments

Comments
 (0)