From 509590e400839993e5406b35f88fd97ec5125f4d Mon Sep 17 00:00:00 2001 From: sektordv Date: Mon, 14 Jun 2021 18:48:22 +0200 Subject: [PATCH 1/7] added homepage condition for channel select --- src/components/AppLayout/AppLayout.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/components/AppLayout/AppLayout.tsx b/src/components/AppLayout/AppLayout.tsx index 7a9717637..0b7a162d7 100644 --- a/src/components/AppLayout/AppLayout.tsx +++ b/src/components/AppLayout/AppLayout.tsx @@ -137,6 +137,8 @@ const AppLayout: React.FC = ({ children }) => { setChannel } = useAppChannel(false); + const isHomepage = location.pathname === "/"; + const menuStructure = createMenuStructure(intl); const configurationMenu = createConfigurationMenu(intl); const userPermissions = user?.userPermissions || []; @@ -216,7 +218,7 @@ const AppLayout: React.FC = ({ children }) => { .includes("mac")} onClick={() => setNavigatorVisibility(true)} /> - {channel && ( + {channel && isHomepage && ( Date: Mon, 14 Jun 2021 19:20:19 +0200 Subject: [PATCH 2/7] disable picker via context --- src/categories/views/CategoryDetails.tsx | 2 +- src/collections/views/CollectionList/CollectionList.tsx | 2 +- src/components/AppLayout/AppLayout.tsx | 4 +--- src/discounts/views/SaleList/SaleList.tsx | 2 +- src/discounts/views/VoucherDetails/VoucherDetails.tsx | 2 +- src/discounts/views/VoucherList/VoucherList.tsx | 2 +- src/orders/views/OrderDraftList/OrderDraftList.tsx | 2 +- src/orders/views/OrderList/OrderList.tsx | 2 +- src/products/views/ProductList/ProductList.tsx | 2 +- src/products/views/ProductUpdate/ProductUpdate.tsx | 2 +- src/shipping/views/ShippingZoneDetails/index.tsx | 2 +- 11 files changed, 11 insertions(+), 13 deletions(-) diff --git a/src/categories/views/CategoryDetails.tsx b/src/categories/views/CategoryDetails.tsx index b413a056e..834d05b03 100644 --- a/src/categories/views/CategoryDetails.tsx +++ b/src/categories/views/CategoryDetails.tsx @@ -81,7 +81,7 @@ export const CategoryDetails: React.FC = ({ variables: { ...paginationState, id } }); - const { availableChannels, channel } = useAppChannel(); + const { availableChannels, channel } = useAppChannel(false); const channelChoices = mapNodeToChoice(availableChannels); diff --git a/src/collections/views/CollectionList/CollectionList.tsx b/src/collections/views/CollectionList/CollectionList.tsx index baead7734..ed8f86a70 100644 --- a/src/collections/views/CollectionList/CollectionList.tsx +++ b/src/collections/views/CollectionList/CollectionList.tsx @@ -90,7 +90,7 @@ export const CollectionList: React.FC = ({ params }) => { } }); - const { availableChannels, channel } = useAppChannel(); + const { availableChannels, channel } = useAppChannel(false); const tabs = getFilterTabs(); diff --git a/src/components/AppLayout/AppLayout.tsx b/src/components/AppLayout/AppLayout.tsx index 0b7a162d7..7a9717637 100644 --- a/src/components/AppLayout/AppLayout.tsx +++ b/src/components/AppLayout/AppLayout.tsx @@ -137,8 +137,6 @@ const AppLayout: React.FC = ({ children }) => { setChannel } = useAppChannel(false); - const isHomepage = location.pathname === "/"; - const menuStructure = createMenuStructure(intl); const configurationMenu = createConfigurationMenu(intl); const userPermissions = user?.userPermissions || []; @@ -218,7 +216,7 @@ const AppLayout: React.FC = ({ children }) => { .includes("mac")} onClick={() => setNavigatorVisibility(true)} /> - {channel && isHomepage && ( + {channel && ( = ({ params }) => { ListViews.SALES_LIST ); const intl = useIntl(); - const { channel } = useAppChannel(); + const { channel } = useAppChannel(false); const [openModal, closeModal] = createDialogActionHandlers< SaleListUrlDialog, diff --git a/src/discounts/views/VoucherDetails/VoucherDetails.tsx b/src/discounts/views/VoucherDetails/VoucherDetails.tsx index 9db06115c..32c58f750 100644 --- a/src/discounts/views/VoucherDetails/VoucherDetails.tsx +++ b/src/discounts/views/VoucherDetails/VoucherDetails.tsx @@ -119,7 +119,7 @@ export const VoucherDetails: React.FC = ({ VoucherUrlQueryParams >(navigate, params => voucherUrl(id, params), params); - const { channel, availableChannels } = useAppChannel(); + const { channel, availableChannels } = useAppChannel(false); const allChannels: ChannelVoucherData[] = createChannelsDataWithDiscountPrice( data?.voucher, diff --git a/src/discounts/views/VoucherList/VoucherList.tsx b/src/discounts/views/VoucherList/VoucherList.tsx index 1992b6e3d..dc4a40f46 100644 --- a/src/discounts/views/VoucherList/VoucherList.tsx +++ b/src/discounts/views/VoucherList/VoucherList.tsx @@ -64,7 +64,7 @@ export const VoucherList: React.FC = ({ params }) => { ); const intl = useIntl(); - const { channel } = useAppChannel(); + const { channel } = useAppChannel(false); const [openModal, closeModal] = createDialogActionHandlers< VoucherListUrlDialog, diff --git a/src/orders/views/OrderDraftList/OrderDraftList.tsx b/src/orders/views/OrderDraftList/OrderDraftList.tsx index f6cec36be..c3808be55 100644 --- a/src/orders/views/OrderDraftList/OrderDraftList.tsx +++ b/src/orders/views/OrderDraftList/OrderDraftList.tsx @@ -80,7 +80,7 @@ export const OrderDraftList: React.FC = ({ params }) => { onCompleted: handleCreateOrderCreateSuccess }); - const { channel, availableChannels } = useAppChannel(); + const { channel, availableChannels } = useAppChannel(false); const tabs = getFilterTabs(); diff --git a/src/orders/views/OrderList/OrderList.tsx b/src/orders/views/OrderList/OrderList.tsx index e6a306b58..f2d24e907 100644 --- a/src/orders/views/OrderList/OrderList.tsx +++ b/src/orders/views/OrderList/OrderList.tsx @@ -71,7 +71,7 @@ export const OrderList: React.FC = ({ params }) => { onCompleted: handleCreateOrderCreateSuccess }); - const { channel, availableChannels } = useAppChannel(); + const { channel, availableChannels } = useAppChannel(false); const limitOpts = useShopLimitsQuery({ variables: { orders: true diff --git a/src/products/views/ProductList/ProductList.tsx b/src/products/views/ProductList/ProductList.tsx index 6c5a378af..490bcd7a6 100644 --- a/src/products/views/ProductList/ProductList.tsx +++ b/src/products/views/ProductList/ProductList.tsx @@ -154,7 +154,7 @@ export const ProductList: React.FC = ({ params }) => { }, skip: params.action !== "export" }); - const { availableChannels, channel } = useAppChannel(); + const { availableChannels, channel } = useAppChannel(false); const limitOpts = useShopLimitsQuery({ variables: { productVariants: true diff --git a/src/products/views/ProductUpdate/ProductUpdate.tsx b/src/products/views/ProductUpdate/ProductUpdate.tsx index d7118c011..04ed46c5e 100644 --- a/src/products/views/ProductUpdate/ProductUpdate.tsx +++ b/src/products/views/ProductUpdate/ProductUpdate.tsx @@ -170,7 +170,7 @@ export const ProductUpdate: React.FC = ({ id, params }) => { productVariantCreateOpts ] = useVariantCreateMutation({}); - const { availableChannels, channel } = useAppChannel(); + const { availableChannels, channel } = useAppChannel(false); const { data, loading, refetch } = useProductDetails({ displayLoader: true, variables: { diff --git a/src/shipping/views/ShippingZoneDetails/index.tsx b/src/shipping/views/ShippingZoneDetails/index.tsx index 9dc2c09fc..de33e1be3 100644 --- a/src/shipping/views/ShippingZoneDetails/index.tsx +++ b/src/shipping/views/ShippingZoneDetails/index.tsx @@ -73,7 +73,7 @@ const ShippingZoneDetails: React.FC = ({ displayLoader: true, variables: { id, ...paginationState } }); - const { availableChannels, channel } = useAppChannel(); + const { availableChannels, channel } = useAppChannel(false); const [openModal, closeModal] = createDialogActionHandlers< ShippingZoneUrlDialog, From 2fa6d42f5e405cd73df9e1f73d7377b257154ea7 Mon Sep 17 00:00:00 2001 From: sektordv Date: Tue, 22 Jun 2021 12:08:45 +0200 Subject: [PATCH 3/7] hide channel selector on all paths except home --- src/components/AppLayout/AppLayout.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/AppLayout/AppLayout.tsx b/src/components/AppLayout/AppLayout.tsx index 7a9717637..36edfdd9e 100644 --- a/src/components/AppLayout/AppLayout.tsx +++ b/src/components/AppLayout/AppLayout.tsx @@ -216,7 +216,7 @@ const AppLayout: React.FC = ({ children }) => { .includes("mac")} onClick={() => setNavigatorVisibility(true)} /> - {channel && ( + {channel && location.pathname === "/" && ( Date: Fri, 6 Aug 2021 20:54:18 +0200 Subject: [PATCH 4/7] hide channelselect instead of disabling --- src/components/AppLayout/AppChannelSelect.tsx | 3 --- src/components/AppLayout/AppLayout.tsx | 3 +-- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/src/components/AppLayout/AppChannelSelect.tsx b/src/components/AppLayout/AppChannelSelect.tsx index 6760b7fde..66ad4e3f2 100644 --- a/src/components/AppLayout/AppChannelSelect.tsx +++ b/src/components/AppLayout/AppChannelSelect.tsx @@ -23,13 +23,11 @@ const useStyles = makeStyles( export interface AppChannelSelectProps extends ChannelProps { channels: ChannelFragment[]; - disabled: boolean; onChannelSelect: (id: string) => void; } const AppChannelSelect: React.FC = ({ channels, - disabled, onChannelSelect, selectedChannelId }) => { @@ -40,7 +38,6 @@ const AppChannelSelect: React.FC = ({ onChannelSelect(event.target.value)} /> diff --git a/src/components/AppLayout/AppLayout.tsx b/src/components/AppLayout/AppLayout.tsx index 36edfdd9e..6bbe3fb20 100644 --- a/src/components/AppLayout/AppLayout.tsx +++ b/src/components/AppLayout/AppLayout.tsx @@ -216,10 +216,9 @@ const AppLayout: React.FC = ({ children }) => { .includes("mac")} onClick={() => setNavigatorVisibility(true)} /> - {channel && location.pathname === "/" && ( + {channel && isPickerActive && ( From 0585f61522e8ce414f08787dd908cbfaedd6d31b Mon Sep 17 00:00:00 2001 From: sektordv Date: Mon, 14 Jun 2021 19:20:19 +0200 Subject: [PATCH 5/7] disable picker via context --- src/categories/views/CategoryDetails.tsx | 2 +- src/collections/views/CollectionList/CollectionList.tsx | 2 +- src/discounts/views/VoucherDetails/VoucherDetails.tsx | 2 +- src/products/views/ProductUpdate/ProductUpdate.tsx | 2 +- src/shipping/views/ShippingZoneDetails/index.tsx | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/categories/views/CategoryDetails.tsx b/src/categories/views/CategoryDetails.tsx index 7f80c39bd..8ae65d1d2 100644 --- a/src/categories/views/CategoryDetails.tsx +++ b/src/categories/views/CategoryDetails.tsx @@ -81,7 +81,7 @@ export const CategoryDetails: React.FC = ({ variables: { ...paginationState, id } }); - const { availableChannels, channel } = useAppChannel(); + const { availableChannels, channel } = useAppChannel(false); const channelChoices = mapNodeToChoice(availableChannels); diff --git a/src/collections/views/CollectionList/CollectionList.tsx b/src/collections/views/CollectionList/CollectionList.tsx index baead7734..ed8f86a70 100644 --- a/src/collections/views/CollectionList/CollectionList.tsx +++ b/src/collections/views/CollectionList/CollectionList.tsx @@ -90,7 +90,7 @@ export const CollectionList: React.FC = ({ params }) => { } }); - const { availableChannels, channel } = useAppChannel(); + const { availableChannels, channel } = useAppChannel(false); const tabs = getFilterTabs(); diff --git a/src/discounts/views/VoucherDetails/VoucherDetails.tsx b/src/discounts/views/VoucherDetails/VoucherDetails.tsx index 31f0f45e8..f8bda40a8 100644 --- a/src/discounts/views/VoucherDetails/VoucherDetails.tsx +++ b/src/discounts/views/VoucherDetails/VoucherDetails.tsx @@ -126,7 +126,7 @@ export const VoucherDetails: React.FC = ({ VoucherUrlQueryParams >(navigate, params => voucherUrl(id, params), params); - const { channel, availableChannels } = useAppChannel(); + const { channel, availableChannels } = useAppChannel(false); const allChannels: ChannelVoucherData[] = createChannelsDataWithDiscountPrice( data?.voucher, diff --git a/src/products/views/ProductUpdate/ProductUpdate.tsx b/src/products/views/ProductUpdate/ProductUpdate.tsx index 94334046b..725740b9e 100644 --- a/src/products/views/ProductUpdate/ProductUpdate.tsx +++ b/src/products/views/ProductUpdate/ProductUpdate.tsx @@ -164,7 +164,7 @@ export const ProductUpdate: React.FC = ({ id, params }) => { productVariantCreateOpts ] = useVariantCreateMutation({}); - const { availableChannels, channel } = useAppChannel(); + const { availableChannels, channel } = useAppChannel(false); const { data, loading, refetch } = useProductDetails({ displayLoader: true, variables: { diff --git a/src/shipping/views/ShippingZoneDetails/index.tsx b/src/shipping/views/ShippingZoneDetails/index.tsx index 3712d236c..dddd58501 100644 --- a/src/shipping/views/ShippingZoneDetails/index.tsx +++ b/src/shipping/views/ShippingZoneDetails/index.tsx @@ -73,7 +73,7 @@ const ShippingZoneDetails: React.FC = ({ displayLoader: true, variables: { id, ...paginationState } }); - const { availableChannels, channel } = useAppChannel(); + const { availableChannels, channel } = useAppChannel(false); const [openModal, closeModal] = createDialogActionHandlers< ShippingZoneUrlDialog, From e5d0ee1179e7f12466ff603291d93aa68108eb43 Mon Sep 17 00:00:00 2001 From: sektordv Date: Fri, 6 Aug 2021 20:54:18 +0200 Subject: [PATCH 6/7] hide channelselect instead of disabling --- src/components/AppLayout/AppChannelSelect.tsx | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/components/AppLayout/AppChannelSelect.tsx b/src/components/AppLayout/AppChannelSelect.tsx index ff075ac07..023758bc7 100644 --- a/src/components/AppLayout/AppChannelSelect.tsx +++ b/src/components/AppLayout/AppChannelSelect.tsx @@ -23,13 +23,11 @@ const useStyles = makeStyles( export interface AppChannelSelectProps extends ChannelProps { channels: ChannelFragment[]; - disabled: boolean; onChannelSelect: (id: string) => void; } const AppChannelSelect: React.FC = ({ channels, - disabled, onChannelSelect, selectedChannelId }) => { @@ -40,7 +38,6 @@ const AppChannelSelect: React.FC = ({ onChannelSelect(event.target.value)} /> From 049210b1b603a84b155f28d331c21400f47a8238 Mon Sep 17 00:00:00 2001 From: sektordv Date: Wed, 11 Aug 2021 13:44:47 +0200 Subject: [PATCH 7/7] reapply changes after rebase --- src/components/AppLayout/AppLayout.tsx | 3 +-- src/orders/views/OrderDraftList/OrderDraftList.tsx | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/components/AppLayout/AppLayout.tsx b/src/components/AppLayout/AppLayout.tsx index eff93ddcd..2aeeefa05 100644 --- a/src/components/AppLayout/AppLayout.tsx +++ b/src/components/AppLayout/AppLayout.tsx @@ -195,10 +195,9 @@ const AppLayout: React.FC = ({ children }) => { isMac={navigator.platform.toLowerCase().includes("mac")} onClick={() => setNavigatorVisibility(true)} /> - {channel && ( + {isPickerActive && ( diff --git a/src/orders/views/OrderDraftList/OrderDraftList.tsx b/src/orders/views/OrderDraftList/OrderDraftList.tsx index 87c777a16..778e7a240 100644 --- a/src/orders/views/OrderDraftList/OrderDraftList.tsx +++ b/src/orders/views/OrderDraftList/OrderDraftList.tsx @@ -81,7 +81,7 @@ export const OrderDraftList: React.FC = ({ params }) => { onCompleted: handleCreateOrderCreateSuccess }); - const { channel, availableChannels } = useAppChannel(); + const { channel, availableChannels } = useAppChannel(false); const limitOpts = useShopLimitsQuery({ variables: { orders: true