mirror of
https://github.com/SableClient/Sable.git
synced 2026-11-21 17:41:25 -08:00
fix desktop windows title bar status
This commit is contained in:
1 parent
d6a5411986
commit
c590956c9c
3 files changed
+25
-12
No files matched your search
@@ -1,5 +1,6 @@
|
||||
import { type ReactNode, Suspense, lazy, useState } from 'react';
|
||||
import { Provider as JotaiProvider } from 'jotai';
|
||||
import type { createStore } from 'jotai/vanilla';
|
||||
import { OverlayContainerProvider, PopOutContainerProvider, TooltipContainerProvider } from 'folds';
|
||||
import { QueryClientProvider } from '@tanstack/react-query';
|
||||
import { isTauri } from '@tauri-apps/api/core';
|
||||
@@ -24,9 +25,10 @@ type AppShellProps = {
|
||||
children: ReactNode;
|
||||
queryClient: Parameters<typeof QueryClientProvider>[0]['client'];
|
||||
screenSize: ScreenSize;
|
||||
jotaiStore?: ReturnType<typeof createStore>;
|
||||
};
|
||||
|
||||
export function AppShell({ children, queryClient, screenSize }: AppShellProps) {
|
||||
export function AppShell({ children, queryClient, screenSize, jotaiStore }: AppShellProps) {
|
||||
const tauriOs = isTauri() ? osType() : undefined;
|
||||
const useDesktopTitleBar = tauriOs === 'windows' || tauriOs === 'linux';
|
||||
const useMacTitleBar = tauriOs === 'macos';
|
||||
@@ -41,7 +43,7 @@ export function AppShell({ children, queryClient, screenSize }: AppShellProps) {
|
||||
<OverlayContainerProvider value={portalContainer ?? undefined}>
|
||||
<ScreenSizeProvider value={screenSize}>
|
||||
<QueryClientProvider client={queryClient}>
|
||||
<JotaiProvider>
|
||||
<JotaiProvider store={jotaiStore}>
|
||||
<TauriFrontendReady />
|
||||
<div
|
||||
style={{
|
||||
|
||||
+18
-9
@@ -30,21 +30,18 @@ const ReactQueryDevtools = lazy(async () => {
|
||||
type BootstrappedAppShellProps = {
|
||||
clientConfig: ClientConfig;
|
||||
screenSize: ScreenSize;
|
||||
jotaiStore: ReturnType<typeof createStore>;
|
||||
};
|
||||
|
||||
function BootstrappedAppShell({ clientConfig, screenSize }: BootstrappedAppShellProps) {
|
||||
function BootstrappedAppShell({ clientConfig, screenSize, jotaiStore }: BootstrappedAppShellProps) {
|
||||
normalizeOAuthCallbackUrl(clientConfig.hashRouter);
|
||||
const jotaiStoreRef = useRef<ReturnType<typeof createStore>>();
|
||||
if (!jotaiStoreRef.current) {
|
||||
jotaiStoreRef.current = createStore();
|
||||
bootstrapSettingsStore(jotaiStoreRef.current, clientConfig.settingsDefaults);
|
||||
}
|
||||
bootstrapSettingsStore(jotaiStore, clientConfig.settingsDefaults);
|
||||
const router = useMemo(() => createRouter(clientConfig, screenSize), [clientConfig, screenSize]);
|
||||
const reactQueryDevtoolsEnabled = isReactQueryDevtoolsEnabled();
|
||||
|
||||
return (
|
||||
<QueryClientProvider client={queryClient}>
|
||||
<JotaiProvider store={jotaiStoreRef.current}>
|
||||
<JotaiProvider store={jotaiStore}>
|
||||
<RouterProvider router={router} />
|
||||
</JotaiProvider>
|
||||
{reactQueryDevtoolsEnabled && (
|
||||
@@ -68,13 +65,21 @@ function renderSentryErrorFallback({ error, eventId }: { error: unknown; eventId
|
||||
function App() {
|
||||
const screenSize = useScreenSize();
|
||||
useCompositionEndTracking();
|
||||
const jotaiStoreRef = useRef<ReturnType<typeof createStore>>();
|
||||
if (!jotaiStoreRef.current) {
|
||||
jotaiStoreRef.current = createStore();
|
||||
}
|
||||
|
||||
const renderConfiguredApp = useCallback(
|
||||
(clientConfig: ClientConfig) => {
|
||||
setMatrixToBase(clientConfig.matrixToBaseUrl);
|
||||
return (
|
||||
<ClientConfigProvider value={clientConfig}>
|
||||
<BootstrappedAppShell clientConfig={clientConfig} screenSize={screenSize} />
|
||||
<BootstrappedAppShell
|
||||
clientConfig={clientConfig}
|
||||
screenSize={screenSize}
|
||||
jotaiStore={jotaiStoreRef.current!}
|
||||
/>
|
||||
</ClientConfigProvider>
|
||||
);
|
||||
},
|
||||
@@ -83,7 +88,11 @@ function App() {
|
||||
|
||||
return (
|
||||
<Sentry.ErrorBoundary fallback={renderSentryErrorFallback}>
|
||||
<AppShell screenSize={screenSize} queryClient={queryClient}>
|
||||
<AppShell
|
||||
screenSize={screenSize}
|
||||
queryClient={queryClient}
|
||||
jotaiStore={jotaiStoreRef.current}
|
||||
>
|
||||
<FeatureCheck>
|
||||
<ClientConfigLoader>{renderConfiguredApp}</ClientConfigLoader>
|
||||
</FeatureCheck>
|
||||
|
||||
@@ -36,7 +36,9 @@ describe('android edge-to-edge inset contract', () => {
|
||||
const systemBarShell = readWorkspaceFile('src/app/components/app-shell/SystemBarShell.tsx');
|
||||
|
||||
expect(indexHtml).not.toContain('id="portalContainer"');
|
||||
expect(appTsx).toContain('<AppShell screenSize={screenSize} queryClient={queryClient}>');
|
||||
expect(appTsx).toContain('<AppShell');
|
||||
expect(appTsx).toContain('screenSize={screenSize}');
|
||||
expect(appTsx).toContain('queryClient={queryClient}');
|
||||
expect(appShell).toContain('const [portalContainer, setPortalContainer] = useState');
|
||||
expect(appShell).toContain('<SystemBarShell onPortalContainerChange={setPortalContainer}>');
|
||||
expect(systemBarShell).toContain('ref={onPortalContainerChange}');
|
||||
|
||||
Reference in new issue
Block a user