Skip to content

Commit 58ad6df

Browse files
hieptlVasilisAvgoustakis
authored andcommitted
refactor(frontend): Make the secrets table styling consistent. (All-Hands-AI#9628)
1 parent 4b8a4f2 commit 58ad6df

File tree

4 files changed

+60
-26
lines changed

4 files changed

+60
-26
lines changed

frontend/src/components/features/settings/secrets-settings/secret-list-item.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,25 +32,26 @@ export function SecretListItem({
3232
return (
3333
<tr
3434
data-testid="secret-item"
35-
className="border-t border-[#717888] last-of-type:border-b max-w-[830px] py-[13px] flex w-full items-center"
35+
className="flex w-full items-center border-t border-tertiary"
3636
>
37-
<td className="w-1/4 text-sm text-content-2 truncate" title={title}>
37+
<td className="p-3 w-1/4 text-sm text-content-2 truncate" title={title}>
3838
{title}
3939
</td>
4040

4141
<td
42-
className="w-1/2 truncate overflow-hidden whitespace-nowrap text-sm text-content-2 opacity-80 italic"
42+
className="p-3 w-1/2 truncate overflow-hidden whitespace-nowrap text-sm text-content-2 opacity-80 italic"
4343
title={description || ""}
4444
>
4545
{description || ""}
4646
</td>
4747

48-
<td className="w-1/4 flex items-center justify-end gap-4">
48+
<td className="p-3 w-1/4 flex items-center justify-end gap-4">
4949
<button
5050
data-testid="edit-secret-button"
5151
type="button"
5252
onClick={onEdit}
5353
aria-label={`Edit ${title}`}
54+
className="cursor-pointer"
5455
>
5556
<FaPencil size={16} />
5657
</button>
@@ -59,6 +60,7 @@ export function SecretListItem({
5960
type="button"
6061
onClick={onDelete}
6162
aria-label={`Delete ${title}`}
63+
className="cursor-pointer"
6264
>
6365
<FaTrash size={16} />
6466
</button>

frontend/src/i18n/declaration.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,7 @@ export enum I18nKey {
386386
SETTINGS$DELETE_API_KEY_CONFIRMATION = "SETTINGS$DELETE_API_KEY_CONFIRMATION",
387387
SETTINGS$NO_API_KEYS = "SETTINGS$NO_API_KEYS",
388388
SETTINGS$NAME = "SETTINGS$NAME",
389+
SECRETS$DESCRIPTION = "SECRETS$DESCRIPTION",
389390
SETTINGS$KEY_PREFIX = "SETTINGS$KEY_PREFIX",
390391
SETTINGS$CREATED_AT = "SETTINGS$CREATED_AT",
391392
SETTINGS$LAST_USED = "SETTINGS$LAST_USED",

frontend/src/i18n/translation.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6176,6 +6176,22 @@
61766176
"es": "Nombre",
61776177
"tr": "İsim"
61786178
},
6179+
"SECRETS$DESCRIPTION": {
6180+
"en": "Description",
6181+
"uk": "Опис",
6182+
"ja": "説明",
6183+
"zh-CN": "描述",
6184+
"zh-TW": "描述",
6185+
"ko-KR": "설명",
6186+
"no": "Beskrivelse",
6187+
"ar": "الوصف",
6188+
"de": "Beschreibung",
6189+
"fr": "Description",
6190+
"it": "Descrizione",
6191+
"pt": "Descrição",
6192+
"es": "Descripción",
6193+
"tr": "Açıklama"
6194+
},
61796195
"SETTINGS$KEY_PREFIX": {
61806196
"en": "Key Prefix",
61816197
"uk": "Префікс ключа",

frontend/src/routes/secrets-settings.tsx

Lines changed: 37 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -100,28 +100,6 @@ function SecretsSettingsScreen() {
100100
<p data-testid="no-secrets-message">{t("SECRETS$NO_SECRETS_FOUND")}</p>
101101
)}
102102

103-
{view === "list" && (
104-
<table className="w-full">
105-
<tbody>
106-
{secrets?.map((secret) => (
107-
<SecretListItem
108-
key={secret.name}
109-
title={secret.name}
110-
description={secret.description}
111-
onEdit={() => {
112-
setView("edit-secret-form");
113-
setSelectedSecret(secret.name);
114-
}}
115-
onDelete={() => {
116-
setConfirmationModalIsVisible(true);
117-
setSelectedSecret(secret.name);
118-
}}
119-
/>
120-
))}
121-
</tbody>
122-
</table>
123-
)}
124-
125103
{!shouldRenderConnectToGitButton && view === "list" && (
126104
<BrandButton
127105
testId="add-secret-button"
@@ -134,6 +112,43 @@ function SecretsSettingsScreen() {
134112
</BrandButton>
135113
)}
136114

115+
{view === "list" && (
116+
<div className="border border-tertiary rounded-md overflow-hidden">
117+
<table className="w-full">
118+
<thead className="bg-base-tertiary">
119+
<tr className="flex w-full items-center">
120+
<th className="w-1/4 text-left p-3 text-sm font-medium">
121+
{t(I18nKey.SETTINGS$NAME)}
122+
</th>
123+
<th className="w-1/2 text-left p-3 text-sm font-medium">
124+
{t(I18nKey.SECRETS$DESCRIPTION)}
125+
</th>
126+
<th className="w-1/4 text-right p-3 text-sm font-medium">
127+
{t(I18nKey.SETTINGS$ACTIONS)}
128+
</th>
129+
</tr>
130+
</thead>
131+
<tbody>
132+
{secrets?.map((secret) => (
133+
<SecretListItem
134+
key={secret.name}
135+
title={secret.name}
136+
description={secret.description}
137+
onEdit={() => {
138+
setView("edit-secret-form");
139+
setSelectedSecret(secret.name);
140+
}}
141+
onDelete={() => {
142+
setConfirmationModalIsVisible(true);
143+
setSelectedSecret(secret.name);
144+
}}
145+
/>
146+
))}
147+
</tbody>
148+
</table>
149+
</div>
150+
)}
151+
137152
{(view === "add-secret-form" || view === "edit-secret-form") && (
138153
<SecretForm
139154
mode={view === "add-secret-form" ? "add" : "edit"}

0 commit comments

Comments
 (0)