chore(web): relocations and cleanups (#957)

* delete manifest (vite-plugin-pwa generates it)

* fix upper case letter on screen components

* fix imports of screens components missing upper case

* remove default export from Base.tsx

* move RegexPlayground to settings import

* replace some relative path imports

* remove React and ununsed imports

* small alignments on vite.config.ts

* move Dashboard and Releases to screens

* move filters/index.tsx to filters/index.ts

* remove default export from APIKeyAddForm

* remove default export from FilterAddForm

* organize imports and exports for the router

* add .vscode workspace to gitignore

* some touchs on .gitignore file

* fix some eslint rules
This commit is contained in:
Fabricio Silva 2023-07-21 16:33:51 +01:00 committed by GitHub
parent 72bb2ddadb
commit c7ec93722b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
41 changed files with 187 additions and 230 deletions

View file

@ -75,4 +75,4 @@ function ActionSettings() {
);
}
export default ActionSettings;
export default ActionSettings;

View file

@ -10,7 +10,7 @@ import { TrashIcon } from "@heroicons/react/24/outline";
import { KeyField } from "@components/fields/text";
import { DeleteModal } from "@components/modals";
import APIKeyAddForm from "@forms/settings/APIKeyAddForm";
import { APIKeyAddForm } from "@forms/settings/APIKeyAddForm";
import Toast from "@components/notifications/Toast";
import { APIClient } from "@api/APIClient";
import { useToggle } from "@hooks/hooks";

View file

@ -51,7 +51,7 @@ function useSort(items: ListItemProps["clients"][], config?: SortConfig) {
sortableItems.sort((a, b) => {
const aValue = sortConfig.key === "enabled" ? (a[sortConfig.key] ?? false) as number | boolean | string : a[sortConfig.key] as number | boolean | string;
const bValue = sortConfig.key === "enabled" ? (b[sortConfig.key] ?? false) as number | boolean | string : b[sortConfig.key] as number | boolean | string;
if (aValue < bValue) {
return sortConfig.direction === "ascending" ? -1 : 1;
}
@ -59,7 +59,7 @@ function useSort(items: ListItemProps["clients"][], config?: SortConfig) {
return sortConfig.direction === "ascending" ? 1 : -1;
}
return 0;
});
});
return sortableItems;
}, [items, sortConfig]);
@ -80,7 +80,7 @@ function useSort(items: ListItemProps["clients"][], config?: SortConfig) {
if (!sortConfig || sortConfig.key !== key) {
return "";
}
return sortConfig.direction === "ascending" ? "↑" : "↓";
};
@ -194,7 +194,7 @@ function DownloadClientSettings() {
onClick={() => sortedClients.requestSort("enabled")}>
Enabled <span className="sort-indicator">{sortedClients.getSortIndicator("enabled")}</span>
</div>
<div
<div
className="col-span-6 sm:col-span-4 lg:col-span-4 pl-12 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider cursor-pointer"
onClick={() => sortedClients.requestSort("name")}
>
@ -225,4 +225,4 @@ function DownloadClientSettings() {
);
}
export default DownloadClientSettings;
export default DownloadClientSettings;

View file

@ -50,7 +50,7 @@ function useSort(items: ListItemProps["feed"][], config?: SortConfig) {
sortableItems.sort((a, b) => {
const aValue = sortConfig.key === "enabled" ? (a[sortConfig.key] ?? false) as number | boolean | string : a[sortConfig.key] as number | boolean | string;
const bValue = sortConfig.key === "enabled" ? (b[sortConfig.key] ?? false) as number | boolean | string : b[sortConfig.key] as number | boolean | string;
if (aValue < bValue) {
return sortConfig.direction === "ascending" ? -1 : 1;
}
@ -58,7 +58,7 @@ function useSort(items: ListItemProps["feed"][], config?: SortConfig) {
return sortConfig.direction === "ascending" ? 1 : -1;
}
return 0;
});
});
return sortableItems;
}, [items, sortConfig]);
@ -73,13 +73,13 @@ function useSort(items: ListItemProps["feed"][], config?: SortConfig) {
}
setSortConfig({ key, direction });
};
const getSortIndicator = (key: keyof ListItemProps["feed"]) => {
if (!sortConfig || sortConfig.key !== key) {
return "";
}
return sortConfig.direction === "ascending" ? "↑" : "↓";
};

View file

@ -40,7 +40,7 @@ function useSort(items: ListItemProps["indexer"][], config?: SortConfig) {
sortableItems.sort((a, b) => {
const aValue = sortConfig.key === "enabled" ? (a[sortConfig.key] ?? false) as number | boolean | string : a[sortConfig.key] as number | boolean | string;
const bValue = sortConfig.key === "enabled" ? (b[sortConfig.key] ?? false) as number | boolean | string : b[sortConfig.key] as number | boolean | string;
if (aValue < bValue) {
return sortConfig.direction === "ascending" ? -1 : 1;
}
@ -48,7 +48,7 @@ function useSort(items: ListItemProps["indexer"][], config?: SortConfig) {
return sortConfig.direction === "ascending" ? 1 : -1;
}
return 0;
});
});
return sortableItems;
}, [items, sortConfig]);
@ -69,7 +69,7 @@ function useSort(items: ListItemProps["indexer"][], config?: SortConfig) {
if (!sortConfig || sortConfig.key !== key) {
return "";
}
return sortConfig.direction === "ascending" ? "↑" : "↓";
};

View file

@ -11,7 +11,7 @@ import { APIClient } from "@api/APIClient";
import { GithubRelease } from "@app/types/Update";
import Toast from "@components/notifications/Toast";
import { LogLevelOptions, SelectOption } from "@domain/constants";
import { LogFiles } from "../Logs";
import { LogFiles } from "@screens/Logs";
interface RowItemProps {
label: string;
@ -195,4 +195,4 @@ function LogSettings() {
);
}
export default LogSettings;
export default LogSettings;

View file

@ -123,13 +123,13 @@ function ListItem({ notification }: ListItemProps) {
queryClient.invalidateQueries({ queryKey: notificationKeys.lists() });
}
});
const onToggleMutation = (newState: boolean) => {
mutation.mutate({
...notification,
enabled: newState
});
};
};
return (
<li key={notification.id} className="text-gray-500 dark:text-gray-400">

View file

@ -5,14 +5,14 @@
import { useRef, useState } from "react";
export const RegexPlayground = () => {
const RegexPlayground = () => {
const regexRef = useRef<HTMLInputElement>(null);
const [output, setOutput] = useState<Array<React.ReactElement>>();
const onInput = (text: string) => {
if (!regexRef || !regexRef.current)
return;
const regexp = new RegExp(regexRef.current.value, "g");
const results: Array<React.ReactElement> = [];
@ -50,7 +50,7 @@ export const RegexPlayground = () => {
</span>
);
}
if (lastIndex > 0)
results.push(<br key={`line-delim-${index}`}/>);
});
@ -107,4 +107,6 @@ export const RegexPlayground = () => {
</div>
</div>
);
};
};
export default RegexPlayground;

View file

@ -3,7 +3,7 @@
* SPDX-License-Identifier: GPL-2.0-or-later
*/
import React, { useRef, useState } from "react";
import { useRef, useState } from "react";
import { useMutation, useQueryClient } from "@tanstack/react-query";
import { toast } from "react-hot-toast";
@ -147,4 +147,4 @@ function DeleteReleases() {
);
}
export default ReleaseSettings;
export default ReleaseSettings;

View file

@ -3,12 +3,13 @@
* SPDX-License-Identifier: GPL-2.0-or-later
*/
export { default as APISettings } from "./Api";
export { default as ApplicationSettings } from "./Application";
export { default as DownloadClientSettings } from "./DownloadClient";
export { default as FeedSettings } from "./Feed";
export { default as IndexerSettings } from "./Indexer";
export { default as IrcSettings } from "./Irc";
export { default as LogSettings } from "./Logs";
export { default as NotificationSettings } from "./Notifications";
export { default as ReleaseSettings } from "./Releases";
export { default as Api } from "./Api";
export { default as Application } from "./Application";
export { default as DownloadClient } from "./DownloadClient";
export { default as Feed } from "./Feed";
export { default as Indexer } from "./Indexer";
export { default as Irc } from "./Irc";
export { default as Logs } from "./Logs";
export { default as Notification } from "./Notifications";
export { default as Release } from "./Releases";
export { default as RegexPlayground } from "./RegexPlayground";