feat(ui): support storage settings, pinned copies and contextual window actions

This commit is contained in:
Codex
2026-11-10 01:04:24 +03:00
parent be929f9d8e
commit 601ca62e9a
12 changed files with 54 additions and 13 deletions
@@ -1,4 +1,4 @@
import { useEffect, useMemo, useState } from "react";
import { useEffect, useMemo, useState, type ReactNode } from "react";
import {
Button,
FeatureSettingsWindow,
@@ -18,9 +18,12 @@ import {
type EnvironmentSurface,
type UploadedEnvironmentMedia,
} from "@nodedc/ui-core";
import type { FeatureSettingsSection } from "./FeatureSettingsWindow.js";
import { EnvironmentMediaPlaylistEditor } from "./EnvironmentMediaPlaylistEditor.js";
export interface EnvironmentSettingsWindowProps {
/** Product-owned sections reuse this shell; each owns its content and save lifecycle. */
additionalSections?: readonly (FeatureSettingsSection & { content: ReactNode; footer?: ReactNode })[];
productName: string;
surfaces: readonly EnvironmentSurface[];
initialSurfaceId?: string;
@@ -70,6 +73,7 @@ function patchBackground(
export function EnvironmentSettingsWindow({
productName,
additionalSections = [],
surfaces,
initialSurfaceId,
open,
@@ -80,6 +84,8 @@ export function EnvironmentSettingsWindow({
onSave,
onUpload,
}: EnvironmentSettingsWindowProps) {
const [activeSection, setActiveSection] = useState("environment");
const extension = additionalSections.find(section => section.id === activeSection);
const [draft, setDraft] = useState(() => cloneEnvironmentSettings(settings));
const [surfaceId, setSurfaceId] = useState(initialSurfaceId ?? surfaces[0]?.id ?? "home");
const [uploading, setUploading] = useState(false);
@@ -196,11 +202,12 @@ export function EnvironmentSettingsWindow({
group: productName.toUpperCase(),
icon: "settings",
},
...additionalSections,
]}
activeSection="environment"
onSectionChange={() => undefined}
activeSection={extension ? activeSection : "environment"}
onSectionChange={setActiveSection}
onClose={onClose}
footer={(
footer={extension ? extension.footer : (
<WindowFooterActions>
<Button
variant="secondary"
@@ -223,7 +230,7 @@ export function EnvironmentSettingsWindow({
</WindowFooterActions>
)}
>
<div className="nodedc-environment-settings">
{extension ? extension.content : <div className="nodedc-environment-settings">
<SettingsCard
eyebrow="ОКРУЖЕНИЕ"
title="Основные элементы управления"
@@ -349,7 +356,7 @@ export function EnvironmentSettingsWindow({
/>
</div>
</SettingsCard>
</div>
</div>}
</FeatureSettingsWindow>
);
}