feat: add dashboard refresh buttons
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
"use client";
|
||||
|
||||
import { useEffect, useState } from "react";
|
||||
import { RefreshCw } from "lucide-react";
|
||||
import { Badge } from "@/components/ui/badge";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Card, CardContent } from "@/components/ui/card";
|
||||
@@ -39,7 +40,7 @@ export function RequestHistory() {
|
||||
|
||||
return (
|
||||
<div className="space-y-4">
|
||||
<div className="flex gap-2">
|
||||
<div className="flex gap-2 flex-wrap">
|
||||
<Input
|
||||
value={query}
|
||||
onChange={(e) => setQuery(e.target.value)}
|
||||
@@ -57,6 +58,10 @@ export function RequestHistory() {
|
||||
<Button variant="secondary" onClick={() => setStatus("DECLINED")}>
|
||||
Declined
|
||||
</Button>
|
||||
<Button variant="outline" onClick={load}>
|
||||
<RefreshCw className="mr-2 h-4 w-4" />
|
||||
Refresh
|
||||
</Button>
|
||||
</div>
|
||||
<div className="grid gap-3">
|
||||
{filtered.map((r) => (
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
import { useEffect, useState } from "react";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { toast } from "sonner";
|
||||
import { RefreshCw } from "lucide-react";
|
||||
import {
|
||||
Card,
|
||||
CardContent,
|
||||
@@ -86,11 +87,8 @@ export default function DashboardPage() {
|
||||
try {
|
||||
const costsRes = await overseerApi.getCosts();
|
||||
setRequestCosts(costsRes.data);
|
||||
} catch {
|
||||
/* ignore */
|
||||
}
|
||||
} catch {}
|
||||
};
|
||||
|
||||
const handleLogout = async () => {
|
||||
try {
|
||||
await authApi.logout();
|
||||
@@ -98,13 +96,20 @@ export default function DashboardPage() {
|
||||
logout();
|
||||
router.push("/login");
|
||||
};
|
||||
const handleRefresh = () => {
|
||||
loadWalletAndPending();
|
||||
loadCosts();
|
||||
};
|
||||
|
||||
if (isLoading) return <div className="p-8">Loading...</div>;
|
||||
|
||||
return (
|
||||
<div className="p-8 space-y-6">
|
||||
<div className="flex items-center justify-between">
|
||||
<div />
|
||||
<Button variant="outline" onClick={handleRefresh}>
|
||||
<RefreshCw className="mr-2 h-4 w-4" />
|
||||
Refresh
|
||||
</Button>
|
||||
<Button variant="outline" onClick={handleLogout}>
|
||||
Logout
|
||||
</Button>
|
||||
@@ -137,10 +142,14 @@ export default function DashboardPage() {
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="mt-4">
|
||||
<div className="mt-4 flex gap-2">
|
||||
<Button onClick={() => setIsSearchModalOpen(true)}>
|
||||
Request content
|
||||
</Button>
|
||||
<Button variant="secondary" onClick={handleRefresh}>
|
||||
<RefreshCw className="mr-2 h-4 w-4" />
|
||||
Check requests
|
||||
</Button>
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
Reference in New Issue
Block a user