Skip to content

Commit

Permalink
feat: implement TestPreviewPage, remove Auth to test on mock-server
Browse files Browse the repository at this point in the history
  • Loading branch information
qmi03 committed Oct 8, 2023
1 parent 6990ec0 commit 2ce2073
Show file tree
Hide file tree
Showing 5 changed files with 387 additions and 20 deletions.
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,17 @@
"prepare": "husky install"
},
"dependencies": {
"@cyntler/react-doc-viewer": "^1.13.0",
"@heroicons/react": "^2.0.18",
"@hookform/resolvers": "^3.2.0",
"@material-tailwind/react": "^2.1.0",
"@types/react-modal": "^3.16.1",
"axios": "^1.4.0",
"moment": "^2.29.4",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-hook-form": "^7.45.4",
"react-modal": "^3.16.1",
"react-router-dom": "^6.15.0",
"react-toastify": "^9.1.3",
"yup": "^1.2.0",
Expand Down
Binary file added public/2309.07870v1.pdf
Binary file not shown.
18 changes: 9 additions & 9 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { useEffect } from 'react';
import { NavigateFunction, useNavigate, useLocation } from 'react-router-dom';
import { AppSkeleton } from '@components/common';
import { MAIN_MENU, SUB_MENU } from '@constants';
import { AppLayout, AuthLayout } from '@layouts';
import { AuthPage, HomePage, TestPreviewPage } from '@pages';
import { AppLayout } from '@layouts';
import { HomePage, TestPreviewPage } from '@pages';
import { useUserStore } from '@states/common';

export default function App() {
Expand All @@ -26,13 +26,13 @@ export default function App() {
return <AppSkeleton />;
}

if (userStatus === 'REJECT') {
return (
<AuthLayout>
<AuthPage />
</AuthLayout>
);
}
// if (userStatus === 'REJECT') {
// return (
// <AuthLayout>
// <AuthPage />
// </AuthLayout>
// );
// }

return (
<AppLayout
Expand Down
35 changes: 34 additions & 1 deletion src/pages/TestPreviewPage.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,36 @@
import DocViewer, { DocViewerRenderers } from '@cyntler/react-doc-viewer';
import Modal from 'react-modal';
import React, { useState } from 'react';
export function TestPreviewPage() {
return <>TestPreviewPage</>;
const [selectedFile, setSelectedFile] = useState<string | null>(null);
const [modalIsOpen, setModalIsOpen] = useState<boolean>(false);
const openPreview = (file: string) => {
setSelectedFile(file);
setModalIsOpen(true);
};
const closePreview = () => {
setModalIsOpen(false);
};
const Files: string[] = [
'http://localhost:3000/ssps-logo.jpg',
'http://localhost:3000/2309.07870v1.pdf'
];
return (
<>
<h1>TestPreviewPage</h1>
<ul>
{Files.map((file, index) => (
<li key={index}>
{file} <button onClick={() => openPreview(file)}>Preview</button>
</li>
))}
</ul>
<Modal isOpen={modalIsOpen} onRequestClose={closePreview}>
{selectedFile && (
<DocViewer pluginRenderers={DocViewerRenderers} documents={[{ uri: selectedFile }]} />
)}
<button onClick={closePreview}>Close Preview</button>
</Modal>
</>
);
}
Loading

0 comments on commit 2ce2073

Please sign in to comment.