diff --git a/apps/taxes/src/modules/ui/app-columns.tsx b/apps/taxes/src/modules/ui/app-columns.tsx new file mode 100644 index 0000000..9cde9ed --- /dev/null +++ b/apps/taxes/src/modules/ui/app-columns.tsx @@ -0,0 +1,22 @@ +import { Box } from "@saleor/macaw-ui/next"; +import React from "react"; + +export const AppColumns = ({ + top, + bottomLeft, + bottomRight, +}: { + top: React.ReactNode; + bottomLeft: React.ReactNode; + bottomRight: React.ReactNode; +}) => { + return ( + + {top} + + {bottomLeft} + {bottomRight} + + + ); +}; diff --git a/apps/taxes/src/modules/ui/app-layout.tsx b/apps/taxes/src/modules/ui/app-layout.tsx new file mode 100644 index 0000000..d748203 --- /dev/null +++ b/apps/taxes/src/modules/ui/app-layout.tsx @@ -0,0 +1,6 @@ +import { Box } from "@saleor/macaw-ui/next"; +import React from "react"; + +export const AppLayout = ({ children }: { children: React.ReactNode }) => { + return {children}; +}; diff --git a/apps/taxes/src/modules/ui/providers.tsx b/apps/taxes/src/modules/ui/providers.tsx new file mode 100644 index 0000000..b0b753c --- /dev/null +++ b/apps/taxes/src/modules/ui/providers.tsx @@ -0,0 +1,102 @@ +import { Box, BoxProps, Button, Text } from "@saleor/macaw-ui/next"; +import { useRouter } from "next/router"; +import { trpcClient } from "../trpc/trpc-client"; +import { ProvidersConfig } from "../providers-configuration/providers-config"; + +const AddProvider = () => { + const router = useRouter(); + + return ( + + + No providers configured yet + + + + ); +}; + +const ProvidersSkeleton = () => { + return ( + + Skeleton... + + ); +}; + +const MOCKED_PROVIDERS: ProvidersConfig = [ + { + provider: "taxjar", + config: { + name: "taxjar-1", + apiKey: "1234", + isSandbox: true, + }, + id: "1", + }, +]; + +const Table = { + Container: (props: BoxProps) => , + THead: (props: BoxProps) => , + TR: (props: BoxProps) => , + TH: (props: BoxProps) => ( + + ), + TBody: (props: BoxProps) => , + TD: (props: BoxProps) => , +}; + +const ProvidersList = () => { + const providers = MOCKED_PROVIDERS; + + return ( + + + + Name + Provider + Status + + + + {providers.map((provider) => ( + + {provider.config.name} + {provider.provider} + Active + + ))} + + + ); +}; + +export const Providers = () => { + const { data, isFetching } = trpcClient.providersConfiguration.getAll.useQuery(); + const isProvider = (data?.length ?? 0) > 0; + + return ( + + {isFetching ? ( + + ) : ( + // <>{!isProvider ? : } + + )} + + ); +}; diff --git a/apps/taxes/src/pages/_app.tsx b/apps/taxes/src/pages/_app.tsx index 0923b2a..be10502 100644 --- a/apps/taxes/src/pages/_app.tsx +++ b/apps/taxes/src/pages/_app.tsx @@ -10,6 +10,7 @@ import { useEffect } from "react"; import { ThemeSynchronizer } from "../lib/theme-synchronizer"; import { trpcClient } from "../modules/trpc/trpc-client"; import { GraphQLProvider } from "../providers/GraphQLProvider"; +import { AppLayout } from "../modules/ui/app-layout"; import { NoSSRWrapper } from "@saleor/apps-shared"; /** @@ -37,7 +38,9 @@ function NextApp({ Component, pageProps }: AppProps) { - + + + diff --git a/apps/taxes/src/pages/configuration.tsx b/apps/taxes/src/pages/configuration.tsx index 2fe636e..018e544 100644 --- a/apps/taxes/src/pages/configuration.tsx +++ b/apps/taxes/src/pages/configuration.tsx @@ -1,5 +1,39 @@ +import { Box, Text } from "@saleor/macaw-ui/next"; +import { AppColumns } from "../modules/ui/app-columns"; +import { Providers } from "../modules/ui/providers"; + +const Header = () => { + return ( + + + Configuration + + + Please configure the app by connecting one of the supported tax providers. + + + ); +}; + +const Intro = () => { + return ( + + + Tax providers + + + Manage providers configuration to connect Saleor with providers. + + + ); +}; + const ConfigurationPage = () => { - return
Configuration
; + return ( +
+ } bottomLeft={} bottomRight={} /> +
+ ); }; export default ConfigurationPage; diff --git a/apps/taxes/src/pages/providers/new.tsx b/apps/taxes/src/pages/providers/new.tsx new file mode 100644 index 0000000..1f807d3 --- /dev/null +++ b/apps/taxes/src/pages/providers/new.tsx @@ -0,0 +1,5 @@ +const NewProviderPage = () => { + return
new
; +}; + +export default NewProviderPage;