fmt: use biome

This commit is contained in:
2025-12-06 22:26:28 +08:00
parent 8be7af6815
commit 9a82ecedac
22 changed files with 400 additions and 429 deletions

View File

@@ -1,7 +1,7 @@
import { Component, createResource, For, Show } from 'solid-js';
import { commandsApi } from '../api/client';
import { Button } from './ui/Button';
import { Card } from './ui/Card';
import { Component, createResource, For, Show } from "solid-js";
import { commandsApi } from "../api/client";
import { Button } from "./ui/Button";
import { Card } from "./ui/Card";
const CommandQueue: Component = () => {
const [commands, { refetch }] = createResource(commandsApi.list);
@@ -11,7 +11,7 @@ const CommandQueue: Component = () => {
await commandsApi.updateStatus(id, { status });
refetch();
} catch (err) {
console.error('Failed to update command:', err);
console.error("Failed to update command:", err);
alert(`Error: ${err}`);
}
};
@@ -26,26 +26,27 @@ const CommandQueue: Component = () => {
<Card>
<Show when={!commands.loading} fallback={<div class="p-4">Loading...</div>}>
<For each={commands()} fallback={
<div class="p-8 text-center text-gray-500">
No commands in queue
</div>
}>
<For
each={commands()}
fallback={<div class="p-8 text-center text-gray-500">No commands in queue</div>}
>
{(cmd) => (
<div class="border-b p-4 hover:bg-gray-50">
<div class="flex justify-between items-start">
<div class="flex-1">
<div class="flex items-center gap-2 mb-2">
<span class={`px-2 py-1 rounded-full text-xs font-semibold ${
cmd.status === 'verified' ? 'bg-green-100 text-green-800' :
cmd.status === 'rejected' ? 'bg-red-100 text-red-800' :
'bg-yellow-100 text-yellow-800'
}`}>
<span
class={`px-2 py-1 rounded-full text-xs font-semibold ${
cmd.status === "verified"
? "bg-green-100 text-green-800"
: cmd.status === "rejected"
? "bg-red-100 text-red-800"
: "bg-yellow-100 text-yellow-800"
}`}
>
{cmd.status}
</span>
<span class="text-sm text-gray-500">
{formatDate(cmd.received_at)}
</span>
<span class="text-sm text-gray-500">{formatDate(cmd.received_at)}</span>
</div>
<pre class="text-sm bg-gray-100 p-3 rounded overflow-x-auto">
{JSON.stringify(cmd.command, null, 2)}
@@ -56,19 +57,19 @@ const CommandQueue: Component = () => {
</div>
</Show>
</div>
<Show when={cmd.status === 'unverified'}>
<Show when={cmd.status === "unverified"}>
<div class="ml-4 flex flex-col gap-2">
<Button
size="sm"
variant="success"
onClick={() => updateCommandStatus(cmd.id, 'verified')}
onClick={() => updateCommandStatus(cmd.id, "verified")}
>
Verify
</Button>
<Button
size="sm"
variant="danger"
onClick={() => updateCommandStatus(cmd.id, 'rejected')}
onClick={() => updateCommandStatus(cmd.id, "rejected")}
>
Reject
</Button>