Refactor join page and update packages

The join page's redirect functionality has been replaced with permanentRedirect. Adjustments were also made for handling conditional authentication and user account verification. Package upgrades were performed and the i18n client now checks if an instance is already initialized. The process tends to deliver performance benefits and enhancing the code readability.
This commit is contained in:
giancarlo
2024-04-14 13:48:50 +08:00
parent fd890ea09d
commit 91bee99857
13 changed files with 446 additions and 422 deletions

View File

@@ -1,5 +1,6 @@
'use client';
import { If } from './if';
import { LoadingOverlay } from './loading-overlay';
import { TopLoadingBarIndicator } from './top-loading-bar-indicator';
import { Trans } from './trans';
@@ -8,21 +9,29 @@ export function GlobalLoader({
children,
displayLogo = false,
fullPage = false,
displaySpinner = true,
displayTopLoadingBar = true,
}: React.PropsWithChildren<{
displayLogo?: boolean;
fullPage?: boolean;
displaySpinner?: boolean;
displayTopLoadingBar?: boolean;
}>) {
const Text = children ?? <Trans i18nKey={'common:loading'} />;
return (
<>
<TopLoadingBarIndicator />
<If condition={displayTopLoadingBar}>
<TopLoadingBarIndicator />
</If>
<div className={'flex flex-1 flex-col items-center justify-center py-48'}>
<LoadingOverlay displayLogo={displayLogo} fullPage={fullPage}>
{Text}
</LoadingOverlay>
</div>
<If condition={displaySpinner}>
<div className={'flex flex-1 flex-col items-center justify-center py-48'}>
<LoadingOverlay displayLogo={displayLogo} fullPage={fullPage}>
{Text}
</LoadingOverlay>
</div>
</If>
</>
);
}

View File

@@ -1,6 +1,6 @@
import type { PropsWithChildren } from 'react';
import { cn } from '../utils/cn';
import { cn } from '../utils';
import Spinner from './spinner';
export function LoadingOverlay({