Skip to content

Commit

Permalink
Merge pull request #918 from woowacourse-teams/FE/dev
Browse files Browse the repository at this point in the history
[FE] 🚀 테스트 서버 배포
  • Loading branch information
anttiey authored Oct 24, 2024
2 parents 17822c3 + c2378ad commit ed4f325
Show file tree
Hide file tree
Showing 41 changed files with 404 additions and 358 deletions.
7 changes: 4 additions & 3 deletions frontend/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ import Main from '@/pages/Main/Main';
import MyPage from '@/pages/MyPage/MyPage';
import PairRoomOnboarding from '@/pages/PairRoomOnboarding/PairRoomOnboarding';
import PrivateRoutes from '@/pages/PrivateRoutes';
import Retrospect from '@/pages/Retrospect/Retrospect';
import RetrospectForm from '@/pages/RetrospectForm/RetrospectForm';
import RetrospectView from '@/pages/RetrospectView/RetrospectView';
import SignUp from '@/pages/SignUp/SignUp';

import HowToPair from '@/components/Landing/HowToPair/HowToPair';
Expand Down Expand Up @@ -100,11 +101,11 @@ const App = () => {
},
{
path: ':accessCode/retrospect',
element: <Retrospect />,
element: <RetrospectView />,
},
{
path: ':accessCode/retrospectForm',
element: <Retrospect readOnly={false} />,
element: <RetrospectForm />,
},
],
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { CheckBoxChecked, CheckBoxUnchecked } from '@/assets';

import useToastStore from '@/stores/toastStore';

import * as S from './CategoryItem.styles';

interface CategoryItemProps {
Expand All @@ -11,6 +13,8 @@ interface CategoryItemProps {
}

const CategoryItem = ({ closeModal, categoryName, categoryId, isChecked, handleSelectCategory }: CategoryItemProps) => {
const { addToast } = useToastStore();

return (
<S.Layout>
<S.Container>
Expand All @@ -20,6 +24,8 @@ const CategoryItem = ({ closeModal, categoryName, categoryId, isChecked, handleS
if (event.currentTarget.id === '카테고리') return;
if (isChecked) return;
handleSelectCategory(event.currentTarget.id);
addToast({ status: 'SUCCESS', message: `${categoryName}가 선택되었어요.` });

closeModal();
}}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export const Header = styled.div`
export const CategoryList = styled.ul`
display: flex;
flex-direction: column-reverse;
gap: 1rem;
gap: 2rem;
width: 100%;
`;
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { useNavigate } from 'react-router-dom';

import Button from '@/components/common/Button/Button';
import Spinner from '@/components/common/Spinner/Spinner';

import useUserStore from '@/stores/userStore';

Expand All @@ -18,9 +19,13 @@ const RetrospectButton = ({ accessCode }: RetrospectButtonProps) => {

const { userStatus } = useUserStore();

const { isUserInPairRoom } = useGetUserIsInPairRoom(accessCode);
const { isUserRetrospectExist } = useGetUserRetrospectExists(accessCode);
const { isUserInPairRoom, isUserInPairRoomFetching } = useGetUserIsInPairRoom(accessCode);
const { isUserRetrospectExist, isUserRetrospectExistsFetching } = useGetUserRetrospectExists(accessCode);

const isLoading = isUserInPairRoomFetching || isUserRetrospectExistsFetching;
if (isLoading) {
return <Spinner size="sm" />;
}
if (userStatus !== 'SIGNED_IN' || !isUserInPairRoom)
return (
<S.Layout>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export const ConnectText = styled.div`
transition: color 0.7s ease;
`;

export const PairRoomButton = styled.button<{ $status: PairRoomStatus }>`
export const PairRoomButton = styled.button<{ $status: PairRoomStatus; $color: 'secondary' | 'primary' }>`
display: flex;
justify-content: space-between;
align-items: center;
Expand Down Expand Up @@ -130,14 +130,14 @@ export const PairRoomButton = styled.button<{ $status: PairRoomStatus }>`
height: 100%;
border-radius: 1rem;
background-color: ${({ $status, theme }) =>
$status === 'IN_PROGRESS' ? theme.color.secondary[100] : theme.color.black[30]};
background-image: ${({ $status, theme }) =>
background-color: ${({ $status, $color, theme }) =>
$status === 'IN_PROGRESS' ? theme.color[$color][100] : theme.color.black[30]};
background-image: ${({ $status, theme, $color }) =>
$status === 'IN_PROGRESS'
? `linear-gradient(
90deg,
${theme.color.secondary[100]} 0 75%,
${theme.color.secondary[600]} 75% 100%
${theme.color[$color][100]} 0 75%,
${theme.color[$color][600]} 75% 100%
)`
: `linear-gradient(
90deg,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const PairRoomButton = ({ driver, navigator, status, accessCode }: PairRoomButto
return (
<S.Layout>
<S.LinkWrapper to={`/room/${accessCode}`} state={{ valid: true }} replace={true}>
<S.PairRoomButton $status={status}>
<S.PairRoomButton $status={status} $color="secondary">
<S.RoleTextContainer>
<S.RoleText $status={status}>
<span>드라이버</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,15 @@ const RetrospectButton = ({ accessCode, answer }: RetrospectButtonProps) => {
return (
<S.Layout>
<S.LinkWrapper to={`/room/${accessCode}/retrospect`} state={{ valid: true }}>
<S.PairRoomButton $status="IN_PROGRESS">
<S.PairRoomButton $status="IN_PROGRESS" $color="primary">
<S.RoleTextContainer>
<S.RoleText $status="IN_PROGRESS">
<span>{accessCode}</span>
{splitAnswer(answer)}
</S.RoleText>
</S.RoleTextContainer>
<S.ConnectText>
더보기
보기
<IoIosArrowForward size="1.8rem" />
</S.ConnectText>
</S.PairRoomButton>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import styled from 'styled-components';
import styled, { css } from 'styled-components';

export const Layout = styled.div`
display: flex;
Expand Down Expand Up @@ -48,3 +48,8 @@ export const Item = styled.li<{ $isChecked: boolean }>`
color: ${({ theme }) => theme.color.black[10]};
}
`;
export const CustomInputMessage = css`
top: 4rem;
font-size: 1rem;
`;
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import { CheckBoxChecked, CheckBoxUnchecked } from '@/assets';
import Input from '@/components/common/Input/Input';
import IconButton from '@/components/PairRoom/ReferenceCard/CategoryManagementModal/IconButton/IconButton';

import useToastStore from '@/stores/toastStore';

import { DEFAULT_CATEGORY_ID } from '@/hooks/PairRoom/useCategories';
import useEditCategory from '@/hooks/PairRoom/useEditCategory';

Expand Down Expand Up @@ -35,6 +37,8 @@ const CategoryItem = ({
deleteCategoryName,
} = useEditCategory(accessCode, categoryId, categoryName);

const { addToast } = useToastStore();

const handleSubmit = async (event: React.FormEvent) => {
event.preventDefault();
await updateCategoryName();
Expand All @@ -49,6 +53,7 @@ const CategoryItem = ({
if (isChecked) return;

handleSelectCategory(event.currentTarget.id);
addToast({ status: 'SUCCESS', message: `${categoryName}가 선택되었어요.` });
closeModal();
};

Expand All @@ -63,6 +68,7 @@ const CategoryItem = ({
status={newCategoryName.status}
message={newCategoryName.message}
onChange={(event) => handleCategoryName(event, categoryName)}
$messageCss={S.CustomInputMessage}
/>
<S.IconContainer>
<IconButton icon="CHECK" type="submit" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const Header = styled.div`
export const CategoryList = styled.ul`
display: flex;
flex-direction: column-reverse;
gap: 1rem;
gap: 2rem;
width: 100%;
`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const AddPairModal = ({ isOpen, closeModal, onPairData }: AddPairModalProps) =>
addToast({ status: 'SUCCESS', message: '페어 정보 연동에 성공했습니다.' });
} catch (error) {
if (error instanceof Error) {
addToast({ status: 'ERROR', message: '회원 정보가 없습니다. 아이디를 다시 확인해 주세요.' });
addToast({ status: 'ERROR', message: error.message });
}
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,19 @@ import { RiInformation2Line } from 'react-icons/ri';
import * as S from './InformationBox.styles';

interface InformationBoxProps {
title: string;
title?: string;
description: string;
}

const InformationBox = ({ title, description }: InformationBoxProps) => {
return (
<S.Layout role="presentation">
<S.Title>
<RiInformation2Line size="2rem" aria-hidden="true" />
{title}
</S.Title>
{title && (
<S.Title>
<RiInformation2Line size="2rem" aria-hidden="true" />
{title}
</S.Title>
)}
<S.Description>{description}</S.Description>
</S.Layout>
);
Expand Down
36 changes: 36 additions & 0 deletions frontend/src/components/Retrospect/Header/Header.styles.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import styled, { css } from 'styled-components';

export const buttonStyles = css`
width: 11rem;
border-color: ${({ theme }) => theme.color.secondary[600]};
color: ${({ theme }) => theme.color.secondary[600]};
&:hover {
border-color: ${({ theme }) => theme.color.secondary[700]};
color: ${({ theme }) => theme.color.secondary[700]};
}
`;

export const Layout = styled.div`
display: flex;
justify-content: space-between;
`;

export const TitleContainer = styled.div`
display: flex;
flex-direction: column;
gap: 1rem;
`;

export const Title = styled.h1`
color: ${({ theme }) => theme.color.primary[800]};
font-size: ${({ theme }) => theme.fontSize.h3};
font-weight: ${({ theme }) => theme.fontWeight.semibold};
`;

export const SubTitle = styled.h2`
color: ${({ theme }) => theme.color.primary[700]};
font-size: ${({ theme }) => theme.fontSize.lg};
`;
26 changes: 26 additions & 0 deletions frontend/src/components/Retrospect/Header/Header.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import Button from '@/components/common/Button/Button';

import * as S from './Header.styles';

interface HeaderProps {
title: string;
subTitle: string;
buttonText: string;
onButtonClick: () => void;
}

const Header = ({ title, subTitle, buttonText, onButtonClick }: HeaderProps) => {
return (
<S.Layout>
<S.TitleContainer>
<S.Title>{title}</S.Title>
<S.SubTitle>{subTitle}</S.SubTitle>
</S.TitleContainer>
<Button $css={S.buttonStyles} filled={false} rounded={true} size="sm" color="primary" onClick={onButtonClick}>
{buttonText}
</Button>
</S.Layout>
);
};

export default Header;
14 changes: 8 additions & 6 deletions frontend/src/components/Retrospect/Question/Question.styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,17 @@ import styled from 'styled-components';
export const Container = styled.div`
display: flex;
flex-direction: column;
gap: 2.5rem;
gap: 2rem;
`;

export const LabelContainer = styled.div`
display: flex;
flex-direction: column;
gap: 1.2rem;
`;

export const Label = styled.label`
color: ${({ theme }) => theme.color.primary[700]};
font-size: ${({ theme }) => theme.fontSize.lg};
`;

export const Subtitle = styled.p`
color: ${({ theme }) => theme.color.black[70]};
font-size: ${({ theme }) => theme.fontSize.md};
font-weight: ${({ theme }) => theme.fontWeight.medium};
`;
11 changes: 8 additions & 3 deletions frontend/src/components/Retrospect/Question/Question.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
import InformationBox from '@/components/PairRoomOnboarding/InformationBox/InformationBox';

import * as S from './Question.styles';

interface QuestionProps extends React.PropsWithChildren {
readonly?: boolean;
id: string;
title: string;
subtitle: string;
}

const Question = ({ id, title, subtitle, children }: QuestionProps) => (
const Question = ({ readonly = false, id, title, subtitle, children }: QuestionProps) => (
<S.Container>
<S.Label htmlFor={id}>{title}</S.Label>
<S.Subtitle>💡 {subtitle}</S.Subtitle>
<S.LabelContainer>
<S.Label htmlFor={id}>{title}</S.Label>
{!readonly && <InformationBox description={`💡 ${subtitle}`} />}
</S.LabelContainer>
{children}
</S.Container>
);
Expand Down

This file was deleted.

Loading

0 comments on commit ed4f325

Please sign in to comment.