Update
This commit is contained in:
parent
20f439f3ce
commit
de68dcca7b
9 changed files with 277 additions and 2686 deletions
|
@ -1,7 +1,6 @@
|
||||||
module.exports = {
|
module.exports = {
|
||||||
root: true,
|
root: true,
|
||||||
// This tells ESLint to load the config from the package `eslint-config-custom`
|
extends: ["saleor"],
|
||||||
extends: ["custom"],
|
|
||||||
settings: {
|
settings: {
|
||||||
next: {
|
next: {
|
||||||
rootDir: ["apps/*/"],
|
rootDir: ["apps/*/"],
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"eslint": "^7.32.0",
|
"eslint": "^7.32.0",
|
||||||
"eslint-config-custom": "workspace:*",
|
"eslint-config-saleor": "workspace:*",
|
||||||
"prettier": "^2.5.1",
|
"prettier": "^2.5.1",
|
||||||
"turbo": "^1.7.0"
|
"turbo": "^1.7.0"
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,4 +1,8 @@
|
||||||
module.exports = {
|
module.exports = {
|
||||||
extends: ["next", "turbo", "prettier"],
|
plugins: ["simple-import-sort"],
|
||||||
rules: {},
|
extends: ["next", "turbo", "prettier"],
|
||||||
};
|
rules: {
|
||||||
|
"simple-import-sort/imports": "warn",
|
||||||
|
"simple-import-sort/exports": "warn",
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
|
@ -4,12 +4,13 @@
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"eslint-config-next": "^13.1.3",
|
"eslint-config-next": "^13.1.6",
|
||||||
"eslint-config-prettier": "^8.6.0",
|
"eslint-config-prettier": "^8.6.0",
|
||||||
"eslint-plugin-react": "7.32.1",
|
"eslint-plugin-react": "7.32.1",
|
||||||
"eslint-config-turbo": "^0.0.7"
|
"eslint-config-turbo": "^0.0.7",
|
||||||
|
"eslint-plugin-simple-import-sort": "^10.0.0"
|
||||||
},
|
},
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
"access": "public"
|
"access": "public"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
3
packages/shared/.eslintrc
Normal file
3
packages/shared/.eslintrc
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"extends": ["saleor"]
|
||||||
|
}
|
|
@ -2,10 +2,21 @@ import { useAppBridge } from "@saleor/app-sdk/app-bridge";
|
||||||
import { useTheme } from "@saleor/macaw-ui";
|
import { useTheme } from "@saleor/macaw-ui";
|
||||||
import { memo, useEffect } from "react";
|
import { memo, useEffect } from "react";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Macaw-ui stores its theme mode in memory and local storage. To synchronize App with Dashboard,
|
||||||
|
* Macaw must be informed about this change from AppBridge.
|
||||||
|
*
|
||||||
|
* If you are not using Macaw, you can remove this.
|
||||||
|
*/
|
||||||
function _ThemeSynchronizer() {
|
function _ThemeSynchronizer() {
|
||||||
const { appBridgeState } = useAppBridge();
|
const { appBridgeState, appBridge } = useAppBridge();
|
||||||
const { setTheme, themeType } = useTheme();
|
const { setTheme, themeType } = useTheme();
|
||||||
|
|
||||||
|
// todo - replace this hook to appBridge.subscribe and react only only on initial theme event
|
||||||
|
// useEffect(() =>{
|
||||||
|
// appBridge?.subscribe('theme',console.log)
|
||||||
|
// },[appBridge])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!setTheme || !appBridgeState?.theme) {
|
if (!setTheme || !appBridgeState?.theme) {
|
||||||
return;
|
return;
|
||||||
|
@ -13,6 +24,11 @@ function _ThemeSynchronizer() {
|
||||||
|
|
||||||
if (themeType !== appBridgeState?.theme) {
|
if (themeType !== appBridgeState?.theme) {
|
||||||
setTheme(appBridgeState.theme);
|
setTheme(appBridgeState.theme);
|
||||||
|
/**
|
||||||
|
* Hack to fix macaw, which is going into infinite loop on light mode (probably de-sync local storage with react state)
|
||||||
|
* TODO Fix me when Macaw 2.0 is shipped
|
||||||
|
*/
|
||||||
|
window.localStorage.setItem("macaw-ui-theme", appBridgeState.theme);
|
||||||
}
|
}
|
||||||
}, [appBridgeState?.theme, setTheme, themeType]);
|
}, [appBridgeState?.theme, setTheme, themeType]);
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/react": "^18.0.27",
|
"@types/react": "^18.0.27",
|
||||||
"@types/react-dom": "^18.0.10"
|
"@types/react-dom": "^18.0.10",
|
||||||
|
"eslint-config-saleor": "workspace:*"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
2898
pnpm-lock.yaml
2898
pnpm-lock.yaml
File diff suppressed because it is too large
Load diff
19
turbo.json
19
turbo.json
|
@ -4,25 +4,6 @@
|
||||||
"build": {
|
"build": {
|
||||||
"outputs": [".next/**"]
|
"outputs": [".next/**"]
|
||||||
},
|
},
|
||||||
"saleor-app-invoice#build": {
|
|
||||||
"env": [
|
|
||||||
"APL",
|
|
||||||
"APP_DEBUG",
|
|
||||||
"NODE_ENV",
|
|
||||||
"SECRET_KEY",
|
|
||||||
"VERCEL_URL",
|
|
||||||
"PORT",
|
|
||||||
"ALLOWED_DOMAIN_PATTERN",
|
|
||||||
"TEMP_PDF_STORAGE_DIR",
|
|
||||||
"SENTRY_AUTH_TOKEN",
|
|
||||||
"SENTRY_PROJECT",
|
|
||||||
"SENTRY_ORG",
|
|
||||||
"REST_APL_TOKEN",
|
|
||||||
"REST_APL_ENDPOINT",
|
|
||||||
"NEXT_PUBLIC_SENTRY_DSN",
|
|
||||||
"SENTRY_DSN"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"saleor-app-slack#build": {
|
"saleor-app-slack#build": {
|
||||||
"env": ["APL", "SENTRY_AUTH_TOKEN", "SENTRY_PROJECT", "SENTRY_ORG"]
|
"env": ["APL", "SENTRY_AUTH_TOKEN", "SENTRY_PROJECT", "SENTRY_ORG"]
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue