saleor-apps-redis_apl/apps/cms/src/pages/index.tsx
Lukasz Ostrowski 1da51639fa
Improve CMS app UX & UI (#349)
* Install apps-shared, render null if app is loading in the iframe

Redesign the app

Add notification toasts and imrpve instructions

Change channels list to select

Replace lists with select

* fix build

* Fix build
2023-04-06 12:56:44 +02:00

36 lines
976 B
TypeScript

import { useAppBridge } from "@saleor/app-sdk/app-bridge";
import { NextPage } from "next";
import { useRouter } from "next/router";
import { useEffect } from "react";
import { useIsMounted } from "usehooks-ts";
import { isInIframe } from "@saleor/apps-shared";
/**
* This is page publicly accessible from your app.
* You should probably remove it.
*/
const IndexPage: NextPage = () => {
const { appBridgeState } = useAppBridge();
const isMounted = useIsMounted();
const { replace } = useRouter();
useEffect(() => {
if (isMounted() && appBridgeState?.ready) {
replace("/home");
}
}, [isMounted, appBridgeState?.ready, replace]);
if (isInIframe()) {
return null;
}
return (
<div>
<h1>Saleor CMS Hub</h1>
<p>This is Saleor App that allows to use external cms providers to sync products data.</p>
<p>Install the app in your Saleor instance and open it in Dashboard.</p>
</div>
);
};
export default IndexPage;