mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-07-22 23:31:12 +02:00
refactor(team): streamline TeamPage function parameters and improve layout constraints
- Simplified the TeamPage function parameter destructuring for better readability. - Updated LayoutDataProvider to increase maximum width for specific pages, enhancing layout consistency. - Adjusted ZeroProvider state management to use undefined instead of null for clarity in context handling.
This commit is contained in:
parent
865e22aaa4
commit
72c2dd0e1b
3 changed files with 7 additions and 12 deletions
|
|
@ -1,10 +1,6 @@
|
||||||
import { TeamContent } from "./team-content";
|
import { TeamContent } from "./team-content";
|
||||||
|
|
||||||
export default async function TeamPage({
|
export default async function TeamPage({ params }: { params: Promise<{ workspace_id: string }> }) {
|
||||||
params,
|
|
||||||
}: {
|
|
||||||
params: Promise<{ workspace_id: string }>;
|
|
||||||
}) {
|
|
||||||
const { workspace_id } = await params;
|
const { workspace_id } = await params;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
|
||||||
|
|
@ -776,7 +776,7 @@ export function LayoutDataProvider({ searchSpaceId, children }: LayoutDataProvid
|
||||||
isAutomationsPage
|
isAutomationsPage
|
||||||
? "max-w-none select-none"
|
? "max-w-none select-none"
|
||||||
: isAllChatsPage
|
: isAllChatsPage
|
||||||
? "max-w-3xl"
|
? "max-w-5xl"
|
||||||
: isUserSettingsPage || isSearchSpaceSettingsPage || isTeamPage
|
: isUserSettingsPage || isSearchSpaceSettingsPage || isTeamPage
|
||||||
? "max-w-5xl"
|
? "max-w-5xl"
|
||||||
: undefined
|
: undefined
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ type LoadedZeroContext = {
|
||||||
context: ZeroContext;
|
context: ZeroContext;
|
||||||
desktopAuth?: string;
|
desktopAuth?: string;
|
||||||
};
|
};
|
||||||
|
type ZeroContextState = LoadedZeroContext | null | undefined;
|
||||||
|
|
||||||
function getCacheURL() {
|
function getCacheURL() {
|
||||||
if (configuredCacheURL) return configuredCacheURL;
|
if (configuredCacheURL) return configuredCacheURL;
|
||||||
|
|
@ -131,7 +132,7 @@ function AuthenticatedZeroProvider({
|
||||||
children: React.ReactNode;
|
children: React.ReactNode;
|
||||||
isDesktop: boolean;
|
isDesktop: boolean;
|
||||||
}) {
|
}) {
|
||||||
const [loadedContext, setLoadedContext] = useState<LoadedZeroContext | null>(null);
|
const [loadedContext, setLoadedContext] = useState<ZeroContextState>(undefined);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
let isMounted = true;
|
let isMounted = true;
|
||||||
|
|
@ -153,7 +154,7 @@ function AuthenticatedZeroProvider({
|
||||||
|
|
||||||
const unsubscribe = window.electronAPI.onAuthChanged(({ accessToken }) => {
|
const unsubscribe = window.electronAPI.onAuthChanged(({ accessToken }) => {
|
||||||
if (!accessToken) {
|
if (!accessToken) {
|
||||||
setLoadedContext(null);
|
setLoadedContext(undefined);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
void load();
|
void load();
|
||||||
|
|
@ -165,9 +166,7 @@ function AuthenticatedZeroProvider({
|
||||||
};
|
};
|
||||||
}, [isDesktop]);
|
}, [isDesktop]);
|
||||||
|
|
||||||
if (!loadedContext) {
|
if (!loadedContext) return null;
|
||||||
return <>{children}</>;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ZeroClientProvider
|
<ZeroClientProvider
|
||||||
|
|
@ -236,7 +235,7 @@ function WebZeroProvider({ children }: { children: React.ReactNode }) {
|
||||||
const session = useSession();
|
const session = useSession();
|
||||||
|
|
||||||
if (session.status !== "authenticated") {
|
if (session.status !== "authenticated") {
|
||||||
return <>{children}</>;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return <AuthenticatedZeroProvider isDesktop={false}>{children}</AuthenticatedZeroProvider>;
|
return <AuthenticatedZeroProvider isDesktop={false}>{children}</AuthenticatedZeroProvider>;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue