Skip to content

Commit

Permalink
Merge pull request #397 from depromeet/bugfix/391/plainTextStyle
Browse files Browse the repository at this point in the history
fix: #391 Fixed Plain Text Container Style
  • Loading branch information
klmhyeonwoo authored Sep 13, 2024
2 parents 9b3244e + d0bf401 commit 80e8167
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 17 deletions.
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
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;
flex: 1;
`}
>
{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

0 comments on commit 80e8167

Please sign in to comment.