11import React , { useState } from 'react' ;
2- import { Modal , message } from 'antd' ;
2+ import { Modal , message , Spin , Typography } from 'antd' ;
33import {
44 KeyOutlined ,
55 CalendarOutlined ,
@@ -10,15 +10,43 @@ import {
1010} from '@ant-design/icons' ;
1111import { SubscriberProfile } from '@app/hooks/usePaidSubscribers' ;
1212import * as S from './SubscriberDetailModal.styles' ;
13+
1314interface SubscriberDetailModalProps {
1415 subscriber : SubscriberProfile | null ;
16+ loading ?: boolean ;
17+ fetchFailed ?: boolean ;
1518 isVisible : boolean ;
1619 onClose : ( ) => void ;
1720}
1821
19- export const SubscriberDetailModal : React . FC < SubscriberDetailModalProps > = ( { subscriber, isVisible, onClose } ) => {
22+ export const SubscriberDetailModal : React . FC < SubscriberDetailModalProps > = ( { subscriber, isVisible, onClose, loading = false , fetchFailed = false } ) => {
2023 const [ copied , setCopied ] = useState ( false ) ;
24+ // Loading state
25+ if ( ! subscriber && loading && ! fetchFailed ) {
26+ return (
27+ < Modal open = { isVisible } footer = { null } onCancel = { onClose } centered >
28+ < Spin tip = "Loading..." />
29+ </ Modal >
30+ ) ;
31+ }
2132
33+ // Error state
34+ if ( ! subscriber && ! loading && fetchFailed ) {
35+ return (
36+ < Modal open = { isVisible } footer = { null } onCancel = { onClose } centered >
37+ < Typography . Text type = "danger" > Failed to fetch subscriber profile. Please try again.</ Typography . Text >
38+ </ Modal >
39+ ) ;
40+ }
41+
42+ // Not found state
43+ if ( ! subscriber && ! loading && ! fetchFailed ) {
44+ return (
45+ < Modal open = { isVisible } footer = { null } onCancel = { onClose } centered >
46+ < Typography . Text type = "secondary" > Couldn't find this subscriber profile.</ Typography . Text >
47+ </ Modal >
48+ ) ;
49+ }
2250 if ( ! subscriber ) {
2351 return null ;
2452 }
0 commit comments