From dc58198488186852e0256f5d85e6354060682c94 Mon Sep 17 00:00:00 2001 From: Matthias Mair Date: Wed, 18 Sep 2024 01:15:47 +0200 Subject: [PATCH] More style fixes (#8140) * more style fixes * fix more changes --- .../src/components/DashboardItemProxy.tsx | 4 ++-- .../src/components/buttons/ButtonMenu.tsx | 4 ++-- .../src/components/buttons/CopyButton.tsx | 4 ++-- .../src/components/buttons/EditButton.tsx | 4 ++-- .../src/components/buttons/SSOButton.tsx | 2 +- .../src/components/details/Details.tsx | 15 ++++++++----- .../src/components/details/DetailsImage.tsx | 12 +++++----- .../src/components/errors/ServerError.tsx | 2 +- src/frontend/src/components/forms/ApiForm.tsx | 22 +++++++++---------- .../components/forms/AuthenticationForm.tsx | 12 +++++----- .../src/components/forms/HostOptionsForm.tsx | 4 ++-- .../src/components/forms/InstanceOptions.tsx | 8 +++---- .../src/components/forms/StandaloneField.tsx | 4 ++-- .../components/forms/fields/ApiFormField.tsx | 4 ++-- .../src/components/forms/fields/DateField.tsx | 4 ++-- .../forms/fields/NestedObjectField.tsx | 4 ++-- .../forms/fields/RelatedModelField.tsx | 4 ++-- .../src/components/items/AttachmentLink.tsx | 4 ++-- .../src/components/items/DashboardItem.tsx | 6 ++--- .../src/components/items/DocTooltip.tsx | 6 ++--- .../components/items/DocumentationLinks.tsx | 4 ++-- .../src/components/items/ErrorItem.tsx | 5 ++++- .../items/GettingStartedCarousel.tsx | 4 ++-- .../src/components/items/InfoItem.tsx | 4 ++-- .../src/components/items/LanguageSelect.tsx | 2 +- .../src/components/items/MenuLinks.tsx | 8 +++---- .../src/components/items/StylishText.tsx | 4 ++-- .../src/components/modals/LicenseModal.tsx | 2 +- .../src/components/nav/BreadcrumbList.tsx | 4 ++-- .../src/components/nav/DetailDrawer.tsx | 5 ++++- .../src/components/nav/NavHoverMenu.tsx | 6 ++--- .../src/components/nav/NavigationDrawer.tsx | 4 ++-- .../src/components/nav/NotificationDrawer.tsx | 4 ++-- .../src/components/nav/SearchDrawer.tsx | 8 +++---- .../src/components/render/InstanceFromUrl.tsx | 4 ++-- src/frontend/src/components/render/Order.tsx | 4 ++-- src/frontend/src/components/render/Part.tsx | 8 +++---- .../src/components/settings/SettingItem.tsx | 8 +++---- .../src/components/settings/SettingList.tsx | 18 ++++++++------- .../src/components/widgets/WidgetLayout.tsx | 10 ++++----- src/frontend/src/contexts/LanguageContext.tsx | 4 +++- src/frontend/src/contexts/ThemeContext.tsx | 4 +++- src/frontend/src/forms/StockForms.tsx | 4 ++-- src/frontend/src/functions/loading.tsx | 2 +- src/frontend/src/pages/Index/Playground.tsx | 4 ++-- src/frontend/src/pages/Index/Scan.tsx | 4 ++-- .../AccountSettings/SecurityContent.tsx | 4 ++-- .../src/pages/part/PartPricingPanel.tsx | 2 +- .../pages/part/pricing/PriceBreakPanel.tsx | 5 +++-- .../part/pricing/PricingOverviewPanel.tsx | 4 ++-- .../part/pricing/SupplierPricingPanel.tsx | 4 +++- .../part/pricing/VariantPricingPanel.tsx | 4 ++-- src/frontend/src/tables/ColumnSelect.tsx | 4 ++-- src/frontend/src/tables/DownloadAction.tsx | 4 ++-- .../src/tables/FilterSelectDrawer.tsx | 12 +++++----- src/frontend/src/tables/InvenTreeTable.tsx | 4 ++-- src/frontend/src/tables/Search.tsx | 4 ++-- src/frontend/src/tables/TableHoverCard.tsx | 4 ++-- src/frontend/src/tables/bom/BomTable.tsx | 7 ++++-- src/frontend/src/tables/bom/UsedInTable.tsx | 4 ++-- .../src/tables/build/BuildOrderTable.tsx | 4 ++-- .../src/tables/company/AddressTable.tsx | 5 +++-- .../src/tables/company/CompanyTable.tsx | 5 +++-- .../src/tables/company/ContactTable.tsx | 5 +++-- .../src/tables/general/AttachmentTable.tsx | 4 ++-- .../src/tables/machine/MachineListTable.tsx | 11 +++++----- .../src/tables/machine/MachineTypeTable.tsx | 12 +++++----- .../notifications/NotificationsTable.tsx | 4 ++-- .../src/tables/part/ParametricPartTable.tsx | 8 +++---- .../src/tables/part/PartCategoryTable.tsx | 3 ++- src/frontend/src/tables/part/PartTable.tsx | 9 ++++---- .../src/tables/part/PartThumbTable.tsx | 2 +- .../src/tables/part/PartVariantTable.tsx | 2 +- .../src/tables/part/RelatedPartTable.tsx | 5 ++++- .../ManufacturerPartParameterTable.tsx | 4 ++-- .../purchasing/ManufacturerPartTable.tsx | 5 ++++- .../purchasing/PurchaseOrderLineItemTable.tsx | 7 ++++-- .../tables/purchasing/PurchaseOrderTable.tsx | 5 +++-- .../tables/purchasing/SupplierPartTable.tsx | 5 ++++- .../purchasing/SupplierPriceBreakTable.tsx | 5 +++-- .../src/tables/sales/ReturnOrderTable.tsx | 3 ++- .../src/tables/sales/SalesOrderTable.tsx | 5 +++-- .../src/tables/settings/GroupTable.tsx | 4 ++-- .../src/tables/settings/TemplateTable.tsx | 8 +++---- .../src/tables/stock/InstalledItemsTable.tsx | 4 ++-- .../src/tables/stock/StockItemTable.tsx | 12 +++++----- .../tables/stock/StockItemTestResultTable.tsx | 5 +++-- .../src/tables/stock/StockLocationTable.tsx | 3 ++- 88 files changed, 268 insertions(+), 219 deletions(-) diff --git a/src/frontend/src/components/DashboardItemProxy.tsx b/src/frontend/src/components/DashboardItemProxy.tsx index d0ed0015c8..b2a99089ee 100644 --- a/src/frontend/src/components/DashboardItemProxy.tsx +++ b/src/frontend/src/components/DashboardItemProxy.tsx @@ -14,13 +14,13 @@ export function DashboardItemProxy({ url, params, autoupdate = true -}: { +}: Readonly<{ id: string; text: string; url: ApiEndpoints; params: any; autoupdate: boolean; -}) { +}>) { function fetchData() { return api .get(`${apiUrl(url)}?search=&offset=0&limit=25`, { params: params }) diff --git a/src/frontend/src/components/buttons/ButtonMenu.tsx b/src/frontend/src/components/buttons/ButtonMenu.tsx index 0bf2a36df7..be9bef9904 100644 --- a/src/frontend/src/components/buttons/ButtonMenu.tsx +++ b/src/frontend/src/components/buttons/ButtonMenu.tsx @@ -9,12 +9,12 @@ export function ButtonMenu({ actions, tooltip = '', label = '' -}: { +}: Readonly<{ icon: any; actions: React.ReactNode[]; label?: string; tooltip?: string; -}) { +}>) { return ( diff --git a/src/frontend/src/components/buttons/CopyButton.tsx b/src/frontend/src/components/buttons/CopyButton.tsx index c63ec29630..87d7586828 100644 --- a/src/frontend/src/components/buttons/CopyButton.tsx +++ b/src/frontend/src/components/buttons/CopyButton.tsx @@ -12,10 +12,10 @@ import { InvenTreeIcon } from '../../functions/icons'; export function CopyButton({ value, label -}: { +}: Readonly<{ value: any; label?: JSX.Element; -}) { +}>) { const ButtonComponent = label ? Button : ActionIcon; return ( diff --git a/src/frontend/src/components/buttons/EditButton.tsx b/src/frontend/src/components/buttons/EditButton.tsx index a64aa41cc9..39c7211405 100644 --- a/src/frontend/src/components/buttons/EditButton.tsx +++ b/src/frontend/src/components/buttons/EditButton.tsx @@ -6,12 +6,12 @@ export function EditButton({ editing, disabled, saveIcon -}: { +}: Readonly<{ setEditing: (value?: React.SetStateAction | undefined) => void; editing: boolean; disabled?: boolean; saveIcon?: JSX.Element; -}) { +}>) { saveIcon = saveIcon || ; return ( }; -export function SsoButton({ provider }: { provider: Provider }) { +export function SsoButton({ provider }: Readonly<{ provider: Provider }>) { function login() { // set preferred provider api diff --git a/src/frontend/src/components/details/Details.tsx b/src/frontend/src/components/details/Details.tsx index b266bd47e1..dc3bf96150 100644 --- a/src/frontend/src/components/details/Details.tsx +++ b/src/frontend/src/components/details/Details.tsx @@ -96,7 +96,10 @@ type FieldProps = { * Badge shows username, full name, or group name depending on server settings. * Badge appends icon to describe type of Owner */ -function NameBadge({ pk, type }: { pk: string | number; type: BadgeType }) { +function NameBadge({ + pk, + type +}: Readonly<{ pk: string | number; type: BadgeType }>) { const { data } = useQuery({ queryKey: ['badge', type, pk], queryFn: async () => { @@ -331,17 +334,17 @@ function StatusValue(props: Readonly) { ); } -function CopyField({ value }: { value: string }) { +function CopyField({ value }: Readonly<{ value: string }>) { return ; } export function DetailsTableField({ item, field -}: { +}: Readonly<{ item: any; field: DetailsField; -}) { +}>) { function getFieldType(type: string) { switch (type) { case 'text': @@ -394,11 +397,11 @@ export function DetailsTable({ item, fields, title -}: { +}: Readonly<{ item: any; fields: DetailsField[]; title?: string; -}) { +}>) { return ( diff --git a/src/frontend/src/components/details/DetailsImage.tsx b/src/frontend/src/components/details/DetailsImage.tsx index f380997b9e..6b5999af6f 100644 --- a/src/frontend/src/components/details/DetailsImage.tsx +++ b/src/frontend/src/components/details/DetailsImage.tsx @@ -81,10 +81,10 @@ const removeModal = (apiPath: string, setImage: (image: string) => void) => function UploadModal({ apiPath, setImage -}: { +}: Readonly<{ apiPath: string; setImage: (image: string) => void; -}) { +}>) { const [currentFile, setCurrentFile] = useState(null); let uploading = false; @@ -96,7 +96,7 @@ function UploadModal({ Drag and drop to upload - + Click to select file(s) @@ -131,7 +131,7 @@ function UploadModal({ {file.name} - + {size.toFixed(2)} MB @@ -246,14 +246,14 @@ function ImageActionButtons({ hasImage, pk, setImage -}: { +}: Readonly<{ actions?: DetailImageButtonProps; visible: boolean; apiPath: string; hasImage: boolean; pk: string; setImage: (image: string) => void; -}) { +}>) { return ( <> {visible && ( diff --git a/src/frontend/src/components/errors/ServerError.tsx b/src/frontend/src/components/errors/ServerError.tsx index 4539645563..4d0aa0b39b 100644 --- a/src/frontend/src/components/errors/ServerError.tsx +++ b/src/frontend/src/components/errors/ServerError.tsx @@ -2,7 +2,7 @@ import { t } from '@lingui/macro'; import GenericErrorPage from './GenericErrorPage'; -export default function ServerError({ status }: { status?: number }) { +export default function ServerError({ status }: Readonly<{ status?: number }>) { return ( ) { const props = useMemo( () => ({ ..._props, @@ -197,11 +197,11 @@ export function ApiForm({ id, props, optionsLoading -}: { +}: Readonly<{ id: string; props: ApiFormProps; optionsLoading: boolean; -}) { +}>) { const navigate = useNavigate(); const [fields, setFields] = useState( @@ -649,10 +649,10 @@ export function ApiForm({ export function CreateApiForm({ id, props -}: { +}: Readonly<{ id?: string; props: ApiFormProps; -}) { +}>) { const createProps = useMemo( () => ({ ...props, @@ -667,10 +667,10 @@ export function CreateApiForm({ export function EditApiForm({ id, props -}: { +}: Readonly<{ id?: string; props: ApiFormProps; -}) { +}>) { const editProps = useMemo( () => ({ ...props, @@ -687,10 +687,10 @@ export function EditApiForm({ export function DeleteApiForm({ id, props -}: { +}: Readonly<{ id?: string; props: ApiFormProps; -}) { +}>) { const deleteProps = useMemo( () => ({ ...props, diff --git a/src/frontend/src/components/forms/AuthenticationForm.tsx b/src/frontend/src/components/forms/AuthenticationForm.tsx index b469ea8e27..5f61a60eb0 100644 --- a/src/frontend/src/components/forms/AuthenticationForm.tsx +++ b/src/frontend/src/components/forms/AuthenticationForm.tsx @@ -118,7 +118,7 @@ export function AuthenticationForm() { navigate('/reset-password')} > @@ -143,7 +143,7 @@ export function AuthenticationForm() { setMode.toggle()} > @@ -278,10 +278,10 @@ export function RegistrationForm() { export function ModeSelector({ loginMode, setMode -}: { +}: Readonly<{ loginMode: boolean; setMode: any; -}) { +}>) { const [auth_settings] = useServerApiState((state) => [state.auth_settings]); const registration_enabled = auth_settings?.registration_enabled || @@ -297,7 +297,7 @@ export function ModeSelector({ setMode.close()} > @@ -308,7 +308,7 @@ export function ModeSelector({ setMode.open()} > diff --git a/src/frontend/src/components/forms/HostOptionsForm.tsx b/src/frontend/src/components/forms/HostOptionsForm.tsx index 15f8368256..dddb592b83 100644 --- a/src/frontend/src/components/forms/HostOptionsForm.tsx +++ b/src/frontend/src/components/forms/HostOptionsForm.tsx @@ -17,10 +17,10 @@ import { HostList } from '../../states/states'; export function HostOptionsForm({ data, saveOptions -}: { +}: Readonly<{ data: HostList; saveOptions: (newData: HostList) => void; -}) { +}>) { const form = useForm({ initialValues: data }); function deleteItem(key: string) { const newData = form.values; diff --git a/src/frontend/src/components/forms/InstanceOptions.tsx b/src/frontend/src/components/forms/InstanceOptions.tsx index 475cc30fd4..65616aa1c8 100644 --- a/src/frontend/src/components/forms/InstanceOptions.tsx +++ b/src/frontend/src/components/forms/InstanceOptions.tsx @@ -13,11 +13,11 @@ export function InstanceOptions({ hostKey, ChangeHost, setHostEdit -}: { +}: Readonly<{ hostKey: string; ChangeHost: (newHost: string | null) => void; setHostEdit: () => void; -}) { +}>) { const [HostListEdit, setHostListEdit] = useToggle([false, true] as const); const [setHost, setHostList, hostList] = useLocalState((state) => [ state.setHost, @@ -85,10 +85,10 @@ export function InstanceOptions({ function ServerInfo({ hostList, hostKey -}: { +}: Readonly<{ hostList: HostList; hostKey: string; -}) { +}>) { const [server] = useServerApiState((state) => [state.server]); return ( diff --git a/src/frontend/src/components/forms/StandaloneField.tsx b/src/frontend/src/components/forms/StandaloneField.tsx index b9f7345a56..73f6299ed1 100644 --- a/src/frontend/src/components/forms/StandaloneField.tsx +++ b/src/frontend/src/components/forms/StandaloneField.tsx @@ -9,13 +9,13 @@ export function StandaloneField({ defaultValue, hideLabels, error -}: { +}: Readonly<{ fieldDefinition: ApiFormFieldType; fieldName?: string; defaultValue?: any; hideLabels?: boolean; error?: string; -}) { +}>) { // Field must have a defined name const name = useMemo(() => fieldName ?? 'field', [fieldName]); diff --git a/src/frontend/src/components/forms/fields/ApiFormField.tsx b/src/frontend/src/components/forms/fields/ApiFormField.tsx index 86539ce64c..2567b7055b 100644 --- a/src/frontend/src/components/forms/fields/ApiFormField.tsx +++ b/src/frontend/src/components/forms/fields/ApiFormField.tsx @@ -105,14 +105,14 @@ export function ApiFormField({ hideLabels, url, setFields -}: { +}: Readonly<{ fieldName: string; definition: ApiFormFieldType; control: Control; hideLabels?: boolean; url?: string; setFields?: React.Dispatch>; -}) { +}>) { const fieldId = useId(); const controller = useController({ name: fieldName, diff --git a/src/frontend/src/components/forms/fields/DateField.tsx b/src/frontend/src/components/forms/fields/DateField.tsx index 47e0ce2072..3bf10b1e04 100644 --- a/src/frontend/src/components/forms/fields/DateField.tsx +++ b/src/frontend/src/components/forms/fields/DateField.tsx @@ -11,10 +11,10 @@ dayjs.extend(customParseFormat); export default function DateField({ controller, definition -}: { +}: Readonly<{ controller: UseControllerReturn; definition: ApiFormFieldType; -}) { +}>) { const fieldId = useId(); const { diff --git a/src/frontend/src/components/forms/fields/NestedObjectField.tsx b/src/frontend/src/components/forms/fields/NestedObjectField.tsx index 77a8693c69..bbecd056aa 100644 --- a/src/frontend/src/components/forms/fields/NestedObjectField.tsx +++ b/src/frontend/src/components/forms/fields/NestedObjectField.tsx @@ -13,13 +13,13 @@ export function NestedObjectField({ definition, url, setFields -}: { +}: Readonly<{ control: Control; definition: ApiFormFieldType; fieldName: string; url?: string; setFields?: React.Dispatch>; -}) { +}>) { return ( diff --git a/src/frontend/src/components/forms/fields/RelatedModelField.tsx b/src/frontend/src/components/forms/fields/RelatedModelField.tsx index 9a74cc4032..c2d1d7caee 100644 --- a/src/frontend/src/components/forms/fields/RelatedModelField.tsx +++ b/src/frontend/src/components/forms/fields/RelatedModelField.tsx @@ -28,12 +28,12 @@ export function RelatedModelField({ fieldName, definition, limit = 10 -}: { +}: Readonly<{ controller: UseControllerReturn; definition: ApiFormFieldType; fieldName: string; limit?: number; -}) { +}>) { const fieldId = useId(); const { field, diff --git a/src/frontend/src/components/items/AttachmentLink.tsx b/src/frontend/src/components/items/AttachmentLink.tsx index 1561e3d788..b76e610b75 100644 --- a/src/frontend/src/components/items/AttachmentLink.tsx +++ b/src/frontend/src/components/items/AttachmentLink.tsx @@ -55,10 +55,10 @@ export function attachmentIcon(attachment: string): ReactNode { export function AttachmentLink({ attachment, external -}: { +}: Readonly<{ attachment: string; external?: boolean; -}): ReactNode { +}>): ReactNode { let text = external ? attachment : attachment.split('/').pop(); const host = useLocalState((s) => s.host); diff --git a/src/frontend/src/components/items/DashboardItem.tsx b/src/frontend/src/components/items/DashboardItem.tsx index a9fb2a5d3c..e1a3225da4 100644 --- a/src/frontend/src/components/items/DashboardItem.tsx +++ b/src/frontend/src/components/items/DashboardItem.tsx @@ -11,16 +11,16 @@ export function StatisticItem({ id, data, isLoading -}: { +}: Readonly<{ id: string; data: StatisticItemProps; isLoading: boolean; -}) { +}>) { return ( - + {data.title} diff --git a/src/frontend/src/components/items/DocTooltip.tsx b/src/frontend/src/components/items/DocTooltip.tsx index 113ca234d6..99558659b1 100644 --- a/src/frontend/src/components/items/DocTooltip.tsx +++ b/src/frontend/src/components/items/DocTooltip.tsx @@ -50,12 +50,12 @@ function ConstBody({ detail, docchildren, link -}: { +}: Readonly<{ text: string | JSX.Element; detail?: string | JSX.Element; docchildren?: React.ReactNode; link?: string; -}) { +}>) { const [height, setHeight] = useState(0); const ref = useRef(null); @@ -78,7 +78,7 @@ function ConstBody({
{detail && ( - + {detail} )} diff --git a/src/frontend/src/components/items/DocumentationLinks.tsx b/src/frontend/src/components/items/DocumentationLinks.tsx index 5d652db40a..bf72a8962b 100644 --- a/src/frontend/src/components/items/DocumentationLinks.tsx +++ b/src/frontend/src/components/items/DocumentationLinks.tsx @@ -26,9 +26,9 @@ export type DocumentationLinkItem = export function DocumentationLinks({ links -}: { +}: Readonly<{ links: DocumentationLinkItem[]; -}) { +}>) { const DocumentationLinkRenderer = ({ link }: { diff --git a/src/frontend/src/components/items/ErrorItem.tsx b/src/frontend/src/components/items/ErrorItem.tsx index fb82b1b342..b4e1813010 100644 --- a/src/frontend/src/components/items/ErrorItem.tsx +++ b/src/frontend/src/components/items/ErrorItem.tsx @@ -1,6 +1,9 @@ import { Trans } from '@lingui/macro'; -export function ErrorItem({ id, error }: { id: string; error?: any }) { +export function ErrorItem({ + id, + error +}: Readonly<{ id: string; error?: any }>) { const error_message = error?.message || error?.toString() || ( Unknown error ); diff --git a/src/frontend/src/components/items/GettingStartedCarousel.tsx b/src/frontend/src/components/items/GettingStartedCarousel.tsx index b34e6093b4..1d98fcb25a 100644 --- a/src/frontend/src/components/items/GettingStartedCarousel.tsx +++ b/src/frontend/src/components/items/GettingStartedCarousel.tsx @@ -33,9 +33,9 @@ function StartedCard({ export function GettingStartedCarousel({ items -}: { +}: Readonly<{ items: DocumentationLinkItem[]; -}) { +}>) { const slides = items.map((item) => ( diff --git a/src/frontend/src/components/items/InfoItem.tsx b/src/frontend/src/components/items/InfoItem.tsx index e3c06789e7..85621c42f4 100644 --- a/src/frontend/src/components/items/InfoItem.tsx +++ b/src/frontend/src/components/items/InfoItem.tsx @@ -12,14 +12,14 @@ export function InfoItem({ value, link, detailDrawerLink -}: { +}: Readonly<{ name: string; children?: React.ReactNode; type?: 'text' | 'boolean' | 'code'; value?: any; link?: To; detailDrawerLink?: boolean; -}) { +}>) { function renderComponent() { if (value === undefined) return null; diff --git a/src/frontend/src/components/items/LanguageSelect.tsx b/src/frontend/src/components/items/LanguageSelect.tsx index 9c38ec9484..55b2d613c3 100644 --- a/src/frontend/src/components/items/LanguageSelect.tsx +++ b/src/frontend/src/components/items/LanguageSelect.tsx @@ -4,7 +4,7 @@ import { useEffect, useState } from 'react'; import { getSupportedLanguages } from '../../contexts/LanguageContext'; import { useLocalState } from '../../states/LocalState'; -export function LanguageSelect({ width = 80 }: { width?: number }) { +export function LanguageSelect({ width = 80 }: Readonly<{ width?: number }>) { const [value, setValue] = useState(null); const [locale, setLanguage] = useLocalState((state) => [ state.language, diff --git a/src/frontend/src/components/items/MenuLinks.tsx b/src/frontend/src/components/items/MenuLinks.tsx index ad50300869..4f80dd403f 100644 --- a/src/frontend/src/components/items/MenuLinks.tsx +++ b/src/frontend/src/components/items/MenuLinks.tsx @@ -23,10 +23,10 @@ export type menuItemsCollection = { function ConditionalDocTooltip({ item, children -}: { +}: Readonly<{ item: MenuLinkItem; children: React.ReactNode; -}) { +}>) { if (item.doctext !== undefined) { return ( ) { const filteredLinks = links.filter( (item) => !highlighted || item.highlight === true ); diff --git a/src/frontend/src/components/items/StylishText.tsx b/src/frontend/src/components/items/StylishText.tsx index 774a6fdde9..cae6245c8a 100644 --- a/src/frontend/src/components/items/StylishText.tsx +++ b/src/frontend/src/components/items/StylishText.tsx @@ -5,10 +5,10 @@ import * as classes from '../../main.css'; export function StylishText({ children, size = 'md' -}: { +}: Readonly<{ children: JSX.Element | string; size?: string; -}) { +}>) { return ( {children} diff --git a/src/frontend/src/components/modals/LicenseModal.tsx b/src/frontend/src/components/modals/LicenseModal.tsx index 21266059e0..f3d85d9588 100644 --- a/src/frontend/src/components/modals/LicenseModal.tsx +++ b/src/frontend/src/components/modals/LicenseModal.tsx @@ -16,7 +16,7 @@ import { api } from '../../App'; import { ApiEndpoints } from '../../enums/ApiEndpoints'; import { apiUrl } from '../../states/ApiState'; -export function LicenceView(entries: Readonly) { +export function LicenceView(entries: any[]) { return ( diff --git a/src/frontend/src/components/nav/BreadcrumbList.tsx b/src/frontend/src/components/nav/BreadcrumbList.tsx index 5302ed194e..930c4ffb64 100644 --- a/src/frontend/src/components/nav/BreadcrumbList.tsx +++ b/src/frontend/src/components/nav/BreadcrumbList.tsx @@ -25,10 +25,10 @@ export type Breadcrumb = { export function BreadcrumbList({ breadcrumbs, navCallback -}: { +}: Readonly<{ breadcrumbs: Breadcrumb[]; navCallback?: () => void; -}) { +}>) { const navigate = useNavigate(); const elements = useMemo(() => { diff --git a/src/frontend/src/components/nav/DetailDrawer.tsx b/src/frontend/src/components/nav/DetailDrawer.tsx index 85a7df857b..981ae39c45 100644 --- a/src/frontend/src/components/nav/DetailDrawer.tsx +++ b/src/frontend/src/components/nav/DetailDrawer.tsx @@ -88,7 +88,10 @@ export function DetailDrawer(props: Readonly) { ); } -export function DetailDrawerLink({ to, text }: { to: To; text: string }) { +export function DetailDrawerLink({ + to, + text +}: Readonly<{ to: To; text: string }>) { const addDetailDrawer = useLocalState((state) => state.addDetailDrawer); const onNavigate = useCallback(() => { diff --git a/src/frontend/src/components/nav/NavHoverMenu.tsx b/src/frontend/src/components/nav/NavHoverMenu.tsx index ca4b957633..2e0a08edee 100644 --- a/src/frontend/src/components/nav/NavHoverMenu.tsx +++ b/src/frontend/src/components/nav/NavHoverMenu.tsx @@ -26,9 +26,9 @@ const onlyItems = Object.values(menuItems); export function NavHoverMenu({ openDrawer: openDrawer -}: { +}: Readonly<{ openDrawer: () => void; -}) { +}>) { const [hostKey, hostList] = useLocalState((state) => [ state.hostKey, state.hostList @@ -99,7 +99,7 @@ export function NavHoverMenu({ Get started - + Overview over high-level objects, functions and possible usecases. diff --git a/src/frontend/src/components/nav/NavigationDrawer.tsx b/src/frontend/src/components/nav/NavigationDrawer.tsx index 92504c39c4..288dac8618 100644 --- a/src/frontend/src/components/nav/NavigationDrawer.tsx +++ b/src/frontend/src/components/nav/NavigationDrawer.tsx @@ -23,10 +23,10 @@ const onlyItems = Object.values(menuItems); export function NavigationDrawer({ opened, close -}: { +}: Readonly<{ opened: boolean; close: () => void; -}) { +}>) { return ( void; -}) { +}>) { const { isLoggedIn } = useUserState(); const navigate = useNavigate(); diff --git a/src/frontend/src/components/nav/SearchDrawer.tsx b/src/frontend/src/components/nav/SearchDrawer.tsx index 0e5266901e..a03afae213 100644 --- a/src/frontend/src/components/nav/SearchDrawer.tsx +++ b/src/frontend/src/components/nav/SearchDrawer.tsx @@ -56,11 +56,11 @@ function QueryResultGroup({ query, onRemove, onResultClick -}: { +}: Readonly<{ query: SearchQuery; onRemove: (query: ModelType) => void; onResultClick: (query: ModelType, pk: number, event: any) => void; -}) { +}>) { if (query.results.count == 0) { return null; } @@ -115,10 +115,10 @@ function QueryResultGroup({ export function SearchDrawer({ opened, onClose -}: { +}: Readonly<{ opened: boolean; onClose: () => void; -}) { +}>) { const [value, setValue] = useState(''); const [searchText] = useDebouncedValue(value, 500); diff --git a/src/frontend/src/components/render/InstanceFromUrl.tsx b/src/frontend/src/components/render/InstanceFromUrl.tsx index 2e0d7877f0..845e494145 100644 --- a/src/frontend/src/components/render/InstanceFromUrl.tsx +++ b/src/frontend/src/components/render/InstanceFromUrl.tsx @@ -14,10 +14,10 @@ import { RenderInstance } from './Instance'; export function InstanceFromUrl({ model, url -}: { +}: Readonly<{ model: ModelType; url: string; -}) { +}>) { const [data, setData] = useState(null); useMemo( () => diff --git a/src/frontend/src/components/render/Order.tsx b/src/frontend/src/components/render/Order.tsx index 72f5544f4f..59009451b4 100644 --- a/src/frontend/src/components/render/Order.tsx +++ b/src/frontend/src/components/render/Order.tsx @@ -110,9 +110,9 @@ export function RenderSalesOrder( */ export function RenderSalesOrderShipment({ instance -}: { +}: Readonly<{ instance: any; -}): ReactNode { +}>): ReactNode { let order = instance.sales_order_detail || {}; return ( diff --git a/src/frontend/src/components/render/Part.tsx b/src/frontend/src/components/render/Part.tsx index 24ca8ea1ad..de0635541c 100644 --- a/src/frontend/src/components/render/Part.tsx +++ b/src/frontend/src/components/render/Part.tsx @@ -83,9 +83,9 @@ export function RenderPartCategory( */ export function RenderPartParameterTemplate({ instance -}: { +}: Readonly<{ instance: any; -}): ReactNode { +}>): ReactNode { return ( ): ReactNode { return ( void; onToggle: (setting: Setting, value: boolean) => void; -}) { +}>) { // Determine the text to display for the setting value const valueText: string = useMemo(() => { let value = setting.value; @@ -81,12 +81,12 @@ export function SettingItem({ shaded, onEdit, onToggle -}: { +}: Readonly<{ setting: Setting; shaded: boolean; onEdit: (setting: Setting) => void; onToggle: (setting: Setting, value: boolean) => void; -}) { +}>) { const { colorScheme } = useMantineColorScheme(); const style: Record = { paddingLeft: '8px' }; diff --git a/src/frontend/src/components/settings/SettingList.tsx b/src/frontend/src/components/settings/SettingList.tsx index b5d2090bfb..08492d9142 100644 --- a/src/frontend/src/components/settings/SettingList.tsx +++ b/src/frontend/src/components/settings/SettingList.tsx @@ -31,11 +31,11 @@ export function SettingList({ settingsState, keys, onChange -}: { +}: Readonly<{ settingsState: SettingsStateProps; keys?: string[]; onChange?: () => void; -}) { +}>) { useEffect(() => { settingsState.fetchSettings(); }, []); @@ -150,7 +150,7 @@ export function SettingList({ onToggle={onValueToggle} /> ) : ( - + Setting {key} not found )} @@ -167,19 +167,21 @@ export function SettingList({ ); } -export function UserSettingList({ keys }: { keys: string[] }) { +export function UserSettingList({ keys }: Readonly<{ keys: string[] }>) { const userSettings = useUserSettingsState(); return ; } -export function GlobalSettingList({ keys }: { keys: string[] }) { +export function GlobalSettingList({ keys }: Readonly<{ keys: string[] }>) { const globalSettings = useGlobalSettingsState(); return ; } -export function PluginSettingList({ pluginKey }: { pluginKey: string }) { +export function PluginSettingList({ + pluginKey +}: Readonly<{ pluginKey: string }>) { const pluginSettingsStore = useRef( createPluginSettingsState({ plugin: pluginKey }) ).current; @@ -192,11 +194,11 @@ export function MachineSettingList({ machinePk, configType, onChange -}: { +}: Readonly<{ machinePk: string; configType: 'M' | 'D'; onChange?: () => void; -}) { +}>) { const machineSettingsStore = useRef( createMachineSettingsState({ machine: machinePk, diff --git a/src/frontend/src/components/widgets/WidgetLayout.tsx b/src/frontend/src/components/widgets/WidgetLayout.tsx index 603ed19daf..c7532bee1f 100644 --- a/src/frontend/src/components/widgets/WidgetLayout.tsx +++ b/src/frontend/src/components/widgets/WidgetLayout.tsx @@ -43,12 +43,12 @@ export function WidgetLayout({ className = 'layout', localstorageName = 'argl', rowHeight = 30 -}: { +}: Readonly<{ items: LayoutItemType[]; className?: string; localstorageName?: string; rowHeight?: number; -}) { +}>) { const [layouts, setLayouts] = useState({}); const [editable, setEditable] = useDisclosure(false); const [boxShown, setBoxShown] = useDisclosure(true); @@ -130,13 +130,13 @@ function WidgetControlBar({ resetLayout, boxShown, boxFnc -}: { +}: Readonly<{ editable: boolean; editFnc: () => void; resetLayout: () => void; boxShown: boolean; boxFnc: () => void; -}) { +}>) { useHotkeys([['mod+E', () => editFnc()]]); return ( @@ -177,7 +177,7 @@ function WidgetControlBar({ } onClick={editFnc} rightSection={ - + ⌘E } diff --git a/src/frontend/src/contexts/LanguageContext.tsx b/src/frontend/src/contexts/LanguageContext.tsx index 0fcb2aa915..0ccf1b815a 100644 --- a/src/frontend/src/contexts/LanguageContext.tsx +++ b/src/frontend/src/contexts/LanguageContext.tsx @@ -57,7 +57,9 @@ export const getSupportedLanguages = (): Record => { }; }; -export function LanguageContext({ children }: { children: JSX.Element }) { +export function LanguageContext({ + children +}: Readonly<{ children: JSX.Element }>) { const [language] = useLocalState((state) => [state.language]); const [server] = useServerApiState((state) => [state.server]); diff --git a/src/frontend/src/contexts/ThemeContext.tsx b/src/frontend/src/contexts/ThemeContext.tsx index e5562c58fa..39fcfecd1d 100644 --- a/src/frontend/src/contexts/ThemeContext.tsx +++ b/src/frontend/src/contexts/ThemeContext.tsx @@ -11,7 +11,9 @@ import { useLocalState } from '../states/LocalState'; import { LanguageContext } from './LanguageContext'; import { colorSchema } from './colorSchema'; -export function ThemeContext({ children }: { children: JSX.Element }) { +export function ThemeContext({ + children +}: Readonly<{ children: JSX.Element }>) { const [primaryColor, whiteColor, blackColor, radius] = useLocalState( (state) => [ state.primaryColor, diff --git a/src/frontend/src/forms/StockForms.tsx b/src/frontend/src/forms/StockForms.tsx index 2b519f6a8e..b8f32f8455 100644 --- a/src/frontend/src/forms/StockForms.tsx +++ b/src/frontend/src/forms/StockForms.tsx @@ -190,10 +190,10 @@ export function useCreateStockItem() { function StockItemDefaultMove({ stockItem, value -}: { +}: Readonly<{ stockItem: any; value: any; -}) { +}>) { const { data } = useSuspenseQuery({ queryKey: [ 'location', diff --git a/src/frontend/src/functions/loading.tsx b/src/frontend/src/functions/loading.tsx index 52be4a5e67..5238ee8dd4 100644 --- a/src/frontend/src/functions/loading.tsx +++ b/src/frontend/src/functions/loading.tsx @@ -23,7 +23,7 @@ export const Loadable = (Component: any) => (props: JSX.IntrinsicAttributes) => ); -export function LoadingItem({ item }: { item: any }): JSX.Element { +export function LoadingItem({ item }: Readonly<{ item: any }>): JSX.Element { const Itm = Loadable(item); return ; } diff --git a/src/frontend/src/pages/Index/Playground.tsx b/src/frontend/src/pages/Index/Playground.tsx index c7b9deb43d..5df5702c0d 100644 --- a/src/frontend/src/pages/Index/Playground.tsx +++ b/src/frontend/src/pages/Index/Playground.tsx @@ -195,10 +195,10 @@ function SpotlighPlayground() { function PlaygroundArea({ title, content -}: { +}: Readonly<{ title: string; content: ReactNode; -}) { +}>) { return ( diff --git a/src/frontend/src/pages/Index/Scan.tsx b/src/frontend/src/pages/Index/Scan.tsx index 6ba7b6f634..560a53e966 100644 --- a/src/frontend/src/pages/Index/Scan.tsx +++ b/src/frontend/src/pages/Index/Scan.tsx @@ -415,11 +415,11 @@ function HistoryTable({ data, selection, setSelection -}: { +}: Readonly<{ data: ScanItem[]; selection: string[]; setSelection: React.Dispatch>; -}) { +}>) { const toggleRow = (id: string) => setSelection((current) => current.includes(id) diff --git a/src/frontend/src/pages/Index/Settings/AccountSettings/SecurityContent.tsx b/src/frontend/src/pages/Index/Settings/AccountSettings/SecurityContent.tsx index b36f45ea91..0915e4830f 100644 --- a/src/frontend/src/pages/Index/Settings/AccountSettings/SecurityContent.tsx +++ b/src/frontend/src/pages/Index/Settings/AccountSettings/SecurityContent.tsx @@ -209,7 +209,7 @@ function EmailContent() { ); } -function SsoContent({ dataProvider }: { dataProvider: any | undefined }) { +function SsoContent({ dataProvider }: Readonly<{ dataProvider: any }>) { const [value, setValue] = useState(''); const [currentProviders, setCurrentProviders] = useState<[]>(); const { isLoading, data } = useQuery({ @@ -249,7 +249,7 @@ function SsoContent({ dataProvider }: { dataProvider: any | undefined }) { /* renderer */ if (isLoading) return ; - function ProviderButton({ provider }: { provider: any }) { + function ProviderButton({ provider }: Readonly<{ provider: any }>) { const button = (