Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Remove unnecessary props from ActivityCard

Lukasz Szewczyk7cae018c7def
diff --git a/saleor/static/dashboard-next/home/components/HomeActivityCard/HomeActivityCard.tsx b/saleor/static/dashboard-next/home/components/HomeActivityCard/HomeActivityCard.tsx
index c9e4f18624..514aef964e 100644
--- a/saleor/static/dashboard-next/home/components/HomeActivityCard/HomeActivityCard.tsx
+++ b/saleor/static/dashboard-next/home/components/HomeActivityCard/HomeActivityCard.tsx
@@ -17,10 +17,7 @@ interface HomeProductListCardProps {
action: string;
admin: boolean;
date: string;
- elementName?: string;
id: string;
- newElement: string;
- user: string;
}>;
}
@@ -52,11 +49,8 @@ const HomeProductListCard = decorate<HomeProductListCardProps>(
dangerouslySetInnerHTML={{
__html: activity.admin
? i18n.t(`Saleor shop admin
- ${activity.action} ${activity.newElement}:
- ${activity.user}`)
- : i18n.t(`
- ${activity.user} ${activity.action} a
- ${activity.newElement}: ${activity.elementName}
+ ${activity.action}`)
+ : i18n.t(`${activity.action} a
`)
}}
/>
diff --git a/saleor/static/dashboard-next/home/components/HomePage/HomePage.tsx b/saleor/static/dashboard-next/home/components/HomePage/HomePage.tsx
index de13ee4e87..be294fa51c 100644
--- a/saleor/static/dashboard-next/home/components/HomePage/HomePage.tsx
+++ b/saleor/static/dashboard-next/home/components/HomePage/HomePage.tsx
@@ -16,14 +16,11 @@ interface MoneyType {
currency: string;
}
export interface HomePageProps {
- activities?: Array<{
+ activities: Array<{
action: string;
admin: boolean;
date: string;
- elementName?: string;
id: string;
- newElement: string;
- user: string;
}>;
daily: {
orders: {
@@ -69,47 +66,45 @@ const decorate = withStyles(theme => ({
}
}));
const HomePage = decorate<HomePageProps>(
- ({ userName, classes, daily, topProducts, onProductClick, activities }) => {
- return (
- <Container width="md">
- <HomeHeader userName={userName} />
- <CardSpacer />
- <div className={classes.root}>
- <div>
- <div className={classes.cardContainer}>
- <HomeAnalyticsCard
- title={"Sales"}
- icon={<AttachMoney fontSize={"inherit"} />}
- >
- {daily && daily.sales ? (
- <Money
- amount={daily.sales.amount}
- currency={daily.sales.currency}
- />
- ) : (
- undefined
- )}
- </HomeAnalyticsCard>
- <HomeAnalyticsCard
- title={"Orders"}
- icon={<LocalShipping fontSize={"inherit"} />}
- >
- {daily && daily.orders ? daily.orders.amount : undefined}
- </HomeAnalyticsCard>
- </div>
-
- <HomeProductListCard
- onRowClick={onProductClick}
- topProducts={topProducts}
- />
- <CardSpacer />
- </div>
- <div>
- <HomeActivityCard activities={activities} />
+ ({ userName, classes, daily, topProducts, onProductClick, activities }) => (
+ <Container width="md">
+ <HomeHeader userName={userName} />
+ <CardSpacer />
+ <div className={classes.root}>
+ <div>
+ <div className={classes.cardContainer}>
+ <HomeAnalyticsCard
+ title={"Sales"}
+ icon={<AttachMoney fontSize={"inherit"} />}
+ >
+ {daily && daily.sales ? (
+ <Money
+ amount={daily.sales.amount}
+ currency={daily.sales.currency}
+ />
+ ) : (
+ undefined
+ )}
+ </HomeAnalyticsCard>
+ <HomeAnalyticsCard
+ title={"Orders"}
+ icon={<LocalShipping fontSize={"inherit"} />}
+ >
+ {daily && daily.orders ? daily.orders.amount : undefined}
+ </HomeAnalyticsCard>
</div>
+
+ <HomeProductListCard
+ onRowClick={onProductClick}
+ topProducts={topProducts}
+ />
+ <CardSpacer />
</div>
- </Container>
- );
- }
+ <div>
+ <HomeActivityCard activities={activities} />
+ </div>
+ </div>
+ </Container>
+ )
);
export default HomePage;
diff --git a/saleor/static/dashboard-next/home/fixtures.ts b/saleor/static/dashboard-next/home/fixtures.ts
index ae74fa0a28..27996d0d9c 100644
--- a/saleor/static/dashboard-next/home/fixtures.ts
+++ b/saleor/static/dashboard-next/home/fixtures.ts
@@ -8,36 +8,25 @@ export const shop: (placeholderImage: string) => HomePageProps = (
action: "published",
admin: false,
date: "2018-09-10T13:22:24.376193+00:00",
- elementName: "Cool socks",
- id: "1",
- newElement: "collection",
- user: "user1234"
+ id: "1"
},
{
action: "published",
admin: false,
date: "2018-10-18T13:22:24.376193+00:00",
- elementName: "books",
- id: "2",
- newElement: "category",
- user: "user4321"
+ id: "2"
},
{
action: "created",
admin: false,
date: "2018-09-19T13:22:24.376193+00:00",
- elementName: "Smooth jazz",
- id: "3",
- newElement: "collection",
- user: "user1432"
+ id: "3"
},
{
action: "added",
admin: true,
date: "2018-09-20T13:22:24.376193+00:00",
- id: "4",
- newElement: "user",
- user: "user9977"
+ id: "4"
}
],
daily: {