Skip to content

Commit f205297

Browse files
author
Joshua Chittick
committed
refactor: align Lark settings card form layout with Slack
Reformat General/Channel/GitHub cards with explicit form labels and restore text-input fields for editable channel and GitHub settings while keeping callback payloads intact.
1 parent 347311c commit f205297

File tree

1 file changed

+28
-117
lines changed

1 file changed

+28
-117
lines changed

packages/ims/lark/settings.ts

Lines changed: 28 additions & 117 deletions
Original file line numberDiff line numberDiff line change
@@ -330,36 +330,6 @@ export function buildLarkSettingsDetailCard(params: {
330330
text: { tag: "plain_text", content: item },
331331
value: item,
332332
}));
333-
const workingDirectoryOptions = Array.from(new Set([
334-
cwd === "(not set)" ? "" : cwd,
335-
"/root/ode-new",
336-
"/root",
337-
"/",
338-
])).map((item) => ({
339-
text: { tag: "plain_text", content: item || "(empty)" },
340-
value: item,
341-
}));
342-
const baseBranchOptions = Array.from(new Set([
343-
baseBranch,
344-
"main",
345-
"master",
346-
"develop",
347-
"dev",
348-
])).map((item) => ({
349-
text: { tag: "plain_text", content: item || "main" },
350-
value: item || "main",
351-
}));
352-
const channelSystemMessageOptions = [
353-
{ text: "(empty)", value: "" },
354-
{ text: "concise", value: "Please keep responses concise and actionable." },
355-
{ text: "detailed", value: "Please provide detailed reasoning and include implementation notes." },
356-
{ text: "current", value: systemMessage === "(none)" ? "" : systemMessage },
357-
]
358-
.filter((item, idx, all) => all.findIndex((x) => x.value === item.value) === idx)
359-
.map((item) => ({
360-
text: { tag: "plain_text", content: item.text },
361-
value: item.value,
362-
}));
363333
const settingsBaseValue = {
364334
action: "set_channel_settings",
365335
channelId,
@@ -440,65 +410,41 @@ export function buildLarkSettingsDetailCard(params: {
440410
content: "Working directory",
441411
},
442412
{
443-
tag: "action",
444-
actions: [
445-
{
446-
tag: "select_static",
447-
placeholder: { tag: "plain_text", content: "Select working directory" },
448-
options: workingDirectoryOptions,
449-
value: {
450-
...settingsBaseValue,
451-
field: "workingDirectory",
452-
},
453-
},
454-
],
413+
tag: "input",
414+
name: "workingDirectory",
415+
placeholder: { tag: "plain_text", content: "Enter working directory" },
416+
value: cwd === "(not set)" ? "" : cwd,
455417
},
456418
{
457419
tag: "markdown",
458420
content: "Base branch",
459421
},
460422
{
461-
tag: "action",
462-
actions: [
463-
{
464-
tag: "select_static",
465-
placeholder: { tag: "plain_text", content: "Select base branch" },
466-
options: baseBranchOptions,
467-
value: {
468-
...settingsBaseValue,
469-
field: "baseBranch",
470-
},
471-
},
472-
],
423+
tag: "input",
424+
name: "baseBranch",
425+
placeholder: { tag: "plain_text", content: "Enter base branch" },
426+
value: baseBranch,
473427
},
474428
{
475429
tag: "markdown",
476430
content: "Channel system message",
477431
},
478432
{
479-
tag: "action",
480-
actions: [
481-
{
482-
tag: "select_static",
483-
placeholder: { tag: "plain_text", content: "Select system message" },
484-
options: channelSystemMessageOptions,
485-
value: {
486-
...settingsBaseValue,
487-
field: "channelSystemMessage",
488-
},
489-
},
490-
],
433+
tag: "input",
434+
name: "channelSystemMessage",
435+
placeholder: { tag: "plain_text", content: "Enter channel system message" },
436+
value: systemMessage === "(none)" ? "" : systemMessage,
491437
},
492438
{
493439
tag: "action",
494440
actions: [
495441
{
496442
tag: "button",
497443
type: "primary",
498-
text: { tag: "plain_text", content: "Refresh" },
444+
text: { tag: "plain_text", content: "Save channel setting" },
499445
value: {
500446
...settingsBaseValue,
501-
field: "refresh",
447+
field: "save",
502448
},
503449
},
504450
{
@@ -560,76 +506,41 @@ export function buildLarkSettingsDetailCard(params: {
560506
content: "GitHub token",
561507
},
562508
{
563-
tag: "action",
564-
actions: [
565-
{
566-
tag: "select_static",
567-
placeholder: { tag: "plain_text", content: "Token action" },
568-
options: [
569-
{ text: { tag: "plain_text", content: "Keep current" }, value: githubToken },
570-
{ text: { tag: "plain_text", content: "Clear token" }, value: "" },
571-
],
572-
value: {
573-
...githubBaseValue,
574-
field: "githubToken",
575-
},
576-
},
577-
],
509+
tag: "input",
510+
name: "githubToken",
511+
placeholder: { tag: "plain_text", content: "Enter GitHub token" },
512+
value: githubToken,
578513
},
579514
{
580515
tag: "markdown",
581516
content: "Git name",
582517
},
583518
{
584-
tag: "action",
585-
actions: [
586-
{
587-
tag: "select_static",
588-
placeholder: { tag: "plain_text", content: "Select git name" },
589-
options: [
590-
{ text: { tag: "plain_text", content: githubName || "(not set)" }, value: githubName },
591-
{ text: { tag: "plain_text", content: "LIU9293" }, value: "LIU9293" },
592-
{ text: { tag: "plain_text", content: "(empty)" }, value: "" },
593-
],
594-
value: {
595-
...githubBaseValue,
596-
field: "githubName",
597-
},
598-
},
599-
],
519+
tag: "input",
520+
name: "githubName",
521+
placeholder: { tag: "plain_text", content: "Enter git name" },
522+
value: githubName,
600523
},
601524
{
602525
tag: "markdown",
603526
content: "Git email",
604527
},
605528
{
606-
tag: "action",
607-
actions: [
608-
{
609-
tag: "select_static",
610-
placeholder: { tag: "plain_text", content: "Select git email" },
611-
options: [
612-
{ text: { tag: "plain_text", content: githubEmail || "(not set)" }, value: githubEmail },
613-
{ text: { tag: "plain_text", content: "mylock.kai@gmail.com" }, value: "mylock.kai@gmail.com" },
614-
{ text: { tag: "plain_text", content: "(empty)" }, value: "" },
615-
],
616-
value: {
617-
...githubBaseValue,
618-
field: "githubEmail",
619-
},
620-
},
621-
],
529+
tag: "input",
530+
name: "githubEmail",
531+
placeholder: { tag: "plain_text", content: "Enter git email" },
532+
value: githubEmail,
622533
},
623534
{
624535
tag: "action",
625536
actions: [
626537
{
627538
tag: "button",
628539
type: "primary",
629-
text: { tag: "plain_text", content: "Refresh" },
540+
text: { tag: "plain_text", content: "Save GitHub setting" },
630541
value: {
631542
...githubBaseValue,
632-
field: "refresh",
543+
field: "save",
633544
},
634545
},
635546
{

0 commit comments

Comments
 (0)