diff --git a/src/lib/components/account/sendVerificationEmailModal.svelte b/src/lib/components/account/sendVerificationEmailModal.svelte new file mode 100644 index 000000000..bbe676142 --- /dev/null +++ b/src/lib/components/account/sendVerificationEmailModal.svelte @@ -0,0 +1,79 @@ + + + + + + + To continue using Appwrite Cloud, please verify your email address. An email will be + sent to {get(user)?.email} + + + + + + + + diff --git a/src/lib/components/alerts/emailVerificationBanner.svelte b/src/lib/components/alerts/emailVerificationBanner.svelte index 51fc4bbab..9af46d418 100644 --- a/src/lib/components/alerts/emailVerificationBanner.svelte +++ b/src/lib/components/alerts/emailVerificationBanner.svelte @@ -1,55 +1,26 @@ {#if shouldShowEmailBanner} - + To avoid losing access to your projects, make sure - + + {/if} diff --git a/src/lib/components/logs/logsRequest.svelte b/src/lib/components/logs/logsRequest.svelte index dc04eb022..618201d74 100644 --- a/src/lib/components/logs/logsRequest.svelte +++ b/src/lib/components/logs/logsRequest.svelte @@ -11,7 +11,6 @@ Tabs, Typography } from '@appwrite.io/pink-svelte'; - import { onMount } from 'svelte'; let { selectedLog, @@ -23,29 +22,30 @@ let requestTab: 'parameters' | 'headers' = $state('parameters'); - let parameters = $state([]); - const href = product === 'site' ? 'https://appwrite.io/docs/products/sites/logs#log-details' : 'https://appwrite.io/docs/products/functions/develop#logging'; - onMount(() => { + // Make parameters reactive to selectedLog changes + let parameters = $derived.by(() => { try { // Add dummy base URL to parse relative paths const url = new URL(selectedLog.requestPath, 'http://dummy.local'); if (url.search) { - parameters = Array.from(url.searchParams.entries()).map(([name, value]) => ({ + return Array.from(url.searchParams.entries()).map(([name, value]) => ({ name, value: decodeURIComponent(value) })); } + return []; } catch (error) { - parameters = []; + return []; } }); - onMount(() => { + // Update requestTab when parameters or selectedLog changes + $effect(() => { if (parameters?.length) { requestTab = 'parameters'; } else if (selectedLog.requestHeaders?.length) { diff --git a/src/lib/components/mfaChallengeFormList.svelte b/src/lib/components/mfaChallengeFormList.svelte index bd5489f0b..fac525caa 100644 --- a/src/lib/components/mfaChallengeFormList.svelte +++ b/src/lib/components/mfaChallengeFormList.svelte @@ -1,21 +1,39 @@ -{#if challengeType === AuthenticationFactor.Recoverycode} +{#if enabledMainFactors.length === 0} + +{:else if challengeType === AuthenticationFactor.Recoverycode} - Enter below one of the recovery codes you received when enabling MFA for this account. + Enter one of the recovery codes you received when enabling MFA. -{:else} - {#if factors.totp && (challengeType === AuthenticationFactor.Totp || challengeType === null)} - Enter below a 6-digit one-time code generated by your authentication app. - {:else if challengeType === AuthenticationFactor.Email} - A 6-digit verification code was sent to your email, enter it below. - {:else if challengeType === AuthenticationFactor.Phone} - A 6-digit verification code was sent to your phone, enter it below. - {/if} +{:else if challengeType === AuthenticationFactor.Totp} + + Enter a 6-digit one-time code from your authenticator app. + + +{:else if challengeType === AuthenticationFactor.Email} + + A 6-digit verification code was sent to your email. Enter it below. + + +{:else if challengeType === AuthenticationFactor.Phone} + + A 6-digit verification code was sent to your phone. Enter it below. + {/if} -{#if showVerifyButton} + +{#if showVerifyButton && enabledMainFactors.length > 0} {/if} -{#if enabledFactors.length > 1} - or -
- {#if factors.totp} - {#if (challengeType === null || challengeType === AuthenticationFactor.Totp || challengeType === AuthenticationFactor.Recoverycode) && factors.email} - - {:else if (challengeType === AuthenticationFactor.Recoverycode && !factors.email) || challengeType === AuthenticationFactor.Email} + +{#if enabledMainFactors.length > 0} + {@const hasSecondaryOptions = + enabledMainFactors.length > 1 || + (factors.recoveryCode && challengeType !== AuthenticationFactor.Recoverycode) || + (enabledMainFactors.length === 1 && factors.recoveryCode)} + + {#if hasSecondaryOptions} + or +
+ + {#if factors.totp && challengeType !== AuthenticationFactor.Totp} - {/if} -
+ + {#if factors.recoveryCode && challengeType !== AuthenticationFactor.Recoverycode} + + {/if} +
+ {/if} {/if} diff --git a/src/lib/helpers/github.ts b/src/lib/helpers/github.ts index 2155642d8..b173d6d22 100644 --- a/src/lib/helpers/github.ts +++ b/src/lib/helpers/github.ts @@ -3,7 +3,9 @@ export function getNestedRootDirectory(repository: string): string | null { return match ? match[1] : null; } -export function getRepositoryInfo(repository: string): { owner: string; name: string } | null { +export function getRepositoryInfo( + repository: string +): { owner: string; name: string; url: string } | null { const match = repository .trim() .match(/(?:^|\/\/|@)github\.com[/:]([^/]+)\/([^/]+?)(?:\.git)?(?:$|[/?#])/i); @@ -13,7 +15,9 @@ export function getRepositoryInfo(repository: string): { owner: string; name: st const owner = decodeURIComponent(match[1]); const name = decodeURIComponent(match[2].replace(/\.git$/i, '')); - return { owner, name }; + const url = `https://github.com/${owner}/${name}`; + + return { owner, name, url }; } export async function getLatestTag(owner: string, name: string): Promise { diff --git a/src/lib/helpers/httpStatus.ts b/src/lib/helpers/httpStatus.ts new file mode 100644 index 000000000..fee77802a --- /dev/null +++ b/src/lib/helpers/httpStatus.ts @@ -0,0 +1,23 @@ +/** + * determines the badge color based on HTTP status code + * + * @param statusCode + * @returns badge color + */ +export function getBadgeTypeFromStatusCode( + statusCode: number +): 'error' | 'warning' | 'success' | undefined { + if (statusCode >= 500) { + return 'error'; + } + + if (statusCode >= 400) { + return 'warning'; + } + + if (statusCode === 0) { + return undefined; + } + + return 'success'; +} diff --git a/src/lib/stores/preferences.ts b/src/lib/stores/preferences.ts index 36419be28..fdcb89f7e 100644 --- a/src/lib/stores/preferences.ts +++ b/src/lib/stores/preferences.ts @@ -66,6 +66,19 @@ function safePrefsKey(widthPreferences: TeamPreferences['widths'], from: string, } } +function safePrefsKeyForOrder( + orderPreferences: TeamPreferences['order'], + from: string, + to: string +) { + if (orderPreferences.includes(from)) { + const index = orderPreferences.indexOf(from); + if (index !== -1) { + orderPreferences[index] = to; + } + } +} + // rare cases where the value was an array, probably due to PHP backend. function ensureObjectProperty, K extends keyof T>( obj: T | null | undefined, @@ -239,7 +252,9 @@ function createPreferences() { }, getColumnOrder(tableId: string): TeamPreferences['order'] { - return teamPreferences?.columnOrder?.[tableId] ?? []; + const columnOrder = teamPreferences?.columnOrder?.[tableId] ?? []; + safePrefsKeyForOrder(columnOrder, '$uid', '$id'); + return columnOrder; }, async saveColumnOrder(orgId: string, tableId: string, columnIds: TeamPreferences['order']) { @@ -247,6 +262,10 @@ function createPreferences() { teamPreferences.columnOrder[tableId] = columnIds; + for (const tableOrder of Object.values(teamPreferences.columnOrder)) { + safePrefsKeyForOrder(tableOrder, '$id', '$uid'); + } + await sdk.forConsole.teams.updatePrefs({ teamId: orgId, prefs: teamPreferences diff --git a/src/routes/(console)/+layout.svelte b/src/routes/(console)/+layout.svelte index 1b0748e12..73846afa2 100644 --- a/src/routes/(console)/+layout.svelte +++ b/src/routes/(console)/+layout.svelte @@ -59,7 +59,6 @@ import type { LayoutData } from './$types'; export let data: LayoutData; - let emailBannerClosed = false; function kebabToSentenceCase(str: string) { return str @@ -347,9 +346,7 @@