Rallly is an open-source scheduling and collaboration tool designed to make organizing events and meetings easier.
TypeScript i18nextnext-authnextjspostgresqlprismareact-emailt3-stacktailwindcsstrpcturborepotypescriptzod
✨ Show upgrade prompt instead of pending invites for hobby spaces (#2698)
Luke Vellaa3cfcd56e95d
diff --git a/apps/web/public/locales/en/app.json b/apps/web/public/locales/en/app.jsonindex d7740144a..c7666615d 100644--- a/apps/web/public/locales/en/app.json+++ b/apps/web/public/locales/en/app.json@@ -500,6 +500,7 @@"pending": "Pending","pendingInvites": "Pending Invites","pendingInvitesDescription": "Invite other users to share your space.",+ "pendingInvitesUpgradeDescription": "Upgrade to Pro to invite members to your space.","perSeatMonth": "/seat/mo","personal": "Personal","planFree": "Free",@@ -646,7 +647,6 @@"spaces": "Spaces","spacesDescription": "Manage the spaces you belong to","spaceSettings": "Space Settings",- "spaceUpdatedError": "Failed to update space","spaceUpdatedSuccess": "Space updated successfully","ssoAuthenticationOnly": "Authentication is managed through Single Sign-On (SSO). Password management is not available.","startOfWeek": "Start of week",@@ -701,7 +701,6 @@"upcomingEventsEmptyStateTitle": "No Upcoming Events","updateAvailable": "Update available","updateEventTypeError": "Failed to update event type",- "updatingSpace": "Updating space...","upgrade": "Upgrade","upgradePromptTitle": "Upgrade to Pro","upgradeToPro": "Upgrade to Pro",diff --git a/apps/web/src/app/[locale]/(space)/settings/members/page-client.tsx b/apps/web/src/app/[locale]/(space)/settings/members/page-client.tsxindex 095f3347f..55bdbfb96 100644--- a/apps/web/src/app/[locale]/(space)/settings/members/page-client.tsx+++ b/apps/web/src/app/[locale]/(space)/settings/members/page-client.tsx@@ -1,8 +1,10 @@"use client";+import { posthog } from "@rallly/posthog/client";import { Alert, AlertDescription } from "@rallly/ui/alert";import { Badge } from "@rallly/ui/badge";-import { InfoIcon } from "lucide-react";+import { Button } from "@rallly/ui/button";+import { InfoIcon, SparklesIcon } from "lucide-react";import Link from "next/link";import { IfCloudHosted, IfSelfHosted } from "@/components/environment";import { OptimizedAvatarImage } from "@/components/optimized-avatar-image";@@ -23,6 +25,8 @@ import {SettingsPageTitle,} from "@/components/settings-layout";import { StackedList, StackedListItem } from "@/components/stacked-list";+import { showPayWall } from "@/features/billing/client";+import { useSpace } from "@/features/space/client";import { SpaceRole } from "@/features/space/components/space-role";import { Trans } from "@/i18n/client";import { trpc } from "@/trpc/client";@@ -31,9 +35,11 @@ import { InviteMemberButton } from "./components/invite-member-button";import { MemberDropdownMenu } from "./components/member-dropdown-menu";export function MembersSettingsPageClient() {+ const space = useSpace();const [members] = trpc.spaces.listMembers.useSuspenseQuery();const [invites] = trpc.spaces.listInvites.useSuspenseQuery();const [seats] = trpc.spaces.getSeats.useSuspenseQuery();+ const canInviteMembers = space.getAbility().can("invite", "Member");return (<SettingsPage>@@ -102,91 +108,122 @@ export function MembersSettingsPageClient() {</PageSectionDescription></PageSectionHeader><PageSectionContent>- {invites.length > 0 ? (- <StackedList>- {invites.map((invite) => (- <StackedListItem key={invite.id}>- <div className="flex flex-1 items-center gap-4">- <OptimizedAvatarImage name={invite.email} size="xl" />- <div>- <div className="flex items-center gap-x-2">- <div className="font-semibold text-sm">- {invite.email}+ {!canInviteMembers ? (+ <Alert variant="primary">+ <SparklesIcon />+ <AlertDescription>+ <p>+ <Trans+ i18nKey="pendingInvitesUpgradeDescription"+ defaults="Upgrade to Pro to invite members to your space."+ />+ </p>+ <Button+ onClick={() => {+ posthog?.capture(+ "members_settings:upgrade_button_click",+ );+ showPayWall();+ }}+ >+ <Trans i18nKey="upgradeToPro" defaults="Upgrade to Pro" />+ </Button>+ </AlertDescription>+ </Alert>+ ) : (+ <>+ {invites.length > 0 ? (+ <StackedList>+ {invites.map((invite) => (+ <StackedListItem key={invite.id}>+ <div className="flex flex-1 items-center gap-4">+ <OptimizedAvatarImage+ name={invite.email}+ size="xl"+ />+ <div>+ <div className="flex items-center gap-x-2">+ <div className="font-semibold text-sm">+ {invite.email}+ </div>+ </div>+ <div className="text-muted-foreground text-sm">+ <Trans+ i18nKey="memberInvitedBy"+ defaults="Invited by {inviterName}"+ values={{+ inviterName: invite.invitedBy.name,+ }}+ />+ </div></div></div>- <div className="text-muted-foreground text-sm">+ <div className="text-sm">+ <SpaceRole role={invite.role} />+ </div>+ <InviteDropdownMenu invite={invite} />+ </StackedListItem>+ ))}+ </StackedList>+ ) : null}+ <div className="flex items-center gap-4">+ <InviteMemberButton+ usedSeats={seats.used}+ totalSeats={seats.total}+ />+ <p className="font-medium text-sm">+ <Trans+ i18nKey="seatUsage"+ defaults="{usedSeats} of {totalSeats} seats used"+ values={{+ usedSeats: seats.used,+ totalSeats: seats.total,+ }}+ />+ </p>+ </div>+ {seats.total - seats.used <= 0 ? (+ <Alert variant="info">+ <InfoIcon />+ <AlertDescription>+ <IfCloudHosted>+ <p><Trans- i18nKey="memberInvitedBy"- defaults="Invited by {inviterName}"- values={{ inviterName: invite.invitedBy.name }}+ i18nKey="noSeatsAvailableAlertBillingDescription"+ defaults="Increase the number of seats in this space from the <a>billing page</a>."+ components={{+ a: (+ <Link+ className="underline hover:text-foreground"+ href="/settings/billing"+ />+ ),+ }}/>- </div>- </div>- </div>- <div className="text-sm">- <SpaceRole role={invite.role} />- </div>- <InviteDropdownMenu invite={invite} />- </StackedListItem>- ))}- </StackedList>- ) : null}- <div className="flex items-center gap-4">- <InviteMemberButton- usedSeats={seats.used}- totalSeats={seats.total}- />- <p className="font-medium text-sm">- <Trans- i18nKey="seatUsage"- defaults="{usedSeats} of {totalSeats} seats used"- values={{- usedSeats: seats.used,- totalSeats: seats.total,- }}- />- </p>- </div>- {seats.total - seats.used <= 0 ? (- <Alert variant="info">- <InfoIcon />- <AlertDescription>- <IfCloudHosted>- <p>- <Trans- i18nKey="noSeatsAvailableAlertBillingDescription"- defaults="Increase the number of seats in this space from the <a>billing page</a>."- components={{- a: (- <Link- className="underline hover:text-foreground"- href="/settings/billing"- />- ),- }}- />- </p>- </IfCloudHosted>- <IfSelfHosted>- <p>- <Trans- i18nKey="noSeatsAvailableAlertSelfHostedDescription"- defaults="You will need to <a>upgrade</a> to increase the number of seats in this space."- components={{- a: (- <Link- className="underline hover:text-foreground"- prefetch={false}- href="https://support.rallly.co/self-hosting/licensing"- />- ),- }}- />- </p>- </IfSelfHosted>- </AlertDescription>- </Alert>- ) : null}+ </p>+ </IfCloudHosted>+ <IfSelfHosted>+ <p>+ <Trans+ i18nKey="noSeatsAvailableAlertSelfHostedDescription"+ defaults="You will need to <a>upgrade</a> to increase the number of seats in this space."+ components={{+ a: (+ <Link+ className="underline hover:text-foreground"+ prefetch={false}+ href="https://support.rallly.co/self-hosting/licensing"+ />+ ),+ }}+ />+ </p>+ </IfSelfHosted>+ </AlertDescription>+ </Alert>+ ) : null}+ </>+ )}</PageSectionContent></PageSection></PageSectionGroup>