-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New home page sidebar and Title (#5268)
* Add feature flag for new home page * New home page with layout * Conditionally render new and old home page * Add changeset * Init new sidebar * Base analytics cards * Base activities cards * Refactor and move fetching logic to hooks near components * Single queries file * Add home title * Move common props to context * Add permission checks * Add change * Rollback type * Improve query data * Fix typo * Fix translations * Fix types * Fix types v2 * Restruct dir structure to align with current setup * Move context inside * Update queries --------- Co-authored-by: M.Graczyk <[email protected]>
- Loading branch information
1 parent
f9130c4
commit 9cd4da2
Showing
26 changed files
with
720 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"saleor-dashboard": patch | ||
--- | ||
|
||
You can now see new sidebar with analytics and activities |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import AppChannelSelect from "@dashboard/components/AppLayout/AppChannelSelect"; | ||
import { topBarHeight } from "@dashboard/components/AppLayout/consts"; | ||
import { DashboardCard } from "@dashboard/components/Card"; | ||
import RequirePermissions from "@dashboard/components/RequirePermissions"; | ||
import { ChannelFragment, PermissionEnum } from "@dashboard/graphql"; | ||
import { Box, Text } from "@saleor/macaw-ui-next"; | ||
import React from "react"; | ||
import { FormattedMessage } from "react-intl"; | ||
|
||
import { HomeActivities } from "./components/HomeActivities"; | ||
import { HomeSalesAnalytics } from "./components/HomeSalesAnalytics"; | ||
import { HomeStocksAnalytics } from "./components/HomeStocksAnalytics"; | ||
import { HomeSidebarContextProvider } from "./context/HomeSidebarContextProvider"; | ||
|
||
interface HomeSidebarProps { | ||
channel: ChannelFragment | undefined; | ||
setChannel: (channelId: string) => void; | ||
channels: ChannelFragment[]; | ||
hasPermissionToManageOrders: boolean; | ||
} | ||
|
||
export const HomeSidebar = (props: HomeSidebarProps) => { | ||
return ( | ||
<HomeSidebarContextProvider {...props}> | ||
<DashboardCard | ||
borderRadius={3} | ||
borderWidth={1} | ||
borderStyle="solid" | ||
borderColor="default1" | ||
__marginTop={topBarHeight} | ||
marginRight={5} | ||
> | ||
<DashboardCard.Header> | ||
<DashboardCard.Title> | ||
<Text size={8}> | ||
<FormattedMessage | ||
defaultMessage="Your store info" | ||
id="x0wum5" | ||
description="home sidebar card title" | ||
/> | ||
</Text> | ||
</DashboardCard.Title> | ||
|
||
<AppChannelSelect | ||
channels={props.channels} | ||
selectedChannelId={props.channel?.id ?? ""} | ||
onChannelSelect={props.setChannel} | ||
/> | ||
</DashboardCard.Header> | ||
<DashboardCard.Content> | ||
<RequirePermissions requiredPermissions={[PermissionEnum.MANAGE_ORDERS]}> | ||
<Box display="grid" gap={5} marginBottom={7}> | ||
<HomeSalesAnalytics /> | ||
<HomeStocksAnalytics /> | ||
</Box> | ||
</RequirePermissions> | ||
<HomeActivities /> | ||
</DashboardCard.Content> | ||
</DashboardCard> | ||
</HomeSidebarContextProvider> | ||
); | ||
}; |
Oops, something went wrong.