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
+2 -2
View File
@@ -693,7 +693,7 @@ textarea.nodedc-field__control {
font-family: inherit;
font-weight: 400;
color: var(--nodedc-text-muted);
font-size: var(--nodedc-font-size-sm);
font-size: var(--nodedc-description-font-size, var(--nodedc-font-size-sm));
line-height: 1.4;
}
@@ -4006,7 +4006,7 @@ textarea.nodedc-field__control {
[data-nodedc-theme="light"] :is(.nodedc-header__brand, .nodedc-header__workspace)[data-monochrome="true"] img { filter: brightness(0); }
/* Owner-admitted linear progress in the shared resource row. */
.nodedc-progress-bar { min-width: 3rem; height: var(--nodedc-space-2); overflow: hidden; border-radius: var(--nodedc-radius-circle); background: var(--nodedc-glass-control-bg); }
.nodedc-progress-bar { min-width: 3rem; height: var(--nodedc-progress-height, var(--nodedc-space-2)); overflow: hidden; border-radius: var(--nodedc-radius-circle); background: var(--nodedc-glass-control-bg); }
.nodedc-progress-bar__fill { display: block; width: 100%; height: 100%; background: var(--nodedc-text-secondary); border-radius: inherit; transform: scaleX(var(--nodedc-progress-fraction)); transform-origin: left; transition: transform var(--nodedc-duration-normal) var(--nodedc-ease-standard); }
.nodedc-progress-bar[data-indeterminate] > .nodedc-progress-bar__fill { width: 35%; animation: nodedc-progress-travel 1.5s ease-in-out infinite alternate; }
@keyframes nodedc-progress-travel { from { transform: translateX(-100%); } to { transform: translateX(285%); } }
@@ -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>
);
}
+2
View File
@@ -47,6 +47,7 @@ import {
PanelTop,
Pencil,
Play,
Pin,
Power,
Plus,
Minus,
@@ -95,6 +96,7 @@ const icons = {
close: X,
copy: Copy,
database: Database,
pin: Pin,
download: Download,
edit: Pencil,
eye: Eye,
+5 -1
View File
@@ -39,6 +39,8 @@ export interface WindowProps extends Omit<HTMLAttributes<HTMLDivElement>, "title
footer?: ReactNode;
/** Context actions beside close, using canonical IconButton controls. */
headerActions?: ReactNode;
/** Keep contextual actions immediately before close when requested. */
headerActionsPlacement?: "before-move" | "before-close";
size?: WindowSize;
placement?: WindowPlacement;
closeLabel?: string;
@@ -66,6 +68,7 @@ export function Window({
children,
footer,
headerActions,
headerActionsPlacement = "before-move",
size = "md",
placement = "center",
closeLabel = "Закрыть",
@@ -286,7 +289,7 @@ export function Window({
{subtitle ? <p id={descriptionId} className="nodedc-window__subtitle">{subtitle}</p> : null}
</div>
<div className="nodedc-window__actions">
{headerActions}
{headerActionsPlacement === "before-move" && headerActions}
{allowFloating && placement === "center" && <IconButton label={isFloating ? "Вернуть модальный режим" : "Свободное окно"} aria-pressed={isFloating} onClick={() => {
dragRef.current = null; resizeRef.current = null;
if (!isFloating) {
@@ -295,6 +298,7 @@ export function Window({
}
setFloating(!isFloating);
}}><Icon name="move" /></IconButton>}
{headerActionsPlacement === "before-close" && headerActions}
<button type="button" className="nodedc-window__close" aria-label={closeLabel} onClick={onClose}>
<Icon name="close" size={16} strokeWidth={1.6} />
</button>