mirror of
https://github.com/appwrite/console.git
synced 2026-11-18 20:47:21 +00:00
fix: QA
This commit is contained in:
1 parent
350dc74e30
commit
fc68a2a6c4
7 files changed
+84
-12
No files matched your search
@@ -0,0 +1,25 @@
|
||||
<script lang="ts">
|
||||
import { sdk } from '$lib/stores/sdk';
|
||||
export let flag: string;
|
||||
export let name: string = flag;
|
||||
export let width = 40;
|
||||
export let height = 30;
|
||||
export let quality = 100;
|
||||
|
||||
export function getFlag(country: string, width: number, height: number, quality: number) {
|
||||
let flag = sdk.forProject.avatars
|
||||
.getFlag(country, width * 2, height * 2, quality)
|
||||
?.toString();
|
||||
flag?.includes('&project=')
|
||||
? (flag = flag.replace('&project=', '&mode=admin'))
|
||||
: flag + '&mode=admin';
|
||||
return flag;
|
||||
}
|
||||
</script>
|
||||
|
||||
<img
|
||||
style="border-radius: 2.5px"
|
||||
src={getFlag(flag, width, height, quality)}
|
||||
alt={name}
|
||||
{width}
|
||||
{height} />
|
||||
@@ -1,2 +1,3 @@
|
||||
export { default as Pill } from './pill.svelte';
|
||||
export { default as SelectSearchItem } from './selectSearchItem.svelte';
|
||||
export { default as Flag } from './flag.svelte';
|
||||
@@ -14,7 +14,7 @@ export type Organization = Models.Team<Record<string, unknown>> & {
|
||||
billingNextInvoiceDate: string;
|
||||
billingTrialStartDate?: string;
|
||||
billingTrialDays?: number;
|
||||
billingAddress?: string;
|
||||
billingAddressId?: string;
|
||||
amount: number;
|
||||
taxId?: string;
|
||||
};
|
||||
|
||||
@@ -49,8 +49,10 @@
|
||||
trackEvent(Submit.BillingAddressCreate);
|
||||
let org: Organization = null;
|
||||
if (organization) {
|
||||
console.log(response);
|
||||
org = await sdk.forConsole.billing.setBillingAddress(organization, response.$id);
|
||||
trackEvent(Submit.OrganizationBillingAddressUpdate);
|
||||
console.log(org);
|
||||
}
|
||||
await invalidate(Dependencies.ADDRESS);
|
||||
show = false;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { base } from '$app/paths';
|
||||
import { Pill } from '$lib/elements';
|
||||
import { Flag, Pill } from '$lib/elements';
|
||||
import { Button } from '$lib/elements/forms';
|
||||
import { Container } from '$lib/layout';
|
||||
import Create from './createProjectCloud.svelte';
|
||||
@@ -28,6 +28,8 @@
|
||||
import { ID } from '@appwrite.io/console';
|
||||
import { openImportWizard } from '../project-[project]/settings/migrations/(import)';
|
||||
import { readOnly } from '$lib/stores/billing';
|
||||
import type { RegionList } from '$lib/sdk/billing';
|
||||
import { onMount } from 'svelte';
|
||||
|
||||
export let data;
|
||||
|
||||
@@ -113,6 +115,11 @@
|
||||
trackError(e, Submit.ProjectCreate);
|
||||
}
|
||||
};
|
||||
|
||||
let regions: RegionList;
|
||||
onMount(async () => {
|
||||
if (isCloud) regions = await sdk.forConsole.billing.listRegions();
|
||||
});
|
||||
</script>
|
||||
|
||||
<Container>
|
||||
@@ -173,9 +180,16 @@
|
||||
+{project.platforms.length - 3}
|
||||
</Pill>
|
||||
{/if}
|
||||
<svelte:fragment slot="icon">
|
||||
{#if isCloud}
|
||||
<p>region</p>
|
||||
<svelte:fragment slot="icons">
|
||||
{#if isCloud && regions}
|
||||
{@const region = regions.regions.find(
|
||||
(region) => region.$id === project.region
|
||||
)}
|
||||
|
||||
<div class="u-flex u-gap-8 u-cross-center">
|
||||
<span class="u-text-color-gray">{region.name}</span>
|
||||
<Flag flag={region.flag} width={24} height={18} />
|
||||
</div>
|
||||
{/if}
|
||||
</svelte:fragment>
|
||||
</GridItem1>
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
}
|
||||
|
||||
$: billingAddress = $addressList?.billingAddresses?.find(
|
||||
(address) => address.$id === $organization?.billingAddress
|
||||
(address) => address.$id === $organization?.billingAddressId
|
||||
);
|
||||
</script>
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
Appwrite.
|
||||
</p>
|
||||
<svelte:fragment slot="aside">
|
||||
{#if $organization?.billingAddress && billingAddress}
|
||||
{#if $organization?.billingAddressId && billingAddress}
|
||||
<div class="box">
|
||||
<div class="u-flex u-main-space-between u-cross-start">
|
||||
<div class="u-line-height-1-5 u-flex u-flex-vertical u-gap-2">
|
||||
@@ -63,7 +63,16 @@
|
||||
<div class="u-flex u-cross-center u-flex-vertical u-main-center u-flex">
|
||||
<div class="common-section">
|
||||
<DropList bind:show={showDropdown} placement="bottom-start">
|
||||
<Button secondary round on:click={() => (showDropdown = !showDropdown)}>
|
||||
<Button
|
||||
secondary
|
||||
round
|
||||
on:click={() => {
|
||||
if ($addressList.total) {
|
||||
showDropdown = !showDropdown;
|
||||
} else {
|
||||
showCreate = true;
|
||||
}
|
||||
}}>
|
||||
<i class="icon-plus" />
|
||||
</Button>
|
||||
<svelte:fragment slot="list">
|
||||
|
||||
@@ -142,16 +142,28 @@
|
||||
</DropList>
|
||||
</CreditCardInfo>
|
||||
{:else}
|
||||
{@const filteredPaymentMethods = $paymentMethods.paymentMethods.filter(
|
||||
(o) => !!o.last4 && o.$id !== $organization.backupPaymentMethodId
|
||||
)}
|
||||
<article class="card u-grid u-cross-center u-width-full-line dashed">
|
||||
<div class="u-flex u-cross-center u-flex-vertical u-main-center u-flex">
|
||||
<div class="common-section">
|
||||
<DropList bind:show={showDropdown} placement="bottom-start">
|
||||
<Button secondary round on:click={() => (showDropdown = !showDropdown)}>
|
||||
<Button
|
||||
secondary
|
||||
round
|
||||
on:click={() => {
|
||||
if (filteredPaymentMethods.length) {
|
||||
showDropdown = !showDropdown;
|
||||
} else {
|
||||
showPayment = true;
|
||||
}
|
||||
}}>
|
||||
<i class="icon-plus" />
|
||||
</Button>
|
||||
<svelte:fragment slot="list">
|
||||
{#if $paymentMethods.total}
|
||||
{#each $paymentMethods.paymentMethods.filter((o) => !!o.last4 && o.$id !== $organization.backupPaymentMethodId) as paymentMethod}
|
||||
{#each filteredPaymentMethods as paymentMethod}
|
||||
<DropListItem
|
||||
on:click={() => {
|
||||
showDropdown = false;
|
||||
@@ -225,6 +237,9 @@
|
||||
</DropList>
|
||||
</CreditCardInfo>
|
||||
{:else}
|
||||
{@const filteredPaymentMethods = $paymentMethods.paymentMethods.filter(
|
||||
(o) => !!o.last4 && o.$id !== $organization.paymentMethodId
|
||||
)}
|
||||
<article class="card u-grid u-cross-center u-width-full-line dashed">
|
||||
<div class="u-flex u-cross-center u-flex-vertical u-main-center u-flex">
|
||||
<div class="common-section">
|
||||
@@ -232,12 +247,18 @@
|
||||
<Button
|
||||
secondary
|
||||
round
|
||||
on:click={() => (showDropdownBackup = !showDropdownBackup)}>
|
||||
on:click={() => {
|
||||
if (filteredPaymentMethods.length) {
|
||||
showDropdownBackup = !showDropdownBackup;
|
||||
} else {
|
||||
showPayment = true;
|
||||
}
|
||||
}}>
|
||||
<i class="icon-plus" />
|
||||
</Button>
|
||||
<svelte:fragment slot="list">
|
||||
{#if $paymentMethods.total}
|
||||
{#each $paymentMethods.paymentMethods.filter((o) => !!o.last4 && o.$id !== $organization?.paymentMethodId) as paymentMethod}
|
||||
{#each filteredPaymentMethods as paymentMethod}
|
||||
<DropListItem
|
||||
on:click={() => {
|
||||
showDropdownBackup = true;
|
||||
|
||||
Reference in new issue
Block a user