11'use client'
22
33import { Suspense } from 'react'
4- import { Chip , cn , Loader } from '@sim/emcn '
4+ import { AuthHeader , AuthButton as Chip , AuthLoader as Loader } from '@sim/auth-ui '
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'
9- import { AUTH_BUTTON_CLASS } from '@/app/(auth)/components/constants'
109import { InviteLayout } from '@/app/invite/components'
1110import { useUnsubscribe , useUnsubscribeMutation } from '@/hooks/queries/unsubscribe'
1211
@@ -39,12 +38,9 @@ function UnsubscribeContent() {
3938 if ( loading ) {
4039 return (
4140 < InviteLayout >
42- < div className = 'space-y-1 text-center' >
43- < h1 className = { 'text-[32px] text-[var(--text-primary)] tracking-tight' } > Loading</ h1 >
44- < p className = { 'text-[var(--text-muted)] text-md' } > Validating your unsubscribe link…</ p >
45- </ div >
46- < div className = { 'mt-8 flex w-full items-center justify-center py-8' } >
47- < Loader className = 'size-8 text-[var(--text-muted)]' animate />
41+ < AuthHeader title = 'Loading' description = 'Validating your unsubscribe link…' />
42+ < div className = 'au:mt-[var(--auth-group-gap)] au:flex au:w-full au:items-center au:justify-center au:py-8' >
43+ < Loader className = 'au:size-8 au:text-[var(--auth-secondary)]' animate />
4844 </ div >
4945 </ InviteLayout >
5046 )
@@ -53,16 +49,11 @@ function UnsubscribeContent() {
5349 if ( error ) {
5450 return (
5551 < 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 >
60- < p className = { 'text-[var(--text-muted)] text-md' } > { error } </ p >
61- </ div >
52+ < AuthHeader title = 'Invalid unsubscribe link' description = { error } />
6253
63- < div className = { ' mt-8 w-full max-w-[410px] space-y-3'} >
54+ < div className = 'au: mt-[var(--auth-group-gap)] au:w-full au: space-y-3'>
6455 < AuthSubmitButton type = 'button' onClick = { ( ) => window . history . back ( ) } loadingLabel = '' >
65- Go Back
56+ Go back
6657 </ AuthSubmitButton >
6758 </ div >
6859 </ InviteLayout >
@@ -72,17 +63,12 @@ function UnsubscribeContent() {
7263 if ( data ?. isTransactional ) {
7364 return (
7465 < 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 >
79- < p className = { 'text-[var(--text-muted)] text-md' } >
80- Transactional emails like password resets, account confirmations, and security alerts
81- cannot be unsubscribed from as they contain essential information for your account.
82- </ p >
83- </ div >
66+ < AuthHeader
67+ title = 'Important account emails'
68+ description = 'Transactional emails like password resets, account confirmations, and security alerts cannot be unsubscribed from as they contain essential information for your account.'
69+ />
8470
85- < div className = { ' mt-8 w-full max-w-[410px] space-y-3'} >
71+ < div className = 'au: mt-[var(--auth-group-gap)] au:w-full au: space-y-3'>
8672 < AuthSubmitButton type = 'button' onClick = { ( ) => window . close ( ) } loadingLabel = '' >
8773 Close
8874 </ AuthSubmitButton >
@@ -94,17 +80,12 @@ function UnsubscribeContent() {
9480 if ( unsubscribed ) {
9581 return (
9682 < 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 >
101- < p className = { 'text-[var(--text-muted)] text-md' } >
102- You have been unsubscribed from our emails. You will stop receiving emails within 48
103- hours.
104- </ p >
105- </ div >
83+ < AuthHeader
84+ title = 'Successfully unsubscribed'
85+ description = 'You have been unsubscribed from our emails. You will stop receiving emails within 48 hours.'
86+ />
10687
107- < div className = { ' mt-8 w-full max-w-[410px] space-y-3'} >
88+ < div className = 'au: mt-[var(--auth-group-gap)] au:w-full au: space-y-3'>
10889 < AuthSubmitButton type = 'button' onClick = { ( ) => window . close ( ) } loadingLabel = '' >
10990 Close
11091 </ AuthSubmitButton >
@@ -117,17 +98,17 @@ function UnsubscribeContent() {
11798
11899 return (
119100 < 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 >
124- < p className = { 'text-[var(--text-muted)] text-md' } >
125- Choose which emails you'd like to stop receiving.
101+ < div className = 'au:space-y-1' >
102+ < AuthHeader
103+ title = 'Email preferences'
104+ description = "Choose which emails you'd like to stop receiving."
105+ />
106+ < p className = 'au:break-all au:text-[var(--auth-secondary)] au:text-control' >
107+ { data ?. email }
126108 </ p >
127- < p className = { 'text-[var(--text-muted)] text-sm' } > { data ?. email } </ p >
128109 </ div >
129110
130- < div className = { ' mt-8 w-full max-w-[410px] space-y-3'} >
111+ < div className = 'au: mt-[var(--auth-group-gap)] au:w-full au: space-y-3'>
131112 < AuthSubmitButton
132113 type = 'button'
133114 onClick = { ( ) => handleUnsubscribe ( 'all' ) }
@@ -140,8 +121,10 @@ function UnsubscribeContent() {
140121 : 'Unsubscribe from All Marketing Emails' }
141122 </ AuthSubmitButton >
142123
143- < div className = 'py-2 text-center' >
144- < span className = { 'text-[var(--text-muted)] text-sm' } > or choose specific types</ span >
124+ < div className = 'au:py-2 au:text-center' >
125+ < span className = 'au:text-[var(--auth-secondary)] au:text-caption' >
126+ or choose specific types
127+ </ span >
145128 </ div >
146129
147130 < Chip
@@ -152,7 +135,7 @@ function UnsubscribeContent() {
152135 isAlreadyUnsubscribedFromAll ||
153136 data ?. currentPreferences . unsubscribeMarketing
154137 }
155- className = { cn ( AUTH_BUTTON_CLASS , 'border border-[var(--border-1)]' ) }
138+ variant = 'outline'
156139 >
157140 { data ?. currentPreferences . unsubscribeMarketing
158141 ? 'Unsubscribed from Marketing'
@@ -167,7 +150,7 @@ function UnsubscribeContent() {
167150 isAlreadyUnsubscribedFromAll ||
168151 data ?. currentPreferences . unsubscribeUpdates
169152 }
170- className = { cn ( AUTH_BUTTON_CLASS , 'border border-[var(--border-1)]' ) }
153+ variant = 'outline'
171154 >
172155 { data ?. currentPreferences . unsubscribeUpdates
173156 ? 'Unsubscribed from Updates'
@@ -182,16 +165,16 @@ function UnsubscribeContent() {
182165 isAlreadyUnsubscribedFromAll ||
183166 data ?. currentPreferences . unsubscribeNotifications
184167 }
185- className = { cn ( AUTH_BUTTON_CLASS , 'border border-[var(--border-1)]' ) }
168+ variant = 'outline'
186169 >
187170 { data ?. currentPreferences . unsubscribeNotifications
188171 ? 'Unsubscribed from Notifications'
189172 : 'Unsubscribe from Notifications' }
190173 </ Chip >
191174 </ div >
192175
193- < div className = { ' mt-6 max-w-[410px] text-center' } >
194- < p className = 'text-[var(--text-muted )] text-small ' >
176+ < div className = 'au: mt-[var(--auth-group-gap)]' >
177+ < p className = 'au: text-[var(--auth-secondary )] au: text-caption ' >
195178 You'll continue receiving important account emails like password resets and security
196179 alerts.
197180 </ p >
@@ -205,12 +188,9 @@ export default function Unsubscribe() {
205188 < Suspense
206189 fallback = {
207190 < InviteLayout >
208- < div className = 'space-y-1 text-center' >
209- < h1 className = { 'text-[32px] text-[var(--text-primary)] tracking-tight' } > Loading</ h1 >
210- < p className = { 'text-[var(--text-muted)] text-md' } > Validating your unsubscribe link…</ p >
211- </ div >
212- < div className = { 'mt-8 flex w-full items-center justify-center py-8' } >
213- < Loader className = 'size-8 text-[var(--text-muted)]' animate />
191+ < AuthHeader title = 'Loading' description = 'Validating your unsubscribe link…' />
192+ < div className = 'au:mt-[var(--auth-group-gap)] au:flex au:w-full au:items-center au:justify-center au:py-8' >
193+ < Loader className = 'au:size-8 au:text-[var(--auth-secondary)]' animate />
214194 </ div >
215195 </ InviteLayout >
216196 }
0 commit comments