feat: recently added apps (#11118)
Co-authored-by: Hariom Balhara <[email protected]> Co-authored-by: Peer Richelsen <[email protected]>
This commit is contained in:
7 files changed
+45
-3
No files matched your search
@@ -34,7 +34,7 @@ export async function getAppWithMetadata(app: { dirName: string } | { slug: stri
|
||||
export async function getAppRegistry() {
|
||||
const dbApps = await prisma.app.findMany({
|
||||
where: { enabled: true },
|
||||
select: { dirName: true, slug: true, categories: true, enabled: true },
|
||||
select: { dirName: true, slug: true, categories: true, enabled: true, createdAt: true },
|
||||
});
|
||||
const apps = [] as App[];
|
||||
const installCountPerApp = await getInstallCountPerApp();
|
||||
@@ -44,7 +44,7 @@ export async function getAppRegistry() {
|
||||
// Skip if app isn't installed
|
||||
/* This is now handled from the DB */
|
||||
// if (!app.installed) return apps;
|
||||
|
||||
app.createdAt = dbapp.createdAt.toISOString();
|
||||
apps.push({
|
||||
...app,
|
||||
category: app.category || "other",
|
||||
@@ -101,6 +101,7 @@ export async function getAppRegistryWithCredentials(userId: number, userAdminTea
|
||||
// Skip if app isn't installed
|
||||
/* This is now handled from the DB */
|
||||
// if (!app.installed) return apps;
|
||||
app.createdAt = dbapp.createdAt.toISOString();
|
||||
let dependencyData: {
|
||||
name?: string;
|
||||
installed?: boolean;
|
||||
|
||||
Vendored
+2
@@ -153,6 +153,8 @@ export interface App {
|
||||
dependencies?: string[];
|
||||
/** Enables video apps to be used for team events. Non Video/Conferencing apps don't honor this as they support team installation always. */
|
||||
concurrentMeetings?: boolean;
|
||||
|
||||
createdAt?: string;
|
||||
}
|
||||
|
||||
export type AppFrontendPayload = Omit<App, "key"> & {
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||
import type { AppFrontendPayload as App } from "@calcom/types/App";
|
||||
|
||||
import { AppCard } from "./AppCard";
|
||||
import { Slider } from "./Slider";
|
||||
|
||||
export const RecentAppsSlider = <T extends App>({ items }: { items: T[] }) => {
|
||||
const { t } = useLocale();
|
||||
|
||||
return (
|
||||
<Slider<T>
|
||||
title={t("recently_added")}
|
||||
items={items.sort(
|
||||
(a, b) => new Date(b?.createdAt || 0).valueOf() - new Date(a?.createdAt || 0).valueOf()
|
||||
)}
|
||||
itemKey={(app) => app.name}
|
||||
options={{
|
||||
perView: 3,
|
||||
breakpoints: {
|
||||
768 /* and below */: {
|
||||
perView: 1,
|
||||
},
|
||||
},
|
||||
}}
|
||||
renderItem={(app) => <AppCard app={app} />}
|
||||
/>
|
||||
);
|
||||
};
|
||||
@@ -4,4 +4,5 @@ export { Slider } from "./Slider";
|
||||
export { SkeletonLoader as AppSkeletonLoader } from "./SkeletonLoader";
|
||||
export { SkeletonLoader } from "./SkeletonLoader";
|
||||
export { PopularAppsSlider } from "./PopularAppsSlider";
|
||||
export { RecentAppsSlider } from "./RecentAppsSlider";
|
||||
export { AppStoreCategories } from "./Categories";
|
||||
@@ -69,6 +69,7 @@ export {
|
||||
SkeletonLoader,
|
||||
Slider,
|
||||
PopularAppsSlider,
|
||||
RecentAppsSlider,
|
||||
useShouldShowArrows,
|
||||
AppStoreCategories,
|
||||
} from "./components/apps";
|
||||
|
||||
Reference in new issue
Block a user