Files
spacedrive/packages/interface/src/AppLayout.tsx
Utku b856f15b22 Tailwind Prettier Plugin (#557)
* add tailwind prettier plugin + run prettier

* add eslint tailwind plugin and eslint fix to turbo

* Ran eslint fix + fixed every other lint issues

* twStyle and lint stuff

* remove auto lint as it's buggy

* update eslint & add twStyle to tailwind regex

* Fix auto lint + config inconsistencies

* Add tailwind config to prettier config

* run lint:fix

---------

Co-authored-by: Brendan Allan <brendonovich@outlook.com>
2023-02-16 07:04:19 +00:00

43 lines
1.3 KiB
TypeScript

import clsx from 'clsx';
import { Suspense } from 'react';
import { Outlet } from 'react-router-dom';
import { useCurrentLibrary } from '@sd/client';
import { Sidebar } from '~/components/layout/Sidebar';
import { Toasts } from '~/components/primitive/Toasts';
import { useOperatingSystem } from '~/hooks/useOperatingSystem';
export function AppLayout() {
const { libraries } = useCurrentLibrary();
const os = useOperatingSystem();
// This will ensure nothing is rendered while the `useCurrentLibrary` hook navigates to the onboarding page. This prevents requests with an invalid library id being sent to the backend
if (libraries?.length === 0) {
return null;
}
return (
<div
className={clsx(
// App level styles
'text-ink flex h-screen cursor-default select-none overflow-hidden',
os === 'browser' && 'bg-app border-app-line/50 border-t',
os === 'macOS' && 'has-blur-effects rounded-[10px]',
os !== 'browser' && os !== 'windows' && 'border-app-frame border'
)}
onContextMenu={(e) => {
// TODO: allow this on some UI text at least / disable default browser context menu
e.preventDefault();
return false;
}}
>
<Sidebar />
<div className="relative flex w-full">
<Suspense fallback={<div className="bg-app h-screen w-screen" />}>
<Outlet />
</Suspense>
</div>
<Toasts />
</div>
);
}