From e81bf8b8e7996b79d22a8194b169c0183ed36933 Mon Sep 17 00:00:00 2001 From: Donkie Date: Sat, 12 Aug 2023 19:54:24 +0200 Subject: [PATCH] Client: Reformatted all files with new line length --- client/src/App.tsx | 159 ++++----------------- client/src/components/column.tsx | 15 +- client/src/components/header/index.tsx | 39 ++--- client/src/components/numberField.tsx | 18 +-- client/src/components/qrCodeScanner.tsx | 17 +-- client/src/components/spoolSelectModal.tsx | 35 ++--- client/src/contexts/color-mode/index.tsx | 16 +-- client/src/pages/filaments/create.tsx | 27 +--- client/src/pages/filaments/edit.tsx | 35 +---- client/src/pages/filaments/list.tsx | 101 ++++--------- client/src/pages/filaments/show.tsx | 11 +- client/src/pages/spools/create.tsx | 10 +- client/src/pages/spools/edit.tsx | 3 +- client/src/pages/spools/list.tsx | 129 +++++------------ client/src/pages/spools/show.tsx | 6 +- client/src/pages/vendors/create.tsx | 10 +- client/src/pages/vendors/list.tsx | 95 ++++-------- client/src/pages/vendors/show.tsx | 6 +- 18 files changed, 159 insertions(+), 573 deletions(-) diff --git a/client/src/App.tsx b/client/src/App.tsx index 244c364..eacf658 100644 --- a/client/src/App.tsx +++ b/client/src/App.tsx @@ -1,13 +1,7 @@ import { Refine } from "@refinedev/core"; import { RefineKbar, RefineKbarProvider } from "@refinedev/kbar"; -import { - ErrorComponent, - notificationProvider, - ThemedLayoutV2, - ThemedSiderV2, - ThemedTitleV2, -} from "@refinedev/antd"; +import { ErrorComponent, notificationProvider, ThemedLayoutV2, ThemedSiderV2, ThemedTitleV2 } from "@refinedev/antd"; import "@refinedev/antd/dist/reset.css"; import routerBindings, { @@ -21,11 +15,7 @@ import { BrowserRouter, Outlet, Route, Routes } from "react-router-dom"; import { Header } from "./components/header"; import { ColorModeContextProvider } from "./contexts/color-mode"; import { ReactComponent as Logo } from "./icon.svg"; -import { - FileOutlined, - HighlightOutlined, - UserOutlined, -} from "@ant-design/icons"; +import { FileOutlined, HighlightOutlined, UserOutlined } from "@ant-design/icons"; import { ConfigProvider } from "antd"; import { Footer } from "antd/es/layout/layout"; import { Version } from "./components/version"; @@ -40,14 +30,10 @@ interface PageProps { mode?: "create" | "clone"; } -const LoadablePage = loadable( - (props: PageProps) => import(`./pages/${props.resource}/${props.page}.tsx`), - { - fallback:
Page is Loading...
, - cacheKey: (props: PageProps) => - `${props.resource}-${props.page}-${props.mode ?? ""}`, - } -); +const LoadablePage = loadable((props: PageProps) => import(`./pages/${props.resource}/${props.page}.tsx`), { + fallback:
Page is Loading...
, + cacheKey: (props: PageProps) => `${props.resource}-${props.page}-${props.mode ?? ""}`, +}); function App() { const { t, i18n } = useTranslation(); @@ -63,9 +49,7 @@ function App() { React.useEffect(() => { const fetchLocale = async () => { const locale = await import( - `./../node_modules/antd/es/locale/${languages[ - i18n.language - ].fullCode.replace("-", "_")}.js` + `./../node_modules/antd/es/locale/${languages[i18n.language].fullCode.replace("-", "_")}.js` ); setAntdLocale(locale.default); }; @@ -77,8 +61,8 @@ function App() { <>

Missing API URL

- App was built without an API URL. Please set the VITE_APIURL - environment variable to the URL of your Spoolman API. + App was built without an API URL. Please set the VITE_APIURL environment variable to the URL of your Spoolman + API.

); @@ -154,11 +138,7 @@ function App() { ( - } - /> + } /> )} /> )} @@ -172,117 +152,30 @@ function App() { } > - } - /> + } /> - } - /> - - } - /> - - } - /> - } - /> - } - /> + } /> + } /> + } /> + } /> + } /> - - } - /> - - } - /> + } /> + } /> - } - /> - - } - /> - - } + element={} /> + } /> + } /> - } - /> - - } - /> - - } - /> - } - /> - } - /> + } /> + } /> + } /> + } /> + } /> } /> diff --git a/client/src/components/column.tsx b/client/src/components/column.tsx index 7677aec..af7e124 100644 --- a/client/src/components/column.tsx +++ b/client/src/components/column.tsx @@ -1,11 +1,7 @@ import { Col, Row, Table } from "antd"; import { ColumnProps as AntdColumnProps } from "antd/es/table"; import { ColumnFilterItem } from "antd/es/table/interface"; -import { - getFiltersForField, - typeFilters, - useListFiltersForField, -} from "../utils/filtering"; +import { getFiltersForField, typeFilters, useListFiltersForField } from "../utils/filtering"; import { TableState } from "../utils/saveload"; import { getSortOrderForField, typeSorters } from "../utils/sorting"; import { NumberFieldUnit } from "./numberField"; @@ -40,14 +36,9 @@ interface CustomColumnProps { ) => React.HTMLAttributes | React.TdHTMLAttributes; } -function Column( - props: BaseColumnProps & FilteredColumnProps & CustomColumnProps -) { +function Column(props: BaseColumnProps & FilteredColumnProps & CustomColumnProps) { const t = useTranslate(); - if ( - props.tableState.showColumns && - !props.tableState.showColumns.includes(props.id) - ) { + if (props.tableState.showColumns && !props.tableState.showColumns.includes(props.id)) { return <>; } const typedSorters = typeSorters(props.tableState.sorters); diff --git a/client/src/components/header/index.tsx b/client/src/components/header/index.tsx index eacdd25..5c3ddcb 100644 --- a/client/src/components/header/index.tsx +++ b/client/src/components/header/index.tsx @@ -1,15 +1,7 @@ import { DownOutlined } from "@ant-design/icons"; import type { RefineThemedLayoutV2HeaderProps } from "@refinedev/antd"; import { useGetLocale, useSetLocale } from "@refinedev/core"; -import { - Button, - Dropdown, - Layout as AntdLayout, - MenuProps, - Space, - Switch, - theme, -} from "antd"; +import { Button, Dropdown, Layout as AntdLayout, MenuProps, Space, Switch, theme } from "antd"; import React, { useContext } from "react"; import { ColorModeContext } from "../../contexts/color-mode"; @@ -19,9 +11,7 @@ import QRCodeScannerModal from "../qrCodeScanner"; const { useToken } = theme; -export const Header: React.FC = ({ - sticky, -}) => { +export const Header: React.FC = ({ sticky }) => { const { token } = useToken(); const locale = useGetLocale(); const changeLanguage = useSetLocale(); @@ -29,19 +19,12 @@ export const Header: React.FC = ({ const currentLocale = locale(); - const menuItems: MenuProps["items"] = [...(Object.keys(languages) || [])] - .sort() - .map((lang: string) => ({ - key: lang, - onClick: () => changeLanguage(lang), - icon: ( - - ), - label: languages[lang].name, - })); + const menuItems: MenuProps["items"] = [...(Object.keys(languages) || [])].sort().map((lang: string) => ({ + key: lang, + onClick: () => changeLanguage(lang), + icon: , + label: languages[lang].name, + })); const headerStyles: React.CSSProperties = { backgroundColor: token.colorBgElevated, @@ -69,11 +52,7 @@ export const Header: React.FC = ({ >