fix(ui): restore background after playlist reset

This commit is contained in:
DCCONSTRUCTIONS
2026-07-29 15:30:35 +03:00
parent 32c5d0dda5
commit 6180c3b8b7
3 changed files with 96 additions and 13 deletions
@@ -8,9 +8,10 @@ import {
} from "@nodedc/ui-react";
import {
createEnvironmentMediaItem,
appendEnvironmentMediaItem,
inferEnvironmentMediaKind,
maxEnvironmentMediaItems,
removeEnvironmentMediaItem,
type EnvironmentBackground,
type EnvironmentMediaItem,
type EnvironmentSurfaceId,
@@ -135,10 +136,7 @@ export function EnvironmentMediaPlaylistEditor({
<IconButton
label="Добавить медиаконтент"
disabled={disabled || background.items.length >= maxEnvironmentMediaItems}
onClick={() => onChange({
...background,
items: [...background.items, createEnvironmentMediaItem()],
})}
onClick={() => onChange(appendEnvironmentMediaItem(background))}
>
<Icon name="plus" />
</IconButton>
@@ -202,14 +200,7 @@ export function EnvironmentMediaPlaylistEditor({
disabled={disabled || uploadingIds.has(item.id)}
onClick={() => {
setItemError(item.id);
const items = background.items.filter(
(candidate) => candidate.id !== item.id,
);
onChange({
...background,
enabled: items.length ? background.enabled : false,
items,
});
onChange(removeEnvironmentMediaItem(background, item.id));
}}
>
<Icon name="trash" />