@@ -16,11 +16,9 @@ import Animated, {
16
16
FadeOutDown ,
17
17
StretchInY ,
18
18
} from 'react-native-reanimated' ;
19
- import { toast } from 'sonner-native' ;
20
- import tw , { useDeviceContext } from 'twrnc' ;
21
19
import AppText from '@/components/AppText' ;
22
20
import AppTouchable from '@/components/AppTouchable' ;
23
- import ErrorChip from '@/components/ErrorChip ' ;
21
+ import ErrorBadge from '@/components/ErrorBagde ' ;
24
22
import { type PeriodType } from '@/components/Events/PeriodBottomSheet' ;
25
23
import AppointmentCard from '@/components/Home/AppointmentCard' ;
26
24
import AttendanceCount from '@/components/Home/AttendanceCount' ;
@@ -42,6 +40,7 @@ import SubscriptionBottomSheet from '@/components/Home/SubscriptionBottomSheet';
42
40
import SubscriptionCard from '@/components/Home/SubscriptionCard' ;
43
41
import UnauthenticatedState from '@/components/Home/UnauthenticatedState' ;
44
42
import UnlockGateCard from '@/components/Home/UnlockGateCard' ;
43
+ import SectionTitle from '@/components/Layout/SectionTitle' ;
45
44
import { useAppContact } from '@/context/contact' ;
46
45
import useAppState from '@/helpers/app-state' ;
47
46
import { isSilentError } from '@/helpers/error' ;
@@ -57,6 +56,8 @@ import {
57
56
import useAuthStore from '@/stores/auth' ;
58
57
import useSettingsStore from '@/stores/settings' ;
59
58
import useToastStore from '@/stores/toast' ;
59
+ import { toast } from 'sonner-native' ;
60
+ import tw , { useDeviceContext } from 'twrnc' ;
60
61
61
62
const MAX_WIDTH = 672 ; // tw`max-w-2xl`
62
63
@@ -333,19 +334,14 @@ export default function HomeScreen() {
333
334
isWide && tw `mx-auto w-full max-w-2xl` ,
334
335
] } >
335
336
< AttendanceCount
337
+ error = {
338
+ currentMembersError && ! isSilentError ( currentMembersError ) ? currentMembersError : null
339
+ }
336
340
loading = { isLoadingCurrentMembers }
337
341
members = { currentMembers }
338
342
style = { tw `mt-4` }
339
343
total = { 40 }
340
344
/>
341
-
342
- { currentMembersError && ! isSilentError ( currentMembersError ) ? (
343
- < ErrorChip
344
- error = { currentMembersError }
345
- label = { t ( 'home.people.onFetch.fail' ) }
346
- style = { tw `self-start` }
347
- />
348
- ) : null }
349
345
</ Animated . View >
350
346
351
347
{ authStore . user ?. onboarding && (
@@ -357,19 +353,13 @@ export default function HomeScreen() {
357
353
) }
358
354
359
355
< Animated . View entering = { FadeInLeft . duration ( 750 ) . delay ( 400 ) } style = { tw `flex self-stretch` } >
360
- < View
361
- style = { [
362
- tw `flex flex-col items-start gap-2 mt-6 px-6` ,
363
- isWide && tw `mx-auto w-full max-w-2xl` ,
364
- ] } >
365
- < AppText style = { tw `text-sm font-normal uppercase text-slate-500` } >
366
- { t ( 'home.profile.label' ) }
367
- </ AppText >
368
-
356
+ < SectionTitle
357
+ style = { [ tw `w-full mt-6 px-6` , isWide && tw `mx-auto max-w-2xl` ] }
358
+ title = { t ( 'home.profile.label' ) } >
369
359
{ profileError && ! isSilentError ( profileError ) ? (
370
- < ErrorChip error = { profileError } label = { t ( 'home.profile.onFetch.fail' ) } />
360
+ < ErrorBadge error = { profileError } title = { t ( 'home.profile.onFetch.fail' ) } />
371
361
) : null }
372
- </ View >
362
+ </ SectionTitle >
373
363
374
364
< ScrollView
375
365
contentContainerStyle = { [
@@ -435,36 +425,22 @@ export default function HomeScreen() {
435
425
</ ScrollView >
436
426
</ Animated . View >
437
427
438
- < Animated . View
428
+ < SectionTitle
429
+ count = { nextCalendarEvents . length > 2 ? nextCalendarEvents . length : null }
439
430
entering = { FadeInRight . duration ( 750 ) . delay ( 600 ) }
440
- style = { [
441
- tw `flex flex-row items-center w-full gap-2 mt-12 px-6` ,
442
- isWide && tw `mx-auto w-full max-w-2xl` ,
443
- ] } >
444
- < AppText style = { tw `text-sm font-normal uppercase text-slate-500` } >
445
- { t ( 'home.calendar.label' ) }
446
- </ AppText >
447
- { nextCalendarEvents . length > 2 && (
448
- < View style = { tw `bg-gray-400/25 dark:bg-gray-700/50 py-1 px-2 rounded-full` } >
449
- < AppText style = { tw `text-xs text-slate-900 dark:text-gray-200 font-medium` } >
450
- { nextCalendarEvents . length }
451
- </ AppText >
452
- </ View >
453
- ) }
431
+ style = { [ tw `w-full mt-6 px-6` , isWide && tw `mx-auto max-w-2xl` ] }
432
+ title = { t ( 'home.calendar.label' ) } >
433
+ { calendarEventsError && ! isSilentError ( calendarEventsError ) ? (
434
+ < ErrorBadge error = { calendarEventsError } title = { t ( 'home.calendar.onFetch.fail' ) } />
435
+ ) : null }
436
+
454
437
< Link asChild href = "/events" >
455
438
< AppText
456
439
style = { tw `ml-auto text-base font-normal leading-5 text-right text-amber-500 min-w-5` } >
457
440
{ t ( 'home.calendar.browse' ) }
458
441
</ AppText >
459
442
</ Link >
460
- </ Animated . View >
461
-
462
- { calendarEventsError && ! isSilentError ( calendarEventsError ) ? (
463
- < View
464
- style = { [ tw `flex flex-col items-start mt-2 px-6` , isWide && tw `mx-auto w-full max-w-2xl` ] } >
465
- < ErrorChip error = { calendarEventsError } label = { t ( 'home.calendar.onFetch.fail' ) } />
466
- </ View >
467
- ) : null }
443
+ </ SectionTitle >
468
444
469
445
< Animated . View entering = { FadeInRight . duration ( 750 ) . delay ( 600 ) } style = { tw `flex w-full` } >
470
446
< ScrollView
@@ -524,11 +500,11 @@ export default function HomeScreen() {
524
500
tw `flex flex-col w-full px-4 gap-4 mt-9 mb-3` ,
525
501
isWide && tw `mx-auto w-full max-w-2xl` ,
526
502
] } >
527
- < AppText
503
+ < SectionTitle
528
504
entering = { FadeInUp . duration ( 500 ) . delay ( 600 ) }
529
- style = { tw `mx-2 text-sm font-normal uppercase text-slate-500` } >
530
- { t ( 'home.services.label' ) }
531
- </ AppText >
505
+ style = { tw `mx-2` }
506
+ title = { t ( 'home.services.label' ) }
507
+ / >
532
508
533
509
< View style = { tw `flex flex-row items-stretch gap-4 min-h-40` } >
534
510
< Animated . View
0 commit comments