mirror of
https://github.com/spacedriveapp/spacedrive.git
synced 2026-04-28 18:38:12 -04:00
* wip + working backfill * Finished BackfillWaiting page + initial auth setup Also, setting up the cloud sync page. * mobile auth * Import Cloud Library Currently, you can import a cloud library, however it seems that the data, such as locations, is not transferring correctly. * Working Mobile Cloud Sync Cloud Sync works for Mobile, and the mobile app can sync files from a cloud library, and other clients can access the data from the phone's cloud library. * Cloud Sync Done * Formatting * Fix new library button * New device type passing to auth * Improve design of cloud settings and import modal * ui adjustments and code cleanup * Update styling if there's only 1 instance * code cleanup, design tweaks * empty state & simple indicator animation * lint * loading indicator and cleanup * Fix to Sync Subscription * Update Cargo.lock * Async logout for debug * tweaks * Update SettingsStack.tsx * cleanups and cloud desktop design improvements * more cleanups and ui improvements * ts * i18n * Cloud Sync Docs * styling * Delete library-sync.mdx Moving docs to a separate branch --------- Co-authored-by: ameer2468 <33054370+ameer2468@users.noreply.github.com>
72 lines
1.7 KiB
TypeScript
72 lines
1.7 KiB
TypeScript
import { useBridgeQuery, useClientContext, useFeatureFlag, useLibraryContext } from '@sd/client';
|
|
import { Button, dialogManager } from '@sd/ui';
|
|
import { useLocale } from '~/hooks';
|
|
|
|
import { Heading } from '../../Layout';
|
|
import CreateDialog from './CreateDialog';
|
|
import JoinDialog from './JoinDialog';
|
|
import ListItem from './ListItem';
|
|
|
|
export const Component = () => {
|
|
const librariesQuery = useBridgeQuery(['library.list']);
|
|
const libraries = librariesQuery.data;
|
|
|
|
const cloudEnabled = useFeatureFlag('cloudSync');
|
|
|
|
const { library } = useLibraryContext();
|
|
const { libraries: librariesCtx } = useClientContext();
|
|
const librariesCtxData = librariesCtx.data;
|
|
|
|
const { t } = useLocale();
|
|
|
|
return (
|
|
<>
|
|
<Heading
|
|
title={t('libraries')}
|
|
description={t('libraries_description')}
|
|
rightArea={
|
|
<div className="flex-row space-x-2">
|
|
<Button
|
|
variant="accent"
|
|
size="sm"
|
|
onClick={() => {
|
|
dialogManager.create((dp) => <CreateDialog {...dp} />);
|
|
}}
|
|
>
|
|
{t('add_library')}
|
|
</Button>
|
|
{cloudEnabled && (
|
|
<Button
|
|
variant="outline"
|
|
size="sm"
|
|
onClick={() => {
|
|
dialogManager.create((dp) => (
|
|
<JoinDialog librariesCtx={librariesCtxData} {...dp} />
|
|
));
|
|
}}
|
|
>
|
|
{t('join_library')}
|
|
</Button>
|
|
)}
|
|
</div>
|
|
}
|
|
/>
|
|
<div className="space-y-2">
|
|
{libraries
|
|
?.sort((a, b) => {
|
|
if (a.uuid === library.uuid) return -1;
|
|
if (b.uuid === library.uuid) return 1;
|
|
return 0;
|
|
})
|
|
.map((lib) => (
|
|
<ListItem
|
|
current={lib.uuid === library.uuid}
|
|
key={lib.uuid}
|
|
library={lib}
|
|
/>
|
|
))}
|
|
</div>
|
|
</>
|
|
);
|
|
};
|