mirror of
https://github.com/spacedriveapp/spacedrive.git
synced 2026-05-18 05:15:16 -04:00
* Introducing location online/offline checks and location relink * Some initial drafts for location watchers * Location metadata relink and add library * Many improvements at job system Now using prisma batching at identifier job Removing blocking I/O from extension subcrate Implementing lazy generation of thumbnails New current directory identifier job to be used on light rescans * Some optimizations on identifier and object validator jobs * merge jamie's identifier PR * fully repaired identifier job * properly hooked up object kind * inspector fix * fix video badge * small improvements to libraries settings * identifier and inspector improvements * fix feature flags and hook up context menu location utilities * BETTER CONTEXT MENU x100 * test-files * style tweaks * new icon designs * manifest * fix thumbnails on web * media data * New Location Watcher and some minor fixes * disable broken media_data extractor, wip * wip * function name fix * Fixing pnpm prep and some warnings * Solving a race condition beetween indexer job and FS event handlerSome other minor warnings * Generating thumbnails on watcher * Remove event handler on watcher * Some initial works on modify events and other small fixes * File update event * Trying to be more generic with used events and some tests to validate our assumptions * Turning on location metadata file * Introducing core unit tests on CI pipeline * Submiting new unit test assumptions to validate on windows CI * Fixing unit tests * Fixing unit tests again * Fixing unit tests * Fixing unit tests for macos * Fixing unit tests for macos again * New structure for platform dependent event handling Implementing event handlers for Linux and MacOS * minor fixes + rustfmt + clippy * Windows event handling * Introducing a feature gate to only use location watching on desktop app for now * Putting more stuff behind feature gates to avoid warnings * Adding feature to cargo test on CI * Changing some debug logs to trace logs and removing Jamie specific stuff * Make location removal from manager less async * fix build when "location-watcher" feature disabled * fix types + clippy * make location manager non-static * remove uses of `to_string_lossy` * more invalidate_query calls * Expose `library_ctx` directly to avoid needless clones * New materialized_path handling for directories * Removing cascade delete between file_path and object - Some other minor stuff * remove unused `CurrentDirFileIdentifierJob` Co-authored-by: Jamie Pine <ijamespine@me.com> Co-authored-by: Oscar Beaumont <oscar@otbeaumont.me>
90 lines
2.8 KiB
TypeScript
90 lines
2.8 KiB
TypeScript
import { useBridgeMutation, useBridgeQuery, useCurrentLibrary } from '@sd/client';
|
|
import { LibraryConfigWrapped } from '@sd/client';
|
|
import { Button, ButtonLink, Card, tw } from '@sd/ui';
|
|
import { Database, DotsSixVertical, Link, Pen, Pencil, Trash } from 'phosphor-react';
|
|
import { useState } from 'react';
|
|
|
|
import CreateLibraryDialog from '../../../components/dialog/CreateLibraryDialog';
|
|
import DeleteLibraryDialog from '../../../components/dialog/DeleteLibraryDialog';
|
|
import { SettingsContainer } from '../../../components/settings/SettingsContainer';
|
|
import { SettingsHeader } from '../../../components/settings/SettingsHeader';
|
|
|
|
const Pill = tw.span`px-1.5 ml-2 py-[2px] rounded text-xs font-medium bg-accent`;
|
|
|
|
function LibraryListItem(props: { library: LibraryConfigWrapped; current: boolean }) {
|
|
const [openDeleteModal, setOpenDeleteModal] = useState(false);
|
|
|
|
const deleteLibrary = useBridgeMutation('library.delete', {
|
|
onSuccess: () => {
|
|
setOpenDeleteModal(false);
|
|
}
|
|
});
|
|
|
|
return (
|
|
<Card>
|
|
<DotsSixVertical weight="bold" className="mt-[15px] mr-3 opacity-30" />
|
|
<div className="flex-1 my-0.5">
|
|
<h3 className="font-semibold">
|
|
{props.library.config.name}
|
|
{props.current && <Pill>Current</Pill>}
|
|
</h3>
|
|
<p className="mt-0.5 text-xs text-ink-dull">{props.library.uuid}</p>
|
|
</div>
|
|
<div className="flex flex-row items-center space-x-2">
|
|
<Button className="!p-1.5" onClick={() => {}} variant="gray">
|
|
<Database className="w-4 h-4" />
|
|
</Button>
|
|
<ButtonLink className="!p-1.5" to="/settings/library" variant="gray">
|
|
<Pencil className="w-4 h-4" />
|
|
</ButtonLink>
|
|
<DeleteLibraryDialog libraryUuid={props.library.uuid}>
|
|
<Button className="!p-1.5" variant="gray">
|
|
<Trash className="w-4 h-4" />
|
|
</Button>
|
|
</DeleteLibraryDialog>
|
|
</div>
|
|
</Card>
|
|
);
|
|
}
|
|
|
|
export default function LibrarySettings() {
|
|
const { data: libraries } = useBridgeQuery(['library.list']);
|
|
const [open, setOpen] = useState(false);
|
|
|
|
const { library: currentLibrary } = useCurrentLibrary();
|
|
|
|
return (
|
|
<SettingsContainer>
|
|
<SettingsHeader
|
|
title="Libraries"
|
|
description="The database contains all library data and file metadata."
|
|
rightArea={
|
|
<div className="flex-row space-x-2">
|
|
<CreateLibraryDialog open={open} setOpen={setOpen}>
|
|
<Button variant="accent" size="sm">
|
|
Add Library
|
|
</Button>
|
|
</CreateLibraryDialog>
|
|
</div>
|
|
}
|
|
/>
|
|
|
|
<div className="space-y-2">
|
|
{libraries
|
|
?.sort((a, b) => {
|
|
if (a.uuid === currentLibrary?.uuid) return -1;
|
|
if (b.uuid === currentLibrary?.uuid) return 1;
|
|
return 0;
|
|
})
|
|
.map((library) => (
|
|
<LibraryListItem
|
|
current={library.uuid === currentLibrary?.uuid}
|
|
key={library.uuid}
|
|
library={library}
|
|
/>
|
|
))}
|
|
</div>
|
|
</SettingsContainer>
|
|
);
|
|
}
|