Skip to content

Commit

Permalink
Rename newHome to wecomePage (#5283)
Browse files Browse the repository at this point in the history
* Rename to welcomePage

* add changeset

* Restore index.ts files

* Apply CR fixes
  • Loading branch information
poulch authored Nov 27, 2024
1 parent a9f48c4 commit 630ac4c
Show file tree
Hide file tree
Showing 64 changed files with 422 additions and 397 deletions.
5 changes: 5 additions & 0 deletions .changeset/eleven-beans-attend.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"saleor-dashboard": patch
---

Rename newHome to wecomePage to allow seamlessly removing a feature flag
2 changes: 1 addition & 1 deletion src/components/DevModePanel/DevModePanel.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// @ts-strict-ignore
import { useDashboardTheme } from "@dashboard/components/GraphiQL/styles";
import { DashboardModal } from "@dashboard/components/Modal";
import { useOnboarding } from "@dashboard/newHome/homeOnboarding/onboardingContext";
import { useOnboarding } from "@dashboard/welcomePage/WelcomePageOnboarding/onboardingContext";
import { createGraphiQLFetcher, FetcherOpts, FetcherParams } from "@graphiql/toolkit";
import { createFetch } from "@saleor/sdk";
import React from "react";
Expand Down
2 changes: 1 addition & 1 deletion src/custom-apps/views/CustomAppList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ import useNavigator from "@dashboard/hooks/useNavigator";
import useNotifier from "@dashboard/hooks/useNotifier";
import { sectionNames } from "@dashboard/intl";
import { findById } from "@dashboard/misc";
import { useOnboarding } from "@dashboard/newHome/homeOnboarding/onboardingContext";
import createDialogActionHandlers from "@dashboard/utils/handlers/dialogActionHandlers";
import { mapEdgesToItems } from "@dashboard/utils/maps";
import { useOnboarding } from "@dashboard/welcomePage/WelcomePageOnboarding/onboardingContext";
import React, { useEffect } from "react";
import { useIntl } from "react-intl";

Expand Down
320 changes: 160 additions & 160 deletions src/graphql/hooks.generated.ts

Large diffs are not rendered by default.

60 changes: 30 additions & 30 deletions src/graphql/types.generated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10745,36 +10745,6 @@ export type MenuDetailsQueryVariables = Exact<{

export type MenuDetailsQuery = { __typename: 'Query', menu: { __typename: 'Menu', id: string, name: string, items: Array<{ __typename: 'MenuItem', id: string, level: number, name: string, url: string | null, children: Array<{ __typename: 'MenuItem', id: string, level: number, name: string, url: string | null, children: Array<{ __typename: 'MenuItem', id: string, level: number, name: string, url: string | null, children: Array<{ __typename: 'MenuItem', id: string, level: number, name: string, url: string | null, children: Array<{ __typename: 'MenuItem', id: string, level: number, name: string, url: string | null, children: Array<{ __typename: 'MenuItem', id: string, level: number, name: string, url: string | null, children: Array<{ __typename: 'MenuItem', id: string, level: number, name: string, url: string | null, category: { __typename: 'Category', id: string, name: string } | null, collection: { __typename: 'Collection', id: string, name: string } | null, page: { __typename: 'Page', id: string, title: string } | null }> | null, category: { __typename: 'Category', id: string, name: string } | null, collection: { __typename: 'Collection', id: string, name: string } | null, page: { __typename: 'Page', id: string, title: string } | null }> | null, category: { __typename: 'Category', id: string, name: string } | null, collection: { __typename: 'Collection', id: string, name: string } | null, page: { __typename: 'Page', id: string, title: string } | null }> | null, category: { __typename: 'Category', id: string, name: string } | null, collection: { __typename: 'Collection', id: string, name: string } | null, page: { __typename: 'Page', id: string, title: string } | null }> | null, category: { __typename: 'Category', id: string, name: string } | null, collection: { __typename: 'Collection', id: string, name: string } | null, page: { __typename: 'Page', id: string, title: string } | null }> | null, category: { __typename: 'Category', id: string, name: string } | null, collection: { __typename: 'Collection', id: string, name: string } | null, page: { __typename: 'Page', id: string, title: string } | null }> | null, category: { __typename: 'Category', id: string, name: string } | null, collection: { __typename: 'Collection', id: string, name: string } | null, page: { __typename: 'Page', id: string, title: string } | null }> | null } | null };

export type UpdateUserMetadataMutationVariables = Exact<{
id: Scalars['ID'];
input: Array<MetadataInput> | MetadataInput;
}>;


export type UpdateUserMetadataMutation = { __typename: 'Mutation', updateMetadata: { __typename: 'UpdateMetadata', errors: Array<{ __typename: 'MetadataError', code: MetadataErrorCode, field: string | null, message: string | null }> } | null };

export type WelcomePageActivitiesQueryVariables = Exact<{
hasPermissionToManageOrders: Scalars['Boolean'];
}>;


export type WelcomePageActivitiesQuery = { __typename: 'Query', activities: { __typename: 'OrderEventCountableConnection', edges: Array<{ __typename: 'OrderEventCountableEdge', node: { __typename: 'OrderEvent', date: any | null, email: string | null, message: string | null, orderNumber: string | null, type: OrderEventsEnum | null, user: { __typename: 'User', email: string } | null } }> } | null };

export type WelcomePageAnalyticsQueryVariables = Exact<{
channel: Scalars['String'];
hasPermissionToManageOrders: Scalars['Boolean'];
}>;


export type WelcomePageAnalyticsQuery = { __typename: 'Query', salesToday: { __typename: 'TaxedMoney', gross: { __typename: 'Money', amount: number, currency: string } } | null };

export type WelcomePageNotificationsQueryVariables = Exact<{
channel: Scalars['String'];
}>;


export type WelcomePageNotificationsQuery = { __typename: 'Query', productsOutOfStock: { __typename: 'ProductCountableConnection', totalCount: number | null } | null };

export type OrderCancelMutationVariables = Exact<{
id: Scalars['ID'];
}>;
Expand Down Expand Up @@ -12657,3 +12627,33 @@ export type WarehousesCountQueryVariables = Exact<{ [key: string]: never; }>;


export type WarehousesCountQuery = { __typename: 'Query', warehouses: { __typename: 'WarehouseCountableConnection', totalCount: number | null } | null };

export type SaveOnBoardingStateMutationVariables = Exact<{
id: Scalars['ID'];
input: Array<MetadataInput> | MetadataInput;
}>;


export type SaveOnBoardingStateMutation = { __typename: 'Mutation', updateMetadata: { __typename: 'UpdateMetadata', errors: Array<{ __typename: 'MetadataError', code: MetadataErrorCode, field: string | null, message: string | null }> } | null };

export type WelcomePageActivitiesQueryVariables = Exact<{
hasPermissionToManageOrders: Scalars['Boolean'];
}>;


export type WelcomePageActivitiesQuery = { __typename: 'Query', activities: { __typename: 'OrderEventCountableConnection', edges: Array<{ __typename: 'OrderEventCountableEdge', node: { __typename: 'OrderEvent', date: any | null, email: string | null, message: string | null, orderNumber: string | null, type: OrderEventsEnum | null, user: { __typename: 'User', email: string } | null } }> } | null };

export type WelcomePageAnalyticsQueryVariables = Exact<{
channel: Scalars['String'];
hasPermissionToManageOrders: Scalars['Boolean'];
}>;


export type WelcomePageAnalyticsQuery = { __typename: 'Query', salesToday: { __typename: 'TaxedMoney', gross: { __typename: 'Money', amount: number, currency: string } } | null };

export type WelcomePageNotificationsQueryVariables = Exact<{
channel: Scalars['String'];
}>;


export type WelcomePageNotificationsQuery = { __typename: 'Query', productsOutOfStock: { __typename: 'ProductCountableConnection', totalCount: number | null } | null };
6 changes: 3 additions & 3 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { useFlag } from "@dashboard/featureFlags";
import { PermissionEnum } from "@dashboard/graphql";
import useAppState from "@dashboard/hooks/useAppState";
import { ThemeProvider } from "@dashboard/theme";
import { OnboardingProvider } from "@dashboard/welcomePage/WelcomePageOnboarding/onboardingContext";
import { ThemeProvider as LegacyThemeProvider } from "@saleor/macaw-ui";
import { SaleorProvider } from "@saleor/sdk";
import React from "react";
Expand Down Expand Up @@ -62,8 +63,6 @@ import { useLocationState } from "./hooks/useLocationState";
import { commonMessages } from "./intl";
import NavigationSection from "./navigation";
import { navigationSection } from "./navigation/urls";
import { HomePage } from "./newHome";
import { OnboardingProvider } from "./newHome/homeOnboarding/onboardingContext/OnboardingContext";
import { NotFound } from "./NotFound";
import OrdersSection from "./orders";
import PageSection from "./pages";
Expand All @@ -81,6 +80,7 @@ import { paletteOverrides, themeOverrides } from "./themeOverrides";
import TranslationsSection from "./translations";
import WarehouseSection from "./warehouses";
import { warehouseSection } from "./warehouses/urls";
import { WelcomePage } from "./welcomePage";

if (GTM_ID) {
TagManager.initialize({ gtmId: GTM_ID });
Expand Down Expand Up @@ -159,7 +159,7 @@ const Routes: React.FC = () => {
const homePageLoading = (authenticated && !channelLoaded) || authenticating;
const { isAppPath } = useLocationState();
const { enabled: isNewHomePageEnabled } = useFlag("new_home_page");
const HomePageComponent = isNewHomePageEnabled ? HomePage : OldHomePage;
const HomePageComponent = isNewHomePageEnabled ? WelcomePage : OldHomePage;

return (
<>
Expand Down
1 change: 0 additions & 1 deletion src/newHome/HomeSidebar/components/HomeActivities/index.ts

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

24 changes: 0 additions & 24 deletions src/newHome/HomeSidebar/context/homeSidebarContext.ts

This file was deleted.

1 change: 0 additions & 1 deletion src/newHome/HomeSidebar/index.ts

This file was deleted.

1 change: 0 additions & 1 deletion src/newHome/index.ts

This file was deleted.

2 changes: 1 addition & 1 deletion src/orders/views/OrderList/OrderList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ import usePaginator, {
createPaginationState,
PaginatorContext,
} from "@dashboard/hooks/usePaginator";
import { useOnboarding } from "@dashboard/newHome/homeOnboarding/onboardingContext";
import { ListViews } from "@dashboard/types";
import createDialogActionHandlers from "@dashboard/utils/handlers/dialogActionHandlers";
import createSortHandler from "@dashboard/utils/handlers/sortHandler";
import { mapEdgesToItems, mapNodeToChoice } from "@dashboard/utils/maps";
import { getSortParams } from "@dashboard/utils/sort";
import { useOnboarding } from "@dashboard/welcomePage/WelcomePageOnboarding/onboardingContext";
import React, { useEffect } from "react";
import { useIntl } from "react-intl";

Expand Down
2 changes: 1 addition & 1 deletion src/products/views/ProductCreate/ProductCreate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import useNavigator from "@dashboard/hooks/useNavigator";
import useNotifier from "@dashboard/hooks/useNotifier";
import useShop from "@dashboard/hooks/useShop";
import { getMutationErrors } from "@dashboard/misc";
import { useOnboarding } from "@dashboard/newHome/homeOnboarding/onboardingContext";
import ProductCreatePage, {
ProductCreateData,
} from "@dashboard/products/components/ProductCreatePage";
Expand All @@ -46,6 +45,7 @@ import createDialogActionHandlers from "@dashboard/utils/handlers/dialogActionHa
import createMetadataCreateHandler from "@dashboard/utils/handlers/metadataCreateHandler";
import { mapEdgesToItems } from "@dashboard/utils/maps";
import { warehouseAddPath } from "@dashboard/warehouses/urls";
import { useOnboarding } from "@dashboard/welcomePage/WelcomePageOnboarding/onboardingContext";
import React, { useMemo } from "react";
import { useIntl } from "react-intl";

Expand Down
2 changes: 1 addition & 1 deletion src/staff/views/StaffList/StaffList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import usePaginator, {
PaginatorContext,
} from "@dashboard/hooks/usePaginator";
import { commonMessages } from "@dashboard/intl";
import { useOnboarding } from "@dashboard/newHome/homeOnboarding/onboardingContext";
import usePermissionGroupSearch from "@dashboard/searches/usePermissionGroupSearch";
import { ListViews } from "@dashboard/types";
import createDialogActionHandlers from "@dashboard/utils/handlers/dialogActionHandlers";
Expand All @@ -23,6 +22,7 @@ import createSortHandler from "@dashboard/utils/handlers/sortHandler";
import { mapEdgesToItems } from "@dashboard/utils/maps";
import { getSortParams } from "@dashboard/utils/sort";
import { getAppMountUriForRedirect } from "@dashboard/utils/urls";
import { useOnboarding } from "@dashboard/welcomePage/WelcomePageOnboarding/onboardingContext";
import React from "react";
import { useIntl } from "react-intl";
import urlJoin from "url-join";
Expand Down
18 changes: 9 additions & 9 deletions src/newHome/HomePage.tsx → src/welcomePage/WelcomePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ import { PermissionEnum } from "@dashboard/graphql";
import { Box } from "@saleor/macaw-ui-next";
import React from "react";

import { HomeTilesContainer } from "./homeInfoTiles/TilesContainer";
import HomeOnboarding from "./homeOnboarding/HomeOnboarding";
import { HomeSidebar } from "./HomeSidebar";
import { HomeTitle } from "./HomeTitle";
import { WelcomePageOnboarding } from "./WelcomePageOnboarding";
import { WelcomePageSidebar } from "./WelcomePageSidebar";
import { WelcomePageTilesContainer } from "./WelcomePageTilesContainer";
import { WelcomePageTitle } from "./WelcomePageTitle";

export const HomePage = () => {
export const WelcomePage = () => {
const { channel, setChannel } = useAppChannel(false);
const { user } = useUser();
const channels = user?.accessibleChannels ?? [];
Expand All @@ -24,12 +24,12 @@ export const HomePage = () => {
<DetailPageLayout withSavebar={false}>
<Box gridColumn="8" gridRowStart="1" />
<DetailPageLayout.Content paddingTop={6} paddingLeft={8}>
<HomeTitle />
<HomeOnboarding />
<HomeTilesContainer />
<WelcomePageTitle />
<WelcomePageOnboarding />
<WelcomePageTilesContainer />
</DetailPageLayout.Content>
<DetailPageLayout.RightSidebar borderLeftStyle="none">
<HomeSidebar
<WelcomePageSidebar
channel={channel}
setChannel={setChannel}
channels={channels}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { DashboardCard } from "@dashboard/components/Card";
import { TOTAL_STEPS_COUNT } from "@dashboard/newHome/homeOnboarding/onboardingContext/initialOnboardingState";
import { TOTAL_STEPS_COUNT } from "@dashboard/welcomePage/WelcomePageOnboarding/onboardingContext/initialOnboardingState";
import { Accordion, Box, Button, ChervonDownIcon, Text } from "@saleor/macaw-ui-next";
import * as React from "react";
import { FormattedMessage } from "react-intl";

import { HomeOnboardingAccordion } from "./HomeOnboardingAccordion";
import { WelcomePageOnboardingAccordion } from "./components/WelcomePageOnboardingAccordion";
import { useOnboarding } from "./onboardingContext/OnboardingContext";

type TitleProps = {
Expand All @@ -15,7 +15,7 @@ type TitleProps = {
};
};

const HomeOnboarding = () => {
export const WelcomePageOnboarding = () => {
const { markAllAsCompleted, isOnboardingCompleted, toggleOnboarding, onboardingState } =
useOnboarding();

Expand Down Expand Up @@ -73,7 +73,7 @@ const HomeOnboarding = () => {

<Accordion.Content>
<DashboardCard.Content padding={6} paddingTop={0}>
<HomeOnboardingAccordion />
<WelcomePageOnboardingAccordion />
</DashboardCard.Content>
</Accordion.Content>
</Accordion.Item>
Expand All @@ -82,7 +82,7 @@ const HomeOnboarding = () => {
);
};

const Title: React.FC<TitleProps> = ({ isOnboardingCompleted, status }) => {
const Title = ({ isOnboardingCompleted, status }: TitleProps) => {
if (isOnboardingCompleted) {
return (
<Text size={7}>
Expand All @@ -109,5 +109,3 @@ const Title: React.FC<TitleProps> = ({ isOnboardingCompleted, status }) => {
</Text>
);
};

export default HomeOnboarding;
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Button } from "@saleor/macaw-ui-next";
import React from "react";
import { FormattedMessage } from "react-intl";

export const HomeCheckGraphQLButton = () => {
export const WelcomePageCheckGraphQLButton = () => {
const context = useDevModeContext();

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import React from "react";
import { FormattedMessage } from "react-intl";
import { Link } from "react-router-dom";

import { HomeFakeDisabledButton } from "./HomeFakeDisabledButton";
import { WelcomePageFakeDisabledButton } from "./WelcomePageFakeDisabledButton";

export const HomeCreateProductButton = () => {
export const WelcomePageCreateProductButton = () => {
const { user } = useUser();
const userPermissions = user?.userPermissions || [];
const hasPermissionToManageProducts = hasPermissions(userPermissions, [
Expand All @@ -20,13 +20,13 @@ export const HomeCreateProductButton = () => {
return (
<Tooltip>
<Tooltip.Trigger>
<HomeFakeDisabledButton>
<WelcomePageFakeDisabledButton>
<FormattedMessage
defaultMessage="Go to all products"
id="XZpRr8"
description="btn label"
/>
</HomeFakeDisabledButton>
</WelcomePageFakeDisabledButton>
</Tooltip.Trigger>
<Tooltip.Content>
<Tooltip.Arrow />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Button, ButtonProps, vars } from "@saleor/macaw-ui-next";
import React from "react";

export const HomeFakeDisabledButton = React.forwardRef<HTMLButtonElement, ButtonProps>(
export const WelcomePageFakeDisabledButton = React.forwardRef<HTMLButtonElement, ButtonProps>(
({ children, ...props }, ref) => {
const [isHovered, setIsHovered] = React.useState(false);

Expand Down Expand Up @@ -30,4 +30,4 @@ export const HomeFakeDisabledButton = React.forwardRef<HTMLButtonElement, Button
},
);

HomeFakeDisabledButton.displayName = "HomeFakeDisabledButton";
WelcomePageFakeDisabledButton.displayName = "WelcomePageFakeDisabledButton";
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import React from "react";
import { FormattedMessage } from "react-intl";
import { Link } from "react-router-dom";

import { HomeFakeDisabledButton } from "./HomeFakeDisabledButton";
import { WelcomePageFakeDisabledButton } from "./WelcomePageFakeDisabledButton";

export const HomeInviteStaffButton = () => {
export const WelcomePageInviteStaffButton = () => {
const { user } = useUser();
const userPermissions = user?.userPermissions || [];
const hasPermissionToManageStaff = hasPermissions(userPermissions, [PermissionEnum.MANAGE_STAFF]);
Expand All @@ -18,9 +18,9 @@ export const HomeInviteStaffButton = () => {
return (
<Tooltip>
<Tooltip.Trigger>
<HomeFakeDisabledButton variant="primary">
<WelcomePageFakeDisabledButton variant="primary">
<FormattedMessage defaultMessage="Invite members" id="BBt3jD" description="btn label" />
</HomeFakeDisabledButton>
</WelcomePageFakeDisabledButton>
</Tooltip.Trigger>
<Tooltip.Content>
<Tooltip.Arrow />
Expand Down
Loading

0 comments on commit 630ac4c

Please sign in to comment.