From 1d28d88115075ffae72a6d6b88b8f742d7470bc7 Mon Sep 17 00:00:00 2001 From: Nischal Shrestha Date: Wed, 3 Jul 2024 12:56:54 +0545 Subject: [PATCH] Refactor: Formatted with precommit config --- .github/workflows/pre-commit.yml | 29 ++++++++++ package.json | 10 ++++ src/frontend/.lintstagedrc | 2 +- src/frontend/README.md | 17 ++---- src/frontend/components.json | 16 ++--- src/frontend/package.json | 26 ++++----- src/frontend/src/api/projects.ts | 11 ++-- .../assets/images/LandingPage/RockerIcon.svg | 2 +- .../assets/images/LandingPage/TargetIcon.svg | 2 +- .../CreateProject/StepSwitcher/index.tsx | 2 +- .../components/LandingPage/Footer/index.tsx | 2 +- .../components/LandingPage/Navbar/index.tsx | 2 +- .../LandingPage/OpenSource/index.tsx | 4 +- .../src/components/RadixComponents/Button.tsx | 6 +- .../src/components/RadixComponents/Image.tsx | 2 +- .../components/RadixComponents/Popover.tsx | 6 +- .../src/components/RadixComponents/Switch.tsx | 10 +--- .../src/components/RadixComponents/Table.tsx | 6 +- .../components/RadixComponents/ToolTip.tsx | 11 +--- .../common/Charts/BarChart/index.tsx | 2 +- .../common/Charts/ChartContainer/index.tsx | 6 +- .../common/Charts/ChartHeader/index.tsx | 10 ++-- .../common/Charts/ChartLegend/index.tsx | 11 ++-- .../common/Charts/DonutChart/index.tsx | 2 +- .../common/Charts/DonutLegendItem/index.tsx | 6 +- .../Charts/HorizontalBarChart/index.tsx | 2 +- .../Charts/HorizontalBarLabel/index.tsx | 5 +- .../common/Charts/LegendItem/index.tsx | 2 +- .../common/Charts/StackedChart/index.tsx | 19 +++--- .../src/components/common/Chip/index.tsx | 7 +-- .../src/components/common/DataCard/index.tsx | 9 +-- .../DataTable/DataTablePagination/index.tsx | 6 +- .../common/DataTable/TableSkeleton/index.tsx | 4 +- .../components/common/ErrorBoundary/index.tsx | 8 +-- .../components/common/ErrorMessage/index.tsx | 2 +- .../common/FormUI/ErrorMessage/index.tsx | 2 +- .../common/FormUI/FileUpload/index.tsx | 7 +-- .../components/common/FormUI/Input/index.tsx | 3 +- .../common/FormUI/MultiSelect/index.tsx | 29 +++++----- .../common/FormUI/SearchInput/index.tsx | 5 +- .../components/common/FormUI/Select/index.tsx | 17 ++---- .../components/common/InfoDialog/index.tsx | 3 +- .../components/common/Layouts/Flex/index.tsx | 3 +- .../common/Layouts/FlexRow/index.tsx | 5 +- .../components/common/Layouts/Grid/index.tsx | 2 +- .../MapLibreComponents/PopupUI/index.tsx | 7 +-- .../src/components/common/Modal/index.tsx | 36 ++++-------- .../src/components/common/Navbar/index.tsx | 6 +- .../components/common/RadioButton/index.tsx | 12 +++- .../components/common/UploadArea/index.tsx | 7 +-- .../Authentication/ForgotPassword/index.tsx | 5 +- .../components/Authentication/Login/index.tsx | 6 +- src/frontend/src/routes/appRoutes.ts | 2 +- src/frontend/src/services/createproject.ts | 4 +- src/frontend/tsconfig.json | 58 ++++++++++--------- src/frontend/tsconfig.node.json | 4 +- src/frontend/vite.config.ts | 7 ++- 57 files changed, 239 insertions(+), 258 deletions(-) create mode 100644 .github/workflows/pre-commit.yml create mode 100644 package.json diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml new file mode 100644 index 00000000..c654d8a5 --- /dev/null +++ b/.github/workflows/pre-commit.yml @@ -0,0 +1,29 @@ +name: Precommit Code Check + +on: + pull_request: + branches: + - master + - develop + - staging + push: + branches: + - "*" + +jobs: + precommit: + name: Code Check + runs-on: self-hosted + steps: + - uses: actions/checkout@v1 + + - name: Set up Python 3.9.17 + uses: actions/setup-python@v2 + with: + python-version: 3.9.17 + + - name: Check Version + run: python --version + + - name: PreCommit + uses: pre-commit/action@v2.0.3 diff --git a/package.json b/package.json new file mode 100644 index 00000000..7cfe2ec9 --- /dev/null +++ b/package.json @@ -0,0 +1,10 @@ +{ + "devDependencies": { + "autoprefixer": "^10.4.19", + "concurrently": "^8.2.2", + "postcss": "^8.4.39", + "prettier": "^3.3.2", + "prettier-plugin-tailwindcss": "^0.6.5", + "tailwindcss": "^3.4.4" + } +} diff --git a/src/frontend/.lintstagedrc b/src/frontend/.lintstagedrc index 63e1c50e..e80e8beb 100644 --- a/src/frontend/.lintstagedrc +++ b/src/frontend/.lintstagedrc @@ -1,3 +1,3 @@ { - "*.{js,jsx,ts,tsx}": "eslint --fix" + "*.{js,jsx,ts,tsx}": "eslint --fix" } diff --git a/src/frontend/README.md b/src/frontend/README.md index 762719bd..331490d3 100644 --- a/src/frontend/README.md +++ b/src/frontend/README.md @@ -1,8 +1,5 @@ - ## Getting started with the starter kit - - 1. Do not use npm to install packages, use yarn. If you want to run `npm install` then delete the `yarn.lock` file and install the packages using npm. 2. Create a .env file and copy .env.sample to .env @@ -11,12 +8,8 @@ 4. If there is error on "/dashboard" route then comment out the proxy setup part on `vite.config.ts` file. - - ## Folder Structure - - - [API](./src/api/readme.md)$~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~$--> Api's for the project - [Wrappers](./src/api/wrappers/readme.md)$~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~$--> Wrappers @@ -27,15 +20,13 @@ - [UI](./src/ui/readme.md) +## Example to add shadcn component (select component- [link](https://ui.shadcn.com/docs/components/select) ) + npx shadcn-ui add select -## Example to add shadcn component (select component- [link](https://ui.shadcn.com/docs/components/select) ) +give path as +**./src/ui/atoms/common/** - npx shadcn-ui add select -give path as - **./src/ui/atoms/common/** - - resolve all classes with tailwind prefix - replace classes with color variables with project color variables - add missing dependencies ( if npx failed to install dependencies automatically e.g: @radix-ui/react-select ) - diff --git a/src/frontend/components.json b/src/frontend/components.json index 6077d1f3..955db484 100644 --- a/src/frontend/components.json +++ b/src/frontend/components.json @@ -1,16 +1,16 @@ { "$schema": "https://ui.shadcn.com/schema.json", - "style": "default", + "aliases": { + "components": "components/RadixComponents", + "utils": "@/lib/utils" + }, "rsc": true, - "tsx": true, + "style": "default", "tailwind": { + "baseColor": "slate", "config": "tailwind.config.js", "css": "src/assets/css/tailwind.css", - "baseColor": "slate", "cssVariables": true }, - "aliases": { - "components": "components/RadixComponents", - "utils": "@/lib/utils" - } -} \ No newline at end of file + "tsx": true +} diff --git a/src/frontend/package.json b/src/frontend/package.json index ed99ab23..5d364219 100644 --- a/src/frontend/package.json +++ b/src/frontend/package.json @@ -1,15 +1,4 @@ { - "name": "starterkit-v2", - "private": true, - "version": "0.0.0", - "type": "module", - "scripts": { - "start": "vite", - "dev": "vite", - "build": "tsc && vite build", - "preview": "vite preview", - "lint": "eslint ./src/ --ext .ts,.tsx --fix" - }, "dependencies": { "@mapbox/mapbox-gl-draw": "^1.4.2", "@mapbox/mapbox-gl-draw-static-mode": "^1.0.1", @@ -44,6 +33,7 @@ "date-fns": "^2.30.0", "dom-to-code": "^1.5.4", "dotenv": "^16.0.3", + "framer-motion": "^11.2.9", "geojson": "^0.5.0", "geojson-validation": "^1.0.2", "html2canvas": "^1.4.1", @@ -58,7 +48,6 @@ "react-redux": "^8.0.5", "react-router-dom": "^6.10.0", "react-toastify": "^9.1.3", - "framer-motion": "^11.2.9", "react-transition-group": "^4.4.5", "recharts": "^2.7.2", "redux-persist": "^6.0.0", @@ -101,5 +90,16 @@ "eslint --fix", "prettier --cache --write" ] - } + }, + "name": "starterkit-v2", + "private": true, + "scripts": { + "build": "tsc && vite build", + "dev": "vite", + "lint": "eslint ./src/ --ext .ts,.tsx --fix", + "preview": "vite preview", + "start": "vite" + }, + "type": "module", + "version": "0.0.0" } diff --git a/src/frontend/src/api/projects.ts b/src/frontend/src/api/projects.ts index f2483769..4f82531f 100644 --- a/src/frontend/src/api/projects.ts +++ b/src/frontend/src/api/projects.ts @@ -1,11 +1,14 @@ -import { UseQueryOptions, useQuery } from "@tanstack/react-query"; -import { getProjectsList } from "@Services/createproject"; +import { UseQueryOptions, useQuery } from '@tanstack/react-query'; +import { getProjectsList } from '@Services/createproject'; -export const useGetProjectsListQuery = (id?:number, queryOptions?: Partial) => { +export const useGetProjectsListQuery = ( + id?: number, + queryOptions?: Partial, +) => { return useQuery({ queryKey: ['projects-list'], queryFn: () => getProjectsList(id), select: (res: any) => res.data, ...queryOptions, }); -}; \ No newline at end of file +}; diff --git a/src/frontend/src/assets/images/LandingPage/RockerIcon.svg b/src/frontend/src/assets/images/LandingPage/RockerIcon.svg index b83a39fd..dd1f2dea 100644 --- a/src/frontend/src/assets/images/LandingPage/RockerIcon.svg +++ b/src/frontend/src/assets/images/LandingPage/RockerIcon.svg @@ -6,4 +6,4 @@ - \ No newline at end of file + diff --git a/src/frontend/src/assets/images/LandingPage/TargetIcon.svg b/src/frontend/src/assets/images/LandingPage/TargetIcon.svg index e3cbf328..7a321722 100644 --- a/src/frontend/src/assets/images/LandingPage/TargetIcon.svg +++ b/src/frontend/src/assets/images/LandingPage/TargetIcon.svg @@ -10,4 +10,4 @@ - \ No newline at end of file + diff --git a/src/frontend/src/components/CreateProject/StepSwitcher/index.tsx b/src/frontend/src/components/CreateProject/StepSwitcher/index.tsx index 9fbe5639..53acff11 100644 --- a/src/frontend/src/components/CreateProject/StepSwitcher/index.tsx +++ b/src/frontend/src/components/CreateProject/StepSwitcher/index.tsx @@ -47,7 +47,7 @@ export default function StepSwitcher({ activeStep === index ? 'currentstep-pointer pulse-animation naxatw-border-red' : '' - } naxatw-flex naxatw-items-center naxatw-justify-center naxatw-rounded-full naxatw-border-[0.15rem] lg:naxatw-h-7 lg:naxatw-w-7 xl:naxatw-h-9 xl:naxatw-w-9 ${ + } naxatw-flex naxatw-items-center naxatw-justify-center naxatw-rounded-full naxatw-border-[0.15rem] lg:naxatw-h-7 lg:naxatw-w-7 xl:naxatw-h-9 xl:naxatw-w-9 ${ activeStep > index ? 'naxatw-border-red naxatw-bg-red' : 'naxatw-bg-transparent' diff --git a/src/frontend/src/components/LandingPage/Footer/index.tsx b/src/frontend/src/components/LandingPage/Footer/index.tsx index eb5a488e..c0eeb110 100644 --- a/src/frontend/src/components/LandingPage/Footer/index.tsx +++ b/src/frontend/src/components/LandingPage/Footer/index.tsx @@ -40,7 +40,7 @@ export default function Footer() { variants={fadeUpVariant} initial="hidden" whileInView="visible" - className="naxatw-flex naxatw-w-full naxatw-flex-col naxatw-items-center naxatw-justify-between naxatw-gap-8 naxatw-border-b naxatw-border-t naxatw-border-landing-white naxatw-px-5 naxatw-py-8 naxatw-text-landing-grey md:naxatw-flex-row md:naxatw-px-9 lg:naxatw-px-32" + className="naxatw-flex naxatw-w-full naxatw-flex-col naxatw-items-center naxatw-justify-between naxatw-gap-8 naxatw-border-b naxatw-border-t naxatw-border-landing-white naxatw-px-5 naxatw-py-8 naxatw-text-landing-grey md:naxatw-flex-row md:naxatw-px-9 lg:naxatw-px-32" >
Developed & Designed by diff --git a/src/frontend/src/components/LandingPage/Navbar/index.tsx b/src/frontend/src/components/LandingPage/Navbar/index.tsx index b1595577..fd01d616 100644 --- a/src/frontend/src/components/LandingPage/Navbar/index.tsx +++ b/src/frontend/src/components/LandingPage/Navbar/index.tsx @@ -5,7 +5,7 @@ export default function Navbar() {
-

+

Open Source

-

+

Drone Tasking Manager

diff --git a/src/frontend/src/components/RadixComponents/Button.tsx b/src/frontend/src/components/RadixComponents/Button.tsx index 3cfe1d5c..c7515bed 100644 --- a/src/frontend/src/components/RadixComponents/Button.tsx +++ b/src/frontend/src/components/RadixComponents/Button.tsx @@ -7,8 +7,8 @@ import Icon from '@Components/common/Icon'; import Spinner from '@Components/common/Spinner'; const buttonVariants = cva( - `naxatw-inline-flex naxatw-items-center naxatw-justify-center naxatw-rounded-md naxatw-text-sm - naxatw-font-bold naxatw-transition-colors focus-visible:naxatw-outline-none focus-visible:naxatw-ring-2 + `naxatw-inline-flex naxatw-items-center naxatw-justify-center naxatw-rounded-md naxatw-text-sm + naxatw-font-bold naxatw-transition-colors focus-visible:naxatw-outline-none focus-visible:naxatw-ring-2 focus-visible:ring-ring focus-visible:naxatw-ring-offset-2 disabled:naxatw-opacity-50 disabled:naxatw-pointer-events-none`, { variants: { @@ -17,7 +17,7 @@ const buttonVariants = cva( 'naxatw-bg-primary-400 naxatw-text-white hover:naxatw-shadow-top hover:naxatw-shadow-primary-400', destructive: 'naxatw-bg-red-500 naxatw-text-white hover:naxatw-shadow-top hover:naxatw-shadow-red-500', - outline: `naxatw-border naxatw-text-primary-400 naxatw-border-primary-400 naxatw-border-input + outline: `naxatw-border naxatw-text-primary-400 naxatw-border-primary-400 naxatw-border-input hover:naxatw-shadow-top naxatw-bg-white`, secondary: 'naxatw-bg-white naxatw-text-primary-400 naxatw-border naxatw-border-primary-400 hover:naxatw-shadow-top', diff --git a/src/frontend/src/components/RadixComponents/Image.tsx b/src/frontend/src/components/RadixComponents/Image.tsx index 7560d969..becee3d5 100644 --- a/src/frontend/src/components/RadixComponents/Image.tsx +++ b/src/frontend/src/components/RadixComponents/Image.tsx @@ -17,7 +17,7 @@ export default function Image({ }: IProps): JSX.Element { return (
{alt} diff --git a/src/frontend/src/components/RadixComponents/Popover.tsx b/src/frontend/src/components/RadixComponents/Popover.tsx index 65c210d1..c3b6f3c6 100644 --- a/src/frontend/src/components/RadixComponents/Popover.tsx +++ b/src/frontend/src/components/RadixComponents/Popover.tsx @@ -23,11 +23,7 @@ const PopoverContent = React.forwardRef< align={align} sideOffset={sideOffset} className={cn( - `naxatw-z-50 naxatw-w-64 naxatw-rounded-md naxatw-border naxatw-bg-white naxatw-p-4 naxatw-text-grey-800 - naxatw-shadow-lg naxatw-outline-none data-[state=open]:naxatw-animate-in data-[state=closed]:naxatw-animate-out - data-[state=closed]:naxatw-fade-out-0 data-[state=open]:naxatw-fade-in-0 data-[state=closed]:naxatw-zoom-out-95 - data-[state=open]:naxatw-zoom-in-95 data-[side=bottom]:naxatw-slide-in-from-top-2 data-[side=left]:naxatw-slide-in-from-right-2 - data-[side=right]:naxatw-slide-in-from-left-2 data-[side=top]:naxatw-slide-in-from-bottom-2`, + `naxatw-z-50 naxatw-w-64 naxatw-rounded-md naxatw-border naxatw-bg-white naxatw-p-4 naxatw-text-grey-800 naxatw-shadow-lg naxatw-outline-none data-[state=open]:naxatw-animate-in data-[state=closed]:naxatw-animate-out data-[state=closed]:naxatw-fade-out-0 data-[state=open]:naxatw-fade-in-0 data-[state=closed]:naxatw-zoom-out-95 data-[state=open]:naxatw-zoom-in-95 data-[side=bottom]:naxatw-slide-in-from-top-2 data-[side=left]:naxatw-slide-in-from-right-2 data-[side=right]:naxatw-slide-in-from-left-2 data-[side=top]:naxatw-slide-in-from-bottom-2`, className, )} {...props} diff --git a/src/frontend/src/components/RadixComponents/Switch.tsx b/src/frontend/src/components/RadixComponents/Switch.tsx index a5ef1296..823b45a7 100644 --- a/src/frontend/src/components/RadixComponents/Switch.tsx +++ b/src/frontend/src/components/RadixComponents/Switch.tsx @@ -8,11 +8,7 @@ const Switch = React.forwardRef< >(({ className, ...props }, ref) => ( diff --git a/src/frontend/src/components/RadixComponents/Table.tsx b/src/frontend/src/components/RadixComponents/Table.tsx index e4237c2f..d4e566ac 100644 --- a/src/frontend/src/components/RadixComponents/Table.tsx +++ b/src/frontend/src/components/RadixComponents/Table.tsx @@ -9,7 +9,7 @@ const Table = React.forwardRef< >(({ className, ...props }, ref) => ( -
+ )); TableCaption.displayName = 'TableCaption'; diff --git a/src/frontend/src/components/RadixComponents/ToolTip.tsx b/src/frontend/src/components/RadixComponents/ToolTip.tsx index 2c70c069..b8f92573 100644 --- a/src/frontend/src/components/RadixComponents/ToolTip.tsx +++ b/src/frontend/src/components/RadixComponents/ToolTip.tsx @@ -35,19 +35,12 @@ export default function ToolTip({ {message && ( diff --git a/src/frontend/src/components/common/Charts/BarChart/index.tsx b/src/frontend/src/components/common/Charts/BarChart/index.tsx index acfbac70..0b3f5a90 100644 --- a/src/frontend/src/components/common/Charts/BarChart/index.tsx +++ b/src/frontend/src/components/common/Charts/BarChart/index.tsx @@ -41,7 +41,7 @@ const CustomizedLabel = (props: any) => { const CustomTooltip = ({ active, payload, label }: any) => { if (active && payload && payload.length) { return ( -
+

{label}

{payload?.map((item: any) => { if (item.dataKey !== 'name') diff --git a/src/frontend/src/components/common/Charts/ChartContainer/index.tsx b/src/frontend/src/components/common/Charts/ChartContainer/index.tsx index 6d53e7b4..4d539468 100644 --- a/src/frontend/src/components/common/Charts/ChartContainer/index.tsx +++ b/src/frontend/src/components/common/Charts/ChartContainer/index.tsx @@ -77,10 +77,10 @@ export default function ChartContainer({ className={`card ${ // eslint-disable-next-line no-nested-ternary type === 'donut' - ? 'naxatw-col-span-12 naxatw-flex naxatw-h-full naxatw-items-center sm:naxatw-col-span-6 md:naxatw-col-span-12 lg:naxatw-col-span-6 ' + ? 'naxatw-col-span-12 naxatw-flex naxatw-h-full naxatw-items-center sm:naxatw-col-span-6 md:naxatw-col-span-12 lg:naxatw-col-span-6' : yLabel ? 'naxatw-col-span-12' - : 'naxatw-col-span-12 naxatw-h-full naxatw-overflow-y-hidden' + : 'naxatw-col-span-12 naxatw-h-full naxatw-overflow-y-hidden' } ${scrollable ? 'scrollbar naxatw-overflow-auto' : ''}`} > {chart && chart({ data, fills, scrollable })} @@ -94,7 +94,7 @@ export default function ChartContainer({
diff --git a/src/frontend/src/components/common/Charts/ChartHeader/index.tsx b/src/frontend/src/components/common/Charts/ChartHeader/index.tsx index 5c54dfb4..b6f76ddc 100644 --- a/src/frontend/src/components/common/Charts/ChartHeader/index.tsx +++ b/src/frontend/src/components/common/Charts/ChartHeader/index.tsx @@ -49,8 +49,7 @@ export default function ChartHeader({ tabIndex={0} role="button" onKeyDown={() => {}} - className="actions naxatw-w-40px naxatw-flex naxatw-cursor-pointer - naxatw-rounded-lg naxatw-p-1 hover:naxatw-bg-primary-50" + className="actions naxatw-w-40px hover:naxatw-bg-primary-50 naxatw-flex naxatw-cursor-pointer naxatw-rounded-lg naxatw-p-1" > {toggle && (
{}} onClick={handleDownloadPng} - className="naxatw-py-3 hover:naxatw-bg-primary-50" + className="hover:naxatw-bg-primary-50 naxatw-py-3" > Export as PNG
@@ -80,7 +78,7 @@ export default function ChartHeader({ tabIndex={0} onKeyDown={() => {}} onClick={handleDownloadCsv} - className="naxatw-py-3 hover:naxatw-bg-primary-50" + className="hover:naxatw-bg-primary-50 naxatw-py-3" > Export as CSV
diff --git a/src/frontend/src/components/common/Charts/ChartLegend/index.tsx b/src/frontend/src/components/common/Charts/ChartLegend/index.tsx index 6800350f..9ed65a30 100644 --- a/src/frontend/src/components/common/Charts/ChartLegend/index.tsx +++ b/src/frontend/src/components/common/Charts/ChartLegend/index.tsx @@ -15,11 +15,8 @@ export default function ChartLegend({ if (type === 'donut') { const maxValue = getSumOfKey(data as PieChartDataItem[], 'value'); return ( -
-
+
+
{data.map((key: any, index: any) => ( ({ removeKeyFromObject(data[0], 'name' as keyof (typeof data)[0]), ); return ( -
-
+
+
{keys.map((key, index) => ( ))} diff --git a/src/frontend/src/components/common/Charts/DonutChart/index.tsx b/src/frontend/src/components/common/Charts/DonutChart/index.tsx index 2f144717..c91b6858 100644 --- a/src/frontend/src/components/common/Charts/DonutChart/index.tsx +++ b/src/frontend/src/components/common/Charts/DonutChart/index.tsx @@ -7,7 +7,7 @@ const CustomTooltip = ({ active, payload }: any) => { const tooltipTextColor = payload[0].payload.fill; // dynamic => changes acc to fill return (

diff --git a/src/frontend/src/components/common/Charts/DonutLegendItem/index.tsx b/src/frontend/src/components/common/Charts/DonutLegendItem/index.tsx index 53b12e78..9b858bd4 100644 --- a/src/frontend/src/components/common/Charts/DonutLegendItem/index.tsx +++ b/src/frontend/src/components/common/Charts/DonutLegendItem/index.tsx @@ -7,19 +7,19 @@ export default function DonutLegendItem({ }: IDonutLegendItemProps) { return (

-
+
-
+
{name}
-
+
{Number(percentage)?.toFixed(1)} %
diff --git a/src/frontend/src/components/common/Charts/HorizontalBarChart/index.tsx b/src/frontend/src/components/common/Charts/HorizontalBarChart/index.tsx index b98c66cf..cb70ecf0 100644 --- a/src/frontend/src/components/common/Charts/HorizontalBarChart/index.tsx +++ b/src/frontend/src/components/common/Charts/HorizontalBarChart/index.tsx @@ -8,7 +8,7 @@ export default function HorizontalBarChart({ data }: IChartProps) { : []; return (
-
+
{finalData?.map((item: any) => (
-
+

{value} diff --git a/src/frontend/src/components/common/Charts/LegendItem/index.tsx b/src/frontend/src/components/common/Charts/LegendItem/index.tsx index a467ce90..17eac7f8 100644 --- a/src/frontend/src/components/common/Charts/LegendItem/index.tsx +++ b/src/frontend/src/components/common/Charts/LegendItem/index.tsx @@ -7,7 +7,7 @@ export default function LegendItem({ color, name }: ILegendItemProps) { className="naxatw-flex naxatw-items-center naxatw-justify-center naxatw-gap-2" > {hasHeader && header && (

@@ -69,7 +67,7 @@ export default function StackedChart({ )} {isDataEmpty ? ( - + {updatedData.map(({ name, color, width }) => (
{name} diff --git a/src/frontend/src/components/common/Chip/index.tsx b/src/frontend/src/components/common/Chip/index.tsx index c1579220..cd4388bf 100644 --- a/src/frontend/src/components/common/Chip/index.tsx +++ b/src/frontend/src/components/common/Chip/index.tsx @@ -9,15 +9,12 @@ interface IChipProps { export default function Chip({ label, onClose }: IChipProps) { return ( -
+

{capitalizeFirstLetter(label.toString())}

); diff --git a/src/frontend/src/components/common/DataCard/index.tsx b/src/frontend/src/components/common/DataCard/index.tsx index bfb8716c..816f7ecf 100644 --- a/src/frontend/src/components/common/DataCard/index.tsx +++ b/src/frontend/src/components/common/DataCard/index.tsx @@ -19,18 +19,19 @@ export default function DataCard({ }: DataCardProps) { return (
{title}
- +
{formatNumberWithCommas(count)}
diff --git a/src/frontend/src/components/common/DataTable/DataTablePagination/index.tsx b/src/frontend/src/components/common/DataTable/DataTablePagination/index.tsx index 8e3eccbb..a7302abd 100644 --- a/src/frontend/src/components/common/DataTable/DataTablePagination/index.tsx +++ b/src/frontend/src/components/common/DataTable/DataTablePagination/index.tsx @@ -5,14 +5,14 @@ import { Button } from '@Components/RadixComponents/Button'; export default function DataTablePagination({ table }: any) { return ( - + Row per page { setIsOpen(true); @@ -117,28 +120,22 @@ export default function MultiSelect({ {showClearIcon ? ( setSearchText('')} /> ) : ( )} {isOpen && ( -
    +
      {options && filterOptions.length > 0 ? ( filterOptions.map(option => (
    • { e.stopPropagation(); diff --git a/src/frontend/src/components/common/FormUI/SearchInput/index.tsx b/src/frontend/src/components/common/FormUI/SearchInput/index.tsx index 0745521b..f48134d0 100644 --- a/src/frontend/src/components/common/FormUI/SearchInput/index.tsx +++ b/src/frontend/src/components/common/FormUI/SearchInput/index.tsx @@ -22,12 +22,11 @@ export default function SearchInput({ }: ISearchInputProps) { return (
      {withSearch ? ( @@ -143,8 +140,7 @@ export default function Select({ {showClearIcon ? ( setSearchText('')} /> ) : ( @@ -160,15 +156,14 @@ export default function Select({ {isOpen && (
        {options && filterOptions.length > 0 ? ( filterOptions.map(option => (
      • handleOptionClick(option[valueKey])} > diff --git a/src/frontend/src/components/common/InfoDialog/index.tsx b/src/frontend/src/components/common/InfoDialog/index.tsx index f38b2df5..f5e36d95 100644 --- a/src/frontend/src/components/common/InfoDialog/index.tsx +++ b/src/frontend/src/components/common/InfoDialog/index.tsx @@ -24,8 +24,7 @@ const InfoDialog: React.FC = ({ status, children }) => { return (
        {children} diff --git a/src/frontend/src/components/common/Layouts/Flex/index.tsx b/src/frontend/src/components/common/Layouts/Flex/index.tsx index d03fcc3b..396d4b17 100644 --- a/src/frontend/src/components/common/Layouts/Flex/index.tsx +++ b/src/frontend/src/components/common/Layouts/Flex/index.tsx @@ -16,8 +16,7 @@ export default function Flex({ return (
        +
          {popupData && Object.keys(popupData).map(key => (
        • {key}

          -

          +

          {popupData[key]?.toString() || '-'}

        • diff --git a/src/frontend/src/components/common/Modal/index.tsx b/src/frontend/src/components/common/Modal/index.tsx index 3854917a..9691da6a 100644 --- a/src/frontend/src/components/common/Modal/index.tsx +++ b/src/frontend/src/components/common/Modal/index.tsx @@ -45,37 +45,26 @@ export default function Modal({ tabIndex={-1} className={`${ show ? '' : '' - } naxatw-h-modal naxatw-fixed naxatw-inset-0 naxatw-z-[11111] naxatw-flex - naxatw-h-screen naxatw-w-screen naxatw-justify-center naxatw-overflow-y-auto naxatw-overflow-x-hidden - naxatw-bg-grey-700/50 naxatw-p-4 md:naxatw-inset-0 md:naxatw-h-full - `} + } naxatw-h-modal naxatw-fixed naxatw-inset-0 naxatw-z-[11111] naxatw-flex naxatw-h-screen naxatw-w-screen naxatw-justify-center naxatw-overflow-y-auto naxatw-overflow-x-hidden naxatw-bg-grey-700/50 naxatw-p-4 md:naxatw-inset-0 md:naxatw-h-full`} style={{ zIndex }} >
          -
          -
          +
          +
          {headerContent || (
          -

          {title}

          +

          {title}

          {subtitle}

          )} @@ -83,9 +72,7 @@ export default function Modal({ {!hideCloseButton && (
          -
          +
          {children}
          diff --git a/src/frontend/src/components/common/Navbar/index.tsx b/src/frontend/src/components/common/Navbar/index.tsx index 19fc40ad..adad3168 100644 --- a/src/frontend/src/components/common/Navbar/index.tsx +++ b/src/frontend/src/components/common/Navbar/index.tsx @@ -17,7 +17,11 @@ export default function Navbar() { key={id} to={link} className={({ isActive }) => - `${isActive ? 'naxatw-border-b-2 naxatw-border-red' : 'hover:naxatw-border-b-2 hover:naxatw-border-grey-900'} -naxatw-mb-[1.2rem] naxatw-px-3 naxatw-pb-2 naxatw-text-body-btn` + `${ + isActive + ? 'naxatw-border-b-2 naxatw-border-red' + : 'hover:naxatw-border-b-2 hover:naxatw-border-grey-900' + } -naxatw-mb-[1.2rem] naxatw-px-3 naxatw-pb-2 naxatw-text-body-btn` } > {linkName} diff --git a/src/frontend/src/components/common/RadioButton/index.tsx b/src/frontend/src/components/common/RadioButton/index.tsx index d51fd24f..d7d7e032 100644 --- a/src/frontend/src/components/common/RadioButton/index.tsx +++ b/src/frontend/src/components/common/RadioButton/index.tsx @@ -39,7 +39,11 @@ const RadioButton: React.FC = ({
          )}
          {options.map(option => { return ( @@ -65,10 +69,12 @@ const RadioButton: React.FC = ({ />