forked from administration/panel
feat: flesh out app
parent
b7a3a61717
commit
ef53ec696f
|
@ -1,4 +1,5 @@
|
||||||
import { NavigateBack } from "@/components/common/NavigateBack";
|
import { NavigateBack } from "@/components/common/NavigateBack";
|
||||||
|
import { NavigationLinks } from "@/components/common/NavigationLinks";
|
||||||
import Image from "next/image";
|
import Image from "next/image";
|
||||||
|
|
||||||
export default function NotFound() {
|
export default function NotFound() {
|
||||||
|
@ -11,6 +12,9 @@ export default function NotFound() {
|
||||||
alt="pinkie pie: http error 404 page not found"
|
alt="pinkie pie: http error 404 page not found"
|
||||||
/>
|
/>
|
||||||
<NavigateBack />
|
<NavigateBack />
|
||||||
|
<div className="gap-2 flex">
|
||||||
|
<NavigationLinks />
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,15 +1,6 @@
|
||||||
import Image from "next/image";
|
import Image from "next/image";
|
||||||
import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar";
|
import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar";
|
||||||
import { buttonVariants } from "@/components/ui/button";
|
import { NavigationLinks } from "@/components/common/NavigationLinks";
|
||||||
import {
|
|
||||||
Globe2,
|
|
||||||
Home,
|
|
||||||
ScrollText,
|
|
||||||
Search,
|
|
||||||
Siren,
|
|
||||||
Sparkles,
|
|
||||||
} from "lucide-react";
|
|
||||||
import Link from "next/link";
|
|
||||||
|
|
||||||
export default function PanelLayout({
|
export default function PanelLayout({
|
||||||
children,
|
children,
|
||||||
|
@ -36,48 +27,7 @@ export default function PanelLayout({
|
||||||
</div>
|
</div>
|
||||||
<div className="flex">
|
<div className="flex">
|
||||||
<div className="pt-2 pl-4 pr-0 gap-2 flex flex-col">
|
<div className="pt-2 pl-4 pr-0 gap-2 flex flex-col">
|
||||||
<Link
|
<NavigationLinks />
|
||||||
className={buttonVariants({ variant: "outline", size: "icon" })}
|
|
||||||
href="/panel"
|
|
||||||
>
|
|
||||||
<Home className="h-4 w-4" />
|
|
||||||
</Link>
|
|
||||||
{/*<Link
|
|
||||||
className={buttonVariants({ variant: "outline", size: "icon" })}
|
|
||||||
href="/panel/grafana"
|
|
||||||
>
|
|
||||||
<TrendingUp className="h-4 w-4" />
|
|
||||||
</Link>*/}
|
|
||||||
<Link
|
|
||||||
className={buttonVariants({ variant: "outline", size: "icon" })}
|
|
||||||
href="/panel/search"
|
|
||||||
>
|
|
||||||
<Search className="h-4 w-4" />
|
|
||||||
</Link>
|
|
||||||
<Link
|
|
||||||
className={buttonVariants({ variant: "outline", size: "icon" })}
|
|
||||||
href="/panel/reports"
|
|
||||||
>
|
|
||||||
<Siren className="h-4 w-4" />
|
|
||||||
</Link>
|
|
||||||
<Link
|
|
||||||
className={buttonVariants({ variant: "outline", size: "icon" })}
|
|
||||||
href="/panel/discover"
|
|
||||||
>
|
|
||||||
<Globe2 className="h-4 w-4" />
|
|
||||||
</Link>
|
|
||||||
<Link
|
|
||||||
className={buttonVariants({ variant: "outline", size: "icon" })}
|
|
||||||
href="/panel/audit"
|
|
||||||
>
|
|
||||||
<ScrollText className="h-4 w-4" />
|
|
||||||
</Link>
|
|
||||||
<Link
|
|
||||||
className={buttonVariants({ variant: "outline", size: "icon" })}
|
|
||||||
href="/panel/sparkle"
|
|
||||||
>
|
|
||||||
<Sparkles className="h-4 w-4" />
|
|
||||||
</Link>
|
|
||||||
</div>
|
</div>
|
||||||
<div className="flex-grow overflow-hidden p-2 pr-4">{children}</div>
|
<div className="flex-grow overflow-hidden p-2 pr-4">{children}</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,22 +1,33 @@
|
||||||
|
import { JsonCard } from "@/components/cards/JsonCard";
|
||||||
import { MessageContextCard } from "@/components/cards/MessageContextCard";
|
import { MessageContextCard } from "@/components/cards/MessageContextCard";
|
||||||
import { ReportCard } from "@/components/cards/ReportCard";
|
import { ReportCard } from "@/components/cards/ReportCard";
|
||||||
|
import { ServerCard } from "@/components/cards/ServerCard";
|
||||||
import { UserCard } from "@/components/cards/UserCard";
|
import { UserCard } from "@/components/cards/UserCard";
|
||||||
|
import { NavigationToolbar } from "@/components/common/NavigationToolbar";
|
||||||
import { Badge } from "@/components/ui/badge";
|
import { Badge } from "@/components/ui/badge";
|
||||||
import { buttonVariants } from "@/components/ui/button";
|
import { Button, buttonVariants } from "@/components/ui/button";
|
||||||
import {
|
import {
|
||||||
Card,
|
Card,
|
||||||
CardDescription,
|
CardDescription,
|
||||||
CardHeader,
|
CardHeader,
|
||||||
CardTitle,
|
CardTitle,
|
||||||
} from "@/components/ui/card";
|
} from "@/components/ui/card";
|
||||||
|
import {
|
||||||
|
DropdownMenu,
|
||||||
|
DropdownMenuContent,
|
||||||
|
DropdownMenuItem,
|
||||||
|
DropdownMenuLabel,
|
||||||
|
DropdownMenuSeparator,
|
||||||
|
DropdownMenuTrigger,
|
||||||
|
} from "@/components/ui/dropdown-menu";
|
||||||
import { Separator } from "@/components/ui/separator";
|
import { Separator } from "@/components/ui/separator";
|
||||||
|
import { Textarea } from "@/components/ui/textarea";
|
||||||
import {
|
import {
|
||||||
fetchReportById,
|
fetchReportById,
|
||||||
fetchReports,
|
fetchReports,
|
||||||
fetchSnapshotsByReport,
|
fetchSnapshotsByReport,
|
||||||
fetchUserById,
|
fetchUserById,
|
||||||
} from "@/lib/db";
|
} from "@/lib/db";
|
||||||
import { ArrowLeft } from "lucide-react";
|
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
import { notFound } from "next/navigation";
|
import { notFound } from "next/navigation";
|
||||||
import { Fragment } from "react";
|
import { Fragment } from "react";
|
||||||
|
@ -44,12 +55,7 @@ export default async function Reports({ params }: { params: { id: string } }) {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex flex-col gap-2">
|
<div className="flex flex-col gap-2">
|
||||||
<Link
|
<NavigationToolbar>Viewing Report</NavigationToolbar>
|
||||||
className={buttonVariants({ variant: "outline", size: "icon" })}
|
|
||||||
href="/panel/reports"
|
|
||||||
>
|
|
||||||
<ArrowLeft className="h-4 w-4" />
|
|
||||||
</Link>
|
|
||||||
|
|
||||||
<Card className="shadow-none">
|
<Card className="shadow-none">
|
||||||
<CardHeader>
|
<CardHeader>
|
||||||
|
@ -65,7 +71,40 @@ export default async function Reports({ params }: { params: { id: string } }) {
|
||||||
</CardDescription>
|
</CardDescription>
|
||||||
</CardHeader>
|
</CardHeader>
|
||||||
</Card>
|
</Card>
|
||||||
<UserCard user={author!} subtitle="Report Author" />
|
|
||||||
|
<Textarea
|
||||||
|
placeholder="Enter notes here..."
|
||||||
|
className="!min-h-0 !h-[76px]"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<div className="flex gap-2">
|
||||||
|
<Button className="flex-1 bg-green-400 hover:bg-green-300">
|
||||||
|
Resolve
|
||||||
|
</Button>
|
||||||
|
<DropdownMenu>
|
||||||
|
<DropdownMenuTrigger asChild>
|
||||||
|
<Button className="flex-1 bg-red-400 hover:bg-red-300">
|
||||||
|
Reject
|
||||||
|
</Button>
|
||||||
|
</DropdownMenuTrigger>
|
||||||
|
<DropdownMenuContent>
|
||||||
|
<DropdownMenuItem>Custom Reason</DropdownMenuItem>
|
||||||
|
<DropdownMenuSeparator />
|
||||||
|
<DropdownMenuLabel>Presets</DropdownMenuLabel>
|
||||||
|
<DropdownMenuItem>Invalid</DropdownMenuItem>
|
||||||
|
<DropdownMenuItem>False or Spam</DropdownMenuItem>
|
||||||
|
<DropdownMenuItem>Duplicate</DropdownMenuItem>
|
||||||
|
<DropdownMenuItem>Not Enough Evidence</DropdownMenuItem>
|
||||||
|
<DropdownMenuItem>Request Clarification</DropdownMenuItem>
|
||||||
|
<DropdownMenuItem>Acknowledge Only</DropdownMenuItem>
|
||||||
|
<DropdownMenuItem>Ignore</DropdownMenuItem>
|
||||||
|
</DropdownMenuContent>
|
||||||
|
</DropdownMenu>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<Link href={`/panel/inspect/user/${author!._id}`}>
|
||||||
|
<UserCard user={author!} subtitle="Report Author" />
|
||||||
|
</Link>
|
||||||
|
|
||||||
{snapshots.map((snapshot, index) => (
|
{snapshots.map((snapshot, index) => (
|
||||||
<Fragment key={snapshot._id}>
|
<Fragment key={snapshot._id}>
|
||||||
|
@ -78,9 +117,19 @@ export default async function Reports({ params }: { params: { id: string } }) {
|
||||||
{snapshot._type === "Message" && (
|
{snapshot._type === "Message" && (
|
||||||
<MessageContextCard snapshot={snapshot} />
|
<MessageContextCard snapshot={snapshot} />
|
||||||
)}
|
)}
|
||||||
|
{snapshot._type === "User" && (
|
||||||
|
<Link href={`/panel/inspect/user/${snapshot!._id}`}>
|
||||||
|
<UserCard user={snapshot} subtitle="Reported User" />
|
||||||
|
</Link>
|
||||||
|
)}
|
||||||
|
{snapshot._type === "Server" && (
|
||||||
|
<Link href={`/panel/inspect/server/${snapshot!._id}`}>
|
||||||
|
<ServerCard server={snapshot} subtitle="Reported Server" />
|
||||||
|
</Link>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
{relatedReports[index].length ? (
|
{relatedReports[index].length ? (
|
||||||
<div className="flex-1">
|
<div className="flex-1 min-w-0">
|
||||||
<h2 className="text-md text-center pb-2">Other Reports</h2>
|
<h2 className="text-md text-center pb-2">Other Reports</h2>
|
||||||
{relatedReports[index].map((relatedReport) => (
|
{relatedReports[index].map((relatedReport) => (
|
||||||
<ReportCard key={relatedReport._id} report={relatedReport} />
|
<ReportCard key={relatedReport._id} report={relatedReport} />
|
||||||
|
@ -90,6 +139,9 @@ export default async function Reports({ params }: { params: { id: string } }) {
|
||||||
</div>
|
</div>
|
||||||
</Fragment>
|
</Fragment>
|
||||||
))}
|
))}
|
||||||
|
|
||||||
|
<Separator className="my-2" />
|
||||||
|
<JsonCard obj={snapshots} />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,9 +3,9 @@ import { Input } from "@/components/ui/input";
|
||||||
import { fetchReports } from "@/lib/db";
|
import { fetchReports } from "@/lib/db";
|
||||||
|
|
||||||
export default async function Reports() {
|
export default async function Reports() {
|
||||||
const reports = (await fetchReports()).sort((b, _) =>
|
const reports = (await fetchReports())
|
||||||
b.content.report_reason.includes("Illegal") ? -1 : 0
|
.reverse()
|
||||||
);
|
.sort((b, _) => (b.content.report_reason.includes("Illegal") ? -1 : 0));
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex flex-col gap-2">
|
<div className="flex flex-col gap-2">
|
||||||
|
|
Loading…
Reference in New Issue