diff --git a/apps/www/app/templates/client.tsx b/apps/www/app/templates/client.tsx deleted file mode 100644 index 085050ebb9..0000000000 --- a/apps/www/app/templates/client.tsx +++ /dev/null @@ -1,423 +0,0 @@ -"use client"; -import { CTA } from "@/components/cta"; -import { ChangelogLight } from "@/components/svg/changelog"; -import { CodeIcon, FrameworkIcon } from "@/components/svg/template-page"; -import { Checkbox } from "@/components/template/checkbox"; - -import { ImageWithBlur } from "@/components/image-with-blur"; -import { - Form, - FormControl, - FormField, - FormItem, - FormLabel, - FormMessage, -} from "@/components/template/form"; -import { SearchInput } from "@/components/template/input"; -import { PageIntro } from "@/components/template/page-intro"; -import { - Accordion, - AccordionContent, - AccordionItem, - AccordionTrigger, -} from "@/components/ui/accordion"; -import { FrostedGlassFilter } from "@/components/ui/image-glass-filter"; -import { MeteorLinesAngular } from "@/components/ui/meteorLines"; -import { Separator } from "@/components/ui/separator"; -import { - type TemplatesFormValues, - getDefaulTemplatesFormValues, - schema, - updateUrl, -} from "@/lib/templates-form"; -import { zodResolver } from "@hookform/resolvers/zod"; -import { ArrowRight, SearchX, VenetianMask } from "lucide-react"; -import Link from "next/link"; -import { useEffect, useMemo } from "react"; -import { useForm } from "react-hook-form"; -import { type Framework, type Language, templates } from "./data"; - -export function TemplatesClient() { - const form = useForm({ - resolver: zodResolver(schema), - defaultValues: getDefaulTemplatesFormValues(), - reValidateMode: "onChange", - }); - - const languages = Object.values(templates).reduce( - (acc, { language }) => { - if (!acc[language]) { - acc[language] = 0; - } - acc[language]++; - return acc; - }, - {} as Record, - ); - - const frameworks = Object.values(templates).reduce( - (acc, { framework }) => { - if (!framework) { - return acc; - } - if (!acc[framework]) { - acc[framework] = 0; - } - acc[framework]++; - return acc; - }, - {} as Record, - ); - - const fields = form.watch(); - - useEffect(() => { - updateUrl(fields); - }, [fields]); - - const filteredTemplates = useMemo( - () => - Object.entries(templates).reduce( - (acc, [id, template]) => { - if ( - fields.frameworks.length > 0 && - (!template.framework || !fields.frameworks.includes(template.framework)) - ) { - return acc; - } - if (fields.languages.length > 0 && !fields.languages.includes(template.language)) { - return acc; - } - if ( - fields.search && - !template.title.toLowerCase().includes(fields.search.toLowerCase()) && - !template.description.toLowerCase().includes(fields.search.toLowerCase()) - ) { - return acc; - } - acc[id] = template; - return acc; - }, - {} as typeof templates, - ), - [fields], - ); - - return ( -
-
-
- -
-
- - - - - - - - -
-
- - -

- Jumpstart your API development with our pre-built solutions. -

-
-
-
-
-
-

- Filter templates -

- ( - - - - - - - )} - /> - - ( - - - - - - - - - Language - - - - - {Object.entries(languages).map(([language, occurences]) => ( - { - return ( - - - { - return checked - ? field.onChange([...field.value, language]) - : field.onChange( - field.value?.filter( - (value: string) => value !== language, - ), - ); - }} - /> - - - {language} - - {occurences} - - - - ); - }} - /> - ))} - - - - - - )} - /> - - ( - - - - - - - Framework - - - - - {Object.entries(frameworks).map(([framework, occurences]) => ( - { - return ( - - - { - return checked - ? field.onChange([...field.value, framework]) - : field.onChange( - field.value?.filter( - (value: string) => value !== framework, - ), - ); - }} - /> - - - {framework} - - {occurences} - - - - ); - }} - /> - ))} - - - - - )} - /> - - -
-
- {Object.entries(filteredTemplates).length === 0 ? ( -
-
-
- -
-

No template found

-

- Try removing some filters or{" "} - - submit a template - - . -

-
-
- ) : ( -
- {Object.entries(filteredTemplates).map(([id, template]) => ( - -
- {template.image ? ( - - - - ) : ( -
- -
- )} -
-
-
-
- {template.framework !== undefined ? ( -
- {template.framework?.toString()} -
- ) : null} - {template.language !== undefined ? ( -
- {template.language?.toString()} -
- ) : null} -
-
-
-
-

- {template.title} -

-
-
-

- {template.description} -

-
- {/* No images currently in author */} - {/* - - */} - -
-
-

- {template.authors.join(", ")} -

- -
-
-
-
- - ))} -
- )} -
-
-
- -
- ); -} diff --git a/oss.gg/3_follow_the_unkey_x_account.md b/oss.gg/3_follow_the_unkey_x_account.md index 43d22b1eab..3a53411e4a 100644 --- a/oss.gg/3_follow_the_unkey_x_account.md +++ b/oss.gg/3_follow_the_unkey_x_account.md @@ -54,3 +54,6 @@ Your turn 👇 » 16-October-2024 by [Zia Ur Rehman](@zia_webdev) » Link to Account: https://x.com/zia_webdev + +» 23-October-2024 by [Shreyans Lakhani](@LakhaniShreyas) +» Link to Account: diff --git a/oss.gg/4_starry_eyed_supporter.md b/oss.gg/4_starry_eyed_supporter.md index f4a1e34d6f..5c0af255d1 100644 --- a/oss.gg/4_starry_eyed_supporter.md +++ b/oss.gg/4_starry_eyed_supporter.md @@ -27,5 +27,6 @@ Your turn 👇 » 16-October-2024 by [Zia Ur Rehman](@zia_webdev) » Link to Issue: https://github.com/unkeyed/unkey/issues/2455 +» 23-October-2024 by [Shreyas Lakhani] (@ShreyasLakhani) ---