11import { Icon } from "@/component/common/Icon" ;
22import { Typography } from "@/component/common/typography" ;
33import SpaceManageToggleMenu from "@/component/space/edit/SpaceManageToggleMenu" ;
4+ import { useApiOptionsGetSpaceInfo } from "@/hooks/api/space/useApiOptionsGetSpaceInfo" ;
5+ import { useActionModal } from "@/hooks/useActionModal" ;
6+ import { useFunnelModal } from "@/hooks/useFunnelModal" ;
7+ import { useModal } from "@/hooks/useModal" ;
8+ import { retrospectInitialState } from "@/store/retrospect/retrospectInitial" ;
49import { currentSpaceState } from "@/store/space/spaceAtom" ;
510import { DESIGN_TOKEN_COLOR } from "@/style/designTokens" ;
611import { isSpaceLeader } from "@/utils/userUtil" ;
712import { css } from "@emotion/react" ;
8- import { useAtomValue } from "jotai" ;
13+ import { useQueries } from "@tanstack/react-query" ;
14+ import { useAtomValue , useSetAtom } from "jotai" ;
15+ import { RetrospectCreate } from "../../retrospectCreate" ;
16+ import { TemplateChoice } from "../../retrospect/choice" ;
17+ import { TemplateList } from "../../retrospect/template/list" ;
18+ import MemberManagement from "@/component/retrospect/space/members/MemberManagement" ;
919
1020export default function AnalysisOverviewHeader ( ) {
21+ const { open } = useModal ( ) ;
22+ const { openFunnelModal } = useFunnelModal ( ) ;
23+ const { openActionModal } = useActionModal ( ) ;
1124 // TODO: 새로고침해도 query를 통해서 데이터를 불러오도록 수정 필요
1225 const currentSelectedSpace = useAtomValue ( currentSpaceState ) ;
26+ const setRetrospectValue = useSetAtom ( retrospectInitialState ) ;
1327
14- const { name, introduction, memberCount , formTag, leader, id : spaceId } = currentSelectedSpace || { } ;
28+ const { name, introduction, formTag, leader, id : spaceId } = currentSelectedSpace || { } ;
1529 const isLeader = isSpaceLeader ( leader ?. id ) ;
1630
31+ const [ { data : spaceInfo } ] = useQueries ( {
32+ queries : [ useApiOptionsGetSpaceInfo ( spaceId ) ] ,
33+ } ) ;
34+
35+ // 회고 추가 함수
36+ const handleRetrospectCreate = ( ) => {
37+ if ( spaceInfo ?. formId ) {
38+ setRetrospectValue ( ( prev ) => ( {
39+ ...prev ,
40+ templateId : String ( spaceInfo . formId ) ,
41+ } ) ) ;
42+
43+ open ( {
44+ title : "전에 진행했던 템플릿이 있어요!\n계속 진행하시겠어요?" ,
45+ contents : "" ,
46+ options : {
47+ buttonText : [ "재설정" , "진행하기" ] ,
48+ } ,
49+ onConfirm : ( ) => {
50+ openFunnelModal ( {
51+ title : "" ,
52+ step : "retrospectCreate" ,
53+ contents : < RetrospectCreate /> ,
54+ } ) ;
55+ } ,
56+ onClose : ( ) => {
57+ openActionModal ( {
58+ title : "" ,
59+ contents : < TemplateChoice /> ,
60+ } ) ;
61+ } ,
62+ } ) ;
63+ }
64+ } ;
65+
66+ // 템플릿 변경 함수
67+ const handleMoveToListTemplate = ( ) => {
68+ openFunnelModal ( {
69+ title : "템플릿 리스트" ,
70+ step : "listTemplate" ,
71+ contents : < TemplateList /> ,
72+ } ) ;
73+ } ;
74+
1775 return (
1876 < section >
1977 { /* ---------- 스페이스 이름 ---------- */ }
@@ -56,6 +114,7 @@ export default function AnalysisOverviewHeader() {
56114 gap : 0.4rem ;
57115 cursor : pointer;
58116 ` }
117+ onClick = { handleRetrospectCreate }
59118 >
60119 < Icon icon = { "ic_plus" } size = { 1.2 } color = { DESIGN_TOKEN_COLOR . gray00 } />
61120 < Typography variant = "body14SemiBold" color = "gray00" >
@@ -76,6 +135,7 @@ export default function AnalysisOverviewHeader() {
76135 flex : 1 ;
77136 cursor : pointer;
78137 ` }
138+ onClick = { handleMoveToListTemplate }
79139 >
80140 < Icon icon = { "ic_document_color" } size = { 2.0 } color = { DESIGN_TOKEN_COLOR . gray00 } />
81141 < Typography variant = "body14SemiBold" color = "gray600" >
@@ -85,33 +145,7 @@ export default function AnalysisOverviewHeader() {
85145 </ article >
86146
87147 { /* ---------- 회고 인원수 필터 ---------- */ }
88- < article
89- css = { css `
90- display : flex;
91- padding : 0.8rem ;
92- border-radius : 0.8rem ;
93- justify-content : space-between;
94- align-items : center;
95- gap : 0.6rem ;
96- background-color : ${ DESIGN_TOKEN_COLOR . white } ;
97- flex : 1 ;
98- cursor : pointer;
99- ` }
100- >
101- < div
102- css = { css `
103- display : flex;
104- align-items : center;
105- gap : 0.6rem ;
106- ` }
107- >
108- < Icon icon = { "ic_team" } size = { 2.0 } color = { DESIGN_TOKEN_COLOR . gray00 } />
109- < Typography variant = "body14SemiBold" color = "gray600" >
110- { memberCount }
111- </ Typography >
112- </ div >
113- < Icon icon = { "ic_chevron_down" } size = { 1.4 } color = { DESIGN_TOKEN_COLOR . gray600 } />
114- </ article >
148+ < MemberManagement spaceId = { spaceId as string } />
115149 </ section >
116150
117151 { /* ---------- 실행목표 ---------- */ }
0 commit comments