Skip to content

Commit

Permalink
fix: backstage page logical
Browse files Browse the repository at this point in the history
  • Loading branch information
SnowballXueQiu committed Aug 25, 2024
1 parent 3d1777f commit 40d4b52
Showing 1 changed file with 21 additions and 10 deletions.
31 changes: 21 additions & 10 deletions app/(root)/backstage/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
'use client';

import React, { useEffect, useState } from 'react';
import { Center, Text } from '@mantine/core';
import Watermark from '@/app/(root)/backstage/components/Watermark';
import { Cookie } from '@/components/cookie';
import Tools from '@/app/(root)/backstage/components/Tools';

export default function BackStageLayout({ children }: { children: React.ReactNode }) {
const [userName, setUserName] = useState('');
const [userId, setUserId] = useState('');
const [userName, setUserName] = useState<string | null>(null);
const [userId, setUserId] = useState<string | null>(null);

useEffect(() => {
if (typeof window !== 'undefined') {
Expand All @@ -19,16 +20,26 @@ export default function BackStageLayout({ children }: { children: React.ReactNod
}
}, []);

if (userName === null || userId === null) {
return (
<Center>
<Text>
Loading...
</Text>
</Center>
);
}

return (
<div>
<Watermark
text={`${userName} ${userId}`}
fontSize={40}
gap={200}
>
<Watermark
text={`${userName} ${userId}`}
fontSize={40}
gap={200}
>
<>
{children}
<Tools />
</Watermark>
</div>
</>
</Watermark>
);
}

0 comments on commit 40d4b52

Please sign in to comment.