revert fb8e77bb68
Local Build and Deploy / deploy (push) Successful in 1m11s

revert style: clean up code with prettier and eslint
This commit is contained in:
remco committed 2026-07-12 21:02:03 +02:00
1 parent 27de078f54
commit e85e4d74ea
378 files changed
+20710 -22428

No files matched your search

+21 -21
View File
@@ -1,44 +1,44 @@
"use client";
'use client'
import { Eye, EyeOff } from "lucide-react";
import { useState } from "react";
import { toast } from "sonner";
import { toggleUserWatch } from "@/actions/watch";
import { Button } from "@/components/ui/button";
import { Eye, EyeOff } from 'lucide-react'
import { useState } from 'react'
import { toast } from 'sonner'
import { toggleUserWatch } from '@/actions/watch'
import { Button } from '@/components/ui/button'
interface UserWatchToggleProps {
targetUserId: number;
username: string;
initialWatching: boolean;
targetUserId: number
username: string
initialWatching: boolean
}
export function UserWatchToggle({ targetUserId, username, initialWatching }: UserWatchToggleProps) {
const [watching, setWatching] = useState(initialWatching);
const [busy, setBusy] = useState(false);
const [watching, setWatching] = useState(initialWatching)
const [busy, setBusy] = useState(false)
async function handleToggle() {
setBusy(true);
setBusy(true)
try {
const result = await toggleUserWatch({ targetUserId });
const result = await toggleUserWatch({ targetUserId })
if (result.ok) {
const data = result.data as { watching: boolean };
setWatching(data.watching);
toast.success(data.watching ? `Now watching ${username}` : `Stopped watching ${username}`);
const data = result.data as { watching: boolean }
setWatching(data.watching)
toast.success(data.watching ? `Now watching ${username}` : `Stopped watching ${username}`)
} else {
toast.error(result.error);
toast.error(result.error)
}
} finally {
setBusy(false);
setBusy(false)
}
}
return (
<Button
variant={watching ? "default" : "outline"}
variant={watching ? 'default' : 'outline'}
size="sm"
disabled={busy}
onClick={handleToggle}
title={watching ? "Stop watching this user" : "Watch this user"}
title={watching ? 'Stop watching this user' : 'Watch this user'}
>
{watching ? (
<>
@@ -50,5 +50,5 @@ export function UserWatchToggle({ targetUserId, username, initialWatching }: Use
</>
)}
</Button>
);
)
}