fmt: use biome
This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user