Skip to content

Commit 1e2ce0f

Browse files
authored
Merge pull request depromeet#620 from depromeet/619-회고-작성-시-좌측-ui-버튼-연동회고-추가-템플리-변경-멤버
feat: 회고 작성 시 회고 추가, 템플릿 변경, 멤버 버튼 연동 작업
2 parents 6f107aa + 1e8aed4 commit 1e2ce0f

2 files changed

Lines changed: 67 additions & 31 deletions

File tree

apps/web/src/app/desktop/component/analysis/AnalysisOverview/AnalysisOverviewHeader.tsx

Lines changed: 63 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,77 @@
11
import { Icon } from "@/component/common/Icon";
22
import { Typography } from "@/component/common/typography";
33
import 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";
49
import { currentSpaceState } from "@/store/space/spaceAtom";
510
import { DESIGN_TOKEN_COLOR } from "@/style/designTokens";
611
import { isSpaceLeader } from "@/utils/userUtil";
712
import { 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

1020
export 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
{/* ---------- 실행목표 ---------- */}

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,11 @@ export function TemplateList() {
2525
const { toast } = useToast();
2626
const isReadOnly = useRef(false);
2727
const isLeader = useRef(false);
28-
const { spaceId } = useRequiredParams<{ spaceId: string }>();
29-
const { data: templates } = useGetDefaultTemplateList();
28+
const params = useRequiredParams<{ spaceId?: string }>();
3029
const [searchParams] = useSearchParams();
30+
const spaceId = params.spaceId || searchParams.get("spaceId") || "";
31+
32+
const { data: templates } = useGetDefaultTemplateList();
3133

3234
// * @see AddSpacePage.tsx - 첫 스페이스와 회고 생성시에 템플릿 선택 화면으로 이동할 때 URL 파라미터로 타입을 넘겨줘요
3335
const type = searchParams.get("template_type") || "";

0 commit comments

Comments
 (0)