Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ENG-1950] Improve UI structure #2799

Draft
wants to merge 37 commits into
base: main
Choose a base branch
from
Draft
Changes from 1 commit
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
506e6c1
refactored Filters.tsx and designed date range API
Sep 22, 2024
ca6d5ef
progress on implementation
Sep 22, 2024
5941d63
completed implementing previous filters
Sep 22, 2024
295b716
tweaks wip
Sep 22, 2024
5582653
packages
Sep 22, 2024
9ba33fb
tweaks + srt support
Sep 25, 2024
d8ffe86
Merge branch 'main' of github.com:spacedriveapp/spacedrive into eng-1…
iLynxcat Oct 31, 2024
88d9040
Merge branch 'main' of github.com:spacedriveapp/spacedrive into eng-1…
iLynxcat Oct 31, 2024
8c5dff1
Add devices module and integrate device management into API; enhance …
jamiepine Nov 5, 2024
cb81cfa
Make overview cards composable
jamiepine Nov 5, 2024
fe218fc
Implement lazy loading for overview cards and add CardWrapper for hot…
jamiepine Nov 5, 2024
167170d
use default card configurations and fix responsive grid sizings
jamiepine Nov 5, 2024
e1a0988
Implement .sdvolume file read/write operations. Enhance storage bar r…
jamiepine Nov 6, 2024
2da3ec6
storage meter, volume alerts and ui tweaks
jamiepine Nov 6, 2024
b41b92a
fix update lib stats + 0.5.0 version bump
jamiepine Nov 6, 2024
a277d05
0.5.0 lock
jamiepine Nov 6, 2024
0fa0a74
some experimental cards, will be feature flagged before merge
jamiepine Nov 7, 2024
b55310a
ignore swift vscode extension index files
iLynxcat Nov 7, 2024
a5ef958
add migration to remove old `storage_statistics`
iLynxcat Nov 7, 2024
7b1355e
relocate small screen override
iLynxcat Nov 7, 2024
43d9d2b
refresh the forbidden 404 page
iLynxcat Nov 7, 2024
bf0fb51
bring account tab back temp
jamiepine Nov 7, 2024
9a0ac02
Merge branch 'eng-1950-improve-ui-structure' of github.com:spacedrive…
iLynxcat Nov 10, 2024
7ee1065
Merge branch 'main' into eng-1896-add-date-range-to-search-options
jamiepine Dec 9, 2024
51a58f7
Merge branch 'main' into eng-1950-improve-ui-structure
jamiepine Dec 10, 2024
a12c337
Merge branch 'eng-1896-add-date-range-to-search-options' into eng-195…
jamiepine Dec 10, 2024
9df4b07
swapy
jamiepine Dec 10, 2024
83651c1
wip
jamiepine Dec 10, 2024
36d3faa
working point
jamiepine Dec 10, 2024
04a12d0
fix types
jamiepine Dec 10, 2024
21e985c
better swappy
jamiepine Dec 10, 2024
483e749
better search
jamiepine Dec 10, 2024
331ea45
better swappy
jamiepine Dec 10, 2024
440d1b8
performance fix
jamiepine Dec 10, 2024
04bab6c
yes
jamiepine Dec 10, 2024
e93477f
checkpoint
jamiepine Dec 10, 2024
841ce12
checkpoint
jamiepine Dec 10, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add devices module and integrate device management into API; enhance …
…overview with recent items and favorite items features
  • Loading branch information
jamiepine committed Nov 5, 2024
commit 8c5dff1c1d2d7ef4f0a2a7bb004d8d4ea1bf3ae0
14 changes: 14 additions & 0 deletions core/src/api/devices.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
use super::{utils::library, Ctx, R};
use rspc::alpha::AlphaRouter;
use serde::Deserialize;
use specta::Type;

pub(crate) fn mount() -> AlphaRouter<Ctx> {
R.router().procedure(
"list",
R.with2(library())
.query(|(node, library), _: ()| async move {
Ok(library.db.device().find_many(vec![]).exec().await?)
}),
)
}
2 changes: 2 additions & 0 deletions core/src/api/mod.rs
Original file line number Diff line number Diff line change
@@ -26,6 +26,7 @@ use tracing::warn;

mod backups;
mod cloud;
pub mod devices;
mod ephemeral_files;
mod files;
mod jobs;
@@ -197,6 +198,7 @@ pub(crate) fn mount() -> Arc<Router> {
.merge("search.", search::mount())
.merge("library.", libraries::mount())
.merge("volumes.", volumes::mount())
.merge("devices.", devices::mount())
.merge("tags.", tags::mount())
.merge("labels.", labels::mount())
.merge("locations.", locations::mount())
47 changes: 47 additions & 0 deletions interface/app/$libraryId/Explorer/View/Grid/SimpleGridItem.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import { HTMLAttributes, ReactNode } from 'react';
import { useNavigate } from 'react-router';
import { useSelector, type ExplorerItem } from '@sd/client';
import { useOperatingSystem } from '~/hooks';
import { useRoutingContext } from '~/RoutingContext';

import { useExplorerContext } from '../../Context';
import { explorerStore, isCut } from '../../store';

interface Props extends Omit<HTMLAttributes<HTMLDivElement>, 'children'> {
item: ExplorerItem;
children: (state: { selected: boolean; cut: boolean }) => ReactNode;
}

export const SimpleGridItem = ({ children, item, ...props }: Props) => {
const explorer = useExplorerContext();
const { currentIndex, maxIndex } = useRoutingContext();
const os = useOperatingSystem();
const navigate = useNavigate();

const cutCopyState = useSelector(explorerStore, (s) => s.cutCopyState);
const cut = isCut(item, cutCopyState);
const selected = explorer.selectedItems.has(item);

const canGoBack = currentIndex !== 0;
const canGoForward = currentIndex !== maxIndex;

return (
<div
{...props}
className="size-full"
onMouseDown={(e) => {
e.stopPropagation();
if (os === 'browser') return;
if (e.buttons === 8 || e.buttons === 3) {
if (!canGoBack) return;
navigate(-1);
} else if (e.buttons === 16 || e.buttons === 4) {
if (!canGoForward) return;
navigate(1);
}
}}
>
{children({ selected, cut })}
</div>
);
};
Original file line number Diff line number Diff line change
@@ -82,26 +82,27 @@ export default function LocalSection() {
// Improved volume tracking
const trackVolumeMutation = useLibraryMutation('volumes.track');

// Mapping of volume paths to location IDs
// Mapping of volume paths to location IDs so we can open the location if root
const locationIdsForVolumes = useMemo(() => {
if (!locations || !volumes) return {};

return locations.reduce(
(acc, location) => {
// match location path to volume mount point
const matchingVolume = volumes.find((v) =>
v.mount_points.some((mp) => mp === location.path)
);

if (matchingVolume && matchingVolume.pub_id && location.path) {
acc[location.path] = {
locationId: location.id,
volumeId: new Uint8Array(matchingVolume.pub_id)
volumeFingerprint: matchingVolume.fingerprint
};
}

return acc;
},
{} as Record<string, { locationId: number; volumeId: Uint8Array }>
{} as Record<string, { locationId: number; volumeFingerprint: string }>
);
}, [locations, volumes]);

@@ -156,9 +157,9 @@ export default function LocalSection() {
onTrack={async () => {
if (!isTracked && volume.pub_id) {
try {
await trackVolumeMutation.mutateAsync({
volume_id: Array.from(volume.pub_id) // Convert Uint8Array to number[]
});
await trackVolumeMutation.mutateAsync(
Array.from(volume.pub_id)
);
toast.success('Volume tracked successfully');
} catch (error) {
toast.error('Failed to track volume');
Original file line number Diff line number Diff line change
@@ -61,7 +61,7 @@ const HorizontalScroll = ({ children, className }: { children: ReactNode; classN
}, rgba(0, 0, 0, 1) ${lastItemVisible ? '95%' : '85%'}, transparent 99%)`;

return (
<div className={clsx(className, 'relative mb-4 flex pl-6')}>
<div className={clsx(className, 'relative mb-4')}>
<ArrowButton
onClick={() => handleArrowOnClick('right')}
className={clsx('left-3', scroll === 0 && 'pointer-events-none opacity-0')}
@@ -72,7 +72,7 @@ const HorizontalScroll = ({ children, className }: { children: ReactNode; classN
ref={ref}
{...events}
className={clsx(
'no-scrollbar flex gap-2 space-x-px overflow-x-scroll pl-1 pr-[60px]',
'no-scrollbar flex gap-2 space-x-px overflow-x-scroll pl-1 pr-[30px]',
isContentOverflow ? 'cursor-grab' : 'cursor-default'
)}
style={{
27 changes: 27 additions & 0 deletions interface/app/$libraryId/overview/cards/FavoriteItems.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { useLibraryQuery } from '@sd/client';

import { ItemsCard } from './ItemsCard';

const FavoriteItemsCard = () => {
const favoriteItemsQuery = useLibraryQuery([
'search.objects',
{
take: 6,
orderAndPagination: {
orderOnly: { field: 'dateAccessed', value: 'Desc' }
},
filters: [{ object: { favorite: true } }]
}
]);

return (
<ItemsCard
title="Favorite Items"
query={favoriteItemsQuery}
buttonText="See all favorites"
buttonLink="/explorer?filter=favorites"
/>
);
};

export default FavoriteItemsCard;
Loading