From 139f0e68c4f0073aeb49f3cea69bc7ddfe11a812 Mon Sep 17 00:00:00 2001 From: Shekar Siri Date: Thu, 25 Jul 2024 11:20:09 +0200 Subject: [PATCH] Mobile UI updates (#2427) * change(ui): mobile resolution * change(ui): removed empty tag that showign as green icon * change(ui): mobile specific filters * change(ui): remove browser card for mobile * change(ui): summary ai toggle --- .../NewDashModal/ExampleCards.tsx | 1 + .../NewDashModal/NewDashboardModal.tsx | 6 +- .../DashboardList/NewDashModal/SelectCard.tsx | 39 ++-- .../Player/MobilePlayer/MobileControls.tsx | 6 +- .../EventsBlock/UserCard/UserCard.js | 4 +- .../FetchBasicDetails/FetchBasicDetails.tsx | 38 ++-- .../Filters/FilterModal/FilterModal.tsx | 2 +- frontend/app/components/ui/Icons/activity.tsx | 1 - .../app/components/ui/Icons/console_info.tsx | 2 +- .../ui/Icons/filters_chevrons_up_down.tsx | 19 ++ .../components/ui/Icons/filters_screen.tsx | 19 ++ frontend/app/components/ui/Icons/index.ts | 2 + .../app/components/ui/Icons/pdf_download.tsx | 2 +- frontend/app/components/ui/Icons/pencil.tsx | 2 +- frontend/app/components/ui/Icons/trash.tsx | 2 +- frontend/app/components/ui/Icons/users.tsx | 3 +- frontend/app/components/ui/SVG.tsx | 10 +- frontend/app/duck/search.js | 10 +- .../svg/icons/filters/chevrons-up-down.svg | 1 + frontend/app/svg/icons/filters/screen.svg | 1 + frontend/app/types/filter/filterType.ts | 8 + frontend/app/types/filter/newFilter.js | 195 +++++++++++++----- 22 files changed, 268 insertions(+), 105 deletions(-) create mode 100644 frontend/app/components/ui/Icons/filters_chevrons_up_down.tsx create mode 100644 frontend/app/components/ui/Icons/filters_screen.tsx create mode 100644 frontend/app/svg/icons/filters/chevrons-up-down.svg create mode 100644 frontend/app/svg/icons/filters/screen.svg 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 && ( -