style(widgets): apply formatter to dashboard and addon files
This commit is contained in:
@@ -18,13 +18,7 @@ import {
|
||||
} from "@/components/ui/select";
|
||||
import { Badge } from "@/components/ui/badge";
|
||||
import { Alert, AlertDescription } from "@/components/ui/alert";
|
||||
import {
|
||||
ChevronDown,
|
||||
ChevronUp,
|
||||
Pencil,
|
||||
Plus,
|
||||
Trash2,
|
||||
} from "lucide-react";
|
||||
import { ChevronDown, ChevronUp, Pencil, Plus, Trash2 } from "lucide-react";
|
||||
import {
|
||||
useDeleteWidgetInstance,
|
||||
useSaveWidgetInstance,
|
||||
@@ -114,9 +108,7 @@ function WidgetConfigFields({
|
||||
>
|
||||
<Select
|
||||
value={String(value)}
|
||||
onValueChange={(v) =>
|
||||
onChange({ ...config, [field.key]: v })
|
||||
}
|
||||
onValueChange={(v) => onChange({ ...config, [field.key]: v })}
|
||||
>
|
||||
<SelectTrigger id={field.key}>
|
||||
<SelectValue />
|
||||
@@ -124,11 +116,7 @@ function WidgetConfigFields({
|
||||
<SelectContent>
|
||||
<SelectItem value="">Default</SelectItem>
|
||||
{machines
|
||||
.filter(
|
||||
(m) =>
|
||||
m.enabled &&
|
||||
m.services.includes("jellyfin"),
|
||||
)
|
||||
.filter((m) => m.enabled && m.services.includes("jellyfin"))
|
||||
.map((m) => (
|
||||
<SelectItem key={m.id} value={m.id}>
|
||||
{m.name}
|
||||
@@ -140,10 +128,7 @@ function WidgetConfigFields({
|
||||
);
|
||||
}
|
||||
|
||||
if (
|
||||
definition.widgetType === "ssh-task" &&
|
||||
field.key === "task_id"
|
||||
) {
|
||||
if (definition.widgetType === "ssh-task" && field.key === "task_id") {
|
||||
return (
|
||||
<Field
|
||||
key={field.key}
|
||||
@@ -153,9 +138,7 @@ function WidgetConfigFields({
|
||||
>
|
||||
<Select
|
||||
value={String(value)}
|
||||
onValueChange={(v) =>
|
||||
onChange({ ...config, [field.key]: v })
|
||||
}
|
||||
onValueChange={(v) => onChange({ ...config, [field.key]: v })}
|
||||
>
|
||||
<SelectTrigger id={field.key}>
|
||||
<SelectValue />
|
||||
@@ -342,9 +325,7 @@ export function WidgetConfigDialog({ open, onClose }: Props) {
|
||||
setDraft({
|
||||
...draft,
|
||||
sort_order:
|
||||
e.target.value === ""
|
||||
? 0
|
||||
: Number(e.target.value),
|
||||
e.target.value === "" ? 0 : Number(e.target.value),
|
||||
})
|
||||
}
|
||||
/>
|
||||
@@ -387,9 +368,7 @@ export function WidgetConfigDialog({ open, onClose }: Props) {
|
||||
) : (
|
||||
<div className="flex flex-col gap-2">
|
||||
{sortedInstances.map((instance, index) => {
|
||||
const typeDef = getWidgetDefinition(
|
||||
instance.widget_type,
|
||||
);
|
||||
const typeDef = getWidgetDefinition(instance.widget_type);
|
||||
return (
|
||||
<div
|
||||
key={instance.id}
|
||||
@@ -397,16 +376,12 @@ export function WidgetConfigDialog({ open, onClose }: Props) {
|
||||
>
|
||||
<div className="flex flex-1 flex-col gap-1">
|
||||
<div className="flex items-center gap-2">
|
||||
<span className="font-medium">
|
||||
{instance.title}
|
||||
</span>
|
||||
<span className="font-medium">{instance.title}</span>
|
||||
<Badge variant="outline">
|
||||
{typeDef?.name ?? instance.widget_type}
|
||||
</Badge>
|
||||
{!instance.enabled ? (
|
||||
<Badge variant="secondary">
|
||||
disabled
|
||||
</Badge>
|
||||
<Badge variant="secondary">disabled</Badge>
|
||||
) : null}
|
||||
</div>
|
||||
</div>
|
||||
@@ -416,9 +391,7 @@ export function WidgetConfigDialog({ open, onClose }: Props) {
|
||||
size="icon"
|
||||
className="h-8 w-8"
|
||||
disabled={index === 0}
|
||||
onClick={() =>
|
||||
moveInstance(index, -1)
|
||||
}
|
||||
onClick={() => moveInstance(index, -1)}
|
||||
>
|
||||
<ChevronUp className="h-4 w-4" />
|
||||
</Button>
|
||||
@@ -426,30 +399,21 @@ export function WidgetConfigDialog({ open, onClose }: Props) {
|
||||
variant="ghost"
|
||||
size="icon"
|
||||
className="h-8 w-8"
|
||||
disabled={
|
||||
index ===
|
||||
sortedInstances.length - 1
|
||||
}
|
||||
onClick={() =>
|
||||
moveInstance(index, 1)
|
||||
}
|
||||
disabled={index === sortedInstances.length - 1}
|
||||
onClick={() => moveInstance(index, 1)}
|
||||
>
|
||||
<ChevronDown className="h-4 w-4" />
|
||||
</Button>
|
||||
<Switch
|
||||
checked={instance.enabled}
|
||||
onCheckedChange={() =>
|
||||
toggleEnabled(instance)
|
||||
}
|
||||
onCheckedChange={() => toggleEnabled(instance)}
|
||||
aria-label={`Toggle ${instance.title}`}
|
||||
/>
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="icon"
|
||||
className="h-8 w-8"
|
||||
onClick={() =>
|
||||
startEdit(instance)
|
||||
}
|
||||
onClick={() => startEdit(instance)}
|
||||
>
|
||||
<Pencil className="h-4 w-4" />
|
||||
</Button>
|
||||
@@ -457,9 +421,7 @@ export function WidgetConfigDialog({ open, onClose }: Props) {
|
||||
variant="ghost"
|
||||
size="icon"
|
||||
className="h-8 w-8 text-destructive"
|
||||
onClick={() =>
|
||||
removeInstance(instance)
|
||||
}
|
||||
onClick={() => removeInstance(instance)}
|
||||
>
|
||||
<Trash2 className="h-4 w-4" />
|
||||
</Button>
|
||||
|
||||
Reference in New Issue
Block a user