mirror of
https://github.com/logto-io/logto.git
synced 2025-03-31 22:51:25 -05:00
refactor(console): add sie tab constants (#2654)
This commit is contained in:
parent
6bead4a319
commit
3ca52420da
3 changed files with 20 additions and 8 deletions
|
@ -31,6 +31,7 @@ import UserDetails from '@/pages/UserDetails';
|
|||
import Users from '@/pages/Users';
|
||||
import Welcome from '@/pages/Welcome';
|
||||
|
||||
import { SignInExperiencePage } from './consts/page-tabs';
|
||||
import { getBasename } from './utilities/router';
|
||||
|
||||
void initI18n();
|
||||
|
@ -73,7 +74,7 @@ const Main = () => {
|
|||
<Route path=":userId/logs/:logId" element={<AuditLogDetails />} />
|
||||
</Route>
|
||||
<Route path="sign-in-experience">
|
||||
<Route index element={<Navigate replace to="branding" />} />
|
||||
<Route index element={<Navigate replace to={SignInExperiencePage.BrandingTab} />} />
|
||||
<Route path=":tab" element={<SignInExperience />} />
|
||||
</Route>
|
||||
<Route path="settings" element={<Settings />} />
|
||||
|
|
5
packages/console/src/consts/page-tabs.ts
Normal file
5
packages/console/src/consts/page-tabs.ts
Normal file
|
@ -0,0 +1,5 @@
|
|||
export enum SignInExperiencePage {
|
||||
BrandingTab = 'branding',
|
||||
SignUpAndSignInTab = 'sign-up-and-sign-in',
|
||||
OthersTab = 'others',
|
||||
}
|
|
@ -12,6 +12,7 @@ import ConfirmModal from '@/components/ConfirmModal';
|
|||
import SubmitFormChangesActionBar from '@/components/SubmitFormChangesActionBar';
|
||||
import TabNav, { TabNavItem } from '@/components/TabNav';
|
||||
import UnsavedChangesAlertModal from '@/components/UnsavedChangesAlertModal';
|
||||
import { SignInExperiencePage } from '@/consts/page-tabs';
|
||||
import type { RequestError } from '@/hooks/use-api';
|
||||
import useApi from '@/hooks/use-api';
|
||||
import useSettings from '@/hooks/use-settings';
|
||||
|
@ -130,16 +131,22 @@ const SignInExperience = () => {
|
|||
className={styles.cardTitle}
|
||||
/>
|
||||
<TabNav className={styles.tabs}>
|
||||
<TabNavItem href="/sign-in-experience/branding" errorCount={getBrandingErrorCount(errors)}>
|
||||
<TabNavItem
|
||||
href={`/sign-in-experience/${SignInExperiencePage.BrandingTab}`}
|
||||
errorCount={getBrandingErrorCount(errors)}
|
||||
>
|
||||
{t('sign_in_exp.tabs.branding')}
|
||||
</TabNavItem>
|
||||
<TabNavItem
|
||||
href="/sign-in-experience/sign-up-and-sign-in"
|
||||
href={`/sign-in-experience/${SignInExperiencePage.SignUpAndSignInTab}`}
|
||||
errorCount={getSignUpAndSignInErrorCount(errors, formData)}
|
||||
>
|
||||
{t('sign_in_exp.tabs.sign_up_and_sign_in')}
|
||||
</TabNavItem>
|
||||
<TabNavItem href="/sign-in-experience/others" errorCount={getOthersErrorCount(errors)}>
|
||||
<TabNavItem
|
||||
href={`/sign-in-experience/${SignInExperiencePage.OthersTab}`}
|
||||
errorCount={getOthersErrorCount(errors)}
|
||||
>
|
||||
{t('sign_in_exp.tabs.others')}
|
||||
</TabNavItem>
|
||||
</TabNav>
|
||||
|
@ -149,10 +156,9 @@ const SignInExperience = () => {
|
|||
<div className={classNames(styles.contentTop, isDirty && styles.withSubmitActionBar)}>
|
||||
<FormProvider {...methods}>
|
||||
<form className={styles.form}>
|
||||
{/* Todo: LOG-4766 Add Constants To Guard Router Path */}
|
||||
<Branding isActive={tab === 'branding'} />
|
||||
<SignUpAndSignIn isActive={tab === 'sign-up-and-sign-in'} />
|
||||
<Others isActive={tab === 'others'} />
|
||||
<Branding isActive={tab === SignInExperiencePage.BrandingTab} />
|
||||
<SignUpAndSignIn isActive={tab === SignInExperiencePage.SignUpAndSignInTab} />
|
||||
<Others isActive={tab === SignInExperiencePage.OthersTab} />
|
||||
</form>
|
||||
</FormProvider>
|
||||
{formData.id && (
|
||||
|
|
Loading…
Add table
Reference in a new issue