feat(DeviceDetailOverlay): improve device display and add clear URL/media set functionality
This commit is contained in:
parent
242358fb0d
commit
488d2304be
|
|
@ -240,15 +240,10 @@ export default function DeviceDetailOverlay({
|
|||
<button onClick={onClose} className="p-2 -m-2">
|
||||
<X className="w-6 h-6" />
|
||||
</button>
|
||||
<div className="flex items-center gap-2">
|
||||
<div className={deviceData.enabled ? 'text-blue-600' : 'text-neutral-400'}>
|
||||
<div className={`flex flex-col items-center gap-0.5 ${deviceData.enabled ? 'text-blue-600' : 'text-neutral-400'}`}>
|
||||
<span className="text-sm font-semibold leading-none">{device.number}</span>
|
||||
{getDeviceIcon(device.type)}
|
||||
</div>
|
||||
<div className="text-center">
|
||||
<div className="text-xs text-neutral-500 capitalize">{device.type}</div>
|
||||
<div className="font-medium">#{device.number}</div>
|
||||
</div>
|
||||
</div>
|
||||
<button
|
||||
onClick={() => setShowCommandMenu(!showCommandMenu)}
|
||||
className="p-2 -m-2 relative"
|
||||
|
|
@ -352,9 +347,20 @@ export default function DeviceDetailOverlay({
|
|||
<button
|
||||
onClick={() => setBrowsingField('base_url')}
|
||||
className="px-3 py-2 border border-neutral-300 rounded-lg bg-neutral-50 hover:bg-neutral-100"
|
||||
title="Browse"
|
||||
>
|
||||
<FolderOpen className="w-5 h-5" />
|
||||
</button>
|
||||
<button
|
||||
onClick={() => {
|
||||
const path = getDevicePath();
|
||||
updateDeviceSetting([...path, 'base_url'], '');
|
||||
}}
|
||||
className="px-3 py-2 border border-neutral-300 rounded-lg bg-neutral-50 hover:bg-red-50 hover:border-red-300 hover:text-red-500"
|
||||
title="Clear Base URL"
|
||||
>
|
||||
<X className="w-5 h-5" />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
@ -363,7 +369,7 @@ export default function DeviceDetailOverlay({
|
|||
<div className="flex gap-2">
|
||||
<input
|
||||
type="text"
|
||||
value={deviceData.url}
|
||||
value={deviceData.url ?? ''}
|
||||
onChange={(e) => {
|
||||
const newUrl = e.target.value;
|
||||
const devicePath = getDevicePath();
|
||||
|
|
@ -379,9 +385,25 @@ export default function DeviceDetailOverlay({
|
|||
<button
|
||||
onClick={() => setBrowsingField('url')}
|
||||
className="px-3 py-2 border border-neutral-300 rounded-lg bg-neutral-50 hover:bg-neutral-100"
|
||||
title="Browse"
|
||||
>
|
||||
<FolderOpen className="w-5 h-5" />
|
||||
</button>
|
||||
<button
|
||||
onClick={() => {
|
||||
const devicePath = getDevicePath();
|
||||
const newConfig = JSON.parse(JSON.stringify(config));
|
||||
let dev = newConfig;
|
||||
for (const k of devicePath) dev = dev[k];
|
||||
delete dev.url;
|
||||
delete dev.media_set;
|
||||
setConfig(newConfig);
|
||||
}}
|
||||
className="px-3 py-2 border border-neutral-300 rounded-lg bg-neutral-50 hover:bg-red-50 hover:border-red-300 hover:text-red-500"
|
||||
title="Clear URL and media set"
|
||||
>
|
||||
<X className="w-5 h-5" />
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{mediaSetFiles && (
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user