-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpageApp.tsx
360 lines (350 loc) · 13.4 KB
/
pageApp.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
import Image from "next/image";
import {
Accordion,
AccordionContent,
AccordionItem,
AccordionTrigger,
} from "@/components/ui/accordion";
import {
PageHeader,
PageHeaderHeading,
PageHeaderDescription,
} from "@/components/page-header";
import { GoCard } from "@/components/go-card";
import { Separator } from "@/components/ui/separator";
import {
fetchCategories,
fetchPaginationAppsByCategory,
} from "@/lib/strapi/actions";
import Link from "next/link";
import PageLimit from "@/components/pagelimit";
import SearchPP from "@/components/searchpp";
import SortSelect from "@/components/sortselect";
import AppPagenation from "@/components/apppagination";
import { Category, ResponseCategories } from "@/lib/strapi/category.types";
import { redirect } from "next/navigation";
interface GoCardAttr {
category?: ResponseCategories;
}
export async function generateMetadata(props: { params: { locale: string } }) {
return {
title: "getOperate - Applications",
description:
"The solution for building internal operation tools including jobs, workflows, data pipelines, api endpoints, and UIs.",
};
}
const Apps = async ({
searchParams,
}: {
searchParams: { [key: string]: string | string[] | undefined };
}) => {
const category = searchParams.category ?? "ALL";
const page = searchParams.page ?? 1;
const appsPerPage = searchParams.perPage ?? 9;
const search = searchParams.search ?? "";
const sort = searchParams.sort ?? "title";
const categories = await fetchCategories();
if (!categories) return null;
// if page and appsPerPage are not numbers, reset the query
if (isNaN(Number(page)) || isNaN(Number(appsPerPage)))
return redirect("/apps");
const apps = await fetchPaginationAppsByCategory(
Number(page),
category,
Number(appsPerPage),
String(search),
String(sort)
);
function slugToTitle(slug: string): string {
return slug
.split("-") // Split the slug by hyphen
.map((word) => word.charAt(0).toUpperCase() + word.slice(1)) // Capitalize the first letter of each word
.join(" "); // Join them with a space
}
return (
<>
<div className="container relative mb-20">
<PageHeader className="w-full items-start">
{/* <div className="inline-flex items-center rounded-lg bg-muted px-3 py-1 text-sm font-medium mx-auto">
📝
<Separator className="mx-2 h-4" orientation="vertical" />{" "}
<span>Over 6,000 templates, Explore now</span>
</div> */}
<PageHeaderHeading className="max-w-xl mx-auto">
Accelerate your app integration process
</PageHeaderHeading>
<PageHeaderDescription className="mt-3 mx-auto">
Quickly integrate apps with or without coding.
<br />
Save time and streamline your workflow with just a few clicks.
</PageHeaderDescription>
{/* <div className="lg:w-1/3 mx-auto mt-6 flex gap-1">
<Input placeholder="Search Application . . ." className="w-full" />
<a href="#" className={cn(buttonVariants(), "block")}>
Search
</a>
</div> */}
</PageHeader>
<div className="flex flex-col md:flex-row gap-3">
<div className="md:w-1/3 lg:w-1/5 pr-5">
<h1 className="any-device text-base font-bold tracking-tighter leading-[1.1] my-3">
<Link href="/apps">App Categories</Link>
</h1>
{Object.entries(categories).map(([role, items], index) => (
<Accordion
key={index}
type="single"
collapsible
className="any-device w-full border-0"
>
<AccordionItem value={`item-${index}`} className="border-0">
<AccordionTrigger className="py-2 hover:no-underline text-left">
<Link
href={{
pathname: "/apps",
query: { category: role },
}}
scroll={false}
>
{role}
</Link>
</AccordionTrigger>
<AccordionContent>
<ul>
{items.map((item) => (
<li
key={item.id}
className="pl-6 py-1 rounded hover:bg-go-blue-hover dark:hover:text-black"
>
{/* <a href="#">{item.attributes.title}</a> */}
<Link
href={{
pathname: "/apps",
query: { category: item?.attributes?.slug },
}}
scroll={false}
>
{item?.attributes?.title}
</Link>
</li>
))}
</ul>
</AccordionContent>
</AccordionItem>
</Accordion>
))}
<Accordion
type="single"
collapsible
className="phone-device w-full border-0"
>
<AccordionItem value="app-cate" className="border-0">
<AccordionTrigger className="text-base font-bold py-2 hover:no-underline text-left">
<Link href="/apps">App Categories</Link>
</AccordionTrigger>
<AccordionContent>
{Object.entries(categories).map(([role, items], index) => (
<Accordion
key={index}
type="single"
collapsible
className="w-full border-0"
>
<AccordionItem
value={`item-${index}`}
className="border-0"
>
<AccordionTrigger className="py-2 hover:no-underline text-left">
<Link
href={{
pathname: "/apps",
query: { category: role },
}}
scroll={false}
>
{role}
</Link>
</AccordionTrigger>
<AccordionContent>
<ul>
{items.map((item) => (
<li
key={item.id}
className="pl-6 py-1 rounded hover:bg-go-blue-hover dark:hover:text-black"
>
{/* <a href="#">{item.attributes.title}</a> */}
<Link
href={{
pathname: "/apps",
query: { category: item?.attributes?.slug },
}}
scroll={false}
>
{item?.attributes?.title}
</Link>
</li>
))}
</ul>
</AccordionContent>
</AccordionItem>
</Accordion>
))}
</AccordionContent>
</AccordionItem>
</Accordion>
</div>
<div className="w-full">
<div className="justify-between flex items-baseline flex-col mb-10">
<h1 className="text-4xl font-bold tracking-tighter leading-[1.1] mb-6">
{category === "ALL" ? "Integrated Apps" : slugToTitle(category)}
</h1>
<div className="flex flex-col-reverse sm:flex-row gap-3 items-left sm:items-center justify-between w-full">
<div>
<p className="text-primary text-sm">
Showing {apps.data.length} results from{" "}
{apps.meta.pagination?.total} total apps
</p>
</div>
<div className="flex gap-5 items-end">
<PageLimit pagination={apps.meta.pagination} />
<SortSelect />
<SearchPP />
</div>
</div>
</div>
<div className="grid lg:grid-cols-3 gap-4">
{apps.data.map((app, index) => (
<GoCard
link={`/apps/${app.attributes?.slug}`}
title={app.attributes?.title}
category={
app.attributes?.categories as any as ResponseCategories
}
categorylink={"/apps?category="}
key={index}
icon={
<>
<Image
src={`https://go-app-images.s3.ap-southeast-1.amazonaws.com/${app?.attributes?.slug}.png`}
alt="icon"
width={32}
height={32}
className="rounded-lg"
/>
</>
}
>
{app.attributes?.description.replace(/[#`_*~>]/g, "").replace(/<u>/g, "").replace(/<\/u>/g, "")}
</GoCard>
))}
{/* <GoCard
link="/apps/newpage"
title="Line"
icon={
<>
<Image
src="/icon-line.png"
alt="icon"
width={32}
height={32}
className="rounded-lg"
/>
</>
}
>
Efficiently reach out to your closed-won deals by using
round-robin tasks. Efficiently reach out to your closed-won
deals by using round-robin tasks. Efficiently reach out to your
closed-won deals by using round-robin tasks.
</GoCard>
<GoCard
link="#"
title="Add closed deals to MixMax with AI and Slack"
icon={
<>
<Image
src="/icon-line.png"
alt="icon"
width={32}
height={32}
className="rounded-lg"
/>
</>
}
>
Elevate your sales strategy with this AI-powered triage template
and seamlessly integrate with MixMax for timely engagement with
won deals.
</GoCard>
<GoCard
link="#"
title="Won deal summary"
icon={
<>
<Image
src="/icon-pgsql.png"
alt="icon"
width={32}
height={32}
className="rounded-lg"
/>
</>
}
>
Set up a workflow that uses AI to outline your won deal and
provide insight on what works in your sales strategy.
</GoCard>
<GoCard
link="#"
title="Customer renewal date autofill"
icon={
<>
<Image
src="/icon-rss.png"
alt="icon"
width={32}
height={32}
className="rounded-lg"
/>
</>
}
>
Fill in customer renewal dates without fault to keep your
Customer Success List up to date.
</GoCard>
<GoCard
link="#"
title="Won deal summary"
icon={
<>
<Image
src="/icon-openai.png"
alt="icon"
width={32}
height={32}
className="rounded-lg"
/>
</>
}
>
Set up a workflow that uses AI to outline your won deal and
provide insight on what works in your sales strategy.
</GoCard> */}
</div>
<div className="w-full flex items-center justify-center my-10">
<AppPagenation pagination={apps.meta.pagination} />
</div>
{/* <div className="w-full">
<button
className={cn(buttonVariants(), "mt-6 block mx-auto px-20")}
>
Load more
</button>
</div> */}
</div>
</div>
</div>
</>
);
};
export default Apps;