Polish settings dynamic row labels

This commit is contained in:
murashit 2026-06-20 12:03:57 +09:00
parent 76c0a5a907
commit 08aad21265
5 changed files with 12 additions and 26 deletions

View file

@ -120,7 +120,7 @@ function ArchivedThreadRow({ thread, state }: { thread: Thread; state: ArchivedT
{!deleteConfirming ? (
<SettingsIconButton
icon="rotate-ccw"
label={`Restore ${title}`}
label="Restore thread"
className="codex-panel-settings__archived-restore"
onClick={() => {
state.onRestore(thread.id);
@ -129,7 +129,7 @@ function ArchivedThreadRow({ thread, state }: { thread: Thread; state: ArchivedT
) : null}
<SettingsIconButton
icon={deleteConfirming ? "check" : "shredder"}
label={deleteConfirming ? `Confirm permanent delete ${title}` : `Delete ${title}`}
label="Delete thread"
className={deleteConfirming ? "codex-panel-settings__archived-delete-confirm" : "codex-panel-settings__archived-delete"}
onClick={() => {
if (deleteConfirming) {

View file

@ -50,7 +50,6 @@ function HookRow({ hook, state }: { hook: HookItem; state: HookSectionState }):
className="codex-panel-settings__dynamic-row codex-panel-settings__hook-row"
name={hookName}
desc={`${hook.eventName} · ${hook.matcher ?? "(no matcher)"} · ${hook.trustStatus} · ${hook.enabled ? "enabled" : "disabled"}`}
extraInfo={<div className="codex-panel-settings__hook-hash">{hook.currentHash}</div>}
>
<ObsidianButton
text="Trust"

View file

@ -47,13 +47,11 @@ export function SettingRow({
name,
desc,
className = "",
extraInfo,
children,
}: {
name: string;
desc: string;
className?: string;
extraInfo?: UiNode;
children: UiNode;
}): UiNode {
return (
@ -61,7 +59,6 @@ export function SettingRow({
<div className="setting-item-info">
<div className="setting-item-name">{name}</div>
<div className="setting-item-description">{desc}</div>
{extraInfo}
</div>
<div className="setting-item-control">{children}</div>
</div>

View file

@ -59,16 +59,6 @@
white-space: nowrap;
}
.codex-panel-settings__hook-hash {
overflow: hidden;
padding-top: var(--size-2-1);
color: var(--text-faint);
font-family: var(--font-monospace);
font-size: var(--font-ui-smaller);
text-overflow: ellipsis;
white-space: nowrap;
}
.codex-panel-settings__hook-warning {
color: var(--codex-panel-color-warning);
}

View file

@ -647,8 +647,10 @@ describe("settings tab", () => {
);
expect(tab.containerEl.querySelectorAll(".codex-panel-settings__hook-list .codex-panel-settings__hook-row")).toHaveLength(1);
expect(tab.containerEl.querySelectorAll(".codex-panel-settings__archived-list .codex-panel-settings__archived-row")).toHaveLength(1);
expect(tab.containerEl.querySelector(".codex-panel-settings__hook-list")?.textContent).toContain("abc123");
expect(tab.containerEl.querySelector(".codex-panel-settings__hook-list")?.textContent).not.toContain("abc123");
expect(tab.containerEl.querySelector(".codex-panel-settings__archived-list")?.textContent).toContain("Archived thread");
expect(buttonLabels(tab)).toContain("Restore thread");
expect(buttonLabels(tab)).toContain("Delete thread");
});
it("confirms archived thread deletion inline and cancels from outside clicks", async () => {
@ -663,13 +665,11 @@ describe("settings tab", () => {
tab.display();
await flushPromises();
clickButtonByLabel(tab, "Delete Archived thread");
clickButtonByLabel(tab, "Delete thread");
expect(tab.containerEl.querySelector(".codex-panel-settings__archived-row--delete-confirming")).not.toBeNull();
expect(tab.containerEl.textContent).toContain("Permanently delete this archived thread? This cannot be undone.");
expect(tab.containerEl.querySelector("[aria-label='Confirm permanent delete Archived thread']")?.getAttribute("data-icon")).toBe(
"check",
);
expect(tab.containerEl.querySelector("[aria-label='Delete thread']")?.getAttribute("data-icon")).toBe("check");
tab.containerEl.dispatchEvent(new MouseEvent("pointerdown", { bubbles: true }));
@ -704,7 +704,7 @@ describe("settings tab", () => {
expect(inputForSetting(tab, "Codex executable")).toBe(codexInput);
expect(selectForSetting(tab, "Send shortcut")).toBe(shortcut);
clickButtonByLabel(tab, "Delete Archived thread");
clickButtonByLabel(tab, "Delete thread");
expect(inputForSetting(tab, "Codex executable")).toBe(codexInput);
expect(selectForSetting(tab, "Send shortcut")).toBe(shortcut);
@ -739,7 +739,7 @@ describe("settings tab", () => {
expect(dynamicSection(tab, "codex-panel-settings__helper-section")).toBe(helperSection);
expect(dynamicSection(tab, "codex-panel-settings__hook-section")).toBe(hookSection);
clickButtonByLabel(tab, "Delete Archived thread");
clickButtonByLabel(tab, "Delete thread");
expect(dynamicSection(tab, "codex-panel-settings__helper-section")).toBe(helperSection);
expect(dynamicSection(tab, "codex-panel-settings__hook-section")).toBe(hookSection);
@ -771,9 +771,9 @@ describe("settings tab", () => {
tab.display();
await flushPromises();
clickButtonByLabel(tab, "Delete Archived thread");
pointerDownButtonByLabel(tab, "Confirm permanent delete Archived thread");
clickButtonByLabel(tab, "Confirm permanent delete Archived thread");
clickButtonByLabel(tab, "Delete thread");
pointerDownButtonByLabel(tab, "Delete thread");
clickButtonByLabel(tab, "Delete thread");
await flushPromises();
expect(client.deleteThread).toHaveBeenCalledWith("thread-archived");