Skip to content

Commit

Permalink
modify: error tips page
Browse files Browse the repository at this point in the history
  • Loading branch information
BigSillyTiger committed May 7, 2024
1 parent 90a08b8 commit 399f2e7
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 9 deletions.
24 changes: 21 additions & 3 deletions src/components/ErrorTips.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,31 @@
import type { FC } from "react";
import Card from "./card";
import { useAsyncError } from "react-router-dom";
import { useAsyncError, useNavigate } from "react-router-dom";
import { useTranslation } from "react-i18next";

const ErrorTips: FC = () => {
const { t } = useTranslation();
const nevigate = useNavigate();
const error = useAsyncError();
console.log("---> Error EL Tips:", error);
return <Card>{t("tips.errorTips")}</Card>;
console.log("---> Error Tips Page:", error);
return (
<div className="h-full w-full flex flex-col justify-center items-center">
<Card className="flex flex-col justify-center items-center">
<p className="text-lg font-bold">{t("tips.errorTips")}</p>
<button
type="button"
className="w-full rounded-md bg-white px-3 py-2 text-sm font-semibold text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 hover:bg-gray-50"
onClick={(e) => {
e.preventDefault();
return nevigate("/login", { replace: true });
}}
>
{t("btn.goToLogin")}
</button>
</Card>
;
</div>
);
};

export default ErrorTips;
2 changes: 1 addition & 1 deletion src/components/loadingEle/loadingPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import SpinningEle from "./SpinningEle";
const LoadingPage = () => {
return (
<>
<div className="flex justify-center">
<div className="flex w-full h-full justify-center items-center">
<SpinningEle />
</div>
</>
Expand Down
4 changes: 3 additions & 1 deletion src/configs/i18n/scriptEn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ const en = {
download: "Download",
edit: "Edit",
editInfo: "Edit Personal Info",
goToLogin: "Go to Login",
invoice: "Invoice",
newOrder: "New Order",
newService: "New Service",
Expand Down Expand Up @@ -304,7 +305,8 @@ const en = {
noDutyToday: "No Work Assignment Today",
noDutyTomorrow: "No Work Assignment Tomorrow",
noDeduction: "No Deduction",
errorTips: "Something went wrong.",
errorTips:
"Something went wrong. Pleas try Re-Login or Contact Manager.",
unfinishedPS: "Unfinished Payslip",
unconfirmedWL: "Unconfirmed Worklogs",
noClient: "No client",
Expand Down
4 changes: 2 additions & 2 deletions src/pages/dashboard/MainContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ const MainContent: FC = () => {
}, [newTodayWLs]);

return (
<div className="flex flex-col gap-4">
<div className="flex flex-col gap-4 px-4 sm:px-6 lg:px-8 top-0">
<div className="h-screen lg:h-[45dvh] flex flex-col md:flex-row px-2 gap-4">
<DutyCard
worklogs={newTodayWLs}
Expand All @@ -70,7 +70,7 @@ const MainContent: FC = () => {
}
/>

<OrderArrangement className="h-[100dvh] lg:h-[45dvh] md:w-full lg:w-[45vw]" />
<OrderArrangement className="h-[100dvh] lg:h-[45dvh] md:w-full " />
</div>
{currentAdmin.role === ROLES.manager && (
<div className="px-2">
Expand Down
2 changes: 1 addition & 1 deletion src/pages/dashboard/dashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const Dashboard: FC = () => {
}, [actionData, modalOpen, setModalOpen, t]);

return (
<div className="mx-2 px-0">
<div className="container border-0">
<Suspense fallback={<SpinningEle />}>
<Await resolve={allPromise} errorElement={<ErrorTips />}>
<MainContent />
Expand Down
2 changes: 1 addition & 1 deletion src/pages/setting/MainContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const MainContent: FC = () => {
];

return (
<div className="container">
<div className="px-4 sm:px-6 lg:px-8 top-0">
<Tab.Group defaultIndex={0}>
<Tab.List className="flex space-x-1 rounded-xl bg-blue-900/20 p-1">
{mTabList.map((item, index) => {
Expand Down

0 comments on commit 399f2e7

Please sign in to comment.