From 4bad35fca5035a7f3c581ed06aae13d43c71081b Mon Sep 17 00:00:00 2001 From: Gregory Mallios Date: Sat, 9 Mar 2024 19:18:52 +0200 Subject: [PATCH] fix: move UI assets and add path aliases --- manager-ui/package.json | 3 ++- .../{ => src}/assets/a3027_img_device.webp | Bin .../{ => src}/assets/a3028_img_device.webp | Bin .../{ => src}/assets/a3029_img_device.webp | Bin .../{ => src}/assets/a3040_img_device.webp | Bin .../{ => src}/assets/a3935_img_device.webp | Bin .../assets/a3951_img_device_left.webp | Bin .../assets/a3951_img_device_right.webp | Bin .../assets/a3951_img_device_right_edited.webp | Bin .../{ => src}/assets/ambient_icon_anc.png | Bin .../{ => src}/assets/ambient_icon_off.png | Bin .../{ => src}/assets/ambient_icon_trans.png | Bin manager-ui/src/assets/index.d.ts | 6 +++++ manager-ui/src/components/OverviewCard.tsx | 16 ++++++------- manager-ui/tsconfig.json | 11 ++++++++- manager-ui/vite.config.ts | 3 ++- package.json | 3 +++ yarn.lock | 21 +++++++++++++++++- 18 files changed, 51 insertions(+), 12 deletions(-) rename manager-ui/{ => src}/assets/a3027_img_device.webp (100%) rename manager-ui/{ => src}/assets/a3028_img_device.webp (100%) rename manager-ui/{ => src}/assets/a3029_img_device.webp (100%) rename manager-ui/{ => src}/assets/a3040_img_device.webp (100%) rename manager-ui/{ => src}/assets/a3935_img_device.webp (100%) rename manager-ui/{ => src}/assets/a3951_img_device_left.webp (100%) rename manager-ui/{ => src}/assets/a3951_img_device_right.webp (100%) rename manager-ui/{ => src}/assets/a3951_img_device_right_edited.webp (100%) rename manager-ui/{ => src}/assets/ambient_icon_anc.png (100%) rename manager-ui/{ => src}/assets/ambient_icon_off.png (100%) rename manager-ui/{ => src}/assets/ambient_icon_trans.png (100%) create mode 100644 manager-ui/src/assets/index.d.ts diff --git a/manager-ui/package.json b/manager-ui/package.json index 57b4b0c..9ea5783 100644 --- a/manager-ui/package.json +++ b/manager-ui/package.json @@ -45,6 +45,7 @@ "eslint-plugin-react": "^7.33.2", "prettier": "^3.2.5", "typescript": "^5.0.4", - "vite": "^5.1.5" + "vite": "^5.1.5", + "vite-tsconfig-paths": "^4.3.1" } } diff --git a/manager-ui/assets/a3027_img_device.webp b/manager-ui/src/assets/a3027_img_device.webp similarity index 100% rename from manager-ui/assets/a3027_img_device.webp rename to manager-ui/src/assets/a3027_img_device.webp diff --git a/manager-ui/assets/a3028_img_device.webp b/manager-ui/src/assets/a3028_img_device.webp similarity index 100% rename from manager-ui/assets/a3028_img_device.webp rename to manager-ui/src/assets/a3028_img_device.webp diff --git a/manager-ui/assets/a3029_img_device.webp b/manager-ui/src/assets/a3029_img_device.webp similarity index 100% rename from manager-ui/assets/a3029_img_device.webp rename to manager-ui/src/assets/a3029_img_device.webp diff --git a/manager-ui/assets/a3040_img_device.webp b/manager-ui/src/assets/a3040_img_device.webp similarity index 100% rename from manager-ui/assets/a3040_img_device.webp rename to manager-ui/src/assets/a3040_img_device.webp diff --git a/manager-ui/assets/a3935_img_device.webp b/manager-ui/src/assets/a3935_img_device.webp similarity index 100% rename from manager-ui/assets/a3935_img_device.webp rename to manager-ui/src/assets/a3935_img_device.webp diff --git a/manager-ui/assets/a3951_img_device_left.webp b/manager-ui/src/assets/a3951_img_device_left.webp similarity index 100% rename from manager-ui/assets/a3951_img_device_left.webp rename to manager-ui/src/assets/a3951_img_device_left.webp diff --git a/manager-ui/assets/a3951_img_device_right.webp b/manager-ui/src/assets/a3951_img_device_right.webp similarity index 100% rename from manager-ui/assets/a3951_img_device_right.webp rename to manager-ui/src/assets/a3951_img_device_right.webp diff --git a/manager-ui/assets/a3951_img_device_right_edited.webp b/manager-ui/src/assets/a3951_img_device_right_edited.webp similarity index 100% rename from manager-ui/assets/a3951_img_device_right_edited.webp rename to manager-ui/src/assets/a3951_img_device_right_edited.webp diff --git a/manager-ui/assets/ambient_icon_anc.png b/manager-ui/src/assets/ambient_icon_anc.png similarity index 100% rename from manager-ui/assets/ambient_icon_anc.png rename to manager-ui/src/assets/ambient_icon_anc.png diff --git a/manager-ui/assets/ambient_icon_off.png b/manager-ui/src/assets/ambient_icon_off.png similarity index 100% rename from manager-ui/assets/ambient_icon_off.png rename to manager-ui/src/assets/ambient_icon_off.png diff --git a/manager-ui/assets/ambient_icon_trans.png b/manager-ui/src/assets/ambient_icon_trans.png similarity index 100% rename from manager-ui/assets/ambient_icon_trans.png rename to manager-ui/src/assets/ambient_icon_trans.png diff --git a/manager-ui/src/assets/index.d.ts b/manager-ui/src/assets/index.d.ts new file mode 100644 index 0000000..35c6e65 --- /dev/null +++ b/manager-ui/src/assets/index.d.ts @@ -0,0 +1,6 @@ +declare module '*.jpg'; +declare module '*.png'; +declare module '*.svg'; +declare module '*.gif'; +declare module '*.jpeg'; +declare module '*.webp'; diff --git a/manager-ui/src/components/OverviewCard.tsx b/manager-ui/src/components/OverviewCard.tsx index 9fba08f..ccc109a 100644 --- a/manager-ui/src/components/OverviewCard.tsx +++ b/manager-ui/src/components/OverviewCard.tsx @@ -1,11 +1,11 @@ import { Box, Grid, Paper, Typography } from '@mui/material'; -import A3951ImgLeft from './../assets/a3951_img_device_left.webp'; -import A3951ImgRight from './../assets/a3951_img_device_right_edited.webp'; -import A3027Img from './../assets/a3027_img_device.webp'; -import A3028Img from './../assets/a3028_img_device.webp'; -import A3029Img from './../assets/a3029_img_device.webp'; -import A3040Img from './../assets/a3040_img_device.webp'; -import A3935Img from './../assets/a3935_img_device.webp'; +import A3951ImgLeft from '@assets/a3951_img_device_left.webp'; +import A3951ImgRight from '@assets/a3951_img_device_right_edited.webp'; +import A3027Img from '@assets/a3027_img_device.webp'; +import A3028Img from '@assets/a3028_img_device.webp'; +import A3029Img from '@assets/a3029_img_device.webp'; +import A3040Img from '@assets/a3040_img_device.webp'; +import A3935Img from '@assets/a3935_img_device.webp'; import BatteryAlertIcon from '@mui/icons-material/BatteryAlert'; import Battery20Icon from '@mui/icons-material/Battery20'; @@ -19,7 +19,7 @@ import BatteryCharging80Icon from '@mui/icons-material/BatteryCharging80'; import BatteryFullIcon from '@mui/icons-material/BatteryFull'; import BatteryChargingFullIcon from '@mui/icons-material/BatteryChargingFull'; import BatteryUnknownIcon from '@mui/icons-material/BatteryUnknown'; -import { useBatteryLevel, useCharging, useDeviceModel } from '../hooks/useSoundcoreDevice'; +import { useBatteryLevel, useCharging, useDeviceModel } from '@hooks/useSoundcoreDevice'; export default function OverviewCard() { // if(levelQuery.isLoading || chargingQuery.isLoading) { diff --git a/manager-ui/tsconfig.json b/manager-ui/tsconfig.json index 3d0a51a..d142446 100644 --- a/manager-ui/tsconfig.json +++ b/manager-ui/tsconfig.json @@ -14,7 +14,16 @@ "resolveJsonModule": true, "isolatedModules": true, "noEmit": true, - "jsx": "react-jsx" + "jsx": "react-jsx", + "baseUrl": "./src", + "paths": { + "@assets/*": ["./assets/*"], + "@components/*": ["./components/*"], + "@screens/*": ["./screens/*"], + "@hooks/*": ["./hooks/*"], + "@stores/*": ["./stores/*"], + "@types/*": ["./types/*"] + } }, "include": ["src"], "references": [{ "path": "./tsconfig.node.json" }] diff --git a/manager-ui/vite.config.ts b/manager-ui/vite.config.ts index 773671d..ec4dc88 100644 --- a/manager-ui/vite.config.ts +++ b/manager-ui/vite.config.ts @@ -1,9 +1,10 @@ import { defineConfig } from 'vite'; import react from '@vitejs/plugin-react'; +import tsconfigPaths from 'vite-tsconfig-paths'; // https://vitejs.dev/config/ export default defineConfig({ - plugins: [react()], + plugins: [tsconfigPaths(), react()], // Vite options tailored for Tauri development and only applied in `tauri dev` or `tauri build` // prevent vite from obscuring rust errors diff --git a/package.json b/package.json index 2a89eb6..83ae96e 100644 --- a/package.json +++ b/package.json @@ -3,6 +3,9 @@ "private": true, "scripts": { "dev": "yarn workspace manager-ui dev", + "build": "yarn workspace manager-ui build", + "lint": "yarn workspace manager-ui lint", + "format": "yarn workspace manager-ui format", "tauri": "tauri" }, "devDependencies": { diff --git a/yarn.lock b/yarn.lock index 8d72004..7368351 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1379,7 +1379,7 @@ d3-selection@3, d3-selection@^3.0.0: resolved "https://registry.yarnpkg.com/d3-selection/-/d3-selection-3.0.0.tgz#c25338207efa72cc5b9bd1458a1a41901f1e1b31" integrity sha512-fmTRWbNMmsmWq6xJV8D19U/gw/bwrHfNXxrIN+HfZgnzqTHp9jOmKMhsTUjXOJnZOdZY9Q28y4yebKzqDKlxlQ== -debug@^4.1.0, debug@^4.3.1, debug@^4.3.2, debug@^4.3.4: +debug@^4.1.0, debug@^4.1.1, debug@^4.3.1, debug@^4.3.2, debug@^4.3.4: version "4.3.4" resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.4.tgz#1319f6579357f2338d3337d2cdd4914bb5dcc865" integrity sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ== @@ -1924,6 +1924,11 @@ globby@^11.1.0: merge2 "^1.4.1" slash "^3.0.0" +globrex@^0.1.2: + version "0.1.2" + resolved "https://registry.yarnpkg.com/globrex/-/globrex-0.1.2.tgz#dd5d9ec826232730cd6793a5e33a9302985e6098" + integrity sha512-uHJgbwAMwNFf5mLst7IWLNg14x1CkeqglJb/K3doi4dw6q2IvAAmM/Y81kevy83wP+Sst+nutFTYOGg3d1lsxg== + gopd@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/gopd/-/gopd-1.0.1.tgz#29ff76de69dac7489b7c0918a5788e56477c332c" @@ -2930,6 +2935,11 @@ ts-api-utils@^1.0.1: resolved "https://registry.yarnpkg.com/ts-api-utils/-/ts-api-utils-1.3.0.tgz#4b490e27129f1e8e686b45cc4ab63714dc60eea1" integrity sha512-UQMIo7pb8WRomKR1/+MFVLTroIvDVtMX3K6OUir8ynLyzB8Jeriont2bTAtmNPa1ekAgN7YPDyf6V+ygrdU+eQ== +tsconfck@^3.0.1: + version "3.0.3" + resolved "https://registry.yarnpkg.com/tsconfck/-/tsconfck-3.0.3.tgz#d9bda0e87d05b1c360e996c9050473c7e6f8084f" + integrity sha512-4t0noZX9t6GcPTfBAbIbbIU4pfpCwh0ueq3S4O/5qXI1VwK1outmxhe9dOiEWqMz3MW2LKgDTpqWV+37IWuVbA== + tslib@^2.6.2: version "2.6.2" resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.6.2.tgz#703ac29425e7b37cd6fd456e92404d46d1f3e4ae" @@ -3031,6 +3041,15 @@ use-sync-external-store@1.2.0, use-sync-external-store@^1.2.0: resolved "https://registry.yarnpkg.com/use-sync-external-store/-/use-sync-external-store-1.2.0.tgz#7dbefd6ef3fe4e767a0cf5d7287aacfb5846928a" integrity sha512-eEgnFxGQ1Ife9bzYs6VLi8/4X6CObHMw9Qr9tPY43iKwsPw8xE8+EFsf/2cFZ5S3esXgpWgtSCtLNS41F+sKPA== +vite-tsconfig-paths@^4.3.1: + version "4.3.1" + resolved "https://registry.yarnpkg.com/vite-tsconfig-paths/-/vite-tsconfig-paths-4.3.1.tgz#28762938151e7c80aec9d70c57e65ddce43a576f" + integrity sha512-cfgJwcGOsIxXOLU/nELPny2/LUD/lcf1IbfyeKTv2bsupVbTH/xpFtdQlBmIP1GEK2CjjLxYhFfB+QODFAx5aw== + dependencies: + debug "^4.1.1" + globrex "^0.1.2" + tsconfck "^3.0.1" + vite@^5.1.5: version "5.1.5" resolved "https://registry.yarnpkg.com/vite/-/vite-5.1.5.tgz#bdbc2b15e8000d9cc5172f059201178f9c9de5fb"