11'use client'
22
33import { Suspense } from 'react'
4- import { Chip , cn , Loader } from '@sim/emcn'
4+ import { Chip , Loader } from '@sim/emcn'
55import { getErrorMessage } from '@sim/utils/errors'
66import { useSearchParams } from 'next/navigation'
77import type { UnsubscribeType } from '@/lib/api/contracts/user'
88import { AuthSubmitButton } from '@/app/(auth)/components'
99import { AUTH_BUTTON_CLASS } from '@/app/(auth)/components/constants'
10- import { InviteLayout } from '@/app/invite/components'
10+ import { InviteHeading , InviteLayout } from '@/app/invite/components'
1111import { useUnsubscribe , useUnsubscribeMutation } from '@/hooks/queries/unsubscribe'
1212
1313function UnsubscribeContent ( ) {
@@ -39,10 +39,9 @@ function UnsubscribeContent() {
3939 if ( loading ) {
4040 return (
4141 < InviteLayout >
42- < div className = 'space-y-1 text-center' >
43- < h1 className = { 'text-[var(--text-primary)] text-title-lg tracking-tight' } > Loading</ h1 >
42+ < InviteHeading title = { 'Loading' } >
4443 < p className = { 'text-[var(--text-muted)] text-md' } > Validating your unsubscribe link…</ p >
45- </ div >
44+ </ InviteHeading >
4645 < div className = { 'mt-8 flex w-full items-center justify-center py-8' } >
4746 < Loader className = 'size-8 text-[var(--text-muted)]' animate />
4847 </ div >
@@ -53,12 +52,9 @@ function UnsubscribeContent() {
5352 if ( error ) {
5453 return (
5554 < InviteLayout >
56- < div className = 'space-y-1 text-center' >
57- < h1 className = { 'text-[var(--text-primary)] text-title-lg tracking-tight' } >
58- Invalid Unsubscribe Link
59- </ h1 >
55+ < InviteHeading title = { 'Invalid Unsubscribe Link' } >
6056 < p className = { 'text-[var(--text-muted)] text-md' } > { error } </ p >
61- </ div >
57+ </ InviteHeading >
6258
6359 < div className = { 'mt-8 w-full max-w-[410px] space-y-3' } >
6460 < AuthSubmitButton type = 'button' onClick = { ( ) => window . history . back ( ) } loadingLabel = '' >
@@ -72,15 +68,12 @@ function UnsubscribeContent() {
7268 if ( data ?. isTransactional ) {
7369 return (
7470 < InviteLayout >
75- < div className = 'space-y-1 text-center' >
76- < h1 className = { 'text-[var(--text-primary)] text-title-lg tracking-tight' } >
77- Important Account Emails
78- </ h1 >
71+ < InviteHeading title = { 'Important Account Emails' } >
7972 < p className = { 'text-[var(--text-muted)] text-md' } >
8073 Transactional emails like password resets, account confirmations, and security alerts
8174 cannot be unsubscribed from as they contain essential information for your account.
8275 </ p >
83- </ div >
76+ </ InviteHeading >
8477
8578 < div className = { 'mt-8 w-full max-w-[410px] space-y-3' } >
8679 < AuthSubmitButton type = 'button' onClick = { ( ) => window . close ( ) } loadingLabel = '' >
@@ -94,15 +87,12 @@ function UnsubscribeContent() {
9487 if ( unsubscribed ) {
9588 return (
9689 < InviteLayout >
97- < div className = 'space-y-1 text-center' >
98- < h1 className = { 'text-[var(--text-primary)] text-title-lg tracking-tight' } >
99- Successfully Unsubscribed
100- </ h1 >
90+ < InviteHeading title = { 'Successfully Unsubscribed' } >
10191 < p className = { 'text-[var(--text-muted)] text-md' } >
10292 You have been unsubscribed from our emails. You will stop receiving emails within 48
10393 hours.
10494 </ p >
105- </ div >
95+ </ InviteHeading >
10696
10797 < div className = { 'mt-8 w-full max-w-[410px] space-y-3' } >
10898 < AuthSubmitButton type = 'button' onClick = { ( ) => window . close ( ) } loadingLabel = '' >
@@ -117,15 +107,12 @@ function UnsubscribeContent() {
117107
118108 return (
119109 < InviteLayout >
120- < div className = 'space-y-1 text-center' >
121- < h1 className = { 'text-[var(--text-primary)] text-title-lg tracking-tight' } >
122- Email Preferences
123- </ h1 >
110+ < InviteHeading title = { 'Email Preferences' } >
124111 < p className = { 'text-[var(--text-muted)] text-md' } >
125112 Choose which emails you'd like to stop receiving.
126113 </ p >
127114 < p className = { 'text-[var(--text-muted)] text-sm' } > { data ?. email } </ p >
128- </ div >
115+ </ InviteHeading >
129116
130117 < div className = { 'mt-8 w-full max-w-[410px] space-y-3' } >
131118 < AuthSubmitButton
@@ -152,7 +139,8 @@ function UnsubscribeContent() {
152139 isAlreadyUnsubscribedFromAll ||
153140 data ?. currentPreferences . unsubscribeMarketing
154141 }
155- className = { cn ( AUTH_BUTTON_CLASS , 'border border-[var(--border-1)]' ) }
142+ variant = 'outline'
143+ className = { AUTH_BUTTON_CLASS }
156144 >
157145 { data ?. currentPreferences . unsubscribeMarketing
158146 ? 'Unsubscribed from Marketing'
@@ -167,7 +155,8 @@ function UnsubscribeContent() {
167155 isAlreadyUnsubscribedFromAll ||
168156 data ?. currentPreferences . unsubscribeUpdates
169157 }
170- className = { cn ( AUTH_BUTTON_CLASS , 'border border-[var(--border-1)]' ) }
158+ variant = 'outline'
159+ className = { AUTH_BUTTON_CLASS }
171160 >
172161 { data ?. currentPreferences . unsubscribeUpdates
173162 ? 'Unsubscribed from Updates'
@@ -182,7 +171,8 @@ function UnsubscribeContent() {
182171 isAlreadyUnsubscribedFromAll ||
183172 data ?. currentPreferences . unsubscribeNotifications
184173 }
185- className = { cn ( AUTH_BUTTON_CLASS , 'border border-[var(--border-1)]' ) }
174+ variant = 'outline'
175+ className = { AUTH_BUTTON_CLASS }
186176 >
187177 { data ?. currentPreferences . unsubscribeNotifications
188178 ? 'Unsubscribed from Notifications'
@@ -205,10 +195,9 @@ export default function Unsubscribe() {
205195 < Suspense
206196 fallback = {
207197 < InviteLayout >
208- < div className = 'space-y-1 text-center' >
209- < h1 className = { 'text-[var(--text-primary)] text-title-lg tracking-tight' } > Loading</ h1 >
198+ < InviteHeading title = { 'Loading' } >
210199 < p className = { 'text-[var(--text-muted)] text-md' } > Validating your unsubscribe link…</ p >
211- </ div >
200+ </ InviteHeading >
212201 < div className = { 'mt-8 flex w-full items-center justify-center py-8' } >
213202 < Loader className = 'size-8 text-[var(--text-muted)]' animate />
214203 </ div >
0 commit comments