mirror of
https://github.com/spacedriveapp/spacedrive
synced 2024-07-18 23:39:10 +00:00
configurable router type
This commit is contained in:
parent
87e24cf1d8
commit
1a6fabbd7d
|
@ -53,6 +53,7 @@ function App() {
|
|||
|
||||
return (
|
||||
<SpacedriveInterface
|
||||
useMemoryRouter
|
||||
transport={new Transport()}
|
||||
platform={platform}
|
||||
convertFileSrc={function (url: string): string {
|
||||
|
|
|
@ -46,6 +46,7 @@ export interface AppProps {
|
|||
onClose?: () => void;
|
||||
onMinimize?: () => void;
|
||||
onFullscreen?: () => void;
|
||||
useMemoryRouter: boolean;
|
||||
}
|
||||
|
||||
function AppLayout() {
|
||||
|
@ -174,7 +175,16 @@ function NotFound() {
|
|||
);
|
||||
}
|
||||
|
||||
function AppContainer() {
|
||||
function MemoryRouterContainer() {
|
||||
useCoreEvents();
|
||||
return (
|
||||
<MemoryRouter>
|
||||
<Router />
|
||||
</MemoryRouter>
|
||||
);
|
||||
}
|
||||
|
||||
function BrowserRouterContainer() {
|
||||
useCoreEvents();
|
||||
return (
|
||||
<MemoryRouter>
|
||||
|
@ -204,7 +214,7 @@ export default function App(props: AppProps) {
|
|||
<QueryClientProvider client={queryClient} contextSharing={false}>
|
||||
<AppPropsContext.Provider value={props}>
|
||||
<ClientProvider>
|
||||
<AppContainer />
|
||||
{props.useMemoryRouter ? <MemoryRouterContainer /> : <BrowserRouterContainer />}
|
||||
</ClientProvider>
|
||||
</AppPropsContext.Provider>
|
||||
</QueryClientProvider>
|
||||
|
|
|
@ -44,13 +44,15 @@ export function MacOSTrafficLights() {
|
|||
const appPropsContext = useContext(AppPropsContext);
|
||||
|
||||
return (
|
||||
<div data-tauri-drag-region className="mt-2 mb-1 -ml-1 ">
|
||||
<TrafficLights
|
||||
onClose={appPropsContext?.onClose}
|
||||
onFullscreen={appPropsContext?.onFullscreen}
|
||||
onMinimize={appPropsContext?.onMinimize}
|
||||
className="p-1.5 z-50 absolute"
|
||||
/>
|
||||
<div data-tauri-drag-region className="h-7">
|
||||
<div className="mt-2 mb-1 -ml-1 ">
|
||||
<TrafficLights
|
||||
onClose={appPropsContext?.onClose}
|
||||
onFullscreen={appPropsContext?.onFullscreen}
|
||||
onMinimize={appPropsContext?.onMinimize}
|
||||
className="p-1.5 z-50 absolute"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
@ -71,10 +73,10 @@ export const Sidebar: React.FC<SidebarProps> = (props) => {
|
|||
];
|
||||
|
||||
return (
|
||||
<div className="flex flex-col flex-grow-0 flex-shrink-0 w-48 min-h-full px-3 pb-1 overflow-x-hidden overflow-y-scroll border-r border-gray-100 no-scrollbar bg-gray-50 dark:bg-gray-850 dark:border-gray-600">
|
||||
<div className="flex flex-col flex-grow-0 flex-shrink-0 w-48 min-h-full px-3 overflow-x-hidden overflow-y-scroll border-r border-gray-100 no-scrollbar bg-gray-50 dark:bg-gray-850 dark:border-gray-600">
|
||||
{appPropsContext?.platform === 'macOS' ? (
|
||||
<>
|
||||
<MacOSTrafficLights /> <div className="mt-6" />
|
||||
<MacOSTrafficLights />
|
||||
</>
|
||||
) : null}
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { useBridgeQuery } from '@sd/client';
|
||||
import { DotsSixVertical, Laptop, LineSegments } from 'phosphor-react';
|
||||
import React, { useState } from 'react';
|
||||
import { Device } from '../components/device/Device';
|
||||
|
@ -22,12 +23,7 @@ const StatItem: React.FC<StatItemProps> = (props) => {
|
|||
};
|
||||
|
||||
export const OverviewScreen: React.FC<{}> = (props) => {
|
||||
const [selectedFile, setSelectedFile] = useState<null | string>(null);
|
||||
|
||||
function handleSelect(key: string) {
|
||||
if (selectedFile === key) setSelectedFile(null);
|
||||
else setSelectedFile(key);
|
||||
}
|
||||
const { data: libraryStatistics } = useBridgeQuery('GetLibraryStatistics');
|
||||
|
||||
return (
|
||||
<div className="flex flex-col w-full h-screen overflow-x-hidden custom-scroll page-scroll">
|
||||
|
@ -36,7 +32,11 @@ export const OverviewScreen: React.FC<{}> = (props) => {
|
|||
<div className="flex items-center w-full">
|
||||
<div className="flex flex-wrap pb-4 space-x-6">
|
||||
<StatItem name="Total capacity" value="26.5" unit="TB" />
|
||||
<StatItem name="Index size" value="103" unit="MB" />
|
||||
<StatItem
|
||||
name="Index size"
|
||||
value={libraryStatistics?.library_db_size ?? '0'}
|
||||
unit="MB"
|
||||
/>
|
||||
<StatItem name="Preview media" value="23.5" unit="GB" />
|
||||
<StatItem name="Free space" value="9.2" unit="TB" />
|
||||
<StatItem name="Total at-risk" value="1.5" unit="TB" />
|
||||
|
|
Loading…
Reference in a new issue