mirror of
https://github.com/spacedriveapp/spacedrive.git
synced 2026-05-24 16:32:45 -04:00
* search options start * small progress * more * bunch of stuff * semi functioning filters * cleanup setup api * progress * remove filters * hooked up to query epic moment * fix * move db stuff to specific modules * in/notIn for some fields * generate ts * big gains * working filter options for locations, tags and kind * working search query * perfect fixed filters * saved searches lol * merge error * saved searches via api * better routing * [ENG-1338] Fix fresh Spacedrive install failing to start due to attempting to query a nonexistent Library (#1649) Fix Spacedrive failing to start due to attempting to query a nonexistent Library - Rename useShoudRedirect to useRedirectToNewLocations - Improve behaviour for the immedite redirection after adding a new location * Show hidden files false by default (#1652) bool * fix remove filter in list * tweaks * fix nav buttons * unify MediaData search handling * cleanup saved search writing * Add left top bar portals for tags and search + fixed media view on tags * added search to filter dropdown * render cycle improvements * hotfix * wip * Refactor with Brendan, but this is a WIP and the search query no longer works Co-authored-by: Brendan Allan <Brendonovich@users.noreply.github.com> * progress * fix location/$id page * fix tags too Co-authored-by: Brendan Allan <Brendonovich@users.noreply.github.com> * 3rd refactor lol epic style * half-done with enum-ification of SearchFilterArgs * broken fixed filters but working inNotIn filters * search name + extension kinda working * hidden filter * fixed filters working?? * deferred search value * extensions works * filtered search items mostly working * tweaks * stacked approach working for non-search filters * move to Explorer/Search * actually use filterArgs in queries things actually work properly now * added new icons from Mint * goof * cleanup types, filters and mutation logic * actually use search value * remove overview from sidebar * don't shrink LibrariesDropdown ga * remove overview from sidebar and default to /network --------- Co-authored-by: Brendan Allan <brendonovich@outlook.com> Co-authored-by: Vítor Vasconcellos <vasconcellos.dev@gmail.com> Co-authored-by: Brendan Allan <Brendonovich@users.noreply.github.com>
73 lines
2.0 KiB
TypeScript
73 lines
2.0 KiB
TypeScript
import { useMemo } from 'react';
|
|
import { useDiscoveredPeers } from '@sd/client';
|
|
import { Icon } from '~/components';
|
|
import { useRouteTitle } from '~/hooks/useRouteTitle';
|
|
|
|
import Explorer from './Explorer';
|
|
import { ExplorerContextProvider } from './Explorer/Context';
|
|
import { createDefaultExplorerSettings, nonIndexedPathOrderingSchema } from './Explorer/store';
|
|
import { DefaultTopBarOptions } from './Explorer/TopBarOptions';
|
|
import { useExplorer, useExplorerSettings } from './Explorer/useExplorer';
|
|
import { TopBarPortal } from './TopBar/Portal';
|
|
|
|
export const Component = () => {
|
|
const title = useRouteTitle('Network');
|
|
|
|
const discoveredPeers = useDiscoveredPeers();
|
|
const peers = useMemo(() => Array.from(discoveredPeers.values()), [discoveredPeers]);
|
|
|
|
const explorerSettings = useExplorerSettings({
|
|
settings: useMemo(
|
|
() =>
|
|
createDefaultExplorerSettings({
|
|
order: {
|
|
field: 'name',
|
|
value: 'Asc'
|
|
}
|
|
}),
|
|
[]
|
|
),
|
|
orderingKeys: nonIndexedPathOrderingSchema
|
|
});
|
|
|
|
const explorer = useExplorer({
|
|
items: peers.map((peer) => ({
|
|
type: 'SpacedropPeer',
|
|
has_local_thumbnail: false,
|
|
thumbnail_key: null,
|
|
item: {
|
|
...peer,
|
|
pub_id: []
|
|
}
|
|
})),
|
|
settings: explorerSettings,
|
|
layouts: { media: false }
|
|
});
|
|
|
|
return (
|
|
<ExplorerContextProvider explorer={explorer}>
|
|
<TopBarPortal
|
|
left={
|
|
<div className="flex items-center gap-2">
|
|
<Icon name="Globe" size={22} />
|
|
<span className="truncate text-sm font-medium">{title}</span>
|
|
</div>
|
|
}
|
|
right={<DefaultTopBarOptions />}
|
|
/>
|
|
<Explorer
|
|
emptyNotice={
|
|
<div className="flex h-full flex-col items-center justify-center text-white">
|
|
<Icon name="Globe" size={128} />
|
|
<h1 className="mt-4 text-lg font-bold">Your Local Network</h1>
|
|
<p className="mt-1 max-w-sm text-center text-sm text-ink-dull">
|
|
Other Spacedrive nodes on your LAN will appear here, along with your
|
|
default OS network mounts.
|
|
</p>
|
|
</div>
|
|
}
|
|
/>
|
|
</ExplorerContextProvider>
|
|
);
|
|
};
|