import fs from 'fs' import DefaultLayout from '~/components/Layouts/Default' import { getSortedPosts } from '~/lib/posts' import { generateRss } from '~/lib/rss' import styles from '~/styles/customers.module.css' import type PostTypes from '~/types/post' import { motion } from 'motion/react' import { NextSeo } from 'next-seo' import Head from 'next/head' import Link from 'next/link' import { useRouter } from 'next/router' import { useState } from 'react' import { Button, cn } from 'ui' import { GlassPanel } from 'ui-patterns/GlassPanel' import CustomersFilters from '../components/CustomerStories/CustomersFilters' import SectionContainer from '../components/Layouts/SectionContainer' import { breadcrumbs } from '@/lib/breadcrumbs' import { breadcrumbListSchema, serializeJsonLd } from '@/lib/json-ld' export async function getStaticProps() { const allPostsData: any[] = getSortedPosts({ directory: '_customers' }) const rss = generateRss(allPostsData) // create a rss feed in public directory // rss feed is added via
component in render return fs.writeFileSync('./public/customers-rss.xml', rss) const industries = allPostsData.reduce<{ [key: string]: number }>( (acc, customer) => { // Increment the 'all' counter acc.all = (acc.all || 0) + 1 // Increment the counter for each category customer.industry?.forEach((industry: string) => { acc[industry] = (acc[industry] || 0) + 1 }) return acc }, { all: 0 } ) const products = allPostsData.reduce<{ [key: string]: number }>( (acc, customer) => { // Increment the 'all' counter acc.all = (acc.all || 0) + 1 // Increment the counter for each category customer.supabase_products?.forEach((product: string) => { acc[product] = (acc[product] || 0) + 1 }) return acc }, { all: 0 } ) return { props: { blogs: allPostsData, industries, products, }, } } function CustomerStoriesPage(props: any) { const { basePath } = useRouter() const _allCustomers = props.blogs?.map((blog: PostTypes, idx: number) => { return { logo: blog.logo, logoInverse: blog.logo_inverse, name: blog.name, title: blog.title, link: blog.url, industry: blog.industry, products: blog.supabase_products, } }) const [customers, setCustomers] = useState(_allCustomers) const meta = { title: 'Customer Stories | Supabase', image: `${basePath}/images/customers/og/customer-stories.jpg`, description: 'See how Supabase empowers companies of all sizes to accelerate their growth and streamline their work.', } return ( <>No customers found