From e8e45c664d563015b6761a4785b8190e039eebae Mon Sep 17 00:00:00 2001
From: martylukyy <35452459+martylukyy@users.noreply.github.com>
Date: Mon, 12 Aug 2024 20:44:57 +0200
Subject: [PATCH] refactor(web): rename custom components (#1581)
Co-authored-by: ze0s <43699394+zze0s@users.noreply.github.com>
---
web/src/components/data-table/Buttons.tsx | 4 +-
web/src/components/data-table/index.tsx | 2 +-
web/src/components/inputs/input_wide.tsx | 34 +++--
web/src/screens/filters/sections/Actions.tsx | 54 ++++----
web/src/screens/filters/sections/Advanced.tsx | 117 ++++++++++--------
web/src/screens/filters/sections/External.tsx | 55 ++++----
web/src/screens/filters/sections/General.tsx | 49 ++++----
.../screens/filters/sections/MoviesAndTV.tsx | 47 +++----
web/src/screens/filters/sections/Music.tsx | 79 ++++++------
.../screens/filters/sections/_components.tsx | 30 ++---
.../action_components/ActionDeluge.tsx | 48 ++++---
.../action_components/ActionPorla.tsx | 40 +++---
.../action_components/ActionQBittorrent.tsx | 96 +++++++-------
.../action_components/ActionRTorrent.tsx | 38 +++---
.../action_components/ActionTransmission.tsx | 72 ++++++-----
.../action_components/OtherActions.tsx | 80 ++++++------
web/src/screens/releases/ReleaseTable.tsx | 44 ++++---
17 files changed, 459 insertions(+), 430 deletions(-)
diff --git a/web/src/components/data-table/Buttons.tsx b/web/src/components/data-table/Buttons.tsx
index 60d9dc7..1cdc374 100644
--- a/web/src/components/data-table/Buttons.tsx
+++ b/web/src/components/data-table/Buttons.tsx
@@ -13,7 +13,7 @@ interface ButtonProps {
onClick?: () => void;
}
-export const Button = ({ children, className, disabled, onClick }: ButtonProps) => (
+export const TableButton = ({ children, className, disabled, onClick }: ButtonProps) => (
-
+
)}
@@ -255,11 +254,11 @@ const TypeForm = ({ external, idx }: TypeFormProps) => {
switch (external.type) {
case "EXEC": {
return (
-
-
+
{
placeholder="0"
/>
-
-
+
+
);
}
case "WEBHOOK": {
return (
<>
-
-
+
{
label="Expected HTTP status code"
placeholder="200"
/>
-
-
-
+
+
-
+
{
label="Retry delay in seconds"
placeholder="1"
/>
-
-
-
+
+
-
+
-
-
+
+
>
);
}
diff --git a/web/src/screens/filters/sections/General.tsx b/web/src/screens/filters/sections/General.tsx
index 867b2c9..0ec0a7f 100644
--- a/web/src/screens/filters/sections/General.tsx
+++ b/web/src/screens/filters/sections/General.tsx
@@ -9,13 +9,12 @@ import { downloadsPerUnitOptions } from "@domain/constants";
import { IndexersOptionsQueryOptions } from "@api/queries";
import { DocsLink } from "@components/ExternalLink";
-
-import * as Input from "@components/inputs";
-import * as Components from "./_components";
+import { FilterLayout, FilterPage, FilterSection } from "./_components";
+import { IndexerMultiSelect, MultiSelectOption, NumberField, Select, SwitchGroup, TextField } from "@components/inputs";
const MapIndexer = (indexer: Indexer) => (
- { label: indexer.name, value: indexer.id } as Input.MultiSelectOption
+ { label: indexer.name, value: indexer.id } as MultiSelectOption
);
export const General = () => {
@@ -25,23 +24,23 @@ export const General = () => {
// const indexerOptions = data?.map(MapIndexer) ?? [];
return (
-
-
-
-
+
+
+
+
{/*{!isLoading && (*/}
-
+
{/*)}*/}
-
-
+
+
-
-
-
+ {
}
/>
- {
}
/>
- {
}
/>
- {
}
/>
- {
}
/>
- {
}
/>
-
+
-
-
+
-
-
-
+
+
+
);
};
diff --git a/web/src/screens/filters/sections/MoviesAndTV.tsx b/web/src/screens/filters/sections/MoviesAndTV.tsx
index 4190e24..3efd54d 100644
--- a/web/src/screens/filters/sections/MoviesAndTV.tsx
+++ b/web/src/screens/filters/sections/MoviesAndTV.tsx
@@ -8,14 +8,19 @@ import { TextAreaAutoResize } from "@components/inputs/input";
import { MultiSelect, SwitchGroup, TextField } from "@components/inputs";
import * as CONSTS from "@domain/constants";
-import * as Components from "./_components";
+import {
+ FilterLayout,
+ FilterPage,
+ FilterSection,
+ FilterWideGridGapClass
+} from "@screens/filters/sections/_components.tsx";
const SeasonsAndEpisodes = () => (
-
-
+
(
description="Do not match episodes older than the last one matched."
/>
-
-
+
+
);
const Quality = () => (
-
-
+
(
}
/>
-
+
-
+
(
}
/>
-
+
-
+
(
}
/>
-
+
-
+
(
}
/>
-
-
+
+
);
export const MoviesTv = () => (
-
-
-
+
+
+
(
}
/>
-
-
+
+
-
+
);
diff --git a/web/src/screens/filters/sections/Music.tsx b/web/src/screens/filters/sections/Music.tsx
index 6dbd72a..cad891c 100644
--- a/web/src/screens/filters/sections/Music.tsx
+++ b/web/src/screens/filters/sections/Music.tsx
@@ -6,19 +6,20 @@
import { useFormikContext } from "formik";
import { DocsLink } from "@components/ExternalLink";
-import * as Input from "@components/inputs";
+import { FilterLayout, FilterPage, FilterRow, FilterSection } from "./_components";
+import { MultiSelect, NumberField, SwitchGroup, TextAreaAutoResize, TextField } from "@components/inputs";
import * as CONSTS from "@domain/constants";
-import * as Components from "./_components";
+
export const Music = () => {
const { values } = useFormikContext();
return (
-
-
-
-
+
+
+ {
}
/>
- {
}
/>
-
-
+
+
-
-
-
+ {
}
/>
- {
}
/>
-
-
+
+
-
-
-
-
+
+ {
}
/>
- {
}
/>
- {
}
/>
-
+
-
-
-
+
+
-
+
-
-
+
-
+
-
-
+ {
}
/>
-
-
-
+
+
+
@@ -172,8 +173,8 @@ export const Music = () => {
-
-
+ {
This is what you want in 90% of cases (instead of options above).
-
-
-
+
+
+
);
}
diff --git a/web/src/screens/filters/sections/_components.tsx b/web/src/screens/filters/sections/_components.tsx
index 2ba2263..56b543f 100644
--- a/web/src/screens/filters/sections/_components.tsx
+++ b/web/src/screens/filters/sections/_components.tsx
@@ -24,41 +24,41 @@ type OwningComponent = {
const VerticalGap = "gap-y-6 sm:gap-y-4";
-export const NormalGridGapClass = `gap-x-0.5 sm:gap-x-3 ${VerticalGap}`;
-export const TightGridGapClass = `gap-x-0.5 sm:gap-x-1.5 ${VerticalGap}`;
-export const WideGridGapClass = `gap-x-0.5 sm:gap-x-6 ${VerticalGap}`;
+export const FilterNormalGridGapClass = `gap-x-0.5 sm:gap-x-3 ${VerticalGap}`;
+export const FilterTightGridGapClass = `gap-x-0.5 sm:gap-x-1.5 ${VerticalGap}`;
+export const FilterWideGridGapClass = `gap-x-0.5 sm:gap-x-6 ${VerticalGap}`;
-export const LayoutClass = "grid grid-cols-12 col-span-12";
+export const FilterLayoutClass = "grid grid-cols-12 col-span-12";
-export const Layout = ({
+export const FilterLayout = ({
children,
className = "",
- gap = NormalGridGapClass
+ gap = FilterNormalGridGapClass
}: OwningComponent) => (
- {children}
+ {children}
);
-export const Row = ({
+export const FilterRow = ({
children,
className = "",
- gap = NormalGridGapClass
+ gap = FilterNormalGridGapClass
}: OwningComponent) => (
{children}
);
-export const HalfRow = ({
+export const FilterHalfRow = ({
children,
className = "",
- gap = NormalGridGapClass
+ gap = FilterNormalGridGapClass
}: OwningComponent) => (
{children}
);
-export const Section = ({
+export const FilterSection = ({
title,
subtitle,
children,
- gap = NormalGridGapClass
+ gap = FilterNormalGridGapClass
}: FilterSectionProps) => (
(
@@ -108,7 +108,7 @@ export const CollapsibleSection = ({
children,
defaultOpen = false,
noBottomBorder = false,
- childClassName = NormalGridGapClass
+ childClassName = FilterNormalGridGapClass
}: CollapsibleSectionProps) => {
const [isOpen, toggleOpen] = useToggle(defaultOpen);
diff --git a/web/src/screens/filters/sections/action_components/ActionDeluge.tsx b/web/src/screens/filters/sections/action_components/ActionDeluge.tsx
index 0bbbb68..e21e7ea 100644
--- a/web/src/screens/filters/sections/action_components/ActionDeluge.tsx
+++ b/web/src/screens/filters/sections/action_components/ActionDeluge.tsx
@@ -3,77 +3,75 @@
* SPDX-License-Identifier: GPL-2.0-or-later
*/
-import * as Input from "@components/inputs";
-
-import { CollapsibleSection } from "../_components";
-import * as FilterSection from "../_components";
+import { CollapsibleSection, FilterHalfRow, FilterLayout, FilterSection } from "../_components";
+import { DownloadClientSelect, NumberField, SwitchGroup, TextAreaAutoResize, TextField } from "@components/inputs";
export const Deluge = ({ idx, action, clients }: ClientActionProps) => (
<>
- Select the specific instance which you want to handle this release filter.>
}
>
-
-
-
+
+
-
-
-
+
+
-
+
-
-
+
-
-
-
+
+
-
-
-
+
+ This will only work on Deluge v2.
}
/>
-
-
+
+
-
-
-
+
>
);
diff --git a/web/src/screens/filters/sections/action_components/ActionPorla.tsx b/web/src/screens/filters/sections/action_components/ActionPorla.tsx
index d01f3af..d80954f 100644
--- a/web/src/screens/filters/sections/action_components/ActionPorla.tsx
+++ b/web/src/screens/filters/sections/action_components/ActionPorla.tsx
@@ -3,29 +3,27 @@
* SPDX-License-Identifier: GPL-2.0-or-later
*/
-import * as Input from "@components/inputs";
-
-import { CollapsibleSection } from "../_components";
-import * as FilterSection from "../_components";
+import { CollapsibleSection, FilterHalfRow, FilterLayout, FilterSection } from "../_components";
+import { DownloadClientSelect, NumberField, TextAreaAutoResize, TextField } from "@components/inputs";
export const Porla = ({ idx, action, clients }: ClientActionProps) => (
<>
- Select the specific instance which you want to handle this release filter.>
}
>
-
-
-
+
+
-
-
-
+
+ (
A case-sensitive preset name as configured in Porla.
}
/>
-
-
+
+
- (
title="Limits"
subtitle="Configure your speed/ratio/seed time limits"
>
-
-
+
-
-
-
+
+
-
+
-
+
>
);
diff --git a/web/src/screens/filters/sections/action_components/ActionQBittorrent.tsx b/web/src/screens/filters/sections/action_components/ActionQBittorrent.tsx
index a2984bc..f64d1e3 100644
--- a/web/src/screens/filters/sections/action_components/ActionQBittorrent.tsx
+++ b/web/src/screens/filters/sections/action_components/ActionQBittorrent.tsx
@@ -7,31 +7,37 @@ import { Link } from "@tanstack/react-router";
import { DocsLink } from "@components/ExternalLink";
import { ActionContentLayoutOptions, ActionPriorityOptions } from "@domain/constants";
-import * as Input from "@components/inputs";
-import { CollapsibleSection } from "../_components";
-import * as FilterSection from "../_components";
+import { CollapsibleSection, FilterHalfRow, FilterLayout, FilterSection, FilterWideGridGapClass } from "../_components";
+import {
+ DownloadClientSelect,
+ NumberField,
+ Select,
+ SwitchGroup,
+ TextAreaAutoResize,
+ TextField
+} from "@components/inputs";
export const QBittorrent = ({ idx, action, clients }: ClientActionProps) => (
<>
- Select the specific instance which you want to handle this release filter.>
}
>
-
-
-
+
+
-
-
+
+
-
-
+ (
}
/>
- (
}
/>
-
+
-
-
+ (
}
/>
-
+
-
-
+ (
}
className="py-2 pb-4"
/>
-
- (
}
/>
-
+
-
-
+
-
-
-
+
-
-
+
-
-
+
-
-
+
-
-
+
-
-
+
-
-
-
-
+
+
-
-
+
-
+
>
);
diff --git a/web/src/screens/filters/sections/action_components/ActionRTorrent.tsx b/web/src/screens/filters/sections/action_components/ActionRTorrent.tsx
index 19d33e4..b5787d4 100644
--- a/web/src/screens/filters/sections/action_components/ActionRTorrent.tsx
+++ b/web/src/screens/filters/sections/action_components/ActionRTorrent.tsx
@@ -4,59 +4,59 @@
*/
import { ActionRtorrentRenameOptions } from "@domain/constants";
-import * as Input from "@components/inputs";
+import { FilterHalfRow, FilterLayout, FilterSection } from "@screens/filters/sections/_components.tsx";
+import { DownloadClientSelect, Select, SwitchGroup, TextAreaAutoResize, TextField } from "@components/inputs";
-import * as FilterSection from "../_components";
export const RTorrent = ({ idx, action, clients }: ClientActionProps) => (
<>
- Select the specific instance which you want to handle this release filter.>
}
>
-
-
-
+
+
-
+
-
-
+
-
-
+
+
-
-
-
-
+
+
-
-
-
-
+
+
+
>
);
diff --git a/web/src/screens/filters/sections/action_components/ActionTransmission.tsx b/web/src/screens/filters/sections/action_components/ActionTransmission.tsx
index 9a00281..2a3c264 100644
--- a/web/src/screens/filters/sections/action_components/ActionTransmission.tsx
+++ b/web/src/screens/filters/sections/action_components/ActionTransmission.tsx
@@ -3,119 +3,117 @@
* SPDX-License-Identifier: GPL-2.0-or-later
*/
-import * as Input from "@components/inputs";
-
-import { CollapsibleSection } from "../_components";
-import * as FilterSection from "../_components";
+import { CollapsibleSection, FilterHalfRow, FilterLayout, FilterSection, FilterWideGridGapClass } from "../_components";
+import { DownloadClientSelect, NumberField, SwitchGroup, TextAreaAutoResize, TextField } from "@components/inputs";
export const Transmission = ({ idx, action, clients }: ClientActionProps) => (
<>
- Select the specific instance which you want to handle this release filter.>
}
>
-
-
-
+
+
-
-
-
+
+
-
-
+
+
-
-
-
-
+
+
-
-
+
+
-
-
+
-
-
+
-
-
+
-
-
+
-
-
+
-
-
-
-
+
+
-
-
+
-
+
>
);
diff --git a/web/src/screens/filters/sections/action_components/OtherActions.tsx b/web/src/screens/filters/sections/action_components/OtherActions.tsx
index dff5097..8e82143 100644
--- a/web/src/screens/filters/sections/action_components/OtherActions.tsx
+++ b/web/src/screens/filters/sections/action_components/OtherActions.tsx
@@ -4,36 +4,36 @@
*/
import { WarningAlert } from "@components/alerts";
-import * as Input from "@components/inputs";
+import { FilterHalfRow, FilterLayout, FilterSection } from "@screens/filters/sections/_components.tsx";
+import { DownloadClientSelect, NumberField, TextAreaAutoResize, TextField } from "@components/inputs";
-import * as FilterSection from "../_components";
export const SABnzbd = ({ idx, action, clients }: ClientActionProps) => (
- Select the specific instance which you want to handle this release filter.>
}
>
-
-
-
+
+
-
-
-
+
+ Category must exist already.
}
/>
-
-
-
+
+
+
);
export const Test = () => (
@@ -46,49 +46,49 @@ export const Test = () => (
);
export const Exec = ({ idx }: ClientActionProps) => (
-
-
-
+
-
-
+
-
+
);
export const WatchFolder = ({ idx }: ClientActionProps) => (
-
-
-
+
-
-
+
+
);
export const WebHook = ({ idx }: ClientActionProps) => (
-
-
-
+ (
URL or IP to your API. Pass params and set API tokens etc.
}
/>
-
-
+
-
+
);
export const Arr = ({ idx, action, clients }: ClientActionProps) => (
- Select the specific instance which you want to handle this release filter.>
}
>
-
-
-
+
+
-
+
-
+
- (
}
/>
- (
}
/>
-
-
-
+
+
+
);
diff --git a/web/src/screens/releases/ReleaseTable.tsx b/web/src/screens/releases/ReleaseTable.tsx
index 9febb46..16e04fb 100644
--- a/web/src/screens/releases/ReleaseTable.tsx
+++ b/web/src/screens/releases/ReleaseTable.tsx
@@ -19,13 +19,11 @@ import {
import { ReleasesRoute } from "@app/routes";
import { ReleasesListQueryOptions } from "@api/queries";
import { RandomLinuxIsos } from "@utils";
-
-import * as Icons from "@components/Icons";
-import { RingResizeSpinner } from "@components/Icons";
-import * as DataTable from "@components/data-table";
-
+import { RingResizeSpinner, SortDownIcon, SortIcon, SortUpIcon } from "@components/Icons";
import { IndexerSelectColumnFilter, PushStatusSelectColumnFilter, SearchColumnFilter } from "./ReleaseFilters";
import { EmptyListState } from "@components/emptystates";
+import { TableButton, TablePageButton } from "@components/data-table/Buttons.tsx";
+import { AgeCell, IndexerCell, LinksCell, NameCell, ReleaseStatusCell } from "@components/data-table";
type TableState = {
queryPageIndex: number;
@@ -100,30 +98,30 @@ export const ReleaseTable = () => {
{
Header: "Age",
accessor: "timestamp",
- Cell: DataTable.AgeCell
+ Cell: AgeCell
},
{
Header: "Release",
accessor: "name",
- Cell: DataTable.NameCell,
+ Cell: NameCell,
Filter: SearchColumnFilter
},
{
Header: "Links",
accessor: (row) => ({ download_url: row.download_url, info_url: row.info_url }),
id: "links",
- Cell: DataTable.LinksCell
+ Cell: LinksCell
},
{
Header: "Actions",
accessor: "action_status",
- Cell: DataTable.ReleaseStatusCell,
+ Cell: ReleaseStatusCell,
Filter: PushStatusSelectColumnFilter
},
{
Header: "Indexer",
accessor: "indexer.identifier",
- Cell: DataTable.IndexerCell,
+ Cell: IndexerCell,
Filter: IndexerSelectColumnFilter,
filter: "equal"
}
@@ -303,12 +301,12 @@ export const ReleaseTable = () => {
{column.isSorted ? (
column.isSortedDesc ? (
-
+
) : (
-
+
)
) : (
-
+
)}
@@ -350,8 +348,8 @@ export const ReleaseTable = () => {
{/* Pagination */}
-
previousPage()} disabled={!canPreviousPage}>Previous
-
nextPage()} disabled={!canNextPage}>Next
+
previousPage()} disabled={!canPreviousPage}>Previous
+
nextPage()} disabled={!canNextPage}>Next
@@ -378,37 +376,37 @@ export const ReleaseTable = () => {