Skip to content

Commit eb40103

Browse files
committed
Merge branch 'main' into 'add-arrow-navs'.
2 parents d7e19c1 + eea75b3 commit eb40103

39 files changed

Lines changed: 459 additions & 283 deletions

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"clean": "rm -rf node_modules && rm -rf .svelte_kit && pnpm i --force",
1313
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
1414
"check:watch": "svelte-check --tsconfig ./tsconfig.json --watch",
15-
"format": "prettier --write .",
15+
"format": "prettier --write --cache .",
1616
"lint": "prettier --check . && eslint .",
1717
"test": "TZ=EST vitest run",
1818
"test:ui": "TZ=EST vitest --ui",
@@ -22,11 +22,11 @@
2222
},
2323
"dependencies": {
2424
"@ai-sdk/svelte": "^1.1.24",
25-
"@appwrite.io/console": "https://pkg.pr.new/appwrite-labs/cloud/@appwrite.io/console@fe3277e",
25+
"@appwrite.io/console": "https://pkg.pr.new/appwrite-labs/cloud/@appwrite.io/console@2752",
2626
"@appwrite.io/pink-icons": "0.25.0",
27-
"@appwrite.io/pink-icons-svelte": "https://pkg.vc/-/@appwrite/@appwrite.io/pink-icons-svelte@d94920e",
27+
"@appwrite.io/pink-icons-svelte": "https://pkg.vc/-/@appwrite/@appwrite.io/pink-icons-svelte@4472521",
2828
"@appwrite.io/pink-legacy": "^1.0.3",
29-
"@appwrite.io/pink-svelte": "https://pkg.vc/-/@appwrite/@appwrite.io/pink-svelte@d94920e",
29+
"@appwrite.io/pink-svelte": "https://pkg.vc/-/@appwrite/@appwrite.io/pink-svelte@4472521",
3030
"@faker-js/faker": "^9.9.0",
3131
"@popperjs/core": "^2.11.8",
3232
"@sentry/sveltekit": "^8.38.0",

pnpm-lock.yaml

Lines changed: 15 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/lib/components/permissions/permissions.svelte

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import { IconPlus, IconX } from '@appwrite.io/pink-icons-svelte';
2121
import type { PinkColumn } from '$lib/helpers/types';
2222
import { Card } from '$lib/components';
23+
import { TableScroll } from '$lib/elements/table';
2324
2425
export let withCreate = false;
2526
export let permissions: string[] = [];
@@ -124,7 +125,7 @@
124125
</script>
125126

126127
{#if [...$groups]?.length}
127-
<div class="table-wrapper">
128+
<TableScroll>
128129
<Table.Root {columns} let:root>
129130
<svelte:fragment slot="header" let:root>
130131
<Table.Header.Cell column="role" {root}>Role</Table.Header.Cell>
@@ -139,7 +140,7 @@
139140
{#each [...$groups] as [role, permission] (role)}
140141
<Table.Row.Base {root}>
141142
<Table.Cell column="role" {root}>
142-
<Row {role} />
143+
<Row {role} onNotFound={() => deleteRole(role)} />
143144
</Table.Cell>
144145
<Table.Cell column="create" {root}>
145146
<Selector.Checkbox
@@ -174,7 +175,7 @@
174175
</Table.Row.Base>
175176
{/each}
176177
</Table.Root>
177-
</div>
178+
</TableScroll>
178179

179180
<div>
180181
<Actions
@@ -210,14 +211,3 @@
210211
</Layout.Stack>
211212
</Card>
212213
{/if}
213-
214-
<style lang="scss">
215-
.table-wrapper {
216-
scrollbar-width: none;
217-
-ms-overflow-style: none;
218-
219-
&::-webkit-scrollbar {
220-
display: none;
221-
}
222-
}
223-
</style>

src/lib/components/permissions/row.svelte

Lines changed: 29 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script lang="ts">
2-
import { type ComponentProps, type Snippet } from 'svelte';
2+
import { type ComponentProps, type Snippet, onMount } from 'svelte';
33
import { sdk } from '$lib/stores/sdk';
44
import type { Models } from '@appwrite.io/console';
55
import { AvatarInitials } from '../';
@@ -34,9 +34,10 @@
3434
role: string;
3535
placement?: ComponentProps<Popover>['placement'];
3636
children?: Snippet;
37+
onNotFound?: (role: string) => void;
3738
}
3839
39-
let { role, placement = 'bottom-start', children }: Props = $props();
40+
let { role, placement = 'bottom-start', children, onNotFound }: Props = $props();
4041
4142
type ParsedPermission = {
4243
type: 'user' | 'team' | 'other';
@@ -111,6 +112,21 @@
111112
return fetchPromise;
112113
}
113114
115+
async function verifyExistence() {
116+
try {
117+
const data = await getData(role);
118+
if (data?.notFound) {
119+
onNotFound?.(role);
120+
}
121+
} catch {
122+
// Intentionally ignore fetch/parse errors; UI handles missing data state
123+
}
124+
}
125+
126+
onMount(() => {
127+
verifyExistence();
128+
});
129+
114130
let isMouseOverTooltip = $state(false);
115131
function hidePopover(hideTooltip: () => void, timeout = true) {
116132
if (!timeout) {
@@ -162,7 +178,7 @@
162178
{:then data}
163179
{formatName(
164180
data.name ?? data?.email ?? data?.phone ?? '-',
165-
$isSmallViewport ? 16 : 18
181+
$isSmallViewport ? 16 : 20
166182
)}
167183
{/await}
168184
</Typography.Text>
@@ -281,20 +297,21 @@
281297
<Divider />
282298
<Layout.Stack gap="xxs" alignItems="flex-start">
283299
{#if data.email}
284-
<Typography.Text
285-
size="xs"
286-
variant="m-400"
300+
<Typography.Caption
301+
variant="400"
287302
color="--fgcolor-neutral-secondary">
288-
Email: {data.email}
289-
</Typography.Text>
303+
Email: {formatName(
304+
data.email,
305+
$isSmallViewport ? 24 : 32
306+
)}
307+
</Typography.Caption>
290308
{/if}
291309
{#if data.phone}
292-
<Typography.Text
293-
size="xs"
294-
variant="m-400"
310+
<Typography.Caption
311+
variant="400"
295312
color="--fgcolor-neutral-secondary">
296313
Phone: {data.phone}
297-
</Typography.Text>
314+
</Typography.Caption>
298315
{/if}
299316
</Layout.Stack>
300317
{/if}

src/lib/elements/forms/inputSelect.svelte

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,29 +21,24 @@
2121
}[];
2222
export let leadingIcon: ComponentType | undefined = undefined;
2323
24-
let element: HTMLSelectElement;
2524
let error: string;
2625
2726
const handleInvalid = (event: Event) => {
2827
event.preventDefault();
28+
const element = event.target as HTMLInputElement;
2929
3030
if (element.validity.valueMissing) {
3131
error = 'This field is required';
3232
return;
3333
}
34+
3435
error = element.validationMessage;
3536
};
3637
3738
const isNotEmpty = (value: string | number | boolean) => {
3839
return typeof value === 'boolean' ? true : !!value;
3940
};
4041
41-
$: if (required && !isNotEmpty(value)) {
42-
element?.setCustomValidity('This field is required');
43-
} else {
44-
element?.setCustomValidity('');
45-
}
46-
4742
$: if (isNotEmpty(value)) {
4843
error = null;
4944
}

src/lib/helpers/buildTimeout.ts

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import type { Models } from '@appwrite.io/console';
2+
3+
/**
4+
* Checks if a build has exceeded the maximum build timeout duration
5+
*/
6+
function isBuildTimedOut(createdAt: string, status: string, timeoutSeconds: number): boolean {
7+
if (!['waiting', 'processing', 'building'].includes(status)) {
8+
return false;
9+
}
10+
11+
if (!timeoutSeconds || timeoutSeconds <= 0) {
12+
return false;
13+
}
14+
15+
const created = new Date(createdAt);
16+
const elapsedSeconds = Math.floor((Date.now() - created.getTime()) / 1000);
17+
18+
return elapsedSeconds > timeoutSeconds;
19+
}
20+
21+
/**
22+
* Gets the effective status for a build, considering timeout
23+
*/
24+
export function getEffectiveBuildStatus(
25+
originalStatus: string,
26+
createdAt: string,
27+
consoleVariables: Models.ConsoleVariables | undefined
28+
): string {
29+
const timeoutSeconds = getBuildTimeoutSeconds(consoleVariables);
30+
if (isBuildTimedOut(createdAt, originalStatus, timeoutSeconds)) {
31+
return 'failed';
32+
}
33+
return originalStatus;
34+
}
35+
36+
/**
37+
* Helper to get timeout value from console variables
38+
*/
39+
function getBuildTimeoutSeconds(consoleVariables: Models.ConsoleVariables | undefined): number {
40+
if (!consoleVariables?._APP_COMPUTE_BUILD_TIMEOUT) {
41+
return 0;
42+
}
43+
const timeout = parseInt(String(consoleVariables._APP_COMPUTE_BUILD_TIMEOUT), 10);
44+
return isNaN(timeout) ? 0 : timeout;
45+
}
221 KB
Loading
86.2 KB
Loading
-90.8 KB
Binary file not shown.
-83.2 KB
Binary file not shown.

0 commit comments

Comments
 (0)