Skip to content

Commit 860e1a1

Browse files
committed
rename some features
1 parent 9b29339 commit 860e1a1

File tree

3 files changed

+4
-39
lines changed

3 files changed

+4
-39
lines changed

src/components/server.tsx

Lines changed: 2 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -149,26 +149,6 @@ export const ServerCard: React.FC<ServerCardProps> = ({ data, mutate }) => {
149149
)
150150
const [publicNoteRaw, setPublicNoteRaw] = useState<string>(data?.public_note ?? "")
151151

152-
const handleFormatClick = () => {
153-
try {
154-
const raw = publicNoteRaw ?? ""
155-
if (!raw.trim()) {
156-
setPublicNoteRaw("")
157-
return
158-
}
159-
const parsed = JSON.parse(raw)
160-
const formatted = JSON.stringify(parsed, null, 2)
161-
setPublicNoteRaw(formatted)
162-
toast(t("Success"), {
163-
description: t("Formatted") ?? "Formatted",
164-
})
165-
} catch (e) {
166-
toast(t("Error"), {
167-
description: t("Validation.InvalidJSON") ?? "Invalid JSON",
168-
})
169-
}
170-
}
171-
172152
const patchPublicNote = (path: string, value: string | undefined) => {
173153
setPublicNoteObj((prev) => applyPublicNotePatch(prev, path, value))
174154
}
@@ -414,35 +394,20 @@ export const ServerCard: React.FC<ServerCardProps> = ({ data, mutate }) => {
414394
className="text-xs h-7"
415395
onClick={() => setPublicNoteMode("raw")}
416396
>
417-
{t("AdvancedJSON")}
397+
{t("PublicNote.RawText")}
418398
</Button>
419399
</div>
420400
</div>
421401

422402
{/* Raw text mode: shown by default; submission uses this string */}
423403
{publicNoteMode === "raw" && (
424-
<div className="space-y-2">
404+
<div>
425405
<Textarea
426406
className="resize-y"
427407
value={publicNoteRaw}
428408
onChange={(e) => setPublicNoteRaw(e.target.value)}
429-
placeholder="{... JSON or empty ...}"
430409
rows={10}
431410
/>
432-
433-
<div className="flex items-center gap-2">
434-
<Button
435-
type="button"
436-
variant="outline"
437-
className="h-7 text-xs"
438-
onClick={handleFormatClick}
439-
>
440-
{t("Format") ?? "Format"}
441-
</Button>
442-
</div>
443-
<p className="text-xs text-muted-foreground">
444-
{t("PublicNote.EditRawHint")}
445-
</p>
446411
</div>
447412
)}
448413

src/locales/en/translation.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@
229229
"CustomFields": "Custom Fields",
230230
"ClearDate": "Clear Date",
231231
"Clear": "Clear",
232-
"EditRawHint": "You can paste JSON. Submission uses this raw string."
232+
"RawText": "Raw Text"
233233
},
234234
"Validation": {
235235
"InvalidDate": "Invalid date",

src/locales/zh-CN/translation.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@
229229
"CustomFields": "自定义字段",
230230
"ClearDate": "清除日期",
231231
"Clear": "清除",
232-
"EditRawHint": "你可以粘贴 JSON,提交将使用该原始字符串。"
232+
"RawText": "原始文本"
233233
},
234234
"Validation": {
235235
"InvalidDate": "无效的日期格式",

0 commit comments

Comments
 (0)