From 30f9342c78cc3174d205e3741281cdb411af259e Mon Sep 17 00:00:00 2001 From: Daniel Harvilik <56021310+danielharvilik@users.noreply.github.com> Date: Sun, 21 Jan 2024 17:34:35 +0100 Subject: [PATCH] finished meiro-fe-task --- frontend/.eslintrc.cjs | 18 ++ frontend/.gitignore | 24 +++ frontend/README.md | 30 ++++ frontend/components.json | 17 ++ frontend/index.html | 12 ++ frontend/package.json | 47 +++++ frontend/postcss.config.js | 6 + frontend/public/vite.svg | 1 + frontend/src/App.tsx | 23 +++ frontend/src/ReactQueryProvider.tsx | 16 ++ frontend/src/assets/meiro_logo.jpeg | Bin 0 -> 12742 bytes frontend/src/assets/react.svg | 1 + frontend/src/helpers/dateFormatter.ts | 19 ++ frontend/src/helpers/matchLabelNames.ts | 14 ++ frontend/src/index.css | 76 ++++++++ frontend/src/lib/utils.ts | 6 + frontend/src/main.tsx | 16 ++ frontend/src/pages/AttributeDetail.tsx | 110 ++++++++++++ .../src/pages/AttributesWInfiniteScroll.tsx | 81 +++++++++ frontend/src/pages/AttributesWPagination.tsx | 69 ++++++++ frontend/src/pages/Home.tsx | 5 + frontend/src/services/attributesService.ts | 80 +++++++++ .../components/custom/DataTable/DataTable.tsx | 76 ++++++++ .../components/custom/DataTable/columns.tsx | 104 +++++++++++ .../custom/FilterPanel/FilterPanel.tsx | 84 +++++++++ .../ui/components/custom/Header/Header.tsx | 35 ++++ .../custom/Pagination/Pagination.tsx | 49 ++++++ .../ui/components/shadcn/ui/alert-dialog.tsx | 141 +++++++++++++++ .../src/ui/components/shadcn/ui/button.tsx | 57 ++++++ frontend/src/ui/components/shadcn/ui/card.tsx | 76 ++++++++ .../src/ui/components/shadcn/ui/input.tsx | 25 +++ .../src/ui/components/shadcn/ui/select.tsx | 164 ++++++++++++++++++ .../src/ui/components/shadcn/ui/table.tsx | 120 +++++++++++++ frontend/src/vite-env.d.ts | 1 + frontend/tailwind.config.js | 77 ++++++++ frontend/tsconfig.json | 31 ++++ frontend/tsconfig.node.json | 10 ++ frontend/vite.config.ts | 12 ++ 38 files changed, 1733 insertions(+) create mode 100644 frontend/.eslintrc.cjs create mode 100644 frontend/.gitignore create mode 100644 frontend/README.md create mode 100644 frontend/components.json create mode 100644 frontend/index.html create mode 100644 frontend/package.json create mode 100644 frontend/postcss.config.js create mode 100644 frontend/public/vite.svg create mode 100644 frontend/src/App.tsx create mode 100644 frontend/src/ReactQueryProvider.tsx create mode 100644 frontend/src/assets/meiro_logo.jpeg create mode 100644 frontend/src/assets/react.svg create mode 100644 frontend/src/helpers/dateFormatter.ts create mode 100644 frontend/src/helpers/matchLabelNames.ts create mode 100644 frontend/src/index.css create mode 100644 frontend/src/lib/utils.ts create mode 100644 frontend/src/main.tsx create mode 100644 frontend/src/pages/AttributeDetail.tsx create mode 100644 frontend/src/pages/AttributesWInfiniteScroll.tsx create mode 100644 frontend/src/pages/AttributesWPagination.tsx create mode 100644 frontend/src/pages/Home.tsx create mode 100644 frontend/src/services/attributesService.ts create mode 100644 frontend/src/ui/components/custom/DataTable/DataTable.tsx create mode 100644 frontend/src/ui/components/custom/DataTable/columns.tsx create mode 100644 frontend/src/ui/components/custom/FilterPanel/FilterPanel.tsx create mode 100644 frontend/src/ui/components/custom/Header/Header.tsx create mode 100644 frontend/src/ui/components/custom/Pagination/Pagination.tsx create mode 100644 frontend/src/ui/components/shadcn/ui/alert-dialog.tsx create mode 100644 frontend/src/ui/components/shadcn/ui/button.tsx create mode 100644 frontend/src/ui/components/shadcn/ui/card.tsx create mode 100644 frontend/src/ui/components/shadcn/ui/input.tsx create mode 100644 frontend/src/ui/components/shadcn/ui/select.tsx create mode 100644 frontend/src/ui/components/shadcn/ui/table.tsx create mode 100644 frontend/src/vite-env.d.ts create mode 100644 frontend/tailwind.config.js create mode 100644 frontend/tsconfig.json create mode 100644 frontend/tsconfig.node.json create mode 100644 frontend/vite.config.ts diff --git a/frontend/.eslintrc.cjs b/frontend/.eslintrc.cjs new file mode 100644 index 0000000..d6c9537 --- /dev/null +++ b/frontend/.eslintrc.cjs @@ -0,0 +1,18 @@ +module.exports = { + root: true, + env: { browser: true, es2020: true }, + extends: [ + 'eslint:recommended', + 'plugin:@typescript-eslint/recommended', + 'plugin:react-hooks/recommended', + ], + ignorePatterns: ['dist', '.eslintrc.cjs'], + parser: '@typescript-eslint/parser', + plugins: ['react-refresh'], + rules: { + 'react-refresh/only-export-components': [ + 'warn', + { allowConstantExport: true }, + ], + }, +} diff --git a/frontend/.gitignore b/frontend/.gitignore new file mode 100644 index 0000000..a547bf3 --- /dev/null +++ b/frontend/.gitignore @@ -0,0 +1,24 @@ +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +pnpm-debug.log* +lerna-debug.log* + +node_modules +dist +dist-ssr +*.local + +# Editor directories and files +.vscode/* +!.vscode/extensions.json +.idea +.DS_Store +*.suo +*.ntvs* +*.njsproj +*.sln +*.sw? diff --git a/frontend/README.md b/frontend/README.md new file mode 100644 index 0000000..0d6babe --- /dev/null +++ b/frontend/README.md @@ -0,0 +1,30 @@ +# React + TypeScript + Vite + +This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules. + +Currently, two official plugins are available: + +- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh +- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh + +## Expanding the ESLint configuration + +If you are developing a production application, we recommend updating the configuration to enable type aware lint rules: + +- Configure the top-level `parserOptions` property like this: + +```js +export default { + // other rules... + parserOptions: { + ecmaVersion: 'latest', + sourceType: 'module', + project: ['./tsconfig.json', './tsconfig.node.json'], + tsconfigRootDir: __dirname, + }, +} +``` + +- Replace `plugin:@typescript-eslint/recommended` to `plugin:@typescript-eslint/recommended-type-checked` or `plugin:@typescript-eslint/strict-type-checked` +- Optionally add `plugin:@typescript-eslint/stylistic-type-checked` +- Install [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react) and add `plugin:react/recommended` & `plugin:react/jsx-runtime` to the `extends` list diff --git a/frontend/components.json b/frontend/components.json new file mode 100644 index 0000000..8e3ef92 --- /dev/null +++ b/frontend/components.json @@ -0,0 +1,17 @@ +{ + "$schema": "https://ui.shadcn.com/schema.json", + "style": "new-york", + "rsc": true, + "tsx": true, + "tailwind": { + "config": "tailwind.config.js", + "css": "src/index.css", + "baseColor": "zinc", + "cssVariables": true, + "prefix": "" + }, + "aliases": { + "components": "@/ui/components/shadcn", + "utils": "@/lib/utils" + } +} \ No newline at end of file diff --git a/frontend/index.html b/frontend/index.html new file mode 100644 index 0000000..8dd5048 --- /dev/null +++ b/frontend/index.html @@ -0,0 +1,12 @@ + + +
+ + +