Skip to content

Commit

Permalink
feat: 재방문 localstorage 사용
Browse files Browse the repository at this point in the history
  • Loading branch information
sjoleee committed Nov 5, 2023
1 parent f80fcd8 commit 5494366
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions src/constants/storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ export const LOCAL_STORAGE_KEY = {
reviewShortQuestionMessages: 'nlasq',
surveyCustomQuestions: 'nlascq',
surveyCreateSurveyRequest: 'nlascsr',
resultRevisit: 'nlarv',
} as const;
12 changes: 6 additions & 6 deletions src/pages/result/SurveyIdLoaded.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import Pill, { type Color } from '~/components/pill/Pill';
import Toast from '~/components/toast/Toast';
import useToast from '~/components/toast/useToast';
import { defaultEasing } from '~/constants/motions';
import { LOCAL_STORAGE_KEY } from '~/constants/storage';
import CollaborationCounter from '~/features/feedback/CollaborationCounter';
import Feedback from '~/features/feedback/Feedback';
import NewFeedbackCopyButton from '~/features/feedback/NewFeedbackCopyButton';
Expand All @@ -34,6 +35,8 @@ import useGetReviewersSummaryBySurveyId from '~/hooks/api/reviewers/useGetReview
import useBoolean from '~/hooks/common/useBoolean';
import useScrollLock from '~/hooks/common/useScrollLock';
import { useScrollSpy } from '~/hooks/common/useScrollSpy';
import useWillUnmount from '~/hooks/lifeCycle/useWillUnmount';
import useLocalStorage from '~/hooks/storage/useLocalStorage';
import { BODY_2_REGULAR, HEAD_1, HEAD_2_BOLD } from '~/styles/typo';

interface Props {
Expand All @@ -44,6 +47,8 @@ const PILL_COLORS: Color[] = ['bluegreen', 'pink', 'skyblue', 'yellowgreen', 'pu

const SurveyIdLoaded = ({ surveyId }: Props) => {
const { fireToast } = useToast();
const [isRevisit, setIsRevisit] = useLocalStorage<boolean>(`${LOCAL_STORAGE_KEY.resultRevisit}`, false);
useWillUnmount(() => !isRevisit && setIsRevisit(true));

const { isLoading: isFeedbackSummaryLoading, data: feedbackSummaryData } = useGetFeedbackSummaryBySurveyId(surveyId);
const { isLoading: isReviewersSummaryLoading, data: reviewersSummaryData } =
Expand Down Expand Up @@ -248,7 +253,7 @@ const SurveyIdLoaded = ({ surveyId }: Props) => {
reviewer={feedback.reviewer}
is_bookmarked={feedback.bookmark.is_bookmarked}
isBookmarkable={true}
withBookmarkTooltip={index === 0 ? true : false}
withBookmarkTooltip={index === 0 && !isRevisit ? true : false}
/>
))}
</div>
Expand Down Expand Up @@ -282,7 +287,6 @@ const emptyFeedbackWrapperCss = css`

const emptyTextCss = (theme: Theme) => css`
${HEAD_2_BOLD};
color: ${theme.colors.gray_400};
`;

Expand Down Expand Up @@ -340,23 +344,20 @@ const ResearchMoveAnchorCss = (innerWidth: number) => css`

const titleCss = css`
${HEAD_1}
margin: 16px 0;
`;

const choiceQuestionTitleCss = css`
display: flex;
gap: 12px;
${HEAD_1}
margin: 16px 0;
`;

const shortQuestionTitleCss = css`
display: flex;
gap: 12px;
${HEAD_1}
margin: 16px 7px;
`;

Expand Down Expand Up @@ -403,7 +404,6 @@ const floatingKeyframes = keyframes`

const bubbleSpanCss = (theme: Theme) => css`
${BODY_2_REGULAR};
position: absolute;
top: -100%;
left: 50%;
Expand Down

0 comments on commit 5494366

Please sign in to comment.