Skip to content

Commit

Permalink
Merge pull request #403 from depromeet/develop
Browse files Browse the repository at this point in the history
develop -> main
  • Loading branch information
sean2337 authored Sep 14, 2024
2 parents 1b89d40 + 7483545 commit cb589c4
Show file tree
Hide file tree
Showing 14 changed files with 105 additions and 40 deletions.
27 changes: 21 additions & 6 deletions apps/web/src/app/retrospect/analysis/RetrospectAnalysisPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ import { AnalysisContainer } from "@/component/retrospect/analysis/Analysis";
import { PersonalForm } from "@/component/retrospect/analysis/PersonalForm.tsx";
import { QuestionForm } from "@/component/retrospect/analysis/QuestionForm.tsx";
import { useGetAnalysisAnswer } from "@/hooks/api/retrospect/analysis/useGetAnalysisAnswer.ts";
import { useApiGetSpacePrivate } from "@/hooks/api/space/useGetSpace";
import { useTabs } from "@/hooks/useTabs";
import { DualToneLayout } from "@/layout/DualToneLayout";
import { EmptyList } from "@/component/common/empty";
import { PendingAnalysisingComp } from "@/component/retrospect/analysis/PendingAnalysisingComp";

export const RetrospectAnalysisPage = () => {
const { title, defaultTab } = useLocation().state as { title: string; defaultTab: "질문" | "개별" | "분석" };
Expand All @@ -25,14 +27,22 @@ export const RetrospectAnalysisPage = () => {
const { tabs, curTab, selectTab } = useTabs(tabNames);
const selectedTab = tabMappings[curTab];
const queryParams = new URLSearchParams(location.search);
const spaceId = queryParams.get("spaceId");
const retrospectId = queryParams.get("retrospectId");
const { data, isLoading } = useGetAnalysisAnswer({ spaceId: spaceId!, retrospectId: retrospectId! });
const spaceId = queryParams.get("spaceId") as string;
const retrospectId = queryParams.get("retrospectId") as string;
const { data, isLoading } = useGetAnalysisAnswer({ spaceId: spaceId, retrospectId: retrospectId });
const { data: spaceInfo } = useApiGetSpacePrivate(Number(spaceId));
let pendingPeopleCnt = 0;

if (spaceInfo && data) {
pendingPeopleCnt = spaceInfo.memberCount - data.individuals.length;
}

useEffect(() => {
if (defaultTab) {
selectTab(defaultTab);
}
}, []);

return (
<DualToneLayout
bottomTheme="gray"
Expand All @@ -43,14 +53,19 @@ export const RetrospectAnalysisPage = () => {
</Fragment>
}
>
{isLoading && <LoadingModal />}
{!data || data.individuals.length === 0 ? (
{isLoading ? (
<LoadingModal />
) : !data || data.individuals.length === 0 ? (
<EmptyList icon={"ic_clock"} message={"제출된 회고가 없어요"} />
) : (
{
QUESTIONS: <QuestionForm data={data} />,
INDIVIDUAL_ANALYSIS: <PersonalForm data={data} />,
ANALYSIS: <AnalysisContainer spaceId={spaceId!} retrospectId={retrospectId!} hasAIAnalyzed={data?.hasAIAnalyzed} />,
ANALYSIS: data.hasAIAnalyzed ? (
<AnalysisContainer spaceId={spaceId} retrospectId={retrospectId} hasAIAnalyzed={data.hasAIAnalyzed} />
) : (
<PendingAnalysisingComp pendingPeople={pendingPeopleCnt} />
),
}[selectedTab]
)}
</DualToneLayout>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import { useTestNatigate } from "@/lib/test-natigate";

export function RetrospectCreateComplete() {
const navigate = useTestNatigate();
const locationState = useLocation().state as { spaceId: number; retrospectId: number };
const { spaceId, retrospectId } = locationState;
const locationState = useLocation().state as { spaceId: number; retrospectId: number; title: string; introduction: string };
const { spaceId, retrospectId, title, introduction } = locationState;
return (
<DefaultLayout>
<Spacing size={2.9} />
Expand All @@ -39,7 +39,7 @@ export function RetrospectCreateComplete() {
<ButtonProvider.Primary
onClick={() => {
navigate("/write", {
state: { spaceId, retrospectId },
state: { spaceId, retrospectId, title, introduction },
});
}}
>
Expand Down
15 changes: 13 additions & 2 deletions apps/web/src/app/write/RetrospectWritePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ type PhaseContextProps = {
decrementPhase: () => void;
spaceId: number;
retrospectId: number;
title: string;
introduction: string;
};

export const AdvanceQuestionsNum = 2;
Expand All @@ -32,6 +34,8 @@ export const PhaseContext = createContext<PhaseContextProps>({
phase: 1,
spaceId: -1,
retrospectId: -1,
title: "",
introduction: "",
movePhase: () => {},
incrementPhase: () => {},
decrementPhase: () => {},
Expand All @@ -48,7 +52,12 @@ function adjustOrder(data: QuestionData): QuestionData {

export function RetrospectWritePage() {
const location = useLocation();
const { spaceId, retrospectId } = location.state as { spaceId: number; retrospectId: number };
const { spaceId, retrospectId, title, introduction } = location.state as {
spaceId: number;
retrospectId: number;
title: string;
introduction: string;
};
const [phase, setPhase] = useState(-1);

const { data, isLoading } = useGetQuestions({ spaceId: spaceId, retrospectId: retrospectId });
Expand All @@ -75,7 +84,9 @@ export function RetrospectWritePage() {
return (
<Fragment>
{isLoading && <LoadingModal purpose={"회고 작성을 위한 데이터를 가져오고 있어요"} />}
<PhaseContext.Provider value={{ data: adjustedData ?? defaultData, phase, movePhase, incrementPhase, decrementPhase, spaceId, retrospectId }}>
<PhaseContext.Provider
value={{ data: adjustedData ?? defaultData, phase, movePhase, incrementPhase, decrementPhase, spaceId, retrospectId, title, introduction }}
>
{phase >= 0 ? <Write /> : <Prepare />}
</PhaseContext.Provider>
</Fragment>
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/component/actionItem/NotActionItemBoxData.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export function NotActionItemBoxData() {
}
`}
>
<Typography>30일간 진행한 회고가 없어요!</Typography>
<Typography>설정된 실행목표가 없어요!</Typography>
<Typography>회고를 진행해 실행목표를 설정해보세요</Typography>
</div>
<Spacing size={3} />
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/component/home/EmptyAnalysis.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export function EmptyAnalysis() {
line-height: 1.5;
`}
>
완료된 회고가 없어요 <br />
분석 완료된 회고가 없어요 <br />
회고를 진행해 분석을 받아보세요!
</Typography>
<Spacing size={3} />
Expand Down
15 changes: 5 additions & 10 deletions apps/web/src/component/home/SpaceOverview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ const SpaceOverview = forwardRef<HTMLDivElement, SpaceOverviewProps>(
width: 100%;
display: flex;
justify-content: space-between;
align-items: center;
margin-top: 1.4rem;
`}
>
Expand All @@ -101,16 +102,10 @@ const SpaceOverview = forwardRef<HTMLDivElement, SpaceOverviewProps>(
gap: 0.4rem;
`}
>
<Icon icon="ic_user" size="2rem" />
<div
css={css`
margin-top: 0.3rem;
`}
>
<Typography variant="body12Medium" color="gray900">
{memberCount}
</Typography>
</div>
<Icon icon="ic_user" size={1.7} />
<Typography variant="body14Medium" color="gray900">
{memberCount}
</Typography>
</div>
</div>
</div>
Expand Down
10 changes: 6 additions & 4 deletions apps/web/src/component/home/SummaryInsightBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ type SummaryInsightBoxProps = {

export function SummaryInsightBox({ type, insightArr }: SummaryInsightBoxProps) {
const transformPoints = transformPointsFun(insightArr);

if (transformPoints.length === 0) return;
return (
<div
css={css`
Expand All @@ -43,9 +43,11 @@ export function SummaryInsightBox({ type, insightArr }: SummaryInsightBoxProps)
gap: 1rem;
`}
>
{transformPoints.map((point, idx) => (
<InsightBox key={idx} type={type} insight={point} />
))}
{transformPoints
.filter((v) => v.point != null)
.map((point, idx) => (
<InsightBox key={idx} type={type} insight={point} />
))}
</div>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export function InsightsBoxSection({ isTeam, type, insightArr }: InsightsBoxProp
line-height: 3.2rem;
`}
>
{`${isTeam ? "우리팀" : user.name}`}{" "}
{`${isTeam ? "우리팀" : user.name + "님"}`}{" "}
{type === "goodPoints" && (
<>
<Typography
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import { css } from "@emotion/react";

import { Icon } from "@/component/common/Icon";
import { Spacing } from "@/component/common/Spacing";
import { Typography } from "@/component/common/typography";

export function PendingAnalysisingComp({ pendingPeople }: { pendingPeople: number }) {
return (
<div
css={css`
height: 100dvh;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
`}
>
<Icon icon="ic_clock" size={8} />
<Spacing size={2} />
<Typography
variant="title18Bold"
color="gray900"
css={css`
text-align: center;
`}
>
{pendingPeople}명이 더 작성하면 <br />
분석 확인이 가능해요!
</Typography>
<Spacing size={3} />
<Typography variant="body16Medium" color="gray500">
모두 회고를 제출한 후에 분석을 시작할게요
</Typography>
</div>
);
}
14 changes: 8 additions & 6 deletions apps/web/src/component/space/view/RetrospectBox.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { css } from "@emotion/react";
import { PATHS } from "@layer/shared";
import { useState, useEffect, useRef } from "react";
import { useNavigate } from "react-router-dom";

import { ProceedingTextBox } from "./ProceedingTextBox";
import { RetrospectOptions } from "./RetrospectOptions";

import { Icon } from "@/component/common/Icon";
Expand All @@ -15,8 +17,6 @@ import { useToast } from "@/hooks/useToast.ts";
import { DESIGN_TOKEN_COLOR } from "@/style/designTokens";
import { Retrospect } from "@/types/retrospect";
import { formatDateAndTime } from "@/utils/date";
import { ProceedingTextBox } from "./ProceedingTextBox";
import { PATHS } from "@layer/shared";

const statusStyles = {
PROCEEDING: DESIGN_TOKEN_COLOR.blue50,
Expand Down Expand Up @@ -63,6 +63,8 @@ export function RetrospectBox({
if (analysisStatus === "NOT_STARTED" && (writeStatus === "NOT_STARTED" || writeStatus === "PROCEEDING")) {
navigate(PATHS.write(), {
state: {
title,
introduction,
retrospectId,
spaceId,
},
Expand Down Expand Up @@ -154,7 +156,7 @@ export function RetrospectBox({
css={css`
width: 100%;
height: auto;
background-color: ${retrospect.retrospectStatus === "PROCEEDING" ? statusStyles.PROCEEDING : statusStyles.DONE};
background-color: ${retrospectStatus === "PROCEEDING" ? statusStyles.PROCEEDING : statusStyles.DONE};
border-radius: 1rem;
padding: 2rem;
display: flex;
Expand All @@ -176,7 +178,7 @@ export function RetrospectBox({
<ProceedingTextBox writeStatus={writeStatus} analysisStatus={analysisStatus} />
{isLeader && (
<RetrospectOptions
retrospectStatus={retrospect.retrospectStatus}
retrospectStatus={retrospectStatus}
isOptionsVisible={isOptionsVisible}
toggleOptionsVisibility={toggleOptionsVisibility}
removeBtnClickFun={removeBtnClickFun}
Expand Down Expand Up @@ -224,12 +226,12 @@ export function RetrospectBox({
`}
>
<Typography color="gray500" variant="body14Medium">
{retrospect.deadline == null ? (
{!deadline ? (
<>모든 인원 제출 시 마감</>
) : (
<>
{" "}
{retrospect.retrospectStatus === "DONE" ? "마감일" : "마감 예정일"} | {formatDateAndTime(deadline!)}
{retrospectStatus === "DONE" ? "마감일" : "마감 예정일"} | {formatDateAndTime(deadline)}
</>
)}
</Typography>
Expand Down
10 changes: 6 additions & 4 deletions apps/web/src/component/write/phase/Write.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export function Write() {
const { open } = useModal();

/** Write Local State */
const { data, incrementPhase, decrementPhase, phase, movePhase, spaceId, retrospectId } = useContext(PhaseContext);
const { data, incrementPhase, decrementPhase, phase, movePhase, spaceId, retrospectId, title, introduction } = useContext(PhaseContext);
const [isEntireModalOpen, setEntireModalOpen] = useState(false);
const [isTemporarySaveModalOpen, setTemporarySaveModalOpen] = useState(false);
const [isAnswerFilled, setIsAnswerFilled] = useState(false);
Expand Down Expand Up @@ -137,6 +137,8 @@ export function Write() {
state: {
spaceId: spaceId,
retrospectId: retrospectId,
title: title,
introduction: introduction,
},
});
const plainTextAnswers = answers.filter(({ questionType }) => questionType === "plain_text");
Expand Down Expand Up @@ -334,9 +336,9 @@ export function Write() {
margin-bottom: 0.8rem;
display: flex;
flex: 1;
flex-direction: column;
row-gap: 0.8rem;
height: 100%;
`}
>
{data?.questions.map((item) => {
Expand Down Expand Up @@ -423,9 +425,9 @@ export function Write() {
{isComplete && (
<Fragment>
<HeaderProvider>
<HeaderProvider.Subject contents={`중간발표 이후 회고`} />
<HeaderProvider.Subject contents={title ?? ""} />
<HeaderProvider.Description
contents={`방향성 체크 및 팀 내 개선점 구축`}
contents={introduction ?? ""}
css={css`
color: #7e7c7c;
`}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ export function ResultContainer({ name, question, children, ...props }: PropsWit
margin-top: 2.4rem;
border-radius: 0.78rem;
padding: 1.9rem 2rem 1.7rem 2rem;
height: 100%;
min-height: fit-content;
box-shadow: 0 3.886px 11.657px 0 rgba(33, 37, 41, 0.04);
font-size: 1.6rem;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export const usePostRetrospectCreate = (spaceId: number) => {
});

navigate(PATHS.completeRetrospectCreate(), {
state: { retrospectId, spaceId },
state: { retrospectId, spaceId, title: variables?.body?.title, introduction: variables?.body?.introduction },
});
resetRetroCreateData();
},
Expand Down
3 changes: 3 additions & 0 deletions apps/web/src/hooks/useEditQuestions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ export const useEditQuestions = () => {
};

const handleDeleteConfirm = () => {
if (temporarilyDeletedIndexes.length === 0) {
return;
}
setNewQuestions((prev) => prev.filter((_, i) => !isTemporarilyDeleted(i)));
setTemporarilyDeletedIndexes([]);
toast.success("삭제가 완료되었어요!");
Expand Down

0 comments on commit cb589c4

Please sign in to comment.