fix: header layout for auth and user pages (#725)

This commit is contained in:
Huang Xin
2025-03-27 12:14:38 +08:00
committed by GitHub
parent 6d4ad34e32
commit 7ba938ea25
2 changed files with 14 additions and 8 deletions
+7 -4
View File
@@ -16,6 +16,7 @@ import { useEnv } from '@/context/EnvContext';
import { useThemeStore } from '@/store/themeStore';
import { useSettingsStore } from '@/store/settingsStore';
import { useTranslation } from '@/hooks/useTranslation';
import { useTrafficLightStore } from '@/store/trafficLightStore';
import { isTauriAppPlatform } from '@/services/environment';
import { onOpenUrl } from '@tauri-apps/plugin-deep-link';
import { start, cancel, onUrl, onInvalidUrl } from '@fabianlars/tauri-plugin-oauth';
@@ -63,6 +64,7 @@ export default function AuthPage() {
const { login } = useAuth();
const { envConfig, appService } = useEnv();
const { isDarkMode } = useThemeStore();
const { isTrafficLightVisible } = useTrafficLightStore();
const { settings, setSettings, saveSettings } = useSettingsStore();
const [port, setPort] = useState<number | null>(null);
const isOAuthServerRunning = useRef(false);
@@ -308,7 +310,8 @@ export default function AuthPage() {
<div
ref={headerRef}
className={clsx(
'flex w-full items-center justify-between py-2 pe-6 ps-4',
'fixed flex w-full items-center justify-between py-2 pe-6 ps-4',
appService?.hasSafeAreaInset && 'mt-[env(safe-area-inset-top)]',
appService?.hasTrafficLight && 'pt-11',
)}
>
@@ -319,9 +322,9 @@ export default function AuthPage() {
{appService?.hasWindowBar && (
<WindowButtons
headerRef={headerRef}
showMinimize={appService?.hasWindowBar}
showMaximize={appService?.hasWindowBar}
showClose={appService?.hasWindowBar}
showMinimize={!isTrafficLightVisible}
showMaximize={!isTrafficLightVisible}
showClose={!isTrafficLightVisible}
onClose={handleGoBack}
/>
)}
+7 -4
View File
@@ -11,6 +11,7 @@ import { useAuth } from '@/context/AuthContext';
import { useTheme } from '@/hooks/useTheme';
import { useTranslation } from '@/hooks/useTranslation';
import { useSettingsStore } from '@/store/settingsStore';
import { useTrafficLightStore } from '@/store/trafficLightStore';
import { QuotaType, UserPlan } from '@/types/user';
import { getStoragePlanData, getUserPlan } from '@/utils/access';
import { navigateToLibrary } from '@/utils/nav';
@@ -25,6 +26,7 @@ const ProfilePage = () => {
const router = useRouter();
const { envConfig, appService } = useEnv();
const { token, user, logout } = useAuth();
const { isTrafficLightVisible } = useTrafficLightStore();
const { settings, setSettings, saveSettings } = useSettingsStore();
const [userPlan, setUserPlan] = useState<UserPlan>('free');
const [quotas, setQuotas] = React.useState<QuotaType[]>([]);
@@ -164,7 +166,8 @@ const ProfilePage = () => {
<div
ref={headerRef}
className={clsx(
'flex w-full items-center justify-between py-2 pe-6 ps-4',
'fixed flex w-full items-center justify-between py-2 pe-6 ps-4',
appService?.hasSafeAreaInset && 'mt-[env(safe-area-inset-top)]',
appService?.hasTrafficLight && 'pt-11',
)}
>
@@ -175,9 +178,9 @@ const ProfilePage = () => {
{appService?.hasWindowBar && (
<WindowButtons
headerRef={headerRef}
showMinimize={appService?.hasWindowBar}
showMaximize={appService?.hasWindowBar}
showClose={appService?.hasWindowBar}
showMinimize={!isTrafficLightVisible}
showMaximize={!isTrafficLightVisible}
showClose={!isTrafficLightVisible}
onClose={handleGoBack}
/>
)}