
* bootstrap segment app from cms app * tracking logic * schema configuratioj * config form * form saving * Connected order_created * add more fields * Order updated webhook * Order cancelled event * order refunded webhook * order fully paid * update deps * error handling * logger * logs * Add app to workflow * add icon * remove breadcrumbs * Change 400 to 200 response if payload is invalid * link to docs * change semgent.io to segment
24 lines
574 B
TypeScript
24 lines
574 B
TypeScript
import { useAppBridge } from "@saleor/app-sdk/app-bridge";
|
|
import { useTheme } from "@saleor/macaw-ui/next";
|
|
import { useEffect } from "react";
|
|
|
|
export function ThemeSynchronizer() {
|
|
const { appBridgeState } = useAppBridge();
|
|
const { setTheme } = useTheme();
|
|
|
|
useEffect(() => {
|
|
if (!setTheme || !appBridgeState?.theme) {
|
|
return;
|
|
}
|
|
|
|
if (appBridgeState.theme === "light") {
|
|
setTheme("defaultLight");
|
|
}
|
|
|
|
if (appBridgeState.theme === "dark") {
|
|
setTheme("defaultDark");
|
|
}
|
|
}, [appBridgeState?.theme, setTheme]);
|
|
|
|
return null;
|
|
}
|