From 5144061f5442aeac4f4a78418be8057e771acd09 Mon Sep 17 00:00:00 2001 From: xWyvernPx Date: Mon, 6 Nov 2023 11:26:08 +0700 Subject: [PATCH] language --- package.json | 1 + pnpm-lock.yaml | 656 +++++++++++++++++- src/base/hooks/useAuth.ts | 17 +- src/base/hooks/useConfig.ts | 3 +- .../Header/HeaderContent/Localization.tsx | 27 +- .../MainLayout/Header/HeaderContent/index.tsx | 4 +- src/base/page/auth/sections/AuthLogin.tsx | 3 +- .../page/auth/sections/FirebaseSocial.tsx | 12 +- src/base/store/atoms/auth.ts | 17 +- src/base/store/context/FirebaseContext.tsx | 111 +++ src/config.ts | 4 +- src/lang.py | 29 + src/main.tsx | 9 +- src/modules/customer/pages/list/list.tsx | 2 +- .../order/components/Menu/OrderActionMenu.tsx | 111 +++ src/modules/order/hook/useOrderTable.tsx | 1 + .../order/pages/list/OrderListPage.tsx | 65 +- src/translations.csv | 7 + src/types/config.ts | 2 +- src/utils/lang/i18n.ts | 10 +- src/utils/lang/locale/en.json | 8 + src/utils/lang/locale/ko.json | 8 + src/utils/lang/locale/vi.json | 8 + vite.config.ts | 2 + 24 files changed, 1044 insertions(+), 73 deletions(-) create mode 100644 src/base/store/context/FirebaseContext.tsx create mode 100644 src/lang.py create mode 100644 src/modules/order/components/Menu/OrderActionMenu.tsx create mode 100644 src/translations.csv create mode 100644 src/utils/lang/locale/en.json create mode 100644 src/utils/lang/locale/ko.json create mode 100644 src/utils/lang/locale/vi.json diff --git a/package.json b/package.json index f38ae03..f492808 100644 --- a/package.json +++ b/package.json @@ -42,6 +42,7 @@ "cva": "^0.0.0", "date-fns": "^2.30.0", "dayjs": "^1.11.10", + "firebase": "^10.5.2", "framer-motion": "^10.12.11", "graphql-request": "^6.0.0", "history": "^5.3.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index b04ede0..ca7d4e7 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -83,6 +83,9 @@ dependencies: dayjs: specifier: ^1.11.10 version: 1.11.10 + firebase: + specifier: ^10.5.2 + version: 10.5.2 framer-motion: specifier: ^10.12.11 version: 10.12.11(react-dom@18.2.0)(react@18.2.0) @@ -3074,6 +3077,460 @@ packages: resolution: {integrity: sha512-cEee/Z+I12mZcFJshKcCqC8tuX5hG3s+d+9nZ3LabqKF1vKdF41B92pJVCBggjAGORAeOzyyDDKrZwIkLffeOQ==} dev: true + /@firebase/analytics-compat@0.2.6(@firebase/app-compat@0.2.22)(@firebase/app@0.9.22): + resolution: {integrity: sha512-4MqpVLFkGK7NJf/5wPEEP7ePBJatwYpyjgJ+wQHQGHfzaCDgntOnl9rL2vbVGGKCnRqWtZDIWhctB86UWXaX2Q==} + peerDependencies: + '@firebase/app-compat': 0.x + dependencies: + '@firebase/analytics': 0.10.0(@firebase/app@0.9.22) + '@firebase/analytics-types': 0.8.0 + '@firebase/app-compat': 0.2.22 + '@firebase/component': 0.6.4 + '@firebase/util': 1.9.3 + tslib: 2.6.2 + transitivePeerDependencies: + - '@firebase/app' + dev: false + + /@firebase/analytics-types@0.8.0: + resolution: {integrity: sha512-iRP+QKI2+oz3UAh4nPEq14CsEjrjD6a5+fuypjScisAh9kXKFvdJOZJDwk7kikLvWVLGEs9+kIUS4LPQV7VZVw==} + dev: false + + /@firebase/analytics@0.10.0(@firebase/app@0.9.22): + resolution: {integrity: sha512-Locv8gAqx0e+GX/0SI3dzmBY5e9kjVDtD+3zCFLJ0tH2hJwuCAiL+5WkHuxKj92rqQj/rvkBUCfA1ewlX2hehg==} + peerDependencies: + '@firebase/app': 0.x + dependencies: + '@firebase/app': 0.9.22 + '@firebase/component': 0.6.4 + '@firebase/installations': 0.6.4(@firebase/app@0.9.22) + '@firebase/logger': 0.4.0 + '@firebase/util': 1.9.3 + tslib: 2.6.2 + dev: false + + /@firebase/app-check-compat@0.3.7(@firebase/app-compat@0.2.22)(@firebase/app@0.9.22): + resolution: {integrity: sha512-cW682AxsyP1G+Z0/P7pO/WT2CzYlNxoNe5QejVarW2o5ZxeWSSPAiVEwpEpQR/bUlUmdeWThYTMvBWaopdBsqw==} + peerDependencies: + '@firebase/app-compat': 0.x + dependencies: + '@firebase/app-check': 0.8.0(@firebase/app@0.9.22) + '@firebase/app-check-types': 0.5.0 + '@firebase/app-compat': 0.2.22 + '@firebase/component': 0.6.4 + '@firebase/logger': 0.4.0 + '@firebase/util': 1.9.3 + tslib: 2.6.2 + transitivePeerDependencies: + - '@firebase/app' + dev: false + + /@firebase/app-check-interop-types@0.3.0: + resolution: {integrity: sha512-xAxHPZPIgFXnI+vb4sbBjZcde7ZluzPPaSK7Lx3/nmuVk4TjZvnL8ONnkd4ERQKL8WePQySU+pRcWkh8rDf5Sg==} + dev: false + + /@firebase/app-check-types@0.5.0: + resolution: {integrity: sha512-uwSUj32Mlubybw7tedRzR24RP8M8JUVR3NPiMk3/Z4bCmgEKTlQBwMXrehDAZ2wF+TsBq0SN1c6ema71U/JPyQ==} + dev: false + + /@firebase/app-check@0.8.0(@firebase/app@0.9.22): + resolution: {integrity: sha512-dRDnhkcaC2FspMiRK/Vbp+PfsOAEP6ZElGm9iGFJ9fDqHoPs0HOPn7dwpJ51lCFi1+2/7n5pRPGhqF/F03I97g==} + peerDependencies: + '@firebase/app': 0.x + dependencies: + '@firebase/app': 0.9.22 + '@firebase/component': 0.6.4 + '@firebase/logger': 0.4.0 + '@firebase/util': 1.9.3 + tslib: 2.6.2 + dev: false + + /@firebase/app-compat@0.2.22: + resolution: {integrity: sha512-kyksJFA19Oz5HZmR56s/ziOM6ivDBF9JYwC0ufacooYNd2sQ3pRsi5MZAYb1FR9hCE7MgoHuPmTtBHA7S/Cv8g==} + dependencies: + '@firebase/app': 0.9.22 + '@firebase/component': 0.6.4 + '@firebase/logger': 0.4.0 + '@firebase/util': 1.9.3 + tslib: 2.6.2 + dev: false + + /@firebase/app-types@0.9.0: + resolution: {integrity: sha512-AeweANOIo0Mb8GiYm3xhTEBVCmPwTYAu9Hcd2qSkLuga/6+j9b1Jskl5bpiSQWy9eJ/j5pavxj6eYogmnuzm+Q==} + dev: false + + /@firebase/app@0.9.22: + resolution: {integrity: sha512-4hbUg9ojPbn4Gj21Z/GnJbiLQYOzkwBDFT5vBkQgUJJGS28qQLG6eZZ1DwLKh8lcrNJc4MR90OPaJWhSzJCR2w==} + dependencies: + '@firebase/component': 0.6.4 + '@firebase/logger': 0.4.0 + '@firebase/util': 1.9.3 + idb: 7.1.1 + tslib: 2.6.2 + dev: false + + /@firebase/auth-compat@0.4.8(@firebase/app-compat@0.2.22)(@firebase/app-types@0.9.0)(@firebase/app@0.9.22): + resolution: {integrity: sha512-qKX8BOl1qewBzpfAXl6/lKPW7fjnY8/3umiSFIGO8SHwLQ3LsAdNFPdwafouwMiKLo5MXxW4XdxNSI4ilt0Z5w==} + peerDependencies: + '@firebase/app-compat': 0.x + dependencies: + '@firebase/app-compat': 0.2.22 + '@firebase/auth': 1.3.2(@firebase/app@0.9.22) + '@firebase/auth-types': 0.12.0(@firebase/app-types@0.9.0)(@firebase/util@1.9.3) + '@firebase/component': 0.6.4 + '@firebase/util': 1.9.3 + node-fetch: 2.6.7 + tslib: 2.6.2 + transitivePeerDependencies: + - '@firebase/app' + - '@firebase/app-types' + - '@react-native-async-storage/async-storage' + - encoding + dev: false + + /@firebase/auth-interop-types@0.2.1: + resolution: {integrity: sha512-VOaGzKp65MY6P5FI84TfYKBXEPi6LmOCSMMzys6o2BN2LOsqy7pCuZCup7NYnfbk5OkkQKzvIfHOzTm0UDpkyg==} + dev: false + + /@firebase/auth-types@0.12.0(@firebase/app-types@0.9.0)(@firebase/util@1.9.3): + resolution: {integrity: sha512-pPwaZt+SPOshK8xNoiQlK5XIrS97kFYc3Rc7xmy373QsOJ9MmqXxLaYssP5Kcds4wd2qK//amx/c+A8O2fVeZA==} + peerDependencies: + '@firebase/app-types': 0.x + '@firebase/util': 1.x + dependencies: + '@firebase/app-types': 0.9.0 + '@firebase/util': 1.9.3 + dev: false + + /@firebase/auth@1.3.2(@firebase/app@0.9.22): + resolution: {integrity: sha512-ksYpeRACL8INRpFZzbCLLnI9NP+L3UH/+ebKo4oBjhc/dSwPbpw6E1wjdm0odB1U5xHhXD/5lpyeFQZ+jXyBxA==} + peerDependencies: + '@firebase/app': 0.x + '@react-native-async-storage/async-storage': ^1.18.1 + peerDependenciesMeta: + '@react-native-async-storage/async-storage': + optional: true + dependencies: + '@firebase/app': 0.9.22 + '@firebase/component': 0.6.4 + '@firebase/logger': 0.4.0 + '@firebase/util': 1.9.3 + node-fetch: 2.6.7 + tslib: 2.6.2 + transitivePeerDependencies: + - encoding + dev: false + + /@firebase/component@0.6.4: + resolution: {integrity: sha512-rLMyrXuO9jcAUCaQXCMjCMUsWrba5fzHlNK24xz5j2W6A/SRmK8mZJ/hn7V0fViLbxC0lPMtrK1eYzk6Fg03jA==} + dependencies: + '@firebase/util': 1.9.3 + tslib: 2.6.2 + dev: false + + /@firebase/database-compat@1.0.1: + resolution: {integrity: sha512-ky82yLIboLxtAIWyW/52a6HLMVTzD2kpZlEilVDok73pNPLjkJYowj8iaIWK5nTy7+6Gxt7d00zfjL6zckGdXQ==} + dependencies: + '@firebase/component': 0.6.4 + '@firebase/database': 1.0.1 + '@firebase/database-types': 1.0.0 + '@firebase/logger': 0.4.0 + '@firebase/util': 1.9.3 + tslib: 2.6.2 + dev: false + + /@firebase/database-types@1.0.0: + resolution: {integrity: sha512-SjnXStoE0Q56HcFgNQ+9SsmJc0c8TqGARdI/T44KXy+Ets3r6x/ivhQozT66bMnCEjJRywYoxNurRTMlZF8VNg==} + dependencies: + '@firebase/app-types': 0.9.0 + '@firebase/util': 1.9.3 + dev: false + + /@firebase/database@1.0.1: + resolution: {integrity: sha512-VAhF7gYwunW4Lw/+RQZvW8dlsf2r0YYqV9W0Gi2Mz8+0TGg1mBJWoUtsHfOr8kPJXhcLsC4eP/z3x6L/Fvjk/A==} + dependencies: + '@firebase/auth-interop-types': 0.2.1 + '@firebase/component': 0.6.4 + '@firebase/logger': 0.4.0 + '@firebase/util': 1.9.3 + faye-websocket: 0.11.4 + tslib: 2.6.2 + dev: false + + /@firebase/firestore-compat@0.3.21(@firebase/app-compat@0.2.22)(@firebase/app-types@0.9.0)(@firebase/app@0.9.22): + resolution: {integrity: sha512-u17so8cP4FQBEJyivAbZc0kW09YBXBvhSmUXiB7swkOLemfZUmmPZQGJxZGa9y/M02euU1y4EzvWN/h/bkx8pg==} + peerDependencies: + '@firebase/app-compat': 0.x + dependencies: + '@firebase/app-compat': 0.2.22 + '@firebase/component': 0.6.4 + '@firebase/firestore': 4.3.2(@firebase/app@0.9.22) + '@firebase/firestore-types': 3.0.0(@firebase/app-types@0.9.0)(@firebase/util@1.9.3) + '@firebase/util': 1.9.3 + tslib: 2.6.2 + transitivePeerDependencies: + - '@firebase/app' + - '@firebase/app-types' + - encoding + dev: false + + /@firebase/firestore-types@3.0.0(@firebase/app-types@0.9.0)(@firebase/util@1.9.3): + resolution: {integrity: sha512-Meg4cIezHo9zLamw0ymFYBD4SMjLb+ZXIbuN7T7ddXN6MGoICmOTq3/ltdCGoDCS2u+H1XJs2u/cYp75jsX9Qw==} + peerDependencies: + '@firebase/app-types': 0.x + '@firebase/util': 1.x + dependencies: + '@firebase/app-types': 0.9.0 + '@firebase/util': 1.9.3 + dev: false + + /@firebase/firestore@4.3.2(@firebase/app@0.9.22): + resolution: {integrity: sha512-K4TwMbgArWw+XAEUYX/vtk+TVy9n1uLeJKSrQeb89lwfkfyFINGLPME6YleaS0ovD1ziLM5/0WgL1CR4s53fDg==} + engines: {node: '>=10.10.0'} + peerDependencies: + '@firebase/app': 0.x + dependencies: + '@firebase/app': 0.9.22 + '@firebase/component': 0.6.4 + '@firebase/logger': 0.4.0 + '@firebase/util': 1.9.3 + '@firebase/webchannel-wrapper': 0.10.3 + '@grpc/grpc-js': 1.9.9 + '@grpc/proto-loader': 0.7.10 + node-fetch: 2.6.7 + tslib: 2.6.2 + transitivePeerDependencies: + - encoding + dev: false + + /@firebase/functions-compat@0.3.5(@firebase/app-compat@0.2.22)(@firebase/app@0.9.22): + resolution: {integrity: sha512-uD4jwgwVqdWf6uc3NRKF8cSZ0JwGqSlyhPgackyUPe+GAtnERpS4+Vr66g0b3Gge0ezG4iyHo/EXW/Hjx7QhHw==} + peerDependencies: + '@firebase/app-compat': 0.x + dependencies: + '@firebase/app-compat': 0.2.22 + '@firebase/component': 0.6.4 + '@firebase/functions': 0.10.0(@firebase/app@0.9.22) + '@firebase/functions-types': 0.6.0 + '@firebase/util': 1.9.3 + tslib: 2.6.2 + transitivePeerDependencies: + - '@firebase/app' + - encoding + dev: false + + /@firebase/functions-types@0.6.0: + resolution: {integrity: sha512-hfEw5VJtgWXIRf92ImLkgENqpL6IWpYaXVYiRkFY1jJ9+6tIhWM7IzzwbevwIIud/jaxKVdRzD7QBWfPmkwCYw==} + dev: false + + /@firebase/functions@0.10.0(@firebase/app@0.9.22): + resolution: {integrity: sha512-2U+fMNxTYhtwSpkkR6WbBcuNMOVaI7MaH3cZ6UAeNfj7AgEwHwMIFLPpC13YNZhno219F0lfxzTAA0N62ndWzA==} + peerDependencies: + '@firebase/app': 0.x + dependencies: + '@firebase/app': 0.9.22 + '@firebase/app-check-interop-types': 0.3.0 + '@firebase/auth-interop-types': 0.2.1 + '@firebase/component': 0.6.4 + '@firebase/messaging-interop-types': 0.2.0 + '@firebase/util': 1.9.3 + node-fetch: 2.6.7 + tslib: 2.6.2 + transitivePeerDependencies: + - encoding + dev: false + + /@firebase/installations-compat@0.2.4(@firebase/app-compat@0.2.22)(@firebase/app-types@0.9.0)(@firebase/app@0.9.22): + resolution: {integrity: sha512-LI9dYjp0aT9Njkn9U4JRrDqQ6KXeAmFbRC0E7jI7+hxl5YmRWysq5qgQl22hcWpTk+cm3es66d/apoDU/A9n6Q==} + peerDependencies: + '@firebase/app-compat': 0.x + dependencies: + '@firebase/app-compat': 0.2.22 + '@firebase/component': 0.6.4 + '@firebase/installations': 0.6.4(@firebase/app@0.9.22) + '@firebase/installations-types': 0.5.0(@firebase/app-types@0.9.0) + '@firebase/util': 1.9.3 + tslib: 2.6.2 + transitivePeerDependencies: + - '@firebase/app' + - '@firebase/app-types' + dev: false + + /@firebase/installations-types@0.5.0(@firebase/app-types@0.9.0): + resolution: {integrity: sha512-9DP+RGfzoI2jH7gY4SlzqvZ+hr7gYzPODrbzVD82Y12kScZ6ZpRg/i3j6rleto8vTFC8n6Len4560FnV1w2IRg==} + peerDependencies: + '@firebase/app-types': 0.x + dependencies: + '@firebase/app-types': 0.9.0 + dev: false + + /@firebase/installations@0.6.4(@firebase/app@0.9.22): + resolution: {integrity: sha512-u5y88rtsp7NYkCHC3ElbFBrPtieUybZluXyzl7+4BsIz4sqb4vSAuwHEUgCgCeaQhvsnxDEU6icly8U9zsJigA==} + peerDependencies: + '@firebase/app': 0.x + dependencies: + '@firebase/app': 0.9.22 + '@firebase/component': 0.6.4 + '@firebase/util': 1.9.3 + idb: 7.0.1 + tslib: 2.6.2 + dev: false + + /@firebase/logger@0.4.0: + resolution: {integrity: sha512-eRKSeykumZ5+cJPdxxJRgAC3G5NknY2GwEbKfymdnXtnT0Ucm4pspfR6GT4MUQEDuJwRVbVcSx85kgJulMoFFA==} + dependencies: + tslib: 2.6.2 + dev: false + + /@firebase/messaging-compat@0.2.4(@firebase/app-compat@0.2.22)(@firebase/app@0.9.22): + resolution: {integrity: sha512-lyFjeUhIsPRYDPNIkYX1LcZMpoVbBWXX4rPl7c/rqc7G+EUea7IEtSt4MxTvh6fDfPuzLn7+FZADfscC+tNMfg==} + peerDependencies: + '@firebase/app-compat': 0.x + dependencies: + '@firebase/app-compat': 0.2.22 + '@firebase/component': 0.6.4 + '@firebase/messaging': 0.12.4(@firebase/app@0.9.22) + '@firebase/util': 1.9.3 + tslib: 2.6.2 + transitivePeerDependencies: + - '@firebase/app' + dev: false + + /@firebase/messaging-interop-types@0.2.0: + resolution: {integrity: sha512-ujA8dcRuVeBixGR9CtegfpU4YmZf3Lt7QYkcj693FFannwNuZgfAYaTmbJ40dtjB81SAu6tbFPL9YLNT15KmOQ==} + dev: false + + /@firebase/messaging@0.12.4(@firebase/app@0.9.22): + resolution: {integrity: sha512-6JLZct6zUaex4g7HI3QbzeUrg9xcnmDAPTWpkoMpd/GoSVWH98zDoWXMGrcvHeCAIsLpFMe4MPoZkJbrPhaASw==} + peerDependencies: + '@firebase/app': 0.x + dependencies: + '@firebase/app': 0.9.22 + '@firebase/component': 0.6.4 + '@firebase/installations': 0.6.4(@firebase/app@0.9.22) + '@firebase/messaging-interop-types': 0.2.0 + '@firebase/util': 1.9.3 + idb: 7.0.1 + tslib: 2.6.2 + dev: false + + /@firebase/performance-compat@0.2.4(@firebase/app-compat@0.2.22)(@firebase/app@0.9.22): + resolution: {integrity: sha512-nnHUb8uP9G8islzcld/k6Bg5RhX62VpbAb/Anj7IXs/hp32Eb2LqFPZK4sy3pKkBUO5wcrlRWQa6wKOxqlUqsg==} + peerDependencies: + '@firebase/app-compat': 0.x + dependencies: + '@firebase/app-compat': 0.2.22 + '@firebase/component': 0.6.4 + '@firebase/logger': 0.4.0 + '@firebase/performance': 0.6.4(@firebase/app@0.9.22) + '@firebase/performance-types': 0.2.0 + '@firebase/util': 1.9.3 + tslib: 2.6.2 + transitivePeerDependencies: + - '@firebase/app' + dev: false + + /@firebase/performance-types@0.2.0: + resolution: {integrity: sha512-kYrbr8e/CYr1KLrLYZZt2noNnf+pRwDq2KK9Au9jHrBMnb0/C9X9yWSXmZkFt4UIdsQknBq8uBB7fsybZdOBTA==} + dev: false + + /@firebase/performance@0.6.4(@firebase/app@0.9.22): + resolution: {integrity: sha512-HfTn/bd8mfy/61vEqaBelNiNnvAbUtME2S25A67Nb34zVuCSCRIX4SseXY6zBnOFj3oLisaEqhVcJmVPAej67g==} + peerDependencies: + '@firebase/app': 0.x + dependencies: + '@firebase/app': 0.9.22 + '@firebase/component': 0.6.4 + '@firebase/installations': 0.6.4(@firebase/app@0.9.22) + '@firebase/logger': 0.4.0 + '@firebase/util': 1.9.3 + tslib: 2.6.2 + dev: false + + /@firebase/remote-config-compat@0.2.4(@firebase/app-compat@0.2.22)(@firebase/app@0.9.22): + resolution: {integrity: sha512-FKiki53jZirrDFkBHglB3C07j5wBpitAaj8kLME6g8Mx+aq7u9P7qfmuSRytiOItADhWUj7O1JIv7n9q87SuwA==} + peerDependencies: + '@firebase/app-compat': 0.x + dependencies: + '@firebase/app-compat': 0.2.22 + '@firebase/component': 0.6.4 + '@firebase/logger': 0.4.0 + '@firebase/remote-config': 0.4.4(@firebase/app@0.9.22) + '@firebase/remote-config-types': 0.3.0 + '@firebase/util': 1.9.3 + tslib: 2.6.2 + transitivePeerDependencies: + - '@firebase/app' + dev: false + + /@firebase/remote-config-types@0.3.0: + resolution: {integrity: sha512-RtEH4vdcbXZuZWRZbIRmQVBNsE7VDQpet2qFvq6vwKLBIQRQR5Kh58M4ok3A3US8Sr3rubYnaGqZSurCwI8uMA==} + dev: false + + /@firebase/remote-config@0.4.4(@firebase/app@0.9.22): + resolution: {integrity: sha512-x1ioTHGX8ZwDSTOVp8PBLv2/wfwKzb4pxi0gFezS5GCJwbLlloUH4YYZHHS83IPxnua8b6l0IXUaWd0RgbWwzQ==} + peerDependencies: + '@firebase/app': 0.x + dependencies: + '@firebase/app': 0.9.22 + '@firebase/component': 0.6.4 + '@firebase/installations': 0.6.4(@firebase/app@0.9.22) + '@firebase/logger': 0.4.0 + '@firebase/util': 1.9.3 + tslib: 2.6.2 + dev: false + + /@firebase/storage-compat@0.3.2(@firebase/app-compat@0.2.22)(@firebase/app-types@0.9.0)(@firebase/app@0.9.22): + resolution: {integrity: sha512-wvsXlLa9DVOMQJckbDNhXKKxRNNewyUhhbXev3t8kSgoCotd1v3MmqhKKz93ePhDnhHnDs7bYHy+Qa8dRY6BXw==} + peerDependencies: + '@firebase/app-compat': 0.x + dependencies: + '@firebase/app-compat': 0.2.22 + '@firebase/component': 0.6.4 + '@firebase/storage': 0.11.2(@firebase/app@0.9.22) + '@firebase/storage-types': 0.8.0(@firebase/app-types@0.9.0)(@firebase/util@1.9.3) + '@firebase/util': 1.9.3 + tslib: 2.6.2 + transitivePeerDependencies: + - '@firebase/app' + - '@firebase/app-types' + - encoding + dev: false + + /@firebase/storage-types@0.8.0(@firebase/app-types@0.9.0)(@firebase/util@1.9.3): + resolution: {integrity: sha512-isRHcGrTs9kITJC0AVehHfpraWFui39MPaU7Eo8QfWlqW7YPymBmRgjDrlOgFdURh6Cdeg07zmkLP5tzTKRSpg==} + peerDependencies: + '@firebase/app-types': 0.x + '@firebase/util': 1.x + dependencies: + '@firebase/app-types': 0.9.0 + '@firebase/util': 1.9.3 + dev: false + + /@firebase/storage@0.11.2(@firebase/app@0.9.22): + resolution: {integrity: sha512-CtvoFaBI4hGXlXbaCHf8humajkbXhs39Nbh6MbNxtwJiCqxPy9iH3D3CCfXAvP0QvAAwmJUTK3+z9a++Kc4nkA==} + peerDependencies: + '@firebase/app': 0.x + dependencies: + '@firebase/app': 0.9.22 + '@firebase/component': 0.6.4 + '@firebase/util': 1.9.3 + node-fetch: 2.6.7 + tslib: 2.6.2 + transitivePeerDependencies: + - encoding + dev: false + + /@firebase/util@1.9.3: + resolution: {integrity: sha512-DY02CRhOZwpzO36fHpuVysz6JZrscPiBXD0fXp6qSrL9oNOx5KWICKdR95C0lSITzxp0TZosVyHqzatE8JbcjA==} + dependencies: + tslib: 2.6.2 + dev: false + + /@firebase/webchannel-wrapper@0.10.3: + resolution: {integrity: sha512-+ZplYUN3HOpgCfgInqgdDAbkGGVzES1cs32JJpeqoh87SkRobGXElJx+1GZSaDqzFL+bYiX18qEcBK76mYs8uA==} + dev: false + /@floating-ui/core@1.4.1: resolution: {integrity: sha512-jk3WqquEJRlcyu7997NtR5PibI+y5bi+LS3hPmguVClypenMsCY3CBa3LAQnozRCtCrYWSEtAdiskpamuJRFOQ==} dependencies: @@ -3184,6 +3641,25 @@ packages: graphql: 16.8.0 dev: false + /@grpc/grpc-js@1.9.9: + resolution: {integrity: sha512-vQ1qwi/Kiyprt+uhb1+rHMpyk4CVRMTGNUGGPRGS7pLNfWkdCHrGEnT6T3/JyC2VZgoOX/X1KwdoU0WYQAeYcQ==} + engines: {node: ^8.13.0 || >=10.10.0} + dependencies: + '@grpc/proto-loader': 0.7.10 + '@types/node': 20.5.9 + dev: false + + /@grpc/proto-loader@0.7.10: + resolution: {integrity: sha512-CAqDfoaQ8ykFd9zqBDn4k6iWT9loLAlc2ETmDFS9JCD70gDcnA4L3AFEo2iV7KyAtAAHFW9ftq1Fz+Vsgq80RQ==} + engines: {node: '>=6'} + hasBin: true + dependencies: + lodash.camelcase: 4.3.0 + long: 5.2.3 + protobufjs: 7.2.5 + yargs: 17.7.2 + dev: false + /@here/maps-api-for-javascript@1.47.0: resolution: {integrity: sha1-EvQYNY/BSwEFWJ1x7ceAy3yi9u8=, tarball: https://repo.platform.here.com/artifactory/api/npm/maps-api-for-javascript/-/@here/maps-api-for-javascript-1.47.0.tgz} dev: false @@ -3675,6 +4151,49 @@ packages: resolution: {integrity: sha512-P1st0aksCrn9sGZhp8GMYwBnQsbvAWsZAX44oXNNvLHGqAOcoVxmjZiohstwQ7SqKnbR47akdNi+uleWD8+g6A==} dev: false + /@protobufjs/aspromise@1.1.2: + resolution: {integrity: sha512-j+gKExEuLmKwvz3OgROXtrJ2UG2x8Ch2YZUxahh+s1F2HZ+wAceUNLkvy6zKCPVRkU++ZWQrdxsUeQXmcg4uoQ==} + dev: false + + /@protobufjs/base64@1.1.2: + resolution: {integrity: sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg==} + dev: false + + /@protobufjs/codegen@2.0.4: + resolution: {integrity: sha512-YyFaikqM5sH0ziFZCN3xDC7zeGaB/d0IUb9CATugHWbd1FRFwWwt4ld4OYMPWu5a3Xe01mGAULCdqhMlPl29Jg==} + dev: false + + /@protobufjs/eventemitter@1.1.0: + resolution: {integrity: sha512-j9ednRT81vYJ9OfVuXG6ERSTdEL1xVsNgqpkxMsbIabzSo3goCjDIveeGv5d03om39ML71RdmrGNjG5SReBP/Q==} + dev: false + + /@protobufjs/fetch@1.1.0: + resolution: {integrity: sha512-lljVXpqXebpsijW71PZaCYeIcE5on1w5DlQy5WH6GLbFryLUrBD4932W/E2BSpfRJWseIL4v/KPgBFxDOIdKpQ==} + dependencies: + '@protobufjs/aspromise': 1.1.2 + '@protobufjs/inquire': 1.1.0 + dev: false + + /@protobufjs/float@1.0.2: + resolution: {integrity: sha512-Ddb+kVXlXst9d+R9PfTIxh1EdNkgoRe5tOX6t01f1lYWOvJnSPDBlG241QLzcyPdoNTsblLUdujGSE4RzrTZGQ==} + dev: false + + /@protobufjs/inquire@1.1.0: + resolution: {integrity: sha512-kdSefcPdruJiFMVSbn801t4vFK7KB/5gd2fYvrxhuJYg8ILrmn9SKSX2tZdV6V+ksulWqS7aXjBcRXl3wHoD9Q==} + dev: false + + /@protobufjs/path@1.1.2: + resolution: {integrity: sha512-6JOcJ5Tm08dOHAbdR3GrvP+yUUfkjG5ePsHYczMFLq3ZmMkAD98cDgcT2iA1lJ9NVwFd4tH/iSSoe44YWkltEA==} + dev: false + + /@protobufjs/pool@1.1.0: + resolution: {integrity: sha512-0kELaGSIDBKvcgS4zkjz1PeddatrjYcmMWOlAuAPwAeccUrPHdUqo/J6LiymHHEiJT5NrF1UVwxY14f+fy4WQw==} + dev: false + + /@protobufjs/utf8@1.1.0: + resolution: {integrity: sha512-Vvn3zZrhQZkkBE8LSuW3em98c0FwgO4nxzv6OdSxPKJIEKY2bGbHn+mhGIPerzI4twdxaP8/0+06HBpwf345Lw==} + dev: false + /@react-dnd/asap@5.0.2: resolution: {integrity: sha512-WLyfoHvxhs0V9U+GTsGilGgf2QsPl6ZZ44fnv0/b8T3nQyvzxidxsg/ZltbWssbsRDlYW8UKSQMTGotuTotZ6A==} dev: false @@ -6582,6 +7101,15 @@ packages: wrap-ansi: 7.0.0 dev: true + /cliui@8.0.1: + resolution: {integrity: sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==} + engines: {node: '>=12'} + dependencies: + string-width: 4.2.3 + strip-ansi: 6.0.1 + wrap-ansi: 7.0.0 + dev: false + /clone-deep@4.0.1: resolution: {integrity: sha512-neHB9xuzh/wk0dIHweyAXv2aPGZIVk3pLMe+/RNzINf17fe0OG96QroktYAUm7SM1PBnzTabaLboqqxDyMU+SQ==} engines: {node: '>=6'} @@ -7678,6 +8206,13 @@ packages: reusify: 1.0.4 dev: true + /faye-websocket@0.11.4: + resolution: {integrity: sha512-CzbClwlXAuiRQAlUyfqPgvPoNKTckTPGfwZV4ZdAhVcP2lh9KUxJg2b5GkE7XbjKQ3YJnQ9z6D9ntLAlB+tP8g==} + engines: {node: '>=0.8.0'} + dependencies: + websocket-driver: 0.7.4 + dev: false + /fb-watchman@2.0.2: resolution: {integrity: sha512-p5161BqbuCaSnB8jIbzQHOlpgsPmK5rJVDfDKO91Axs5NC1uu3HRQm6wt9cd9/+GtQQIO53JdGXXoyDpTAsgYA==} dependencies: @@ -7798,6 +8333,40 @@ packages: path-exists: 4.0.0 dev: true + /firebase@10.5.2: + resolution: {integrity: sha512-LLCig21TBYdByMbGJt5YmUzzk2HpsFCsIUTvOteQjW9BUh40IrSP2+dZi9IvT8RlztM3zcH+TNZ0jOsOaa7GMQ==} + dependencies: + '@firebase/analytics': 0.10.0(@firebase/app@0.9.22) + '@firebase/analytics-compat': 0.2.6(@firebase/app-compat@0.2.22)(@firebase/app@0.9.22) + '@firebase/app': 0.9.22 + '@firebase/app-check': 0.8.0(@firebase/app@0.9.22) + '@firebase/app-check-compat': 0.3.7(@firebase/app-compat@0.2.22)(@firebase/app@0.9.22) + '@firebase/app-compat': 0.2.22 + '@firebase/app-types': 0.9.0 + '@firebase/auth': 1.3.2(@firebase/app@0.9.22) + '@firebase/auth-compat': 0.4.8(@firebase/app-compat@0.2.22)(@firebase/app-types@0.9.0)(@firebase/app@0.9.22) + '@firebase/database': 1.0.1 + '@firebase/database-compat': 1.0.1 + '@firebase/firestore': 4.3.2(@firebase/app@0.9.22) + '@firebase/firestore-compat': 0.3.21(@firebase/app-compat@0.2.22)(@firebase/app-types@0.9.0)(@firebase/app@0.9.22) + '@firebase/functions': 0.10.0(@firebase/app@0.9.22) + '@firebase/functions-compat': 0.3.5(@firebase/app-compat@0.2.22)(@firebase/app@0.9.22) + '@firebase/installations': 0.6.4(@firebase/app@0.9.22) + '@firebase/installations-compat': 0.2.4(@firebase/app-compat@0.2.22)(@firebase/app-types@0.9.0)(@firebase/app@0.9.22) + '@firebase/messaging': 0.12.4(@firebase/app@0.9.22) + '@firebase/messaging-compat': 0.2.4(@firebase/app-compat@0.2.22)(@firebase/app@0.9.22) + '@firebase/performance': 0.6.4(@firebase/app@0.9.22) + '@firebase/performance-compat': 0.2.4(@firebase/app-compat@0.2.22)(@firebase/app@0.9.22) + '@firebase/remote-config': 0.4.4(@firebase/app@0.9.22) + '@firebase/remote-config-compat': 0.2.4(@firebase/app-compat@0.2.22)(@firebase/app@0.9.22) + '@firebase/storage': 0.11.2(@firebase/app@0.9.22) + '@firebase/storage-compat': 0.3.2(@firebase/app-compat@0.2.22)(@firebase/app-types@0.9.0)(@firebase/app@0.9.22) + '@firebase/util': 1.9.3 + transitivePeerDependencies: + - '@react-native-async-storage/async-storage' + - encoding + dev: false + /flat-cache@3.0.4: resolution: {integrity: sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg==} engines: {node: ^10.12.0 || >=12.0.0} @@ -7973,7 +8542,6 @@ packages: /get-caller-file@2.0.5: resolution: {integrity: sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==} engines: {node: 6.* || 8.* || >= 10.*} - dev: true /get-intrinsic@1.2.0: resolution: {integrity: sha512-L049y6nFOuom5wGyRc3/gdTLO94dySVKRACj1RmJZBQXlbTMhtNIgkWkUHq+jYmZvKf14EW1EoJnnjbmoHij0Q==} @@ -8283,6 +8851,10 @@ packages: toidentifier: 1.0.1 dev: true + /http-parser-js@0.5.8: + resolution: {integrity: sha512-SGeBX54F94Wgu5RH3X5jsDtf4eHyRogWX1XGT3b4HuW3tQPM4AaBzoUji/4AAJNXCEOWZ5O0DgZmJw1947gD5Q==} + dev: false + /http-signature@1.3.6: resolution: {integrity: sha512-3adrsD6zqo4GsTqtO7FyrejHNv+NgiIfAfv68+jVlFmSr9OGy7zrxONceFRLKvnnZA5jbxQBX1u9PpB6Wi32Gw==} engines: {node: '>=0.10'} @@ -8366,6 +8938,14 @@ packages: postcss: 8.4.23 dev: true + /idb@7.0.1: + resolution: {integrity: sha512-UUxlE7vGWK5RfB/fDwEGgRf84DY/ieqNha6msMV99UsEMQhJ1RwbCd8AYBj3QMgnE3VZnfQvm4oKVCJTYlqIgg==} + dev: false + + /idb@7.1.1: + resolution: {integrity: sha512-gchesWBzyvGHRO9W8tzUWFDycow5gwjvFKfyV9FF32Y7F50yZMp7mP+T2mJIWFx49zicqyC4uefHM17o6xKIVQ==} + dev: false + /ieee754@1.1.13: resolution: {integrity: sha512-4vf7I2LYV/HaWerSo3XmlMkp5eZ83i+/CDluXi/IGTs/O1sejBNhTtnxzmRZfvOUqj7lZjqHkeTvpgSFDlWZTg==} dev: false @@ -9132,6 +9712,10 @@ packages: resolution: {integrity: sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw==} dev: false + /lodash.camelcase@4.3.0: + resolution: {integrity: sha512-TwuEnCnxbc3rAvhf/LbG7tJUDzhqXyFnv3dtzLOPgCG/hODL7WFnsbwktkD7yUV0RrreP/l1PALq/YSg6VvjlA==} + dev: false + /lodash.debounce@4.0.8: resolution: {integrity: sha512-FT1yDzDYEoYWhnSGnpE/4Kj1fLZkDFyqRb7fNt6FdYOSxlUWAtp42Eh6Wb0rGIv/m9Bgo7x4GhQbm5Ys4SG5ow==} @@ -9164,6 +9748,10 @@ packages: wrap-ansi: 6.2.0 dev: true + /long@5.2.3: + resolution: {integrity: sha512-lcHwpNoggQTObv5apGNCTdJrO69eHOZMi4BNC+rTLER8iHAqGrUVeLh/irVIM7zTw2bOXA8T6uNPeujwOLg/2Q==} + dev: false + /loose-envify@1.4.0: resolution: {integrity: sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==} hasBin: true @@ -9497,6 +10085,18 @@ packages: dependencies: whatwg-url: 5.0.0 + /node-fetch@2.6.7: + resolution: {integrity: sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==} + engines: {node: 4.x || >=6.0.0} + peerDependencies: + encoding: ^0.1.0 + peerDependenciesMeta: + encoding: + optional: true + dependencies: + whatwg-url: 5.0.0 + dev: false + /node-int64@0.4.0: resolution: {integrity: sha512-O5lz91xSOeoXP6DulyHfllpq+Eg00MWitZIbtPfoSEvqIHdl5gfcY6hYzDWnj0qD5tz52PI08u9qUvSVeUBeHw==} dev: true @@ -10082,6 +10682,25 @@ packages: resolution: {integrity: sha512-IJUkICM5dP5znhCckHSv30Q4b5/JA5enCtkRHYaOVOAocnH/1BQEYTC5NMfT3AVl/iXKdr3aqQbQn9DxyWknwA==} dev: false + /protobufjs@7.2.5: + resolution: {integrity: sha512-gGXRSXvxQ7UiPgfw8gevrfRWcTlSbOFg+p/N+JVJEK5VhueL2miT6qTymqAmjr1Q5WbOCyJbyrk6JfWKwlFn6A==} + engines: {node: '>=12.0.0'} + requiresBuild: true + dependencies: + '@protobufjs/aspromise': 1.1.2 + '@protobufjs/base64': 1.1.2 + '@protobufjs/codegen': 2.0.4 + '@protobufjs/eventemitter': 1.1.0 + '@protobufjs/fetch': 1.1.0 + '@protobufjs/float': 1.0.2 + '@protobufjs/inquire': 1.1.0 + '@protobufjs/path': 1.1.2 + '@protobufjs/pool': 1.1.0 + '@protobufjs/utf8': 1.1.0 + '@types/node': 20.5.9 + long: 5.2.3 + dev: false + /proxy-addr@2.0.7: resolution: {integrity: sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==} engines: {node: '>= 0.10'} @@ -10779,7 +11398,6 @@ packages: /require-directory@2.1.1: resolution: {integrity: sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==} engines: {node: '>=0.10.0'} - dev: true /require-from-string@2.0.2: resolution: {integrity: sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==} @@ -12141,6 +12759,20 @@ packages: - esbuild - uglify-js + /websocket-driver@0.7.4: + resolution: {integrity: sha512-b17KeDIQVjvb0ssuSDF2cYXSg2iztliJ4B9WdsuB6J952qCPKmnVq4DyW5motImXHDC1cBT/1UezrJVsKw5zjg==} + engines: {node: '>=0.8.0'} + dependencies: + http-parser-js: 0.5.8 + safe-buffer: 5.2.1 + websocket-extensions: 0.1.4 + dev: false + + /websocket-extensions@0.1.4: + resolution: {integrity: sha512-OqedPIGOfsDlo31UNwYbCFMSaO9m9G/0faIHj5/dZFDMFqPTcx6UwqyOy3COEaEOg/9VsGIpdqn62W5KhoKSpg==} + engines: {node: '>=0.8.0'} + dev: false + /whatwg-url@5.0.0: resolution: {integrity: sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==} dependencies: @@ -12229,7 +12861,6 @@ packages: ansi-styles: 4.3.0 string-width: 4.2.3 strip-ansi: 6.0.1 - dev: true /wrap-ansi@8.1.0: resolution: {integrity: sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==} @@ -12307,7 +12938,6 @@ packages: /y18n@5.0.8: resolution: {integrity: sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==} engines: {node: '>=10'} - dev: true /yallist@3.1.1: resolution: {integrity: sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==} @@ -12330,6 +12960,11 @@ packages: engines: {node: '>=10'} dev: true + /yargs-parser@21.1.1: + resolution: {integrity: sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==} + engines: {node: '>=12'} + dev: false + /yargs@16.2.0: resolution: {integrity: sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==} engines: {node: '>=10'} @@ -12343,6 +12978,19 @@ packages: yargs-parser: 20.2.9 dev: true + /yargs@17.7.2: + resolution: {integrity: sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==} + engines: {node: '>=12'} + dependencies: + cliui: 8.0.1 + escalade: 3.1.1 + get-caller-file: 2.0.5 + require-directory: 2.1.1 + string-width: 4.2.3 + y18n: 5.0.8 + yargs-parser: 21.1.1 + dev: false + /yauzl@2.10.0: resolution: {integrity: sha512-p4a9I6X6nu6IhoGmBqAcbJy1mlC4j27vEPZX9F4L4/vZT3Lyq1VkFHw/V/PUcB9Buo+DG3iHkT0x3Qya58zc3g==} dependencies: diff --git a/src/base/hooks/useAuth.ts b/src/base/hooks/useAuth.ts index 6153330..8bbb33d 100644 --- a/src/base/hooks/useAuth.ts +++ b/src/base/hooks/useAuth.ts @@ -1,16 +1,13 @@ +import { useContext } from "react"; +import FirebaseContext from "../store/context/FirebaseContext"; const useAuth = () => { - return ( - { - logout: ()=>{ - // console.log("TODO: impl"); - }, - user: { - name: "" - } - } - ) + const context = useContext(FirebaseContext); + + if (!context) throw new Error('context must be use inside provider'); + + return context; } export default useAuth \ No newline at end of file diff --git a/src/base/hooks/useConfig.ts b/src/base/hooks/useConfig.ts index 00e724a..285c710 100644 --- a/src/base/hooks/useConfig.ts +++ b/src/base/hooks/useConfig.ts @@ -2,11 +2,12 @@ import config from "@/config"; // ==============================|| CONFIG - HOOKS ||============================== // import { FontFamily, I18n, PresetColor, ThemeDirection, ThemeMode } from '@/types/config'; +import i18n from "@/utils/lang/i18n"; const useConfig = () => ({ ...config, onChangeContainer: () => {}, - onChangeLocalization: (lang: I18n) => {console.log(lang) + onChangeLocalization: (lang: I18n) => {i18n.changeLanguage(lang) }, onChangeMode: (mode: ThemeMode) => {console.log(mode)}, onChangePresetColor: (theme: PresetColor) => {console.log(theme)}, diff --git a/src/base/layout/MainLayout/Header/HeaderContent/Localization.tsx b/src/base/layout/MainLayout/Header/HeaderContent/Localization.tsx index 49c6bd3..b22b79d 100644 --- a/src/base/layout/MainLayout/Header/HeaderContent/Localization.tsx +++ b/src/base/layout/MainLayout/Header/HeaderContent/Localization.tsx @@ -12,6 +12,7 @@ import useConfig from '@/base/hooks/useConfig'; // assets import { TranslationOutlined } from '@ant-design/icons'; import { I18n } from '@/types/config'; +import i18n from '@/utils/lang/i18n'; // ==============================|| HEADER CONTENT - LOCALIZATION ||============================== // @@ -19,7 +20,7 @@ const Localization = () => { const theme = useTheme(); const matchesXs = useMediaQuery(theme.breakpoints.down('md')); - const { i18n, onChangeLocalization } = useConfig(); + const { onChangeLocalization } = useConfig(); const anchorRef = useRef(null); const [open, setOpen] = useState(false); @@ -91,7 +92,7 @@ const Localization = () => { } }} > - handleListItemClick('en')}> + handleListItemClick('en')}> @@ -103,7 +104,7 @@ const Localization = () => { } /> - handleListItemClick('fr')}> + handleListItemClick('fr')}> @@ -115,19 +116,19 @@ const Localization = () => { } /> - handleListItemClick('ro')}> + handleListItemClick('ko')}> - Română + 한국어 - (Romanian) + (Korean) } /> - handleListItemClick('zh')}> + handleListItemClick('zh')}> @@ -139,6 +140,18 @@ const Localization = () => { } /> + handleListItemClick('vi')}> + + Tiếng Việt + + (Vietnamese) + + + } + /> + diff --git a/src/base/layout/MainLayout/Header/HeaderContent/index.tsx b/src/base/layout/MainLayout/Header/HeaderContent/index.tsx index c1dc5ec..575847c 100644 --- a/src/base/layout/MainLayout/Header/HeaderContent/index.tsx +++ b/src/base/layout/MainLayout/Header/HeaderContent/index.tsx @@ -32,12 +32,12 @@ const HeaderContent = () => { return ( <> {!matchesXs && } - {!matchesXs && megaMenu} + {/* {!matchesXs && megaMenu} */} {!matchesXs && localization} {matchesXs && } - + {/* */} {!matchesXs && } {matchesXs && } diff --git a/src/base/page/auth/sections/AuthLogin.tsx b/src/base/page/auth/sections/AuthLogin.tsx index ba6de34..b7eb1e1 100644 --- a/src/base/page/auth/sections/AuthLogin.tsx +++ b/src/base/page/auth/sections/AuthLogin.tsx @@ -30,6 +30,7 @@ import { // assets import { EyeInvisibleOutlined, EyeOutlined } from '@ant-design/icons'; import AnimateButton from '@ui/@extended/AnimateButton'; +import FirebaseSocial from './FirebaseSocial'; // ============================|| FIREBASE - LOGIN ||============================ // @@ -168,7 +169,7 @@ const AuthLogin = () => { - {/* */} + diff --git a/src/base/page/auth/sections/FirebaseSocial.tsx b/src/base/page/auth/sections/FirebaseSocial.tsx index fd45daf..46c4231 100644 --- a/src/base/page/auth/sections/FirebaseSocial.tsx +++ b/src/base/page/auth/sections/FirebaseSocial.tsx @@ -1,14 +1,13 @@ // material-ui +import useAuth from '@/base/hooks/useAuth'; import { Button, Stack, useMediaQuery } from '@mui/material'; import { useTheme } from '@mui/material/styles'; -// project import -// import useAuth from 'hooks/useAuth'; // assets -import Facebook from 'assets/images/icons/facebook.svg'; -import Google from 'assets/images/icons/google.svg'; -import Twitter from 'assets/images/icons/twitter.svg'; +import Facebook from '@/assets/images/icons/facebook.svg'; +import Google from '@/assets/images/icons/google.svg'; +import Twitter from '@/assets/images/icons/twitter.svg'; // ==============================|| FIREBASE - SOCIAL BUTTON ||============================== // @@ -16,8 +15,7 @@ const FirebaseSocial = () => { const theme = useTheme(); const matchDownSM = useMediaQuery(theme.breakpoints.down('sm')); - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-ignore + const { firebaseFacebookSignIn, firebaseGoogleSignIn, firebaseTwitterSignIn } = useAuth(); const googleHandler = async () => { try { diff --git a/src/base/store/atoms/auth.ts b/src/base/store/atoms/auth.ts index f7dac92..3a0a332 100644 --- a/src/base/store/atoms/auth.ts +++ b/src/base/store/atoms/auth.ts @@ -1,9 +1,10 @@ -// import { atom } from 'recoil'; +import { atom } from 'recoil'; -// import { getDefaultAuth } from '@base/utils/vora'; -// import { AuthProps } from '@base/types/auth'; - -// export const authAtom = atom({ -// key: 'authAtom', -// default: getDefaultAuth() -// }); +export const authState = atom({ + key: 'authState', + default: { + isLoggedIn: false, + isInitialized: false, + user: null, + }, +}); \ No newline at end of file diff --git a/src/base/store/context/FirebaseContext.tsx b/src/base/store/context/FirebaseContext.tsx new file mode 100644 index 0000000..53e97e3 --- /dev/null +++ b/src/base/store/context/FirebaseContext.tsx @@ -0,0 +1,111 @@ +import React, { createContext, useEffect, useReducer } from 'react'; +import { RecoilRoot, useRecoilState } from 'recoil'; +import { initializeApp } from 'firebase/app'; +import { getAuth, onAuthStateChanged, GoogleAuthProvider, TwitterAuthProvider, FacebookAuthProvider, createUserWithEmailAndPassword, signInWithEmailAndPassword, signOut, sendPasswordResetEmail, signInWithPopup } from 'firebase/auth'; +import { authState } from '../atoms/auth'; +import { FirebaseContextType } from '@/types/auth'; + +const firebaseConfig = { + apiKey: "AIzaSyDiyMFnM1CM6C4XUhLgHrtjloOjyk0ECz4", + authDomain: "homekitchen-55393.firebaseapp.com", + databaseURL: "https://homekitchen-55393-default-rtdb.asia-southeast1.firebasedatabase.app", + projectId: "homekitchen-55393", + storageBucket: "homekitchen-55393.appspot.com", + messagingSenderId: "218849426684", + appId: "1:218849426684:web:7e34dc7aa3d17634ed2b79", + measurementId: "G-Y869SZN9KS" +}; + +const app = initializeApp(firebaseConfig); + +// const +// const initialState: AuthProps = { +// isLoggedIn: false, +// isInitialized: false, +// user: null +// }; + +// ==============================|| FIREBASE CONTEXT & PROVIDER ||============================== // + +const FirebaseContext = createContext(null); + +export const FirebaseProvider = ({ children }: { children: React.ReactElement }) => { + const [state, dispatch] = useRecoilState(authState); + + const auth = getAuth(app); + useEffect(() => { + + onAuthStateChanged(auth, (user) => { + if (user) { + dispatch({ + isLoggedIn: true, + user: { + id: user.uid, + email: user.email, + name: user.displayName || 'Stebin Ben', + role: 'UI/UX Designer', + }, + isInitialized : false + }); + } else { + dispatch({ + isLoggedIn: false, + user: null, + isInitialized : false + }); + } + }); + }, [dispatch]); + + const firebaseEmailPasswordSignIn = (email: string, password: string) => signInWithEmailAndPassword(auth,email, password); + + const firebaseGoogleSignIn = () => { + const provider = new GoogleAuthProvider(); + return signInWithPopup(auth,provider); + }; + + const firebaseTwitterSignIn = () => { + const provider = new TwitterAuthProvider(); + return signInWithPopup(auth, provider); + }; + + const firebaseFacebookSignIn = () => { + const provider = new FacebookAuthProvider(); + return signInWithPopup(auth, provider); + }; + + const firebaseRegister = async (email: string, password: string) => createUserWithEmailAndPassword(auth,email, password); + + const logout = () => signOut(auth); + + const resetPassword = async (email: string) => { + await sendPasswordResetEmail(auth,email); + }; + + const updateProfile = () => {console.log("update profile")}; + // if (state.isInitialized !== undefined && !state.isInitialized) { + // return
Loading
; + // } + + return ( + {console.log("login"); + }, + firebaseGoogleSignIn, + firebaseTwitterSignIn, + firebaseFacebookSignIn, + logout, + resetPassword, + updateProfile + }} + > + {children} + + ); +}; + +export default FirebaseContext; diff --git a/src/config.ts b/src/config.ts index 596cd31..783b538 100644 --- a/src/config.ts +++ b/src/config.ts @@ -1,6 +1,8 @@ // types // import { DefaultConfigProps } from '@/types/config'; +import i18n from "./utils/lang/i18n"; + export const drawerWidth = 260; export const twitterColor = "#1DA1F2"; @@ -37,7 +39,7 @@ export const AUTH0_API = { const config = { defaultPath: "/sample-page", fontFamily: `'Public Sans', sans-serif`, - i18n: "en", + i18n: i18n.language, miniDrawer: false, container: false, mode: "light", diff --git a/src/lang.py b/src/lang.py new file mode 100644 index 0000000..9466e87 --- /dev/null +++ b/src/lang.py @@ -0,0 +1,29 @@ +import csv +import json + +# Input CSV file and output directory +input_csv_file = 'translations.csv' # Replace with your CSV file path +output_dir = './utils/lang/locale' # Directory where JSON files will be saved + +# Create the output directory if it doesn't exist +import os +if not os.path.exists(output_dir): + os.makedirs(output_dir) + +# Languages to extract +languages = ['en', 'vi', 'ko'] + +for language in languages: + json_data = {} + + with open(input_csv_file, newline='') as csvfile: + csv_reader = csv.DictReader(csvfile) + for row in csv_reader: + key = row['key'] + value = row[language] + json_data[key] = value + + output_json_file = f'{output_dir}/{language}.json' + with open(output_json_file, 'w', encoding='utf-8') as jsonfile: + json.dump(json_data, jsonfile, ensure_ascii=False, indent=2) + print(f'File "{output_json_file}" created.') \ No newline at end of file diff --git a/src/main.tsx b/src/main.tsx index 4f67078..aae245e 100644 --- a/src/main.tsx +++ b/src/main.tsx @@ -17,12 +17,16 @@ import { ReactQueryDevtools } from "react-query/devtools"; import { RecoilRoot } from "recoil"; import "./index.css"; import queryClient from "./services/queryClient.ts"; +import { FirebaseProvider } from "./base/store/context/FirebaseContext.tsx"; ReactDOM.createRoot(document.getElementById("root") as HTMLElement).render( + + + <> + + + ); diff --git a/src/modules/customer/pages/list/list.tsx b/src/modules/customer/pages/list/list.tsx index ba1d24c..84c00eb 100644 --- a/src/modules/customer/pages/list/list.tsx +++ b/src/modules/customer/pages/list/list.tsx @@ -310,7 +310,7 @@ const CustomerList = () => { "user.avatarUrl": true, }} columns={columns} - data={data?.data} + data={data?.data??[]} renderRowSubComponent={renderRowSubComponent} totalRows={totalRows} onPaginationChange={(pagination) => { diff --git a/src/modules/order/components/Menu/OrderActionMenu.tsx b/src/modules/order/components/Menu/OrderActionMenu.tsx new file mode 100644 index 0000000..89f479f --- /dev/null +++ b/src/modules/order/components/Menu/OrderActionMenu.tsx @@ -0,0 +1,111 @@ +import * as React from 'react'; +import { styled, alpha } from '@mui/material/styles'; +import Button from '@mui/material/Button'; +import Menu, { MenuProps } from '@mui/material/Menu'; +import MenuItem from '@mui/material/MenuItem'; +import EditIcon from '@mui/icons-material/Edit'; +import Divider from '@mui/material/Divider'; +import ArchiveIcon from '@mui/icons-material/Archive'; +import FileCopyIcon from '@mui/icons-material/FileCopy'; +import MoreHorizIcon from '@mui/icons-material/MoreHoriz'; +import KeyboardArrowDownIcon from '@mui/icons-material/KeyboardArrowDown'; +type Props = { + selectionRows:string[] +} + +const OrderActionMenu = ({selectionRows}: Props) => { + const [anchorEl, setAnchorEl] = React.useState(null); + const open = Boolean(anchorEl); + const handleClick = (event: React.MouseEvent) => { + setAnchorEl(event.currentTarget); + }; + const handleClose = () => { + setAnchorEl(null); + }; + + return ( +
+ + + + + Edit + + + + Duplicate + + + + + Archive + + + + More + + +
+ ); +} +const StyledMenu = styled((props: MenuProps) => ( + + ))(({ theme }) => ({ + '& .MuiPaper-root': { + borderRadius: 6, + marginTop: theme.spacing(1), + minWidth: 180, + color: + theme.palette.mode === 'light' ? 'rgb(55, 65, 81)' : theme.palette.grey[300], + boxShadow: + 'rgb(255, 255, 255) 0px 0px 0px 0px, rgba(0, 0, 0, 0.05) 0px 0px 0px 1px, rgba(0, 0, 0, 0.1) 0px 10px 15px -3px, rgba(0, 0, 0, 0.05) 0px 4px 6px -2px', + '& .MuiMenu-list': { + padding: '4px 0', + }, + '& .MuiMenuItem-root': { + '& .MuiSvgIcon-root': { + fontSize: 18, + color: theme.palette.text.secondary, + marginRight: theme.spacing(1.5), + }, + '&:active': { + backgroundColor: alpha( + theme.palette.primary.main, + theme.palette.action.selectedOpacity, + ), + }, + }, + }, + })); + +export default OrderActionMenu \ No newline at end of file diff --git a/src/modules/order/hook/useOrderTable.tsx b/src/modules/order/hook/useOrderTable.tsx index 82aed30..2e052e7 100644 --- a/src/modules/order/hook/useOrderTable.tsx +++ b/src/modules/order/hook/useOrderTable.tsx @@ -11,6 +11,7 @@ import { MouseEvent, useCallback, useMemo } from "react"; import NumberFormat from "react-number-format"; import { useNavigate } from "react-router-dom"; import OrderViewInline from "../components/OrderViewInline"; +// import { useTranslation } from "react-i18next"; type Props = { handleEditClick: (order: OrderAdmin) => void; diff --git a/src/modules/order/pages/list/OrderListPage.tsx b/src/modules/order/pages/list/OrderListPage.tsx index 704fb88..eaa2202 100644 --- a/src/modules/order/pages/list/OrderListPage.tsx +++ b/src/modules/order/pages/list/OrderListPage.tsx @@ -19,10 +19,13 @@ import { DatePicker } from "@mui/x-date-pickers"; import Snackbar from "@ui/@extended/Snackbar"; import MainCard from "@ui/MainCard"; import QuickTable from "@ui/common/table/QuickTable"; -import { useEffect, useState } from "react"; +import { useEffect, useMemo, useState } from "react"; import { useNavigate } from "react-router-dom"; import useOrderData from "../../hook/useOrderData"; import useOrderTable from "../../hook/useOrderTable"; +import { RowSelection } from "@tanstack/react-table"; +import OrderActionMenu from "../../components/Menu/OrderActionMenu"; +import { useTranslation } from "react-i18next"; const OrderListPage = () => { // const data = useMemo( @@ -35,6 +38,8 @@ const OrderListPage = () => { // ); const [confirmationToggle, setConfirmationToggle] = useState(false); const [actionId, setActionId] = useState(); + const [selectionRows, setSelectionRows] = useState(); + const {t} = useTranslation(); const { setSortState, setFilter, @@ -99,6 +104,30 @@ const OrderListPage = () => { }, })); }, [rangeDate.to, setFilter]); + const ActionBars = useMemo(()=> <> + {selectionRows?.length>0 && + + } + refreshOrderData()} + color={"secondary"} + sx={{}}> + + + { + setRangeDate({ ...rangeDate, from: val.toString() }); + }} + /> + { + setRangeDate({ ...rangeDate, to: val.toString() }); + }} + /> +,[selectionRows]) return ( { - All + {t("all")} } @@ -125,7 +154,7 @@ const OrderListPage = () => { - Unpaid + {t("unpaid")} } @@ -134,7 +163,7 @@ const OrderListPage = () => { - Paid + {t("paid")} } @@ -143,7 +172,7 @@ const OrderListPage = () => { - Cancel + {t("cancel")} } @@ -152,7 +181,7 @@ const OrderListPage = () => { - Complete + {t("complete")} } @@ -167,7 +196,7 @@ const OrderListPage = () => { onPaginationChange={(pagination) => { setPagination(pagination); }} - onRowSelectedChange={(rows) => console.log(rows)} + onRowSelectedChange={(rows) => setSelectionRows(rows)} addButton={{ isShown: false, addButtonHandler: () => { @@ -179,27 +208,7 @@ const OrderListPage = () => { onSearchKeywordChange={(q) => setKeyword(q)} onSortByChange={(sort) => setSortState(sort)} actionComponents={ - <> - refreshOrderData()} - color={"secondary"} - sx={{}}> - - - { - setRangeDate({ ...rangeDate, from: val.toString() }); - }} - /> - { - setRangeDate({ ...rangeDate, to: val.toString() }); - }} - /> - + ActionBars } /> diff --git a/src/translations.csv b/src/translations.csv new file mode 100644 index 0000000..f415419 --- /dev/null +++ b/src/translations.csv @@ -0,0 +1,7 @@ +key,en,vi,ko +all,All,Tất cả,모든 +unpaid,Unpaid,Chưa thanh toán,미지불 +pending,Pending,Đang chờ,보류 중 +paid,Paid,Đã thanh toán,유료 +complete,Complete,Hoàn thành,완료 +cancel,Cancel,Hủy,취소 \ No newline at end of file diff --git a/src/types/config.ts b/src/types/config.ts index 5bc1289..ea9c452 100644 --- a/src/types/config.ts +++ b/src/types/config.ts @@ -2,7 +2,7 @@ export type ThemeDirection = 'ltr' | 'rtl'; export type ThemeMode = 'light' | 'dark'; export type FontFamily = `'Inter', sans-serif` | `'Poppins', sans-serif` | `'Roboto', sans-serif` | `'Public Sans', sans-serif`; export type PresetColor = 'default' | 'theme1' | 'theme2' | 'theme3' | 'theme4' | 'theme5' | 'theme6' | 'theme7' | 'theme8'; -export type I18n = 'en' | 'fr' | 'ro' | 'zh'; // 'en' - English, 'fr' - French, 'ro' - Romanian, 'zh' - Chinese +export type I18n = 'en' | 'fr' | 'ro' | 'zh' | 'vi' | 'ko'; // 'en' - English, 'fr' - French, 'ro' - Romanian, 'zh' - Chinese // ==============================|| CONFIG TYPES ||============================== // diff --git a/src/utils/lang/i18n.ts b/src/utils/lang/i18n.ts index 3c61678..bd8234b 100644 --- a/src/utils/lang/i18n.ts +++ b/src/utils/lang/i18n.ts @@ -1,6 +1,8 @@ import i18n from "i18next"; import { initReactI18next } from "react-i18next"; -import eng from "./en/en.json"; +import eng from "./locale/en.json"; +import vi from "./locale/vi.json"; +import ko from "./locale/ko.json"; // the translations // (tip move them in a JSON file and import them, // or even better, manage them separated from your code: https://react.i18next.com/guides/multiple-translation-files) @@ -13,6 +15,12 @@ const resources = { "Welcome to React": "Bienvenue à React et react-i18next", }, }, + vi : { + translation: vi + }, + ko : { + translation: ko + } }; i18n diff --git a/src/utils/lang/locale/en.json b/src/utils/lang/locale/en.json new file mode 100644 index 0000000..fb32859 --- /dev/null +++ b/src/utils/lang/locale/en.json @@ -0,0 +1,8 @@ +{ + "all": "All", + "unpaid": "Unpaid", + "pending": "Pending", + "paid": "Paid", + "complete": "Complete", + "cancel": "Cancel" +} \ No newline at end of file diff --git a/src/utils/lang/locale/ko.json b/src/utils/lang/locale/ko.json new file mode 100644 index 0000000..63436ec --- /dev/null +++ b/src/utils/lang/locale/ko.json @@ -0,0 +1,8 @@ +{ + "all": "모든", + "unpaid": "미지불", + "pending": "보류 중", + "paid": "유료", + "complete": "완료", + "cancel": "취소" +} \ No newline at end of file diff --git a/src/utils/lang/locale/vi.json b/src/utils/lang/locale/vi.json new file mode 100644 index 0000000..2f4f651 --- /dev/null +++ b/src/utils/lang/locale/vi.json @@ -0,0 +1,8 @@ +{ + "all": "Tất cả", + "unpaid": "Chưa thanh toán", + "pending": "Đang chờ", + "paid": "Đã thanh toán", + "complete": "Hoàn thành", + "cancel": "Hủy" +} \ No newline at end of file diff --git a/vite.config.ts b/vite.config.ts index e21e68f..14f3ac2 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -35,6 +35,8 @@ export default defineConfig({ return "vendor_here"; } else if (id.includes("@aws-sdk")) { return "vendor_aws_sdk"; + }else if (id.includes("firebase")) { + return "vendor_firebase"; } return "vendor"; // all other package goes here