Compare commits
3
Commits
afa6e8d473
...
v0.8.1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fc7fd74d17 | ||
|
|
8c3d4e4e33 | ||
|
|
581c3c0e6c |
@@ -7,6 +7,7 @@ import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
|
||||
import { SessionTimelineChart } from "@/components/sessions/SessionTimelineChart";
|
||||
import { SessionTitleEditor } from "@/components/sessions/SessionTitleEditor";
|
||||
import { SessionDescriptionEditor } from "@/components/sessions/SessionDescriptionEditor";
|
||||
import { SessionDeleteButton } from "@/components/sessions/SessionDeleteButton";
|
||||
import { STATUS_VARIANT } from "@/components/sessions/session-status";
|
||||
import { getSessionDetail, getSessionName } from "@/lib/db/queries/sessions";
|
||||
import { getSessionTimeline } from "@/lib/db/queries/stats";
|
||||
@@ -65,6 +66,7 @@ export default async function SessionDetailPage({ params }: { params: Promise<{
|
||||
</Link>
|
||||
</Button>
|
||||
)}
|
||||
<SessionDeleteButton sessionId={detail.session.id} sessionName={detail.session.name} />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -241,7 +241,7 @@ export function ButtplugConsole() {
|
||||
|
||||
{Object.keys(devices).length === 0 ? (
|
||||
<Card className="bp-glass">
|
||||
<CardContent className="py-6 text-sm text-muted-foreground">
|
||||
<CardContent className="text-sm text-muted-foreground">
|
||||
No devices connected yet. Scan to discover nearby toys, then select one from your browser's
|
||||
pairing prompt.
|
||||
</CardContent>
|
||||
|
||||
@@ -164,7 +164,7 @@ export function ReplayPlayer({ sessionId }: { sessionId: number }) {
|
||||
|
||||
{connectedDevices.length === 0 && (
|
||||
<Card className="bp-glass">
|
||||
<CardContent className="py-6 text-sm text-muted-foreground">
|
||||
<CardContent className="text-sm text-muted-foreground">
|
||||
No devices connected yet. Scan to discover nearby toys, then match them to this session's
|
||||
original device slots.
|
||||
</CardContent>
|
||||
@@ -173,7 +173,7 @@ export function ReplayPlayer({ sessionId }: { sessionId: number }) {
|
||||
</>
|
||||
) : (
|
||||
<Card className="bp-glass">
|
||||
<CardContent className="flex flex-col gap-3 py-6">
|
||||
<CardContent className="flex flex-col gap-3">
|
||||
{replayTargets.length > 0 && (
|
||||
<div className="flex flex-wrap gap-2">
|
||||
{replayTargets.map((t) => (
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
"use client";
|
||||
|
||||
import { useState } from "react";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import {
|
||||
Dialog,
|
||||
DialogContent,
|
||||
DialogDescription,
|
||||
DialogFooter,
|
||||
DialogHeader,
|
||||
DialogTitle,
|
||||
} from "@/components/ui/dialog";
|
||||
import { Trash2 } from "lucide-react";
|
||||
import { toast } from "sonner";
|
||||
|
||||
export function SessionDeleteButton({ sessionId, sessionName }: { sessionId: number; sessionName: string | null }) {
|
||||
const router = useRouter();
|
||||
const [open, setOpen] = useState(false);
|
||||
const [deleting, setDeleting] = useState(false);
|
||||
|
||||
async function handleDelete() {
|
||||
setDeleting(true);
|
||||
const res = await fetch(`/api/sessions/${sessionId}`, { method: "DELETE" });
|
||||
setDeleting(false);
|
||||
if (res.ok) {
|
||||
toast.success("Session deleted");
|
||||
router.push("/sessions");
|
||||
router.refresh();
|
||||
} else {
|
||||
toast.error("Could not delete session");
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<Button variant="ghost" size="icon-sm" onClick={() => setOpen(true)} aria-label="Delete session">
|
||||
<Trash2 className="size-4" />
|
||||
</Button>
|
||||
|
||||
<Dialog open={open} onOpenChange={setOpen}>
|
||||
<DialogContent>
|
||||
<DialogHeader>
|
||||
<DialogTitle>Delete session?</DialogTitle>
|
||||
<DialogDescription>
|
||||
This permanently deletes{" "}
|
||||
<span className="font-medium text-foreground">{sessionName ?? `Session #${sessionId}`}</span> and all
|
||||
of its recorded events. This can't be undone.
|
||||
</DialogDescription>
|
||||
</DialogHeader>
|
||||
<DialogFooter>
|
||||
<Button variant="ghost" onClick={() => setOpen(false)}>
|
||||
Cancel
|
||||
</Button>
|
||||
<Button variant="destructive" onClick={() => void handleDelete()} disabled={deleting}>
|
||||
{deleting ? "Deleting..." : "Delete"}
|
||||
</Button>
|
||||
</DialogFooter>
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
</>
|
||||
);
|
||||
}
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "sexy",
|
||||
"version": "0.8.0",
|
||||
"version": "0.8.1",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "next dev",
|
||||
|
||||
Reference in New Issue
Block a user