mirror of
https://github.com/spacedriveapp/spacedrive.git
synced 2026-04-22 07:28:43 -04:00
* beginnings of app directory * settings mostly good * colocate way more components * flatten components folder * reexport QueryClientProvider from client * move CodeBlock back to interface * colocate Explorer, KeyManager + more * goddamn captialisation * get toasts out of components * please eslint * no more src directory * $ instead of : * added back RowHeader component * fix settings modal padding * more spacing, less margin * fix sidebar locations button * fix tags sidebar link * clean up back button * added margin to explorer context menu to prevent contact with edge of viewport * don't export QueryClientProvider from @sd/client * basic guidelines * import interface correctly * remove old demo data * fix onboarding layout * fix onboarding navigation * fix key manager settings button --------- Co-authored-by: Jamie Pine <ijamespine@me.com>
41 lines
1.1 KiB
TypeScript
41 lines
1.1 KiB
TypeScript
import { useLibraryMutation } from '@sd/client';
|
|
import { dialogManager } from '@sd/ui';
|
|
import { usePlatform } from '~/util/Platform';
|
|
import AddLocationDialog from '../../settings/library/locations/AddDialog';
|
|
|
|
export default () => {
|
|
const platform = usePlatform();
|
|
|
|
const createLocation = useLibraryMutation('locations.create');
|
|
|
|
return (
|
|
<button
|
|
onClick={() => {
|
|
if (platform.platform === 'web') {
|
|
dialogManager.create((dp) => <AddLocationDialog {...dp} />);
|
|
} else {
|
|
if (!platform.openDirectoryPickerDialog) {
|
|
alert('Opening a dialogue is not supported on this platform!');
|
|
return;
|
|
}
|
|
platform.openDirectoryPickerDialog().then((result) => {
|
|
// TODO: Pass indexer rules ids to create location
|
|
if (result)
|
|
createLocation.mutate({
|
|
path: result as string,
|
|
indexer_rules_ids: []
|
|
});
|
|
});
|
|
}
|
|
}}
|
|
className="
|
|
border-sidebar-line hover:border-sidebar-selected cursor-normal text-ink-faint mt-1 w-full rounded
|
|
border border-dashed px-2 py-1 text-center
|
|
text-xs font-medium transition
|
|
"
|
|
>
|
|
Add Location
|
|
</button>
|
|
);
|
|
};
|