mirror of
https://github.com/logto-io/logto.git
synced 2025-01-06 20:40:08 -05:00
style(ui): hide back CTA for root error pages (#3407)
This commit is contained in:
parent
2bd5f36fc3
commit
cc7f3fcdab
4 changed files with 16 additions and 13 deletions
|
@ -80,7 +80,7 @@ const App = () => {
|
|||
<Route element={<AppLayout />}>
|
||||
<Route
|
||||
path="unknown-session"
|
||||
element={<ErrorPage message="error.invalid_session" />}
|
||||
element={<ErrorPage isRootPath message="error.invalid_session" />}
|
||||
/>
|
||||
<Route path="springboard" element={<Springboard />} />
|
||||
|
||||
|
@ -128,7 +128,7 @@ const App = () => {
|
|||
<Route path="callback/:connectorId" element={<Callback />} />
|
||||
</Route>
|
||||
|
||||
<Route path="*" element={<ErrorPage />} />
|
||||
<Route path="*" element={<ErrorPage isRootPath />} />
|
||||
</Route>
|
||||
</Routes>
|
||||
</AppBoundary>
|
||||
|
|
|
@ -16,9 +16,10 @@ type Props = {
|
|||
title?: TFuncKey;
|
||||
message?: TFuncKey;
|
||||
rawMessage?: string;
|
||||
isRootPath?: boolean;
|
||||
};
|
||||
|
||||
const ErrorPage = ({ title = 'description.not_found', message, rawMessage }: Props) => {
|
||||
const ErrorPage = ({ title = 'description.not_found', message, rawMessage, isRootPath }: Props) => {
|
||||
const { t } = useTranslation();
|
||||
const navigate = useNavigate();
|
||||
const { theme } = useContext(PageContext);
|
||||
|
@ -27,19 +28,21 @@ const ErrorPage = ({ title = 'description.not_found', message, rawMessage }: Pro
|
|||
|
||||
return (
|
||||
<StaticPageLayout>
|
||||
<NavBar />
|
||||
{!isRootPath && <NavBar />}
|
||||
<div className={styles.container}>
|
||||
{theme === 'light' ? <EmptyState /> : <EmptyStateDark />}
|
||||
<div className={styles.title}>{t(title)}</div>
|
||||
{errorMessage && <div className={styles.message}>{String(errorMessage)}</div>}
|
||||
</div>
|
||||
<Button
|
||||
className={styles.backButton}
|
||||
title="action.back"
|
||||
onClick={() => {
|
||||
navigate(-1);
|
||||
}}
|
||||
/>
|
||||
{!isRootPath && (
|
||||
<Button
|
||||
className={styles.backButton}
|
||||
title="action.back"
|
||||
onClick={() => {
|
||||
navigate(-1);
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
</StaticPageLayout>
|
||||
);
|
||||
};
|
||||
|
|
|
@ -17,7 +17,7 @@ const Register = () => {
|
|||
const { t } = useTranslation();
|
||||
|
||||
if (!signInMode || signInMode === SignInMode.SignIn) {
|
||||
return <ErrorPage />;
|
||||
return <ErrorPage isRootPath />;
|
||||
}
|
||||
|
||||
return (
|
||||
|
|
|
@ -17,7 +17,7 @@ const SignIn = () => {
|
|||
const { t } = useTranslation();
|
||||
|
||||
if (!signInMode || signInMode === SignInMode.Register) {
|
||||
return <ErrorPage />;
|
||||
return <ErrorPage isRootPath />;
|
||||
}
|
||||
|
||||
return (
|
||||
|
|
Loading…
Reference in a new issue