mirror of
https://github.com/spacedriveapp/spacedrive.git
synced 2026-03-12 11:36:32 -04:00
Fix types - Interface
This commit is contained in:
@@ -11,7 +11,8 @@
|
||||
"./components/*": "./src/components/*"
|
||||
},
|
||||
"scripts": {
|
||||
"icons": "./scripts/generateSvgImports.mjs"
|
||||
"icons": "./scripts/generateSvgImports.mjs",
|
||||
"lint": "eslint src/**/*.{ts,tsx} && tsc --noEmit"
|
||||
},
|
||||
"dependencies": {
|
||||
"@apollo/client": "^3.6.9",
|
||||
|
||||
@@ -21,10 +21,10 @@ function RouterContainer(props: { props: AppProps }) {
|
||||
const { data: client } = useBridgeQuery(['getNode']);
|
||||
|
||||
useEffect(() => {
|
||||
setAppProps({
|
||||
setAppProps((appProps) => ({
|
||||
...appProps,
|
||||
data_path: client?.data_path
|
||||
});
|
||||
}));
|
||||
}, [client?.data_path]);
|
||||
|
||||
return (
|
||||
@@ -40,7 +40,7 @@ export default function SpacedriveInterface(props: AppProps) {
|
||||
useInvalidateQuery();
|
||||
|
||||
return (
|
||||
<ErrorBoundary FallbackComponent={ErrorFallback} onReset={() => {}}>
|
||||
<ErrorBoundary FallbackComponent={ErrorFallback}>
|
||||
<QueryClientProvider client={queryClient}>
|
||||
{import.meta.env.MODE === 'development' && <ReactQueryDevtools position="bottom-right" />}
|
||||
<RouterContainer props={props} />
|
||||
|
||||
@@ -44,7 +44,7 @@ export function AppRouter() {
|
||||
if (libraryState.currentLibraryUuid === null && libraries && libraries.length > 0) {
|
||||
libraryState.switchLibrary(libraries[0].uuid);
|
||||
}
|
||||
}, [libraryState.currentLibraryUuid, libraries]);
|
||||
}, [libraryState, libraryState.currentLibraryUuid, libraries]);
|
||||
|
||||
return (
|
||||
<>
|
||||
|
||||
@@ -73,10 +73,11 @@ export const FileList: React.FC<{ location_id: number; path: string; limit: numb
|
||||
index: goingUp ? selectedRowIndex - 1 : selectedRowIndex
|
||||
});
|
||||
}
|
||||
}, [selectedRowIndex]);
|
||||
}, [goingUp, selectedRowIndex]);
|
||||
|
||||
useEffect(() => {
|
||||
setLocationId(props.location_id);
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [props.location_id]);
|
||||
|
||||
useKey('ArrowUp', (e) => {
|
||||
@@ -168,7 +169,7 @@ interface RenderItemProps {
|
||||
|
||||
const RenderGridItem: React.FC<RenderItemProps> = ({ item, index, dirId }) => {
|
||||
const { selectedRowIndex, setSelectedRowIndex } = useExplorerStore();
|
||||
let [_, setSearchParams] = useSearchParams();
|
||||
const [_, setSearchParams] = useSearchParams();
|
||||
|
||||
return (
|
||||
<FileItem
|
||||
@@ -189,7 +190,7 @@ const RenderGridItem: React.FC<RenderItemProps> = ({ item, index, dirId }) => {
|
||||
const RenderRow: React.FC<RenderItemProps> = ({ item, index, dirId }) => {
|
||||
const { selectedRowIndex, setSelectedRowIndex } = useExplorerStore();
|
||||
const isActive = selectedRowIndex === index;
|
||||
let [_, setSearchParams] = useSearchParams();
|
||||
const [_, setSearchParams] = useSearchParams();
|
||||
|
||||
return useMemo(
|
||||
() => (
|
||||
@@ -217,6 +218,7 @@ const RenderRow: React.FC<RenderItemProps> = ({ item, index, dirId }) => {
|
||||
))}
|
||||
</div>
|
||||
),
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
[item.id, isActive]
|
||||
);
|
||||
};
|
||||
|
||||
@@ -32,7 +32,7 @@ export default function FileThumb(props: {
|
||||
}
|
||||
|
||||
if (icons[props.file.extension as keyof typeof icons]) {
|
||||
let Icon = icons[props.file.extension as keyof typeof icons];
|
||||
const Icon = icons[props.file.extension as keyof typeof icons];
|
||||
return <Icon className={clsx('max-w-[170px] w-full h-full', props.className)} />;
|
||||
}
|
||||
return <div></div>;
|
||||
|
||||
@@ -62,6 +62,7 @@ export const Inspector = (props: {
|
||||
return () => {
|
||||
clearTimeout(handler);
|
||||
};
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [note]);
|
||||
|
||||
const toggleFavorite = () => {
|
||||
|
||||
@@ -18,7 +18,7 @@ import RunningJobsWidget from '../jobs/RunningJobsWidget';
|
||||
import { MacTrafficLights } from '../os/TrafficLights';
|
||||
import { DefaultProps } from '../primitive/types';
|
||||
|
||||
interface SidebarProps extends DefaultProps {}
|
||||
type SidebarProps = DefaultProps;
|
||||
|
||||
export const SidebarLink = (props: NavLinkProps & { children: React.ReactNode }) => (
|
||||
<NavLink {...props}>
|
||||
@@ -88,6 +88,7 @@ export const Sidebar: React.FC<SidebarProps> = (props) => {
|
||||
|
||||
useEffect(() => {
|
||||
if (libraries && !currentLibraryUuid) initLibraries(libraries);
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [libraries, currentLibraryUuid]);
|
||||
|
||||
const { mutate: createLocation } = useLibraryMutation('locations.create');
|
||||
|
||||
@@ -55,8 +55,9 @@ export default function RunningJobsWidget() {
|
||||
|
||||
return (
|
||||
<div className="flex flex-col space-y-4">
|
||||
{jobs?.map((job) => (
|
||||
{jobs?.map((job, index) => (
|
||||
<Transition
|
||||
key={job.id + index}
|
||||
show={true}
|
||||
enter="transition-translate ease-in-out duration-200"
|
||||
enterFrom="translate-y-24"
|
||||
|
||||
@@ -9,7 +9,7 @@ import { useNavigate } from 'react-router-dom';
|
||||
import { Shortcut } from '../primitive/Shortcut';
|
||||
import { DefaultProps } from '../primitive/types';
|
||||
|
||||
export interface TopBarProps extends DefaultProps {}
|
||||
export type TopBarProps = DefaultProps;
|
||||
export interface TopBarButtonProps
|
||||
extends DetailedHTMLProps<HTMLAttributes<HTMLButtonElement>, HTMLButtonElement> {
|
||||
icon: React.ComponentType<IconProps>;
|
||||
@@ -18,7 +18,7 @@ export interface TopBarButtonProps
|
||||
left?: boolean;
|
||||
right?: boolean;
|
||||
}
|
||||
interface SearchBarProps extends DefaultProps {}
|
||||
type SearchBarProps = DefaultProps;
|
||||
|
||||
const TopBarButton: React.FC<TopBarButtonProps> = ({
|
||||
icon: Icon,
|
||||
@@ -90,7 +90,7 @@ export const TopBar: React.FC<TopBarProps> = (props) => {
|
||||
}
|
||||
});
|
||||
|
||||
let navigate = useNavigate();
|
||||
const navigate = useNavigate();
|
||||
return (
|
||||
<>
|
||||
<div
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import React from 'react';
|
||||
import ReactJson, { ReactJsonViewProps } from 'react-json-view';
|
||||
|
||||
export interface CodeBlockProps extends ReactJsonViewProps {}
|
||||
export type CodeBlockProps = ReactJsonViewProps;
|
||||
|
||||
export default function CodeBlock(props: CodeBlockProps) {
|
||||
return (
|
||||
|
||||
@@ -16,7 +16,7 @@ export default function Listbox(props: { options: ListboxOption[]; className?: s
|
||||
if (!selected) {
|
||||
setSelected(props.options[0]);
|
||||
}
|
||||
}, [props.options]);
|
||||
}, [props.options, selected]);
|
||||
|
||||
return (
|
||||
<>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import React from 'react';
|
||||
|
||||
export const ContentScreen: React.FC<{}> = (props) => {
|
||||
export const ContentScreen: React.FC<unknown> = (props) => {
|
||||
// const [address, setAddress] = React.useState('');
|
||||
return (
|
||||
<div className="flex flex-col w-full h-screen p-5 custom-scroll page-scroll">
|
||||
|
||||
@@ -4,7 +4,7 @@ import React, { useContext } from 'react';
|
||||
|
||||
import CodeBlock from '../components/primitive/Codeblock';
|
||||
|
||||
export const DebugScreen: React.FC<{}> = (props) => {
|
||||
export const DebugScreen: React.FC<unknown> = (props) => {
|
||||
const appPropsContext = useContext(AppPropsContext);
|
||||
const { data: nodeState } = useBridgeQuery(['getNode']);
|
||||
const { data: libraryState } = useBridgeQuery(['library.get']);
|
||||
|
||||
@@ -6,12 +6,12 @@ import { FileList } from '../components/file/FileList';
|
||||
import { Inspector } from '../components/file/Inspector';
|
||||
import { TopBar } from '../components/layout/TopBar';
|
||||
|
||||
export const ExplorerScreen: React.FC<{}> = () => {
|
||||
let [searchParams] = useSearchParams();
|
||||
let path = searchParams.get('path') || '';
|
||||
export const ExplorerScreen: React.FC<unknown> = () => {
|
||||
const [searchParams] = useSearchParams();
|
||||
const path = searchParams.get('path') || '';
|
||||
|
||||
let { id } = useParams();
|
||||
let location_id = Number(id);
|
||||
const { id } = useParams();
|
||||
const location_id = Number(id);
|
||||
|
||||
const [limit, setLimit] = React.useState(100);
|
||||
|
||||
|
||||
@@ -70,7 +70,7 @@ const StatItem: React.FC<StatItemProps> = (props) => {
|
||||
setCount((count) => count + 1);
|
||||
}, quadratic(appProps?.demoMode ? 1000 : 500, +size.value, count));
|
||||
}
|
||||
}, [count, size]);
|
||||
}, [appProps?.demoMode, count, size]);
|
||||
|
||||
return (
|
||||
<div
|
||||
@@ -139,6 +139,7 @@ export const OverviewScreen = () => {
|
||||
|
||||
setOverviewStats(newStatistics);
|
||||
}
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [appProps, libraryStatistics]);
|
||||
|
||||
// useEffect(() => {
|
||||
@@ -187,7 +188,7 @@ export const OverviewScreen = () => {
|
||||
<Dialog
|
||||
title="Add Device"
|
||||
description="Connect a new device to your library. Either enter another device's code or copy this one."
|
||||
ctaAction={() => {}}
|
||||
// ctaAction={() => {}}
|
||||
ctaLabel="Connect"
|
||||
trigger={
|
||||
<Button
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import React from 'react';
|
||||
|
||||
export const PhotosScreen: React.FC<{}> = (props) => {
|
||||
export const PhotosScreen: React.FC<unknown> = (props) => {
|
||||
return (
|
||||
<div className="flex flex-col w-full h-screen p-5 custom-scroll page-scroll">
|
||||
<div className="flex flex-col space-y-5 pb-7">
|
||||
|
||||
@@ -12,6 +12,7 @@ export const RedirectPage: React.FC<RedirectPageProps> = (props) => {
|
||||
|
||||
useEffect(() => {
|
||||
navigate(destination);
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, []);
|
||||
|
||||
return null;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import React from 'react';
|
||||
import { useParams } from 'react-router-dom';
|
||||
|
||||
export const TagScreen: React.FC<{}> = () => {
|
||||
let { id } = useParams();
|
||||
export const TagScreen: React.FC<unknown> = () => {
|
||||
const { id } = useParams();
|
||||
|
||||
return (
|
||||
<div className="w-full p-5">
|
||||
|
||||
@@ -35,6 +35,7 @@ export default function LibraryGeneralSettings() {
|
||||
});
|
||||
}
|
||||
}
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [nameDebounced, descriptionDebounced]);
|
||||
|
||||
useEffect(() => {
|
||||
@@ -42,6 +43,7 @@ export default function LibraryGeneralSettings() {
|
||||
setName(currentLibrary.config.name);
|
||||
setDescription(currentLibrary.config.description);
|
||||
}
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [libraries]);
|
||||
|
||||
useEffect(() => {
|
||||
@@ -50,6 +52,7 @@ export default function LibraryGeneralSettings() {
|
||||
setName(currentLibrary.config.name);
|
||||
setDescription(currentLibrary.config.description);
|
||||
}
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [currentLibraryUuid]);
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
@@ -47,10 +47,11 @@ export default function TagsSettings() {
|
||||
if (!currentTag && tags?.length) {
|
||||
setSelectedTag(tags[0].id);
|
||||
}
|
||||
}, [tags]);
|
||||
}, [currentTag, tags]);
|
||||
|
||||
useEffect(() => {
|
||||
reset(currentTag);
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [currentTag]);
|
||||
|
||||
const { register, handleSubmit, watch, reset, control } = useForm({
|
||||
@@ -59,6 +60,7 @@ export default function TagsSettings() {
|
||||
|
||||
const submitTagUpdate = handleSubmit((data) => updateTag(data));
|
||||
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
const autoUpdateTag = useCallback(useDebounce(submitTagUpdate, 500), []);
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
@@ -39,7 +39,7 @@ function LibraryListItem(props: { library: LibraryConfigWrapped }) {
|
||||
ctaDanger
|
||||
ctaLabel="Delete"
|
||||
trigger={
|
||||
<Button variant="gray" className="!p-1.5" onClick={() => {}}>
|
||||
<Button variant="gray" className="!p-1.5">
|
||||
<TrashIcon className="w-4 h-4" />
|
||||
</Button>
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user