-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: 질문 폼 생성하기 베이스 배경 이미지 적용 (#490)
* chore: deps * feat: 설문 없을 때 배경 이미지 적용 * feat: 설문이 있을 때 핸들링 (#491) * feat: 설문이 있을 때 핸들링 * feat: 연구 결과 피드백 없을 때 마크업 (#492) * chore: 결과 베이스 이미지 * feat: mobile header props 뚫기 * feat: 결과 베이스
- Loading branch information
Showing
5 changed files
with
117 additions
and
7 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
import { type FC, useEffect } from 'react'; | ||
import Image from 'next/image'; | ||
import { useRouter } from 'next/router'; | ||
import { css, type Theme } from '@emotion/react'; | ||
|
||
import BottomBar from '~/components/bottomBar/BottomBar'; | ||
import Button from '~/components/button/Button'; | ||
import MobileHeader from '~/components/header/MobileHeader'; | ||
import FixedSpinner from '~/components/loading/FixedSpinner'; | ||
import LoadingHandler from '~/components/loading/LoadingHandler'; | ||
import useGetFeedbackSummaryBySurveyId from '~/hooks/api/feedbacks/useGetFeedbackSummaryBySurveyId'; | ||
import useGetSurveyIdByUserStatus from '~/hooks/api/surveys/useGetSurveyIdByUserStatus'; | ||
import { HEAD_2_BOLD } from '~/styles/typo'; | ||
|
||
const ResultBasePage: FC = () => { | ||
const { data, isLoading } = useGetSurveyIdByUserStatus(); | ||
|
||
return ( | ||
<LoadingHandler isLoading={isLoading} fallback={<FixedSpinner />}> | ||
{data && <WhenSurveyIdLoaded surveyId={data.survey_id} />} | ||
</LoadingHandler> | ||
); | ||
}; | ||
|
||
export default ResultBasePage; | ||
|
||
interface WhenSurveyIdLoadedProps { | ||
surveyId: string; | ||
} | ||
|
||
const WhenSurveyIdLoaded: FC<WhenSurveyIdLoadedProps> = ({ surveyId }) => { | ||
const router = useRouter(); | ||
const { data } = useGetFeedbackSummaryBySurveyId(surveyId); | ||
|
||
useEffect( | ||
function replaceWhenHasFeedback() { | ||
if (!data) return; | ||
if (data.all_feedback_count > 0) router.replace('/result'); | ||
}, | ||
[data, router], | ||
); | ||
|
||
return ( | ||
<> | ||
<main css={mainCss}> | ||
<MobileHeader title="연구 결과" hasMenu={false} /> | ||
<Image css={imageCss} alt="빈 폴더" src="/images/result/empty.webp" width={212} height={162} /> | ||
<span css={spanCss}>아직 도착한 피드백이 없어요</span> | ||
<Button color="blue">질문 폼 공유하기</Button> | ||
</main> | ||
<BottomBar /> | ||
</> | ||
); | ||
}; | ||
|
||
const mainCss = css` | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
justify-content: center; | ||
width: 100%; | ||
height: 100dvh; | ||
`; | ||
|
||
const imageCss = css` | ||
margin-bottom: 30px; | ||
`; | ||
|
||
const spanCss = (theme: Theme) => css` | ||
${HEAD_2_BOLD}; | ||
margin-bottom: 32px; | ||
color: ${theme.colors.gray_400}; | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters