+13
-19
frontend/src/components/LinkList.tsx
+13
-19
frontend/src/components/LinkList.tsx
···
1
-
import { lazy, Suspense } from 'react'
2
-
3
1
import { useEffect, useState } from 'react'
4
2
import { Link } from '../types/api'
5
3
import { getAllLinks, deleteLink } from '../api/client'
···
24
22
DialogFooter,
25
23
} from "@/components/ui/dialog"
26
24
27
-
const StatisticsModal = lazy(() => import('./StatisticsModal'))
25
+
import { StatisticsModal } from "./StatisticsModal"
28
26
29
27
interface LinkListProps {
30
28
refresh?: number;
···
87
85
const baseUrl = window.location.origin
88
86
navigator.clipboard.writeText(`${baseUrl}/${shortCode}`)
89
87
toast({
90
-
description: (
91
-
<>
92
-
Link copied to clipboard
93
-
<br />
94
-
You can add ?source=TextHere to the end of the link to track the source of clicks
95
-
</>
96
-
),
88
+
description: (
89
+
<>
90
+
Link copied to clipboard
91
+
<br />
92
+
You can add ?source=TextHere to the end of the link to track the source of clicks
93
+
</>
94
+
),
97
95
})
98
96
}
99
97
···
188
186
</div>
189
187
</CardContent>
190
188
</Card>
191
-
{statsModal.isOpen && (
192
-
<Suspense fallback={<div>Loading...</div>}>
193
-
<StatisticsModal
194
-
isOpen={statsModal.isOpen}
195
-
onClose={() => setStatsModal({ isOpen: false, linkId: null })}
196
-
linkId={statsModal.linkId!}
197
-
/>
198
-
</Suspense>
199
-
)}
189
+
<StatisticsModal
190
+
isOpen={statsModal.isOpen}
191
+
onClose={() => setStatsModal({ isOpen: false, linkId: null })}
192
+
linkId={statsModal.linkId!}
193
+
/>
200
194
</>
201
195
)
202
196
}
+1
-1
frontend/src/components/StatisticsModal.tsx
+1
-1
frontend/src/components/StatisticsModal.tsx
···
58
58
return null;
59
59
};
60
60
61
-
export default function StatisticsModal({ isOpen, onClose, linkId }: StatisticsModalProps) {
61
+
export function StatisticsModal({ isOpen, onClose, linkId }: StatisticsModalProps) {
62
62
const [clicksOverTime, setClicksOverTime] = useState<EnhancedClickStats[]>([]);
63
63
const [sourcesData, setSourcesData] = useState<SourceStats[]>([]);
64
64
const [loading, setLoading] = useState(true);