Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions apps/sim/app/invite/components/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export { InvitationDisclosure } from '@/app/invite/components/invitation-disclosure'
export { InviteHeading } from '@/app/invite/components/invite-heading'
export { default as InviteLayout } from '@/app/invite/components/layout'
export { InviteStatusCard } from '@/app/invite/components/status-card'
16 changes: 16 additions & 0 deletions apps/sim/app/invite/components/invite-heading.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import type { ReactNode } from 'react'

interface InviteHeadingProps {
title: ReactNode
children: ReactNode
}

/** Heading shared by invitation and email-preference states; subcopy stays with each caller. */
export function InviteHeading({ title, children }: InviteHeadingProps) {
return (
<div className='space-y-1 text-center'>
<h1 className='text-[var(--text-primary)] text-title-lg tracking-tight'>{title}</h1>
{children}
</div>
)
}
11 changes: 5 additions & 6 deletions apps/sim/app/invite/components/status-card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import { Chip, cn, Loader } from '@sim/emcn'
import { AuthSubmitButton } from '@/app/(auth)/components'
import { AUTH_BUTTON_CLASS } from '@/app/(auth)/components/constants'
import { InviteHeading } from '@/app/invite/components/invite-heading'

/** A document navigation, so the marketing surface initializes its own theme store. */
function returnHome(): void {
Expand Down Expand Up @@ -37,10 +38,9 @@ export function InviteStatusCard({
if (type === 'loading') {
return (
<>
<div className='space-y-1 text-center'>
<h1 className='text-[var(--text-primary)] text-title-lg tracking-tight'>Loading</h1>
<InviteHeading title={'Loading'}>
<p className='text-[var(--text-muted)]'>{description}</p>
</div>
</InviteHeading>
<div className='mt-8 flex w-full items-center justify-center py-8'>
<Loader className='size-8 text-[var(--text-muted)]' animate />
</div>
Expand All @@ -50,10 +50,9 @@ export function InviteStatusCard({

return (
<>
<div className='space-y-1 text-center'>
<h1 className='text-[var(--text-primary)] text-title-lg tracking-tight'>{title}</h1>
<InviteHeading title={title}>
<p className='text-[var(--text-muted)]'>{description}</p>
</div>
</InviteHeading>

<div className='mt-8 w-full max-w-[410px] space-y-3'>
{details}
Expand Down
40 changes: 13 additions & 27 deletions apps/sim/app/unsubscribe/unsubscribe.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { useSearchParams } from 'next/navigation'
import type { UnsubscribeType } from '@/lib/api/contracts/user'
import { AuthSubmitButton } from '@/app/(auth)/components'
import { AUTH_BUTTON_CLASS } from '@/app/(auth)/components/constants'
import { InviteLayout } from '@/app/invite/components'
import { InviteHeading, InviteLayout } from '@/app/invite/components'
import { useUnsubscribe, useUnsubscribeMutation } from '@/hooks/queries/unsubscribe'

function UnsubscribeContent() {
Expand Down Expand Up @@ -39,10 +39,9 @@ function UnsubscribeContent() {
if (loading) {
return (
<InviteLayout>
<div className='space-y-1 text-center'>
<h1 className={'text-[var(--text-primary)] text-title-lg tracking-tight'}>Loading</h1>
<InviteHeading title={'Loading'}>
<p className={'text-[var(--text-muted)] text-md'}>Validating your unsubscribe link…</p>
</div>
</InviteHeading>
<div className={'mt-8 flex w-full items-center justify-center py-8'}>
<Loader className='size-8 text-[var(--text-muted)]' animate />
</div>
Expand All @@ -53,12 +52,9 @@ function UnsubscribeContent() {
if (error) {
return (
<InviteLayout>
<div className='space-y-1 text-center'>
<h1 className={'text-[var(--text-primary)] text-title-lg tracking-tight'}>
Invalid Unsubscribe Link
</h1>
<InviteHeading title={'Invalid Unsubscribe Link'}>
<p className={'text-[var(--text-muted)] text-md'}>{error}</p>
</div>
</InviteHeading>

<div className={'mt-8 w-full max-w-[410px] space-y-3'}>
<AuthSubmitButton type='button' onClick={() => window.history.back()} loadingLabel=''>
Expand All @@ -72,15 +68,12 @@ function UnsubscribeContent() {
if (data?.isTransactional) {
return (
<InviteLayout>
<div className='space-y-1 text-center'>
<h1 className={'text-[var(--text-primary)] text-title-lg tracking-tight'}>
Important Account Emails
</h1>
<InviteHeading title={'Important Account Emails'}>
<p className={'text-[var(--text-muted)] text-md'}>
Transactional emails like password resets, account confirmations, and security alerts
cannot be unsubscribed from as they contain essential information for your account.
</p>
</div>
</InviteHeading>

<div className={'mt-8 w-full max-w-[410px] space-y-3'}>
<AuthSubmitButton type='button' onClick={() => window.close()} loadingLabel=''>
Expand All @@ -94,15 +87,12 @@ function UnsubscribeContent() {
if (unsubscribed) {
return (
<InviteLayout>
<div className='space-y-1 text-center'>
<h1 className={'text-[var(--text-primary)] text-title-lg tracking-tight'}>
Successfully Unsubscribed
</h1>
<InviteHeading title={'Successfully Unsubscribed'}>
<p className={'text-[var(--text-muted)] text-md'}>
You have been unsubscribed from our emails. You will stop receiving emails within 48
hours.
</p>
</div>
</InviteHeading>

<div className={'mt-8 w-full max-w-[410px] space-y-3'}>
<AuthSubmitButton type='button' onClick={() => window.close()} loadingLabel=''>
Expand All @@ -117,15 +107,12 @@ function UnsubscribeContent() {

return (
<InviteLayout>
<div className='space-y-1 text-center'>
<h1 className={'text-[var(--text-primary)] text-title-lg tracking-tight'}>
Email Preferences
</h1>
<InviteHeading title={'Email Preferences'}>
<p className={'text-[var(--text-muted)] text-md'}>
Choose which emails you'd like to stop receiving.
</p>
<p className={'text-[var(--text-muted)] text-sm'}>{data?.email}</p>
</div>
</InviteHeading>

<div className={'mt-8 w-full max-w-[410px] space-y-3'}>
<AuthSubmitButton
Expand Down Expand Up @@ -205,10 +192,9 @@ export default function Unsubscribe() {
<Suspense
fallback={
<InviteLayout>
<div className='space-y-1 text-center'>
<h1 className={'text-[var(--text-primary)] text-title-lg tracking-tight'}>Loading</h1>
<InviteHeading title={'Loading'}>
<p className={'text-[var(--text-muted)] text-md'}>Validating your unsubscribe link…</p>
</div>
</InviteHeading>
<div className={'mt-8 flex w-full items-center justify-center py-8'}>
<Loader className='size-8 text-[var(--text-muted)]' animate />
</div>
Expand Down
Loading