From f663774fee644769a018a5b43e48e4cc49e23989 Mon Sep 17 00:00:00 2001 From: Udit Takkar <53316345+Udit-takkar@users.noreply.github.com> Date: Thu, 19 Jan 2023 00:18:10 +0530 Subject: [PATCH] feat: add most popular section in apps (#6539) * feat: add most popular section in apps Signed-off-by: Udit Takkar * chore: remove margin Signed-off-by: Udit Takkar * fix: merge conflict Signed-off-by: Udit Takkar Signed-off-by: Udit Takkar --- apps/web/pages/apps/index.tsx | 4 ++-- apps/web/public/static/locales/en/common.json | 1 + packages/app-store/_appRegistry.ts | 5 +++++ packages/ui/components/apps/AllApps.tsx | 7 ++++++- .../apps/{TrendingAppsSlider.tsx => PopularAppsSlider.tsx} | 4 ++-- packages/ui/components/apps/Slider.tsx | 4 ++-- packages/ui/components/apps/index.ts | 2 +- packages/ui/index.tsx | 2 +- 8 files changed, 20 insertions(+), 9 deletions(-) rename packages/ui/components/apps/{TrendingAppsSlider.tsx => PopularAppsSlider.tsx} (82%) diff --git a/apps/web/pages/apps/index.tsx b/apps/web/pages/apps/index.tsx index 6725a20427..ec6e7bed2c 100644 --- a/apps/web/pages/apps/index.tsx +++ b/apps/web/pages/apps/index.tsx @@ -14,7 +14,7 @@ import { HorizontalTabs, Icon, TextField, - TrendingAppsSlider, + PopularAppsSlider, } from "@calcom/ui"; import AppsLayout from "@components/apps/layouts/AppsLayout"; @@ -77,7 +77,7 @@ export default function Apps({ categories, appStore }: inferSSRProps - + )} (searchText ? app.name.toLowerCase().includes(searchText.toLowerCase()) : true)); + .filter((app) => (searchText ? app.name.toLowerCase().includes(searchText.toLowerCase()) : true)) + .sort(function (a, b) { + if (a.name < b.name) return -1; + else if (a.name > b.name) return 1; + return 0; + }); return (
diff --git a/packages/ui/components/apps/TrendingAppsSlider.tsx b/packages/ui/components/apps/PopularAppsSlider.tsx similarity index 82% rename from packages/ui/components/apps/TrendingAppsSlider.tsx rename to packages/ui/components/apps/PopularAppsSlider.tsx index 7e0ff29a7e..3c95ff2e70 100644 --- a/packages/ui/components/apps/TrendingAppsSlider.tsx +++ b/packages/ui/components/apps/PopularAppsSlider.tsx @@ -4,12 +4,12 @@ import { AppFrontendPayload as App } from "@calcom/types/App"; import { AppCard } from "./AppCard"; import { Slider } from "./Slider"; -export const TrendingAppsSlider = ({ items }: { items: T[] }) => { +export const PopularAppsSlider = ({ items }: { items: T[] }) => { const { t } = useLocale(); return ( - title={t("trending_apps")} + title={t("most_popular")} items={items.filter((app) => !!app.trending)} itemKey={(app) => app.name} options={{ diff --git a/packages/ui/components/apps/Slider.tsx b/packages/ui/components/apps/Slider.tsx index 9209bc3bff..5754d657d0 100644 --- a/packages/ui/components/apps/Slider.tsx +++ b/packages/ui/components/apps/Slider.tsx @@ -56,11 +56,11 @@ export const Slider = ({ `}
-
+
{isLocaleReady ? ( title && (
-

{title}

+

{title}

) ) : ( diff --git a/packages/ui/components/apps/index.ts b/packages/ui/components/apps/index.ts index c715a7657d..359e1503fe 100644 --- a/packages/ui/components/apps/index.ts +++ b/packages/ui/components/apps/index.ts @@ -3,5 +3,5 @@ export { AppCard } from "./AppCard"; export { Slider } from "./Slider"; export { SkeletonLoader as AppSkeletonLoader } from "./SkeletonLoader"; export { SkeletonLoader } from "./SkeletonLoader"; -export { TrendingAppsSlider } from "./TrendingAppsSlider"; +export { PopularAppsSlider } from "./PopularAppsSlider"; export { AppStoreCategories } from "./Categories"; diff --git a/packages/ui/index.tsx b/packages/ui/index.tsx index 215249e6de..217cf7bad1 100644 --- a/packages/ui/index.tsx +++ b/packages/ui/index.tsx @@ -64,7 +64,7 @@ export { AppSkeletonLoader, SkeletonLoader, Slider, - TrendingAppsSlider, + PopularAppsSlider, useShouldShowArrows, AppStoreCategories, } from "./components/apps";