mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-07-08 22:22:17 +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";
|
||||
|
||||
export default async function TeamPage({
|
||||
params,
|
||||
}: {
|
||||
params: Promise<{ workspace_id: string }>;
|
||||
}) {
|
||||
export default async function TeamPage({ params }: { params: Promise<{ workspace_id: string }> }) {
|
||||
const { workspace_id } = await params;
|
||||
|
||||
return (
|
||||
|
|
|
|||
|
|
@ -776,7 +776,7 @@ export function LayoutDataProvider({ searchSpaceId, children }: LayoutDataProvid
|
|||
isAutomationsPage
|
||||
? "max-w-none select-none"
|
||||
: isAllChatsPage
|
||||
? "max-w-3xl"
|
||||
? "max-w-5xl"
|
||||
: isUserSettingsPage || isSearchSpaceSettingsPage || isTeamPage
|
||||
? "max-w-5xl"
|
||||
: undefined
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ type LoadedZeroContext = {
|
|||
context: ZeroContext;
|
||||
desktopAuth?: string;
|
||||
};
|
||||
type ZeroContextState = LoadedZeroContext | null | undefined;
|
||||
|
||||
function getCacheURL() {
|
||||
if (configuredCacheURL) return configuredCacheURL;
|
||||
|
|
@ -131,7 +132,7 @@ function AuthenticatedZeroProvider({
|
|||
children: React.ReactNode;
|
||||
isDesktop: boolean;
|
||||
}) {
|
||||
const [loadedContext, setLoadedContext] = useState<LoadedZeroContext | null>(null);
|
||||
const [loadedContext, setLoadedContext] = useState<ZeroContextState>(undefined);
|
||||
|
||||
useEffect(() => {
|
||||
let isMounted = true;
|
||||
|
|
@ -153,7 +154,7 @@ function AuthenticatedZeroProvider({
|
|||
|
||||
const unsubscribe = window.electronAPI.onAuthChanged(({ accessToken }) => {
|
||||
if (!accessToken) {
|
||||
setLoadedContext(null);
|
||||
setLoadedContext(undefined);
|
||||
return;
|
||||
}
|
||||
void load();
|
||||
|
|
@ -165,9 +166,7 @@ function AuthenticatedZeroProvider({
|
|||
};
|
||||
}, [isDesktop]);
|
||||
|
||||
if (!loadedContext) {
|
||||
return <>{children}</>;
|
||||
}
|
||||
if (!loadedContext) return null;
|
||||
|
||||
return (
|
||||
<ZeroClientProvider
|
||||
|
|
@ -236,7 +235,7 @@ function WebZeroProvider({ children }: { children: React.ReactNode }) {
|
|||
const session = useSession();
|
||||
|
||||
if (session.status !== "authenticated") {
|
||||
return <>{children}</>;
|
||||
return null;
|
||||
}
|
||||
|
||||
return <AuthenticatedZeroProvider isDesktop={false}>{children}</AuthenticatedZeroProvider>;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue