Skip to content

Commit 37887df

Browse files
Bill LeoutsakosBill Leoutsakos
authored andcommitted
improvement(ui): share account status headings
1 parent ea31ca7 commit 37887df

3 files changed

Lines changed: 34 additions & 32 deletions

File tree

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import type { ReactNode } from 'react'
2+
3+
interface InviteHeadingProps {
4+
title: ReactNode
5+
children: ReactNode
6+
}
7+
8+
/** Heading shared by invitation and email-preference states; subcopy stays with each caller. */
9+
export function InviteHeading({ title, children }: InviteHeadingProps) {
10+
return (
11+
<div className='space-y-1 text-center'>
12+
<h1 className='text-[32px] text-[var(--text-primary)] tracking-tight'>{title}</h1>
13+
{children}
14+
</div>
15+
)
16+
}

‎apps/sim/app/invite/components/status-card.tsx‎

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import { Chip, cn, Loader } from '@sim/emcn'
33
import { AuthSubmitButton } from '@/app/(auth)/components'
44
import { AUTH_BUTTON_CLASS } from '@/app/(auth)/components/constants'
5+
import { InviteHeading } from '@/app/invite/components/invite-heading'
56

67
/** A document navigation, so the marketing surface initializes its own theme store. */
78
function returnHome(): void {
@@ -37,10 +38,9 @@ export function InviteStatusCard({
3738
if (type === 'loading') {
3839
return (
3940
<>
40-
<div className='space-y-1 text-center'>
41-
<h1 className='text-[32px] text-[var(--text-primary)] tracking-tight'>Loading</h1>
41+
<InviteHeading title={'Loading'}>
4242
<p className='text-[var(--text-muted)]'>{description}</p>
43-
</div>
43+
</InviteHeading>
4444
<div className='mt-8 flex w-full items-center justify-center py-8'>
4545
<Loader className='size-8 text-[var(--text-muted)]' animate />
4646
</div>
@@ -50,10 +50,9 @@ export function InviteStatusCard({
5050

5151
return (
5252
<>
53-
<div className='space-y-1 text-center'>
54-
<h1 className='text-[32px] text-[var(--text-primary)] tracking-tight'>{title}</h1>
53+
<InviteHeading title={title}>
5554
<p className='text-[var(--text-muted)]'>{description}</p>
56-
</div>
55+
</InviteHeading>
5756

5857
<div className='mt-8 w-full max-w-[410px] space-y-3'>
5958
{details}

‎apps/sim/app/unsubscribe/unsubscribe.tsx‎

Lines changed: 13 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import type { UnsubscribeType } from '@/lib/api/contracts/user'
88
import { AuthSubmitButton } from '@/app/(auth)/components'
99
import { AUTH_BUTTON_CLASS } from '@/app/(auth)/components/constants'
1010
import { InviteLayout } from '@/app/invite/components'
11+
import { InviteHeading } from '@/app/invite/components/invite-heading'
1112
import { useUnsubscribe, useUnsubscribeMutation } from '@/hooks/queries/unsubscribe'
1213

1314
function UnsubscribeContent() {
@@ -39,10 +40,9 @@ function UnsubscribeContent() {
3940
if (loading) {
4041
return (
4142
<InviteLayout>
42-
<div className='space-y-1 text-center'>
43-
<h1 className={'text-[32px] text-[var(--text-primary)] tracking-tight'}>Loading</h1>
43+
<InviteHeading title={'Loading'}>
4444
<p className={'text-[var(--text-muted)] text-md'}>Validating your unsubscribe link…</p>
45-
</div>
45+
</InviteHeading>
4646
<div className={'mt-8 flex w-full items-center justify-center py-8'}>
4747
<Loader className='size-8 text-[var(--text-muted)]' animate />
4848
</div>
@@ -53,12 +53,9 @@ function UnsubscribeContent() {
5353
if (error) {
5454
return (
5555
<InviteLayout>
56-
<div className='space-y-1 text-center'>
57-
<h1 className={'text-[32px] text-[var(--text-primary)] tracking-tight'}>
58-
Invalid Unsubscribe Link
59-
</h1>
56+
<InviteHeading title={'Invalid Unsubscribe Link'}>
6057
<p className={'text-[var(--text-muted)] text-md'}>{error}</p>
61-
</div>
58+
</InviteHeading>
6259

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

8579
<div className={'mt-8 w-full max-w-[410px] space-y-3'}>
8680
<AuthSubmitButton type='button' onClick={() => window.close()} loadingLabel=''>
@@ -94,15 +88,12 @@ function UnsubscribeContent() {
9488
if (unsubscribed) {
9589
return (
9690
<InviteLayout>
97-
<div className='space-y-1 text-center'>
98-
<h1 className={'text-[32px] text-[var(--text-primary)] tracking-tight'}>
99-
Successfully Unsubscribed
100-
</h1>
91+
<InviteHeading title={'Successfully Unsubscribed'}>
10192
<p className={'text-[var(--text-muted)] text-md'}>
10293
You have been unsubscribed from our emails. You will stop receiving emails within 48
10394
hours.
10495
</p>
105-
</div>
96+
</InviteHeading>
10697

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

118109
return (
119110
<InviteLayout>
120-
<div className='space-y-1 text-center'>
121-
<h1 className={'text-[32px] text-[var(--text-primary)] tracking-tight'}>
122-
Email Preferences
123-
</h1>
111+
<InviteHeading title={'Email Preferences'}>
124112
<p className={'text-[var(--text-muted)] text-md'}>
125113
Choose which emails you'd like to stop receiving.
126114
</p>
127115
<p className={'text-[var(--text-muted)] text-sm'}>{data?.email}</p>
128-
</div>
116+
</InviteHeading>
129117

130118
<div className={'mt-8 w-full max-w-[410px] space-y-3'}>
131119
<AuthSubmitButton
@@ -205,10 +193,9 @@ export default function Unsubscribe() {
205193
<Suspense
206194
fallback={
207195
<InviteLayout>
208-
<div className='space-y-1 text-center'>
209-
<h1 className={'text-[32px] text-[var(--text-primary)] tracking-tight'}>Loading</h1>
196+
<InviteHeading title={'Loading'}>
210197
<p className={'text-[var(--text-muted)] text-md'}>Validating your unsubscribe link…</p>
211-
</div>
198+
</InviteHeading>
212199
<div className={'mt-8 flex w-full items-center justify-center py-8'}>
213200
<Loader className='size-8 text-[var(--text-muted)]' animate />
214201
</div>

0 commit comments

Comments
 (0)