Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/Team-Lecue/Lecue-Client
Browse files Browse the repository at this point in the history
…into Hotfix-Dori
  • Loading branch information
doyn511 committed Jan 19, 2024
2 parents dbf3d69 + b68afd3 commit 90a0ee3
Show file tree
Hide file tree
Showing 11 changed files with 37 additions and 46 deletions.
2 changes: 1 addition & 1 deletion src/Detail/components/LecueNoteListContainer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ function LecueNoteListContainer(props: LecueNoteListContainerProps) {
) {
sessionStorage.setItem('scrollPosition', window.scrollY.toString());

navigate('/sticker-pack', { state: { bookId: bookId } });
navigate('/sticker-pack', { state: { bookId: bookId }, replace: true });
} else {
setModalOn(true);
}
Expand Down
3 changes: 2 additions & 1 deletion src/Detail/components/SmallLecueNote/SmallLecueNote.style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ export const SmallLecueNoteNickName = styled.p`

export const SmallLecueNoteContentWrapper = styled.div`
display: flex;
justify-content: center;
align-items: center;
height: 10rem;
Expand All @@ -81,6 +80,8 @@ export const SmallLecueNoteContent = styled.p`
max-height: 100%;
white-space: pre-wrap;
${({ theme }) => theme.fonts.Body2_M_14};
`;

Expand Down
36 changes: 18 additions & 18 deletions src/Detail/components/ZigZagView/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,24 +40,6 @@ const ZigZagView = forwardRef(function ZigZagView(
))}
</Fragment>
)}

{isEditable && (
<Draggable
defaultPosition={{
x: 0,
y: savedScrollPosition,
}}
onDrag={handleDrag}
bounds="parent"
nodeRef={nodeRef}
>
<S.Sticker
ref={nodeRef}
stickerImage={stickerState.stickerImage}
isEditable
/>
</Draggable>
)}
{postedStickerList.length > 0 && (
<Fragment>
{postedStickerList.map(
Expand All @@ -78,6 +60,24 @@ const ZigZagView = forwardRef(function ZigZagView(
)}
</Fragment>
)}

{isEditable && (
<Draggable
defaultPosition={{
x: 0,
y: savedScrollPosition,
}}
onDrag={handleDrag}
bounds="parent"
nodeRef={nodeRef}
>
<S.Sticker
ref={nodeRef}
stickerImage={stickerState.stickerImage}
isEditable
/>
</Draggable>
)}
</S.ZigZagViewWrapper>
);
});
Expand Down
2 changes: 1 addition & 1 deletion src/LecueNote/page/LeceuNotePage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ function LecueNotePage() {
const postMutation = usePostLecueNote();
const location = useLocation();

const { bookId } = location.state;
const { bookId } = location.state || {};

const handleClickCategory = (
e: React.MouseEvent<HTMLButtonElement, MouseEvent>,
Expand Down
26 changes: 7 additions & 19 deletions src/Router.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import { Suspense } from 'react';
import { ErrorBoundary } from 'react-error-boundary';
import { ErrorBoundary, FallbackProps } from 'react-error-boundary';
import { useQueryErrorResetBoundary } from 'react-query';
import { BrowserRouter, Route, Routes } from 'react-router-dom';

import ErrorPage from './components/common/ErrorPage';
Expand All @@ -20,9 +21,10 @@ import StickerPack from './StickerPack/page/StickerPack';
import TargetPage from './Target/page/TargetPage';

function Router() {
const { reset } = useQueryErrorResetBoundary();
return (
<BrowserRouter>
<ErrorBoundary FallbackComponent={fallbackRender}>
<ErrorBoundary FallbackComponent={fallbackRender} onReset={reset}>
<Suspense fallback={<LoadingPage />}>
<Routes>
<Route path="/" element={<SelectView />} />
Expand Down Expand Up @@ -54,23 +56,9 @@ function Router() {

export default Router;

function fallbackRender({ error, resetErrorBoundary }: any) {
if (error.response.status === 404 || error.error.response.status === 404) {
resetErrorBoundary();
function fallbackRender({ error }: FallbackProps) {
if (error.response?.status === 401 || error.response?.status === 403) {
return <Login />;
} else if (
error.response.status === 401 ||
error.error.response.status === 401
) {
resetErrorBoundary();
localStorage.removeItem('token');
localStorage.removeItem('nickname');
return <Login />;
} else {
alert(
` ${error.response.status},
${error.error.response.status},
에러 발생 : 콘솔창 캡쳐해서 개발자 보내주삼`,
);
}
return <ErrorPage />;
}
2 changes: 1 addition & 1 deletion src/SelectBook/components/MakeLecueBookButton/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ function MakeLecueBookButton({ isActive, onClick }: MakeLecueBookButtonProps) {
return (
<S.MakeLecueBookButtonWrapper>
<Button variant="choose" disabled={!isActive} onClick={onClick}>
레큐북 만들기
다음
</Button>
</S.MakeLecueBookButtonWrapper>
);
Expand Down
2 changes: 1 addition & 1 deletion src/SelectBook/page/SelectBookPage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function SelectBookPage() {

return (
<S.SelectBookPageWrapper>
<Header headerTitle="레큐북 만들기" />
<Header headerTitle="요금 선택" />
<S.SelectBookPageBodyWrapper>
<S.SelectBookContainer isClickedSelectButton={isClickedSelectButton}>
{isClickedSelectButton ? (
Expand Down
2 changes: 1 addition & 1 deletion src/StickerAttach/hooks/usePostStickerState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const usePostStickerState = (bookUuId: string) => {
});
},
onSuccess: () => {
navigate(`/lecue-book/${bookUuId}`);
navigate(`/lecue-book/${bookUuId}`, { replace: true });
},

onError: () => navigate('/error'),
Expand Down
4 changes: 2 additions & 2 deletions src/StickerPack/page/StickerPack/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ function StickerPack() {
const navigate = useNavigate();
const location = useLocation();

const { bookId } = location.state;
const { bookId } = location.state || {};

const [selectedStickerData, setSelectedStickerData] = useState<stickerType>({
stickerId: 0,
Expand All @@ -37,7 +37,7 @@ function StickerPack() {

const handleClickDone = () => {
navigate(`/sticker-attach/${bookUuId}`, {
state: { sticker: selectedStickerData },
state: { sticker: selectedStickerData, replace: true },
});
};

Expand Down
2 changes: 1 addition & 1 deletion src/Target/components/CompleteButton/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ function CompleteButton({ isActive, onClick }: CompleteButtonProps) {
return (
<S.CompleteButtonWrapper>
<Button variant="complete" disabled={!isActive} onClick={onClick}>
완료
다음
</Button>
</S.CompleteButtonWrapper>
);
Expand Down
2 changes: 2 additions & 0 deletions src/Target/page/TargetPage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ function TargetPage() {
};
}

sessionStorage.setItem('name', name);

navigate('/select-book', {
state: { presignedFileName: presignedFileName, name: name },
});
Expand Down

0 comments on commit 90a0ee3

Please sign in to comment.