Skip to content

Commit 3bd9695

Browse files
committed
skip fetching process if using dummy data
1 parent 4a744b3 commit 3bd9695

File tree

3 files changed

+20
-6
lines changed

3 files changed

+20
-6
lines changed

src/components/header/components/searchDropdown/SearchDropdown.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ export const SearchDropdown: React.FC<SearchOverlayProps> = ({
130130
<InputSearch
131131
width="100%"
132132
value={query}
133-
placeholder={t('header.search') + ' pubkey'}
133+
placeholder={t('header.search') + ' hex pubkey'}
134134
filter={
135135
<Btn
136136
size="small"

src/components/relay-dashboard/paid-subscribers/PaidSubscribers.tsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const { Text } = Typography;
2323
export const PaidSubscribers: React.FC = () => {
2424
console.log('[PaidSubscribers] Component rendering...');
2525
const hookResult = usePaidSubscribers(12);
26-
const { subscribers, fetchMore, hasMore, loading } = hookResult;
26+
const { subscribers, fetchMore, hasMore, loading, useDummyData } = hookResult;
2727
const ndkInstance = useNDK();
2828

2929
// Modal state for subscriber details
@@ -94,6 +94,11 @@ export const PaidSubscribers: React.FC = () => {
9494

9595
useEffect(() => {
9696
// Fetch profiles for test subscribers
97+
if (useDummyData) {
98+
console.warn('[PaidSubscribers] Using dummy data, skipping profile fetch');
99+
setLoadingProfiles(false);
100+
return;
101+
}
97102
const fetchProfiles = async () => {
98103
if (!ndkInstance || !ndkInstance.ndk) {
99104
console.error('NDK instance is not initialized');
@@ -191,7 +196,7 @@ export const PaidSubscribers: React.FC = () => {
191196
))}
192197
</S.FlexWrapper>
193198

194-
<SubscriberDetailModal subscriber={selectedSubscriber} isVisible={isModalVisible} onClose={handleCloseModal} />
199+
<SubscriberDetailModal loading={loading} subscriber={selectedSubscriber} isVisible={isModalVisible} onClose={handleCloseModal} />
195200

196201
{/* View All Subscribers Modal */}
197202
<Modal
@@ -371,7 +376,7 @@ export const PaidSubscribers: React.FC = () => {
371376
</SplideCarousel>
372377

373378
{isModalVisible && (
374-
<SubscriberDetailModal subscriber={selectedSubscriber} isVisible={isModalVisible} onClose={handleCloseModal} />
379+
<SubscriberDetailModal loading={loading} subscriber={selectedSubscriber} isVisible={isModalVisible} onClose={handleCloseModal} />
375380
)}
376381

377382
{/* View All Subscribers Modal */}

src/hooks/usePaidSubscribers.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { useState, useEffect, useCallback, useRef } from 'react';
2-
import { message } from 'antd';
32
import config from '@app/config/config';
43
import { readToken } from '@app/services/localStorage.service';
54
import { useHandleLogout } from './authUtils';
@@ -21,15 +20,24 @@ import adminDefaultAvatar from '@app/assets/admin-default-avatar.png';
2120

2221
export interface SubscriberProfile {
2322
pubkey: string;
24-
picture: string;
23+
picture?: string;
2524
name?: string;
2625
about?: string;
2726
metadata?: {
2827
subscriptionTier?: string;
2928
subscribedSince?: string;
3029
};
3130
}
31+
const testSubscribers: SubscriberProfile[] = [
32+
{ pubkey: '91dfb08db37712e74d892adbbf63abab43cb6aa3806950548f3146347d29b6ae' },
33+
{ pubkey: '59cacbd83ad5c54ad91dacf51a49c06e0bef730ac0e7c235a6f6fa29b9230f02' },
34+
{ pubkey: '32e1827635450ebb3c5a7d12c1f8e7b2b514439ac10a67eef3d9fd9c5c68e245' },
35+
{ pubkey: '78a317586cbc30d20f8aa94d8450eb0cd58b312bad94fc76139c72eb2e5c81d2' },
36+
{ pubkey: '4657dfe8965be8980a93072bcfb5e59a65124406db0f819215ee78ba47934b3e' },
37+
{ pubkey: '6e75f7972397ca3295e0f4ca0fbc6eb9cc79be85bafdd56bd378220ca8eee74e' },
38+
{ pubkey: '7b991f776d04d87cb5d4259688187a520f6afc16b2b9ad26dac6b8ee76c2840d'}
3239

40+
];
3341
// Define dummy profiles using the imported images
3442
const dummyProfiles: SubscriberProfile[] = [
3543
{ pubkey: 'dummy-1', picture: profile1 },
@@ -46,6 +54,7 @@ const dummyProfiles: SubscriberProfile[] = [
4654
{ pubkey: 'dummy-12', picture: profile11 },
4755
];
4856

57+
4958
// URL of the placeholder avatar that comes from the API
5059
const PLACEHOLDER_AVATAR_URL = 'http://localhost:3000/placeholder-avatar.png';
5160

0 commit comments

Comments
 (0)