Skip to content

Commit

Permalink
Bugs Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
six-standard committed Aug 25, 2024
1 parent 167ee94 commit a4c4e91
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 14 deletions.
6 changes: 4 additions & 2 deletions packages/main/src/pages/Error.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
import { Header } from "ui";
import { useParams } from "react-router-dom";

const string: { [key: string]: string } = {
400: "Bad Request",
401: "Unauthorized",
403: "Forbidden",
404: "Not found",
unsigned: "Unsigned Error",
unsigned: "Unsigned Error"
};

export const Error = () => {
const { code } = useParams();

return (
<div className="col-flex flex-center size-full">
<div className="col-flex flex-center w-full h-screen relative">
<Header className="absolute top-0" />
<span className="text-[7rem] font-black">{code}</span>
<span className="text-[1.5rem] font-medium">
{string[code || "unsigned"]}
Expand Down
6 changes: 5 additions & 1 deletion packages/main/src/pages/Pdf/LibraryView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@ export const LibraryView = () => {
) : (
<Page pageIndex={page - 1} className="w-fit h-fit" width={450} />
)}
<Page pageIndex={page} className="w-fit h-fit" width={450} />
{page === max ? (
<div className="w-[450px] h-full" />
) : (
<Page pageIndex={page} className="w-fit h-fit" width={450} />
)}
</Document>
<Box
width="100%"
Expand Down
4 changes: 1 addition & 3 deletions packages/main/src/router/Layout/components/Modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,7 @@ export const Modal = ({ opened, setOpened }: IProp) => {
<div
className="relative w-96 h-12 rounded-md bg-[#2E2E2E] flex gap-6 items-center cursor-pointer"
onClick={() =>
window.localStorage.replace(
`${process.env.VITE_APP_URL_STUDENT}/login`
)
window.location.replace(`${process.env.VITE_APP_URL_TEACHER}/login`)
}
>
<div className="rounded-l-md bg-black w-[70px] h-full flex flex-center">
Expand Down
8 changes: 5 additions & 3 deletions packages/main/src/router/Layout/index.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
import { Header, Modal } from "./components";
import { Outlet } from "react-router-dom";
import { useState } from "react";
export * from "./ViewLayout";

export const Layout = () => {
interface IProp {
children: React.ReactElement | React.ReactElement[];
}
export const Layout = ({ children }: IProp) => {
const [opened, setOpened] = useState(false);

return (
<div className="w-full h-screen bg-gray-900">
<Header setOpened={setOpened} />
<Modal opened={opened} setOpened={setOpened} />
<Outlet />
{children}
</div>
);
};
13 changes: 9 additions & 4 deletions packages/main/src/router/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,14 @@ export const Router = () => {
return (
<BrowserRouter>
<Routes>
<Route path="/" element={<Layout />}>
<Route path="" element={<_.Landing />} />
<Route path="error/:code" element={<_.Error />} />
</Route>
<Route
path="/"
element={
<Layout>
<_.Landing />
</Layout>
}
/>
<Route path="/render/">
<Route path="all/:year/:grade" element={<_.Book />} />
<Route path="specific/:id" element={<_.Specific />} />
Expand All @@ -18,6 +22,7 @@ export const Router = () => {
<Route path="teacher/:id" element={<_.TeacherView />} />
<Route path="library/:id" element={<_.LibraryView />} />
</Route>
<Route path="error/:code" element={<_.Error />} />
<Route path="/*" element={<Navigate to="/error/404" />} />
</Routes>
</BrowserRouter>
Expand Down
2 changes: 1 addition & 1 deletion packages/teacher/src/page/Library/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ interface IProp {

const navigate = (id: string) =>
window.location.replace(
`${process.env._VITE_APP_URL_MAIN}/library/${id}?prev=${window.location.href}`
`http://localhost:3000/viewer/library/${id}?prev=${window.location.href}`
);

export const Button = ({ id, year, grade, generation }: IProp) => {
Expand Down

0 comments on commit a4c4e91

Please sign in to comment.