@@ -7,6 +7,10 @@ import { TemplateLottiePicture } from "@/component/template/TemplateLottiePictur
77import { DESIGN_SYSTEM_COLOR } from "@/style/variable" ;
88import { useFunnelModal } from "@/hooks/useFunnelModal" ;
99import 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
1115type DesktopTemplateListItemProps = {
1216 id : number ;
@@ -18,7 +22,11 @@ type DesktopTemplateListItemProps = {
1822
1923export 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 선택하기
0 commit comments