diff --git a/react-frontend/bun.lockb b/react-frontend/bun.lockb index e791da6..8bc16a5 100755 Binary files a/react-frontend/bun.lockb and b/react-frontend/bun.lockb differ diff --git a/react-frontend/src/App.tsx b/react-frontend/src/App.tsx index 64d2de5..45bbef3 100644 --- a/react-frontend/src/App.tsx +++ b/react-frontend/src/App.tsx @@ -25,7 +25,7 @@ import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card' import { Toaster } from '@/components/ui/toaster' import { useToast } from '@/components/ui/use-toast' -import { Copy } from 'lucide-react' +import { Copy, Loader2 } from 'lucide-react' import { useEffect, useState } from 'react' @@ -40,8 +40,10 @@ type Shortener = { export default function App() { const [shorteners, setShorteners] = useState([]) + const [isLoading, setIsLoading] = useState(false) const getShorteners = async () => { + setIsLoading(true) const response = await fetch(backend_url + '/link', { method: 'GET', }) @@ -49,6 +51,7 @@ export default function App() { const data = (await response.json()).shorteners as Shortener[] setShorteners(data) + setIsLoading(false) } useEffect(() => { @@ -64,7 +67,10 @@ export default function App() {
- +
@@ -146,7 +152,13 @@ const CreateShortener = ({ ) } -const ShortenerTable = ({ shorteners }: { shorteners: Shortener[] }) => { +const ShortenerTable = ({ + shorteners, + isLoading, +}: { + shorteners: Shortener[] + isLoading: boolean +}) => { const { toast } = useToast() const copyLinkToClipboard = async (code: string) => { await navigator.clipboard.writeText(backend_url + '/' + code) @@ -158,7 +170,10 @@ const ShortenerTable = ({ shorteners }: { shorteners: Shortener[] }) => { return ( - Shorteners + +
Shorteners
+ {isLoading && } +