Skip to content

Commit 0643c88

Browse files
committed
feat(admin): render pinned JWT fields as static text
1 parent ea1d62c commit 0643c88

1 file changed

Lines changed: 19 additions & 8 deletions

File tree

web/src/views/admin/SecurityHardeningPage.tsx

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import {
2020
SettingsLayouts,
2121
toast,
2222
} from "@opal/layouts";
23-
import { Card, InputTypeIn, Switch } from "@opal/components";
23+
import { Card, InputTypeIn, Switch, Text } from "@opal/components";
2424
import { markdown } from "@opal/utils";
2525
import type { RichStr } from "@opal/types";
2626
import type {
@@ -95,16 +95,27 @@ function JwtTextRow({
9595
useEffect(() => {
9696
if (!focused) setText(value);
9797
}, [value, revision, focused]);
98+
99+
if (pinned) {
100+
// An input promises editability. A pinned value is display-only.
101+
return (
102+
<InputVertical
103+
title={title}
104+
description="Pinned by an environment variable."
105+
withLabel
106+
>
107+
<Text font="main-ui-body" color="text-03">
108+
{value}
109+
</Text>
110+
</InputVertical>
111+
);
112+
}
113+
98114
return (
99-
<InputVertical
100-
title={title}
101-
description={pinned ? "Pinned by an environment variable." : description}
102-
withLabel
103-
>
115+
<InputVertical title={title} description={description} withLabel>
104116
<InputTypeIn
105117
value={text}
106118
placeholder={placeholder}
107-
variant={pinned ? "readOnly" : "primary"}
108119
onChange={(e) => {
109120
dirty.current = true;
110121
setText(e.target.value);
@@ -116,7 +127,7 @@ function JwtTextRow({
116127
onBlur={async () => {
117128
setFocused(false);
118129
const next = text.trim();
119-
if (pinned || !dirty.current || next === value) return;
130+
if (!dirty.current || next === value) return;
120131
dirty.current = false;
121132
await onCommit(next);
122133
setRevision((r) => r + 1);

0 commit comments

Comments
 (0)