Skip to content

Commit

Permalink
Migrate to the newest MacawUI version (#1547)
Browse files Browse the repository at this point in the history
  • Loading branch information
krzysztofzuraw authored Aug 30, 2024
1 parent 2bfc6d4 commit 6fed4b1
Show file tree
Hide file tree
Showing 81 changed files with 624 additions and 559 deletions.
14 changes: 14 additions & 0 deletions .changeset/bright-apples-build.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
"@saleor/react-hook-form-macaw": patch
"data-importer": patch
"products-feed": patch
"@saleor/apps-shared": patch
"klaviyo": patch
"app-avatax": patch
"cms-v2": patch
"search": patch
"@saleor/apps-ui": patch
"smtp": patch
---

Migrate to new newest MacawUI version. Functionally nothing has changed. UI may look a bit different but it will be on par with Dashboard UI.
2 changes: 1 addition & 1 deletion apps/avatax/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"@saleor/apps-otel": "workspace:*",
"@saleor/apps-shared": "workspace:*",
"@saleor/apps-ui": "workspace:*",
"@saleor/macaw-ui": "1.0.0-pre.7",
"@saleor/macaw-ui": "1.1.10",
"@saleor/react-hook-form-macaw": "workspace:*",
"@saleor/sentry-utils": "workspace:*",
"@saleor/webhook-utils": "workspace:*",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { FormSection } from "./form-section";
const FieldSuggestion = ({ suggestion }: { suggestion: string }) => {
return (
<Box alignItems={"center"} display={"flex"} justifyContent={"space-between"} marginTop={1}>
<Text paddingLeft={2} color="textNeutralSubdued" variant="caption">
<Text paddingLeft={2} color="default2" size={2}>
{suggestion}
</Text>
</Box>
Expand Down
10 changes: 8 additions & 2 deletions apps/avatax/src/modules/avatax/ui/avatax-instructions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ export const AvataxInstructions = () => {
</li>
</Box>
<Text as="p" marginBottom={8}>
You must verify the credentials by clicking the <Text variant="bodyStrong">Verify</Text>{" "}
You must verify the credentials by clicking the{" "}
<Text size={4} fontWeight="bold">
Verify
</Text>{" "}
button.
</Text>
<Text as="p">
Expand All @@ -45,7 +48,10 @@ export const AvataxInstructions = () => {
</li>
</Box>
<Text as="p" marginBottom={4}>
You must verify the address by clicking the <Text variant="bodyStrong">Verify</Text>{" "}
You must verify the address by clicking the{" "}
<Text size={4} fontWeight="bold">
Verify
</Text>{" "}
button.
</Text>
<Text as="p" marginBottom={4}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const AvataxTaxCodeMatcherTable = () => {
if (isLoading) {
return (
<Box>
<Text color="textNeutralSubdued">Loading...</Text>
<Text color="default2">Loading...</Text>
</Box>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,15 +129,15 @@ export const EditAvataxConfiguration = () => {
// todo: replace with skeleton once its available in Macaw
return (
<Box>
<Text color="textNeutralSubdued">Loading...</Text>
<Text color="default2">Loading...</Text>
</Box>
);
}

if (isGetError) {
return (
<Box>
<Text color="textCriticalDefault">Error while fetching the provider data.</Text>
<Text color="critical1">Error while fetching the provider data.</Text>
</Box>
);
}
Expand Down
4 changes: 2 additions & 2 deletions apps/avatax/src/modules/avatax/ui/form-helper-text.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ export const HelperText = ({
}) => {
return (
<Text
color={disabled ? "textNeutralDisabled" : "textNeutralSubdued"}
fontWeight={"captionLarge"}
color={disabled ? "defaultDisabled" : "default2"}
fontWeight="regular"
marginTop={2}
as="p"
>
Expand Down
9 changes: 5 additions & 4 deletions apps/avatax/src/modules/avatax/ui/form-section.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Box, Text } from "@saleor/macaw-ui";
import React, { PropsWithChildren } from "react";
import { PropsWithChildren } from "react";

import styles from "./form-section.module.css";

Expand All @@ -21,13 +21,14 @@ export const FormSection = ({
<Text
marginBottom={4}
as="h3"
variant="heading"
{...(disabled && { color: "textNeutralDisabled" })}
size={5}
fontWeight="bold"
{...(disabled && { color: "defaultDisabled" })}
>
{title}
</Text>
{subtitle && (
<Text as="p" marginBottom={4} {...(disabled && { color: "textNeutralDisabled" })}>
<Text as="p" marginBottom={4} {...(disabled && { color: "defaultDisabled" })}>
{subtitle}
</Text>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const NoChannelConfigured = () => {
height={"100%"}
justifyContent={"center"}
>
<Text variant="body">No channels configured yet</Text>
<Text>No channels configured yet</Text>
<Button data-testid="configure-channel-button" onClick={redirectToTaxes}>
Configure channels
</Button>
Expand All @@ -33,7 +33,7 @@ const Skeleton = () => {
// todo: replace with skeleton
return (
<Box height={"100%"} display={"flex"} alignItems={"center"} justifyContent={"center"}>
<Text color="textNeutralSubdued">Loading...</Text>
<Text color="default2">Loading...</Text>
</Box>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export const ChannelTable = () => {

return (
<Table.Container>
<Table.THead color={"textNeutralSubdued"}>
<Table.THead color={"default2"}>
<Table.TR>
<Table.TH>Channel slug</Table.TH>
<Table.TH>Provider</Table.TH>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const AddProvider = () => {
height={"100%"}
justifyContent={"center"}
>
<Text variant="body">No providers configured yet</Text>
<Text>No providers configured yet</Text>
<Button data-testid="no-providers-list-add-button" onClick={() => router.push("/providers")}>
Add first provider
</Button>
Expand All @@ -29,7 +29,7 @@ const Skeleton = () => {
// todo: replace with skeleton
return (
<Box height={"100%"} display={"flex"} alignItems={"center"} justifyContent={"center"}>
<Text color="textNeutralSubdued">Loading...</Text>
<Text color="default2">Loading...</Text>
</Box>
);
};
Expand Down
2 changes: 1 addition & 1 deletion apps/avatax/src/modules/ui/app-card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export const AppCard = ({ children, ...p }: PropsWithBox<{}>) => {
<Box
borderRadius={4}
borderWidth={1}
borderColor={"neutralPlain"}
borderColor={"default1"}
borderStyle={"solid"}
padding={8}
{...p}
Expand Down
6 changes: 1 addition & 5 deletions apps/avatax/src/modules/ui/app-dashboard-link.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,8 @@ export const AppDashboardLink = ({
return (
<Text
transition={"ease"}
variant={"bodyStrong"}
cursor={"pointer"}
color={{
default: "text3Decorative",
hover: "text1Decorative",
}}
color="info1"
onClick={redirectToDashboardPath}
{...rest}
>
Expand Down
8 changes: 3 additions & 5 deletions apps/avatax/src/modules/ui/app-section.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ const MAX_WIDTH = "480px";
const Header = ({ children, ...props }: PropsWithBox<{ children: React.ReactNode }>) => {
return (
<Box __maxWidth={MAX_WIDTH} {...props}>
<Text as="p" variant="body">
{children}
</Text>
<Text as="p">{children}</Text>
</Box>
);
};
Expand All @@ -24,12 +22,12 @@ const Description = ({
return (
<Box display="flex" flexDirection={"column"} gap={10} __maxWidth={MAX_WIDTH} {...props}>
{title && (
<Text as="h3" variant="heading">
<Text as="h3" size={5} fontWeight="bold">
{title}
</Text>
)}
{description && (
<Box fontWeight={"bodyMedium"} fontSize={"bodyMedium"}>
<Box fontWeight="regular" fontSize={4}>
{description}
</Box>
)}
Expand Down
6 changes: 3 additions & 3 deletions apps/avatax/src/modules/ui/matcher-section.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const MatcherTable = () => {
<AppCard __minHeight={"320px"} height="100%" data-testid="matcher-table">
{isLoading ? (
<Box height="100%" display={"flex"} alignItems={"center"} justifyContent={"center"}>
<Text color="textNeutralSubdued">Loading...</Text>
<Text color="default2">Loading...</Text>
</Box>
) : (
<>
Expand Down Expand Up @@ -53,7 +53,7 @@ const MatcherTable = () => {
</Table.Container>
) : (
<Box height="100%" display={"flex"} alignItems={"center"} justifyContent={"center"}>
<Text color="textNeutralSubdued">You must configure a tax provider first</Text>
<Text color="default2">You must configure a tax provider first</Text>
</Box>
)}
</>
Expand All @@ -71,7 +71,7 @@ const Intro = () => {
<>
Tax Code Matcher allows you to map Saleor tax classes to provider tax codes to extend
products base tax rate.
<Text as="span" display="block" marginY={4}>
<Text as="span" display="block" marginY={4} size={4}>
You need to have at least one provider configured to use this feature.
</Text>
</>
Expand Down
4 changes: 3 additions & 1 deletion apps/avatax/src/modules/ui/provider-label.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ export const ProviderLabel = ({ name }: { name: ProviderNameWithStripeTax }) =>
return (
<Box alignItems={"center"} display={"flex"} gap={3}>
<Image src={icon} width={20} height={20} alt={`provider icon`} />
<Text variant="bodyStrong">{label}</Text>
<Text size={4} fontWeight="bold">
{label}
</Text>
</Box>
);
};
2 changes: 1 addition & 1 deletion apps/avatax/src/modules/ui/providers-table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const ProvidersTable = () => {

return (
<Table.Container>
<Table.THead color={"textNeutralSubdued"}>
<Table.THead color={"default2"}>
<Table.TR>
<Table.TH>Name</Table.TH>
<Table.TH>Provider</Table.TH>
Expand Down
6 changes: 2 additions & 4 deletions apps/avatax/src/modules/ui/table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,8 @@ export const Table = {
),
THead: (props: BoxProps) => <Box {...props} as="thead" />,
TR: (props: BoxProps) => <Box {...props} as="tr" />,
TH: (props: BoxProps) => (
<Box fontWeight={"captionSmall"} fontSize={"captionSmall"} {...props} as="th" />
),
TH: (props: BoxProps) => <Box fontWeight="regular" fontSize={1} {...props} as="th" />,
TBody: (props: BoxProps) => <Box {...props} as="tbody" />,
TD: (props: BoxProps) => <Box fontSize="bodyMedium" paddingTop={2} {...props} as="td" />,
TD: (props: BoxProps) => <Box fontSize={4} paddingTop={2} {...props} as="td" />,
Skeleton: () => <TableSkeleton />,
};
4 changes: 1 addition & 3 deletions apps/avatax/src/pages/providers/avatax/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ import { AppPageLayout } from "../../../modules/ui/app-page-layout";
const Header = () => {
return (
<Box>
<Text as="p" variant="body">
Create new AvaTax configuration
</Text>
<Text as="p">Create new AvaTax configuration</Text>
</Box>
);
};
Expand Down
11 changes: 2 additions & 9 deletions apps/avatax/src/pages/providers/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,19 +48,12 @@ const ProviderCard = ({
<Box display={"flex"} justifyContent={"space-between"}>
<ProviderLabel name={provider} />
{isComingSoon && (
<Text
variant="body"
fontSize={"headingSmall"}
color={"textNeutralSubdued"}
textTransform={"uppercase"}
>
<Text size={9} color="default2" textTransform={"uppercase"}>
Coming soon
</Text>
)}
</Box>
<Text variant="body" __maxWidth={"480px"}>
{description}
</Text>
<Text __maxWidth={"480px"}>{description}</Text>
</Box>
<Box display={"flex"} justifyContent={"flex-end"} marginTop={12}>
{!isComingSoon && (
Expand Down
2 changes: 1 addition & 1 deletion apps/cms-v2/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"@saleor/apps-otel": "workspace:*",
"@saleor/apps-shared": "workspace:*",
"@saleor/apps-ui": "workspace:*",
"@saleor/macaw-ui": "1.0.0-pre.7",
"@saleor/macaw-ui": "1.1.10",
"@saleor/react-hook-form-macaw": "workspace:*",
"@saleor/sentry-utils": "workspace:*",
"@sentry/cli": "../../node_modules/@sentry/cli",
Expand Down
18 changes: 10 additions & 8 deletions apps/cms-v2/src/modules/bulk-sync/bulk-sync-section.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { zodResolver } from "@hookform/resolvers/zod";
import { ButtonsBox, Layout, SkeletonLayout } from "@saleor/apps-ui";
import { Box, Button, Text } from "@saleor/macaw-ui";
import { trpcClient } from "../trpc/trpc-client";

import { useForm } from "react-hook-form";
import { Select } from "@saleor/react-hook-form-macaw";
import { useRouter } from "next/router";
import { zodResolver } from "@hookform/resolvers/zod";
import { useForm } from "react-hook-form";
import { z } from "zod";

import { ProvidersResolver } from "../providers/providers-resolver";
import { ButtonsBox, Layout, SkeletonLayout } from "@saleor/apps-ui";
import { trpcClient } from "../trpc/trpc-client";

const FormSchema = z.object({
connectionId: z.string().min(7),
Expand All @@ -16,7 +16,9 @@ const FormSchema = z.object({
const EmptyState = () => (
<Layout.AppSectionCard>
<Box display="flex" flexDirection={"column"} gap={4} justifyContent={"center"}>
<Text variant="heading">Bulk products synchronization</Text>
<Text size={5} fontWeight="bold">
Bulk products synchronization
</Text>
<Text>Create a channel connection above to enable bulk synchronization.</Text>
</Box>
</Layout.AppSectionCard>
Expand Down Expand Up @@ -45,13 +47,13 @@ export const BulkSyncSection = () => {

return (
<Layout.AppSectionCard>
<Text as="h2" marginBottom={6} variant="heading">
<Text as="h2" marginBottom={6} size={5} fontWeight="bold">
Bulk products synchronization
</Text>
<Text as="p">
Choose a connection and start synchronization. Process is running in the browser.
</Text>
<Text as="p" variant="bodyStrong">
<Text as="p" size={4} fontWeight="bold">
Do not close the app until it is finished
</Text>
<Box
Expand Down
Loading

0 comments on commit 6fed4b1

Please sign in to comment.