Rallly is an open-source scheduling and collaboration tool designed to make organizing events and meetings easier.
TypeScript i18nextnext-authnextjspostgresqlprismareact-emailt3-stacktailwindcsstrpcturborepotypescriptzod
💄 Replace stale landing page stats with a live 30-day activity claim (#2917)
Luke Vella798a89c8227b
diff --git a/apps/landing/public/locales/en/home.json b/apps/landing/public/locales/en/home.jsonindex 962f836a8..618182d10 100644--- a/apps/landing/public/locales/en/home.json+++ b/apps/landing/public/locales/en/home.json@@ -20,12 +20,9 @@"metaTitle": "Rallly: Free Group Meeting Scheduling Tool","mobileVotingBlog": "A clearer way to vote on your phone","new": "New",- "noLoginRequired": "No login required","pcmagQuote": "“Set up a scheduling poll in as little time as possible.”","popsciQuote": "“The perfect pick if you want to keep your RSVPs simple.”",- "statsLanguagesSupported": "10+ languages supported",- "statsPollsCreated": "{count, number, ::compact-short}+ polls created",- "statsUsersRegistered": "{count, number, ::compact-short}+ registered users",+ "statsLast30Days": "<b>{voterCount, plural, one {# person} other {# people}}</b> voted on <b>{pollCount, plural, one {# poll} other {# polls}}</b> in the last 30 days","subheading": "Coordinate group meetings without the back-and-forth emails","viaTrustpilot": "via Trustpilot","when2meetAlternative": "A Modern When2Meet Alternative",diff --git a/apps/landing/src/app/[locale]/(main)/(seo)/best-doodle-alternative/page.tsx b/apps/landing/src/app/[locale]/(main)/(seo)/best-doodle-alternative/page.tsxindex 80f3b9d02..68b43cdf1 100644--- a/apps/landing/src/app/[locale]/(main)/(seo)/best-doodle-alternative/page.tsx+++ b/apps/landing/src/app/[locale]/(main)/(seo)/best-doodle-alternative/page.tsx@@ -11,7 +11,7 @@ import { getTranslation } from "@/i18n/server";export default async function Page(props: {params: Promise<{ locale: string }>;}) {- cacheLife("max");+ cacheLife("days");const { locale } = await props.params;const { t } = await getTranslation(locale, ["home"]);return (diff --git a/apps/landing/src/app/[locale]/(main)/(seo)/free-scheduling-poll/page.tsx b/apps/landing/src/app/[locale]/(main)/(seo)/free-scheduling-poll/page.tsxindex 0b99503a0..9301d3af4 100644--- a/apps/landing/src/app/[locale]/(main)/(seo)/free-scheduling-poll/page.tsx+++ b/apps/landing/src/app/[locale]/(main)/(seo)/free-scheduling-poll/page.tsx@@ -11,7 +11,7 @@ import { getTranslation } from "@/i18n/server";export default async function Page(props: {params: Promise<{ locale: string }>;}) {- cacheLife("max");+ cacheLife("days");const { locale } = await props.params;const { t } = await getTranslation(locale, ["home"]);return (diff --git a/apps/landing/src/app/[locale]/(main)/(seo)/when2meet-alternative/page.tsx b/apps/landing/src/app/[locale]/(main)/(seo)/when2meet-alternative/page.tsxindex 20bf470ca..6ee5978f3 100644--- a/apps/landing/src/app/[locale]/(main)/(seo)/when2meet-alternative/page.tsx+++ b/apps/landing/src/app/[locale]/(main)/(seo)/when2meet-alternative/page.tsx@@ -11,7 +11,7 @@ import { getTranslation } from "@/i18n/server";export default async function Page(props: {params: Promise<{ locale: string }>;}) {- cacheLife("max");+ cacheLife("days");const { locale } = await props.params;const { t } = await getTranslation(locale, ["home"]);return (diff --git a/apps/landing/src/app/[locale]/(main)/page.tsx b/apps/landing/src/app/[locale]/(main)/page.tsxindex fd763761d..4a38d173a 100644--- a/apps/landing/src/app/[locale]/(main)/page.tsx+++ b/apps/landing/src/app/[locale]/(main)/page.tsx@@ -10,7 +10,7 @@ import { getTranslation } from "@/i18n/server";export default async function Page(props: {params: Promise<{ locale: string }>;}) {- cacheLife("max");+ cacheLife("days");const { locale } = await props.params;const { t } = await getTranslation(locale, ["home", "common"]);return (@@ -29,8 +29,10 @@ export default async function Page(props: {ns: "home",})}/>- <Bonus locale={locale} />- <BigTestimonial />+ <div className="space-y-8">+ <Bonus locale={locale} />+ <BigTestimonial />+ </div><MentionedBy /></Marketing>);diff --git a/apps/landing/src/app/[locale]/globals.css b/apps/landing/src/app/[locale]/globals.cssindex 60e3ccf4c..829253643 100644--- a/apps/landing/src/app/[locale]/globals.css+++ b/apps/landing/src/app/[locale]/globals.css@@ -5,6 +5,7 @@body {@apply bg-gray-100;+ --foreground: var(--color-gray-700);}/* Blog post content styles */diff --git a/apps/landing/src/components/home/bonus-item.tsx b/apps/landing/src/components/home/bonus-item.tsxdeleted file mode 100644index 745189a55..000000000--- a/apps/landing/src/components/home/bonus-item.tsx+++ /dev/null@@ -1,37 +0,0 @@-"use client";-import { cn } from "@rallly/ui";-import * as m from "motion/react-m";--export const BonusItem = ({- className,- children,- delay = 0,- icon,-}: React.PropsWithChildren<{- className?: string;- delay?: number;- icon: React.ReactNode;-}>) => {- return (- <m.div- transition={{- delay,- type: "spring",- bounce: 0.3,- }}- initial={{ opacity: 0, y: -20 }}- whileInView={{ opacity: 1, y: 0 }}- viewport={{ once: true, amount: "all" }}- className="flex justify-center"- >- <div className="flex items-center justify-center gap-x-2.5 rounded-full border bg-gray-50 p-1 pr-6 shadow-xs">- <span- className={cn("rounded-full bg-primary p-2 text-gray-50", className)}- >- {icon}- </span>- <div className="font-semibold text-sm">{children}</div>- </div>- </m.div>- );-};diff --git a/apps/landing/src/components/home/bonus.tsx b/apps/landing/src/components/home/bonus.tsxindex c4a8f0af5..01874cde3 100644--- a/apps/landing/src/components/home/bonus.tsx+++ b/apps/landing/src/components/home/bonus.tsx@@ -1,70 +1,27 @@-import {- CalendarCheck2Icon,- LanguagesIcon,- Users2Icon,- ZapIcon,-} from "lucide-react";import { Trans } from "react-i18next/TransWithoutContext";-import { BonusItem } from "@/components/home/bonus-item";import { getTranslation } from "@/i18n/server";-import { getUserCount } from "@/lib/data";+import { getMonthlyPollCount, getMonthlyVoterCount } from "@/lib/data";export async function Bonus(props: { locale: string }) {- const userCount = await getUserCount();+ const [pollCount, voterCount] = await Promise.all([+ getMonthlyPollCount(),+ getMonthlyVoterCount(),+ ]);const { t } = await getTranslation(props.locale, ["home"]);return (- <div className="mx-auto flex flex-wrap justify-center gap-2 whitespace-nowrap text-center sm:grid-cols-4 sm:gap-4 sm:gap-x-8">- <BonusItem- className="bg-indigo-600"- icon={<Users2Icon className="size-4" />}- >- <Trans- t={t}- i18nKey="statsUsersRegistered"- ns="home"- defaults="{count, number, ::compact-short} registered users"- values={{ count: userCount }}- />- </BonusItem>- <BonusItem- delay={0.25}- className="bg-pink-600"- icon={<CalendarCheck2Icon className="size-4" />}- >- <Trans- t={t}- ns="home"- i18nKey="statsPollsCreated"- values={{ count: 300 * 1000 }}- defaults="{count, number, ::compact-short}+ polls created"- />- </BonusItem>- <BonusItem- delay={0.5}- className="bg-gray-800"- icon={<LanguagesIcon className="size-4" />}- >- <Trans- t={t}- ns="home"- i18nKey="statsLanguagesSupported"- defaults="10+ languages supported"- />- </BonusItem>- <BonusItem- delay={0.75}- className="bg-teal-500"- icon={<ZapIcon className="size-4" />}- >- <Trans- t={t}- ns="home"- i18nKey="noLoginRequired"- defaults="No login required"- />- </BonusItem>- </div>+ <p className="mx-auto max-w-2xl text-balance text-center text-gray-600 text-lg">+ <Trans+ t={t}+ ns="home"+ i18nKey="statsLast30Days"+ defaults="<b>{voterCount, plural, one {# person} other {# people}}</b> voted on <b>{pollCount, plural, one {# poll} other {# polls}}</b> in the last 30 days"+ values={{ voterCount, pollCount }}+ components={{+ b: <strong className="font-semibold text-gray-800" />,+ }}+ />+ </p>);}diff --git a/apps/landing/src/lib/data.ts b/apps/landing/src/lib/data.tsindex 60df6c6c7..b10ea2193 100644--- a/apps/landing/src/lib/data.ts+++ b/apps/landing/src/lib/data.ts@@ -3,13 +3,31 @@ import "server-only";import { prisma } from "@rallly/database";import { cacheLife } from "next/cache";-export const getUserCount = async () => {+const THIRTY_DAYS_MS = 30 * 24 * 60 * 60 * 1000;++export const getMonthlyPollCount = async () => {+ "use cache";+ cacheLife("days");+ return prisma.poll.count({+ where: {+ deleted: false,+ participants: {+ some: {+ createdAt: { gte: new Date(Date.now() - THIRTY_DAYS_MS) },+ deleted: false,+ },+ },+ },+ });+};++export const getMonthlyVoterCount = async () => {"use cache";cacheLife("days");- const userCount = await prisma.user.count({+ return prisma.participant.count({where: {- isAnonymous: false,+ createdAt: { gte: new Date(Date.now() - THIRTY_DAYS_MS) },+ deleted: false,},});- return userCount;};