From 2b27c0c463816b3d0fa4b1746d4be2434b7f7584 Mon Sep 17 00:00:00 2001 From: Lukasz Ostrowski Date: Thu, 22 Jun 2023 10:47:39 +0200 Subject: [PATCH] Rewrtirren Slack to the new macaw --- .changeset/plenty-mayflies-enjoy.md | 5 ++ .../AccessWarning/AccessWarning.tsx | 8 +-- .../AppColumnsLayout/AppColumnsLayout.tsx | 8 ++- apps/slack/src/pages/_app.tsx | 5 +- apps/slack/src/pages/configuration.tsx | 51 +++++++++---------- 5 files changed, 46 insertions(+), 31 deletions(-) create mode 100644 .changeset/plenty-mayflies-enjoy.md diff --git a/.changeset/plenty-mayflies-enjoy.md b/.changeset/plenty-mayflies-enjoy.md new file mode 100644 index 0000000..b40c7f5 --- /dev/null +++ b/.changeset/plenty-mayflies-enjoy.md @@ -0,0 +1,5 @@ +--- +"saleor-app-slack": minor +--- + +Rewritten UI to use modern macaw UI, instead legacy one with Material UI. There are slight changes in typography and spacings, but no new changes were introduced. diff --git a/apps/slack/src/components/AccessWarning/AccessWarning.tsx b/apps/slack/src/components/AccessWarning/AccessWarning.tsx index df494a2..ae3dc24 100644 --- a/apps/slack/src/components/AccessWarning/AccessWarning.tsx +++ b/apps/slack/src/components/AccessWarning/AccessWarning.tsx @@ -20,9 +20,11 @@ const warnings: Record = { export function AccessWarning({ cause = "unknown_cause" }: AccessWarningProps) { return ( -
- App can't be accessed outside of the Saleor Dashboard - +
+ + App can't be accessed outside of the Saleor Dashboard + + ❌ {warnings[cause]}
diff --git a/apps/slack/src/components/AppColumnsLayout/AppColumnsLayout.tsx b/apps/slack/src/components/AppColumnsLayout/AppColumnsLayout.tsx index 6551eb8..381bea6 100644 --- a/apps/slack/src/components/AppColumnsLayout/AppColumnsLayout.tsx +++ b/apps/slack/src/components/AppColumnsLayout/AppColumnsLayout.tsx @@ -5,7 +5,13 @@ type Props = PropsWithChildren<{}>; export const AppColumnsLayout = ({ children }: Props) => { return ( - + {children} ); diff --git a/apps/slack/src/pages/_app.tsx b/apps/slack/src/pages/_app.tsx index a50a676..e6b4da8 100644 --- a/apps/slack/src/pages/_app.tsx +++ b/apps/slack/src/pages/_app.tsx @@ -13,12 +13,15 @@ import { ThemeSynchronizer } from "../hooks/theme-synchronizer"; export const appBridgeInstance = typeof window !== "undefined" ? new AppBridge() : undefined; function SaleorApp({ Component, pageProps }: AppProps) { + // @ts-ignore todo refactor + const getLayout = Component.getLayout ?? ((page) => page); + return ( - + {getLayout()} diff --git a/apps/slack/src/pages/configuration.tsx b/apps/slack/src/pages/configuration.tsx index eb883b3..9ebc512 100644 --- a/apps/slack/src/pages/configuration.tsx +++ b/apps/slack/src/pages/configuration.tsx @@ -71,18 +71,22 @@ function Configuration() {
{configuration!.map(({ key, value }) => (
- +
))} -

- This webhook will be called when new order is created and `order_created` event is - triggered. -

-
+ -
+
); } @@ -112,7 +116,7 @@ function Instructions() { return ( <> - How to configure + How to configure
  • - Install Slack application + Install Slack application
  • - Copy incoming Webhook URL from Slack app configuration and paste it below into - `WEBHOOK_URL` field + + Copy incoming Webhook URL from Slack app configuration and paste it below into + `WEBHOOK_URL` field +
  • Save configuration
- Useful links + Useful links @@ -171,11 +166,15 @@ ConfigurationWithAuth.getLayout = (page: ReactElement) => (
- Configuration + + Configuration + {page} - Instructions + + Instructions +