chore: fix errors

This commit is contained in:
Arman committed 2025-05-02 14:53:07 +02:00
1 parent f2ce095ff9
commit f7658ab167
19 files changed
+26 -195

No files matched your search

@@ -1,5 +1,5 @@
import { derived } from 'svelte/store';
import { page } from '$app/state';
import { page } from '$app/stores';
import type { Models } from '@appwrite.io/console';
export const provider = derived(page, (page) => page.data.provider as Models.Provider);
export const provider = derived(page, ($page) => $page.data.provider as Models.Provider);
@@ -1,68 +0,0 @@
<script context="module" lang="ts">
import { createPlatform } from './store';
import { wizard } from '$lib/stores/wizard';
import { writable } from 'svelte/store';
import { invalidate } from '$app/navigation';
import { Dependencies } from '$lib/constants';
const showSkippedModal = writable(false);
async function closeWizard() {
wizard.hide();
createPlatform.reset();
}
/**
* Previously, data was updated after the wizard was closed,
* this sometimes caused outdated data to be visible for a brief moment.
*/
export async function invalidateDependencies(): Promise<void> {
await Promise.all([invalidate(Dependencies.PROJECT), invalidate(Dependencies.PLATFORMS)]);
}
export async function onPlatformSetupFinish(event: CustomEvent): Promise<void> {
const type = event.type;
const skipped = event.detail?.skipped ?? false;
const optional = event.detail?.optional ?? false;
const isSkipped = type === 'finish' ? skipped : type === 'exit' ? optional : false;
showSkippedModal.set(isSkipped);
if (!isSkipped) {
await closeWizard();
}
}
</script>
<script lang="ts">
import { page } from '$app/state';
import { CopyInput, Modal } from '$lib/components';
import { Button, FormList } from '$lib/elements/forms';
import { getProjectEndpoint } from '$lib/helpers/project';
const project = page.params.project;
</script>
<Modal
closable={false}
closeByEscape={false}
headerDivider={false}
onSubmit={closeWizard}
bind:show={$showSkippedModal}
title="Skipping optional steps">
<FormList>
<p>
The platform will be added to your project. Access Appwrite services using this
project's API Endpoint and Project ID:
</p>
<CopyInput label="API Endpoint" showLabel={true} value={getProjectEndpoint()} />
<CopyInput label="Project ID" showLabel={true} value={project} />
</FormList>
<svelte:fragment slot="footer">
<Button text on:click={() => ($showSkippedModal = false)}>Cancel</Button>
<Button submit>Go to dashboard</Button>
</svelte:fragment>
</Modal>
@@ -1,19 +0,0 @@
<script lang="ts">
import { page } from '$app/state';
import { WizardStep } from '$lib/layout';
$: isFirstProject = page.data.platforms.total === 0;
</script>
<WizardStep>
<svelte:fragment slot="title">All set</svelte:fragment>
<p>
{#if isFirstProject}
Congratulations on adding the first platform to your project! Start exploring by
creating users, adding a database to your project, or uploading files to a bucket.
{:else}
Congratulations on adding another platform to your project! Start building by adding a
database, uploading files to a bucket and more via your dashboard.
{/if}
</p>
</WizardStep>
@@ -1,68 +0,0 @@
import { writable } from 'svelte/store';
import { sdk } from '$lib/stores/sdk';
import { cachedStore } from '$lib/helpers/cache';
import type { Models } from '@appwrite.io/console';
function createPlatformStore() {
const { subscribe, update, set } = writable<Partial<Models.Platform>>({
$id: null,
name: null,
hostname: null,
key: null,
store: null,
type: null
});
return {
subscribe,
update,
set,
reset() {
set({
$id: null,
name: null,
hostname: null,
key: null,
store: null,
type: null
});
}
};
}
export const createPlatform = createPlatformStore();
export const versions = cachedStore<
{
server: string;
'client-web': string;
'client-flutter': string;
'client-apple': string;
'client-android': string;
'console-web': string;
'console-cli': string;
'server-nodejs': string;
'server-deno': string;
'server-php': string;
'server-python': string;
'server-ruby': string;
'server-dart': string;
'server-kotlin': string;
'server-swift': string;
},
{
load: () => Promise<void>;
}
>('versions', function ({ set }) {
return {
load: async () => {
const { endpoint, project } = sdk.forConsole.client.config;
const response = await fetch(`${endpoint}/../versions`, {
headers: {
'X-Appwrite-Project': project
}
});
set(await response.json());
}
};
});
@@ -1,30 +0,0 @@
<script lang="ts">
import { page } from '$app/state';
import { Code } from '$lib/components';
import { WizardStep } from '$lib/layout';
import { getProjectEndpoint } from '$lib/helpers/project';
const project = page.params.project;
const code = `const client = new Client();
client
.setEndpoint('${getProjectEndpoint()}')
.setProject('${project}');`;
</script>
<WizardStep>
<svelte:fragment slot="title">Initialize SDK</svelte:fragment>
<p>Initialize your SDK by pointing the client to your Appwrite project.</p>
<div class="u-margin-block-start-16">
<Code
label="Web SDK"
labelIcon="code"
language="js"
{code}
withCopy
withLineNumbers
noMargin />
</div>
</WizardStep>
@@ -8,7 +8,6 @@
import { addNotification } from '$lib/stores/notifications';
import { sdk } from '$lib/stores/sdk';
import { isCloud } from '$lib/system';
import type { RegionList } from '$lib/sdk/billing';
import Confirm from '$lib/components/confirm.svelte';
import { project, projectRegion } from '../store';
@@ -7,6 +7,7 @@
import { Dependencies } from '$lib/constants';
import { Confirm } from '$lib/components';
import { Typography } from '@appwrite.io/pink-svelte';
import { page } from '$app/state';
let {
show = $bindable(),
@@ -8,6 +8,7 @@
import { Dependencies } from '$lib/constants';
import type { Models } from '@appwrite.io/console';
import CnameTable from '$lib/components/domains/cnameTable.svelte';
import { page } from '$app/state';
let {
show = $bindable(),
@@ -14,10 +14,11 @@
import { getCountryName } from '$lib/helpers/diallingCodes.js';
import { Accordion, Icon, Layout, Link, Table, Typography } from '@appwrite.io/pink-svelte';
import { IconChartSquareBar } from '@appwrite.io/pink-icons-svelte';
import { page } from '$app/state';
export let data;
$: baseRoute = `${base}/project-${data.project.region}-${data.project.$id}`;
$: baseRoute = `${base}/project-${page.params.region}-${page.params.project}`;
$: network = data.usage.network;
$: users = data.usage.users;
$: usersTotal = data.usage.usersTotal;
@@ -1,4 +1,5 @@
<script lang="ts">
import { page } from '$app/state';
import { Modal } from '$lib/components';
import Card from '$lib/components/card.svelte';
import { Button, InputSelect } from '$lib/elements/forms';
@@ -6,6 +6,7 @@
import { Submit, trackError, trackEvent } from '$lib/actions/analytics';
import { invalidate } from '$app/navigation';
import { Dependencies } from '$lib/constants';
import { page } from '$app/state';
export let show = false;
export let selectedDeploymentId: string;
@@ -1,5 +1,6 @@
<script lang="ts">
import { invalidate } from '$app/navigation';
import { page } from '$app/state';
import { Submit, trackEvent, trackError } from '$lib/actions/analytics';
import { Confirm } from '$lib/components';
import { Dependencies } from '$lib/constants';
@@ -1,5 +1,6 @@
<script lang="ts">
import { invalidate } from '$app/navigation';
import { page } from '$app/state';
import { Modal, Card } from '$lib/components';
import { Repositories } from '$lib/components/git';
import { Dependencies } from '$lib/constants';
@@ -7,6 +7,7 @@
import { Dependencies } from '$lib/constants';
import { Confirm } from '$lib/components';
import { Typography } from '@appwrite.io/pink-svelte';
import { page } from '$app/state';
let {
show = $bindable(),
@@ -13,6 +13,7 @@
import { timeFromNow, toLocaleDateTime } from '$lib/helpers/date';
import { capitalize } from '$lib/helpers/string';
import { calculateSize } from '$lib/helpers/sizeConvertion';
import { page } from '$app/state';
export let show = false;
export let deployment: Models.Deployment;
@@ -8,6 +8,7 @@
import { sdk } from '$lib/stores/sdk';
import { onMount } from 'svelte';
import { Adapter, BuildRuntime, Framework, type Models } from '@appwrite.io/console';
import { page } from '$app/state';
export let site: Models.Site;
let siteName: string = null;
@@ -45,7 +45,14 @@
const fileId = id ?? ID.unique();
try {
const promise = uploader.uploadFile(page.params.bucket, fileId, files[0], permissions);
const promise = uploader.uploadFile(
page.params.region,
page.params.project,
page.params.bucket,
fileId,
files[0],
permissions
);
await goto(
`${base}/project-${page.params.region}-${page.params.project}/storage/bucket-${page.params.bucket}`
);
@@ -1,12 +1,12 @@
import { page } from '$app/state';
import type { Models } from '@appwrite.io/console';
import type { BarSeriesOption } from 'echarts/charts';
import { derived, get, writable } from 'svelte/store';
import { regions } from '$lib/stores/organization';
import { page } from '$app/stores';
export const project = derived(
page,
(page) => page.data.project as Models.Project & { region?: string }
($page) => $page.data.project as Models.Project & { region?: string }
);
export const projectRegion = derived(project, ($project) => {
@@ -5,14 +5,14 @@
import { SvgIcon } from '$lib/components/index.js';
import { Button, Form, InputSelect } from '$lib/elements/forms';
import { getFlagUrl } from '$lib/helpers/flag.js';
import type { AllowedRegions, Region as RegionType } from '$lib/sdk/billing.js';
import type { AllowedRegions } from '$lib/sdk/billing.js';
import { app } from '$lib/stores/app';
import { addNotification } from '$lib/stores/notifications';
import { sdk } from '$lib/stores/sdk';
import { getFrameworkIcon } from '$lib/stores/sites.js';
import { isCloud } from '$lib/system';
import { ID, OAuthProvider, Query, type Models, Region } from '@appwrite.io/console';
import { IconGithub, IconPencil, IconPlus, IconPlusSm } from '@appwrite.io/pink-icons-svelte';
import { IconGithub, IconPencil, IconPlusSm } from '@appwrite.io/pink-icons-svelte';
import {
Card,
Divider,
@@ -34,7 +34,7 @@
let projectName = $state<string>();
let showCustomId = $state(false);
let region = $state<AllowedRegions>();
let regions = $state<Array<RegionType>>([]);
let regions = $state<Array<Models.ConsoleRegion>>([]);
let id = $state<string>();
function getRegions() {