|
2 | 2 | import { Empty, Paginator } from '$lib/components'; |
3 | 3 | import { Button } from '$lib/elements/forms'; |
4 | 4 | import { |
5 | | - ActionMenu, |
6 | 5 | Accordion, |
7 | 6 | Badge, |
8 | 7 | InteractiveText, |
9 | 8 | Icon, |
10 | 9 | Layout, |
11 | | - Popover, |
12 | 10 | Skeleton, |
13 | 11 | Table, |
14 | | - Tooltip, |
15 | | - Button as PinkButton |
| 12 | + Tooltip |
16 | 13 | } from '@appwrite.io/pink-svelte'; |
17 | | - import { |
18 | | - IconDotsHorizontal, |
19 | | - IconCode, |
20 | | - IconUpload, |
21 | | - IconPlus, |
22 | | - IconTrash, |
23 | | - IconEyeOff, |
24 | | - IconPencil |
25 | | - } from '@appwrite.io/pink-icons-svelte'; |
| 14 | + import { IconCode, IconUpload, IconPlus } from '@appwrite.io/pink-icons-svelte'; |
| 15 | + import VariableActionMenu from './variableActionMenu.svelte'; |
26 | 16 | import type { Models } from '@appwrite.io/console'; |
27 | 17 | import VariableEditorModal from './variableEditorModal.svelte'; |
28 | 18 | import SecretVariableModal from './secretVariableModal.svelte'; |
|
66 | 56 | const tableColumns = $derived( |
67 | 57 | $isSmallViewport |
68 | 58 | ? [ |
69 | | - { id: 'key', width: { min: 420 } }, |
70 | | - { id: 'value', width: { min: 240 } }, |
| 59 | + { id: 'key', width: { min: 120, max: 300 } }, |
| 60 | + { id: 'value', width: { min: 100, max: 200 } }, |
71 | 61 | { id: 'actions', width: 40 } |
72 | 62 | ] |
73 | 63 | : [ |
74 | | - { id: 'key', width: { min: 300 } }, |
75 | | - { id: 'value', width: { min: 280 } }, |
76 | | - { id: 'actions', width: 40 } |
| 64 | + { id: 'key', width: { min: 280, max: 420 } }, |
| 65 | + { id: 'value', width: { min: 200, max: 400 } }, |
| 66 | + { id: 'actions', width: 50 } |
77 | 67 | ] |
78 | 68 | ); |
79 | 69 | </script> |
|
111 | 101 | <Button |
112 | 102 | secondary |
113 | 103 | size="s" |
| 104 | + icon={$isSmallViewport} |
114 | 105 | on:click={() => { |
115 | 106 | showCreate = true; |
116 | 107 | trackEvent(Click.VariablesCreateClick, { |
117 | 108 | source: createSource |
118 | 109 | }); |
119 | 110 | }}> |
120 | | - <Icon slot="start" icon={IconPlus} /> Create variable |
| 111 | + <Icon slot="start" icon={IconPlus} /> |
| 112 | + {#if !$isSmallViewport}Create variable{/if} |
121 | 113 | </Button> |
122 | 114 | {/if} |
123 | 115 | </Layout.Stack> |
|
179 | 171 | </Table.Cell> |
180 | 172 | <Table.Cell column="actions" {root}> |
181 | 173 | <div style="margin-inline-start: auto"> |
182 | | - <Popover |
183 | | - padding="none" |
184 | | - placement="bottom-end" |
185 | | - let:toggle> |
186 | | - <PinkButton.Button |
187 | | - icon |
188 | | - variant="text" |
189 | | - size="s" |
190 | | - aria-label="More options" |
191 | | - onclick={(e) => { |
192 | | - e.preventDefault(); |
193 | | - toggle(e); |
194 | | - }}> |
195 | | - <Icon icon={IconDotsHorizontal} size="s" /> |
196 | | - </PinkButton.Button> |
197 | | - |
198 | | - <svelte:fragment slot="tooltip" let:toggle> |
199 | | - <ActionMenu.Root> |
200 | | - {#if !variable?.secret} |
201 | | - <ActionMenu.Item.Button |
202 | | - leadingIcon={IconPencil} |
203 | | - onclick={(e) => { |
204 | | - toggle(e); |
205 | | - currentVariable = variable; |
206 | | - showUpdate = true; |
207 | | - }}> |
208 | | - Update |
209 | | - </ActionMenu.Item.Button> |
210 | | - {/if} |
211 | | - {#if !variable?.secret} |
212 | | - <ActionMenu.Item.Button |
213 | | - leadingIcon={IconEyeOff} |
214 | | - onclick={(e) => { |
215 | | - toggle(e); |
216 | | - currentVariable = variable; |
217 | | - showSecretModal = true; |
218 | | - }}> |
219 | | - Secret |
220 | | - </ActionMenu.Item.Button> |
221 | | - {/if} |
222 | | - <ActionMenu.Item.Button |
223 | | - status="danger" |
224 | | - leadingIcon={IconTrash} |
225 | | - onclick={(e) => { |
226 | | - toggle(e); |
227 | | - currentVariable = variable; |
228 | | - showDelete = true; |
229 | | - }}> |
230 | | - Delete |
231 | | - </ActionMenu.Item.Button> |
232 | | - </ActionMenu.Root> |
233 | | - </svelte:fragment> |
234 | | - </Popover> |
| 174 | + <VariableActionMenu |
| 175 | + {variable} |
| 176 | + onUpdate={() => { |
| 177 | + currentVariable = variable; |
| 178 | + showUpdate = true; |
| 179 | + }} |
| 180 | + onSecret={() => { |
| 181 | + currentVariable = variable; |
| 182 | + showSecretModal = true; |
| 183 | + }} |
| 184 | + onDelete={() => { |
| 185 | + currentVariable = variable; |
| 186 | + showDelete = true; |
| 187 | + }} /> |
235 | 188 | </div> |
236 | 189 | </Table.Cell> |
237 | 190 | </Table.Row.Base> |
|
0 commit comments