Refactor code and update dependencies configuration
This commit includes reorganizing dependencies in 'package.json' for better readability. It also refactors code associated with user and personal account data along with animations for AvatarFallback and profile name display. Additionally, the 'next' package version has been updated to '14.2.0-canary.56'. Some changes have been made for minor corrections and enhancements in the scripts.
This commit is contained in:
@@ -10,12 +10,19 @@ import { PersonalAccountDropdown } from '@kit/accounts/personal-account-dropdown
|
||||
import { useSignOut } from '@kit/supabase/hooks/use-sign-out';
|
||||
import { useUser } from '@kit/supabase/hooks/use-user';
|
||||
import { Button } from '@kit/ui/button';
|
||||
import { If } from '@kit/ui/if';
|
||||
import { Trans } from '@kit/ui/trans';
|
||||
|
||||
import featuresFlagConfig from '~/config/feature-flags.config';
|
||||
import pathsConfig from '~/config/paths.config';
|
||||
|
||||
const paths = {
|
||||
home: pathsConfig.app.home,
|
||||
};
|
||||
|
||||
const features = {
|
||||
enableThemeToggle: featuresFlagConfig.enableThemeToggle,
|
||||
};
|
||||
|
||||
export function SiteHeaderAccountSection({
|
||||
user,
|
||||
}: React.PropsWithChildren<{
|
||||
@@ -32,22 +39,18 @@ function SuspendedPersonalAccountDropdown(props: { user: User | null }) {
|
||||
const signOut = useSignOut();
|
||||
const user = useUser(props.user);
|
||||
|
||||
return (
|
||||
<If condition={user.data} fallback={<AuthButtons />}>
|
||||
{(data) => (
|
||||
<PersonalAccountDropdown
|
||||
paths={{
|
||||
home: pathsConfig.app.home,
|
||||
}}
|
||||
features={{
|
||||
enableThemeToggle: featuresFlagConfig.enableThemeToggle,
|
||||
}}
|
||||
user={data}
|
||||
signOutRequested={() => signOut.mutateAsync()}
|
||||
/>
|
||||
)}
|
||||
</If>
|
||||
);
|
||||
if (user.data) {
|
||||
return (
|
||||
<PersonalAccountDropdown
|
||||
paths={paths}
|
||||
features={features}
|
||||
user={user.data}
|
||||
signOutRequested={() => signOut.mutateAsync()}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
return <AuthButtons />;
|
||||
}
|
||||
|
||||
function AuthButtons() {
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
"edge-csrf": "^1.0.9",
|
||||
"i18next": "^23.10.1",
|
||||
"i18next-resources-to-backend": "^1.2.0",
|
||||
"next": "14.2.0-canary.55",
|
||||
"next": "14.2.0-canary.56",
|
||||
"next-sitemap": "^4.2.3",
|
||||
"next-themes": "0.3.0",
|
||||
"react": "18.2.0",
|
||||
|
||||
Reference in New Issue
Block a user