diff --git a/frontend/app/components/Dashboard/components/DashboardList/NewDashModal/ExampleCards.tsx b/frontend/app/components/Dashboard/components/DashboardList/NewDashModal/ExampleCards.tsx index f4c1bdf92..024e25c84 100644 --- a/frontend/app/components/Dashboard/components/DashboardList/NewDashModal/ExampleCards.tsx +++ b/frontend/app/components/Dashboard/components/DashboardList/NewDashModal/ExampleCards.tsx @@ -1,3 +1,4 @@ + import ExampleFunnel from './Examples/Funnel'; import ExamplePath from './Examples/Path'; import ExampleTrend from './Examples/Trend'; diff --git a/frontend/app/components/Dashboard/components/DashboardList/NewDashModal/NewDashboardModal.tsx b/frontend/app/components/Dashboard/components/DashboardList/NewDashModal/NewDashboardModal.tsx index c974e8bf3..c1301765d 100644 --- a/frontend/app/components/Dashboard/components/DashboardList/NewDashModal/NewDashboardModal.tsx +++ b/frontend/app/components/Dashboard/components/DashboardList/NewDashModal/NewDashboardModal.tsx @@ -10,13 +10,15 @@ interface NewDashboardModalProps { open: boolean; isAddingFromLibrary?: boolean; isEnterprise?: boolean; + isMobile?: boolean; } const NewDashboardModal: React.FC = ({ onClose, open, isAddingFromLibrary = false, - isEnterprise = false + isEnterprise = false, + isMobile = false }) => { const [step, setStep] = React.useState(0); const [selectedCategory, setSelectedCategory] = React.useState('product-analytics'); @@ -53,6 +55,7 @@ const NewDashboardModal: React.FC = ({ setSelectedCategory={setSelectedCategory} onCard={() => setStep(step + 1)} isLibrary={isAddingFromLibrary} + isMobile={isMobile} isEnterprise={isEnterprise} />} {step === 1 && setStep(0)} />} @@ -63,6 +66,7 @@ const NewDashboardModal: React.FC = ({ }; const mapStateToProps = (state: any) => ({ + isMobile: state.getIn(['site', 'instance', 'platform']) === 'ios', isEnterprise: state.getIn(['user', 'account', 'edition']) === 'ee' || state.getIn(['user', 'account', 'edition']) === 'msaas' }); diff --git a/frontend/app/components/Dashboard/components/DashboardList/NewDashModal/SelectCard.tsx b/frontend/app/components/Dashboard/components/DashboardList/NewDashModal/SelectCard.tsx index 97e0e3d70..44e3d396a 100644 --- a/frontend/app/components/Dashboard/components/DashboardList/NewDashModal/SelectCard.tsx +++ b/frontend/app/components/Dashboard/components/DashboardList/NewDashModal/SelectCard.tsx @@ -1,6 +1,6 @@ import React, { useMemo, useState, useEffect } from 'react'; import { Button, Input, Segmented, Space } from 'antd'; -import { RightOutlined } from '@ant-design/icons' +import { RightOutlined } from '@ant-design/icons'; import { ArrowRight, Info } from 'lucide-react'; import { CARD_LIST, CARD_CATEGORIES, CardType } from './ExampleCards'; import { useStore } from 'App/mstore'; @@ -8,6 +8,7 @@ import Option from './Option'; import CardsLibrary from 'Components/Dashboard/components/DashboardList/NewDashModal/CardsLibrary'; import { FUNNEL } from 'App/constants/card'; import { useHistory } from 'react-router'; +import { FilterKey } from 'Types/filter/filterType'; interface SelectCardProps { onClose: (refresh?: boolean) => void; @@ -16,10 +17,11 @@ interface SelectCardProps { selected?: string; setSelectedCategory?: React.Dispatch>; isEnterprise?: boolean; + isMobile?: boolean; } const SelectCard: React.FC = (props: SelectCardProps) => { - const { onCard, isLibrary = false, selected, setSelectedCategory, isEnterprise } = props; + const { onCard, isLibrary = false, selected, setSelectedCategory, isEnterprise, isMobile } = props; const [selectedCards, setSelectedCards] = React.useState([]); const { metricStore, dashboardStore } = useStore(); const siteId: string = location.pathname.split('/')[1]; @@ -74,20 +76,23 @@ const SelectCard: React.FC = (props: SelectCardProps) => { }; const cardItems = useMemo(() => { - return CARD_LIST.filter((card) => card.category === selected && (!card.isEnterprise || (card.isEnterprise && isEnterprise))) - .map((card) => ( -
- -
- )); - }, [selected]); + return CARD_LIST.filter((card) => + card.category === selected && + (!card.isEnterprise || (card.isEnterprise && isEnterprise)) && + (!isMobile || (isMobile && ![FilterKey.USER_BROWSER].includes(card.key))) + ).map((card) => ( +
+ +
+ )); + }, [selected, isEnterprise, isMobile]); const onCardClick = (cardId: number) => { if (selectedCards.includes(cardId)) { @@ -119,7 +124,7 @@ const SelectCard: React.FC = (props: SelectCardProps) => { )} {isCreatingDashboard && ( -