Skip to content

Commit 734fa70

Browse files
Merge pull request #1740 from appwrite/backups-to-pink2
Backups to pink2
2 parents dcc8d89 + fd8a6f0 commit 734fa70

24 files changed

+686
-657
lines changed

src/lib/components/backupRestoreBox.svelte

+21-14
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import { base } from '$app/paths';
1313
import { getProjectId } from '$lib/helpers/project';
1414
import { toLocaleDate } from '$lib/helpers/date';
15+
import { Typography } from '@appwrite.io/pink-svelte';
1516
1617
const backupRestoreItems: {
1718
archives: Map<string, BackupArchive>;
@@ -146,7 +147,9 @@
146147
<section class="upload-box">
147148
<header class="upload-box-header">
148149
<h4 class="upload-box-title">
149-
<span class="text">{titleText} ({items.size})</span>
150+
<Typography.Text variant="m-500">
151+
{titleText} ({items.size})
152+
</Typography.Text>
150153
</h4>
151154
<button
152155
class="upload-box-button"
@@ -172,13 +175,13 @@
172175
<section class="progress-bar u-width-full-line">
173176
<div
174177
class="progress-bar-top-line u-flex u-gap-8 u-main-space-between">
175-
<span class="body-text-2">
178+
<Typography.Text>
176179
{text(item.status, key)}
177-
</span>
180+
</Typography.Text>
178181

179-
<span class="backup-name">
182+
<Typography.Caption variant="400">
180183
{backupName(item, key)}
181-
</span>
184+
</Typography.Caption>
182185
</div>
183186
<div
184187
class="progress-bar-container"
@@ -195,7 +198,7 @@
195198
</div>
196199
{/if}
197200

198-
<style>
201+
<style lang="scss">
199202
.upload-box-title {
200203
font-size: 11px;
201204
}
@@ -211,13 +214,17 @@
211214
justify-content: center;
212215
}
213216
214-
.backup-name {
215-
font-size: 12px;
216-
font-weight: 400;
217-
line-height: 130%;
218-
font-style: normal;
219-
letter-spacing: -0.12px;
220-
color: var(--mid-neutrals-50, #818186);
221-
font-family: var(--font-family-sansSerif, Inter);
217+
.progress-bar-container {
218+
height: 4px;
219+
220+
&::before {
221+
height: 4px;
222+
background-color: var(--bgcolor-neutral-invert);
223+
}
224+
225+
&.is-danger::before {
226+
height: 4px;
227+
background-color: var(--bgcolor-error);
228+
}
222229
}
223230
</style>

src/lib/components/billing/paymentModal.svelte

+9-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,9 @@
7777

7878
<div class="aw-stripe-container" data-private>
7979
{#if isLoading}
80-
<Spinner />
80+
<div class="loader-element">
81+
<Spinner />
82+
</div>
8183
{/if}
8284

8385
<div class="stripe-element" bind:this={element}>
@@ -99,5 +101,11 @@
99101
.stripe-element {
100102
width: 100%;
101103
}
104+
105+
.loader-element {
106+
width: 100%;
107+
align-self: center;
108+
justify-items: end;
109+
}
102110
}
103111
</style>

src/lib/components/billing/selectPaymentMethod.svelte

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script lang="ts">
2-
import { Button, InputChoice, InputText } from '$lib/elements/forms';
2+
import { Button, InputText } from '$lib/elements/forms';
33
import type { PaymentList, PaymentMethodData } from '$lib/sdk/billing';
44
import { hasStripePublicKey, isCloud } from '$lib/system';
55
import { onMount } from 'svelte';

src/lib/components/confirm.svelte

+5
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@
1515
1616
let confirm = false;
1717
let checkboxId = `delete_${title.replaceAll(' ', '_').toLowerCase()}`;
18+
19+
// reset checkbox status
20+
$: if (open && confirmDeletion) {
21+
confirm = false;
22+
}
1823
</script>
1924

2025
<Form isModal {onSubmit}>

src/lib/components/modal.svelte

+9-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
export let show = false;
88
export let error: string = null;
99
export let dismissible = true;
10+
export let size: 's' | 'm' | 'l' = 'm';
1011
export let onSubmit: (e: SubmitEvent) => Promise<void> | void = function () {
1112
return;
1213
};
@@ -28,7 +29,7 @@
2829
</script>
2930

3031
<Form isModal {onSubmit} bind:this={formComponent}>
31-
<Modal {title} bind:open={show} {hideFooter} {dismissible}>
32+
<Modal {title} bind:open={show} {hideFooter} {dismissible} {size}>
3233
<slot slot="description" name="description" />
3334
{#if error}
3435
<div bind:this={alert}>
@@ -50,3 +51,10 @@
5051
</svelte:fragment>
5152
</Modal>
5253
</Form>
54+
55+
<style>
56+
/* temporary fix to modal width */
57+
:global(dialog section) {
58+
max-width: 100% !important;
59+
}
60+
</style>

src/lib/elements/forms/inputSelectCheckbox.svelte

+39-14
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
<script lang="ts">
22
import { DropList } from '$lib/components';
33
import { SelectSearchCheckbox } from '..';
4+
import { Icon } from '@appwrite.io/pink-svelte';
5+
import { IconChevronDown, IconChevronUp } from '@appwrite.io/pink-icons-svelte';
46
57
type Option = {
68
value: string;
@@ -60,16 +62,11 @@
6062
</ul>
6163
</div>
6264

63-
<input
64-
class="tags-input-text u-cursor-text"
65-
{placeholder}
66-
bind:value={search}
67-
bind:this={input} />
68-
<span
69-
class:icon-cheveron-up={show}
70-
class:icon-cheveron-down={!show}
71-
class="chevron-icon u-position-absolute u-inset-inline-end-12"
72-
aria-hidden="true"></span>
65+
<div class="input">
66+
<input {placeholder} bind:value={search} bind:this={input} />
67+
68+
<Icon size="m" icon={show ? IconChevronUp : IconChevronDown} />
69+
</div>
7370
</button>
7471

7572
<svelte:fragment slot="list">
@@ -88,13 +85,41 @@
8885
</DropList>
8986

9087
<style>
91-
@media (max-width: 768px) {
92-
.chevron-icon {
93-
inset-block-start: 0.25rem !important;
94-
}
88+
.tags-input {
89+
width: 100%;
90+
}
9591
92+
@media (max-width: 768px) {
9693
.tags-input {
9794
padding-right: 2rem;
9895
}
9996
}
97+
98+
.input {
99+
width: 100%;
100+
display: flex;
101+
align-items: center;
102+
transition: all 0.15s ease-in-out;
103+
border: var(--border-width-s) solid var(--border-neutral);
104+
border-radius: var(--border-radius-s);
105+
background-color: var(--p-input-background-color);
106+
padding-inline: var(--space-6);
107+
outline-offset: calc(var(--border-width-s) * -1);
108+
--p-input-background-color: var(--input-background-color, var(--bgcolor-neutral-default));
109+
}
110+
.input input {
111+
inline-size: 100%;
112+
padding-block: var(--space-3);
113+
padding-inline: 0;
114+
border: none;
115+
display: block;
116+
line-height: 140%;
117+
background: none;
118+
}
119+
.input input::placeholder {
120+
color: var(--fgcolor-neutral-tertiary);
121+
}
122+
.input:focus-within {
123+
outline: var(--border-width-l) solid var(--border-focus);
124+
}
100125
</style>

src/lib/elements/forms/inputSwitch.svelte

+3-1
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,6 @@
88
export let description: string = undefined;
99
</script>
1010

11-
<Selector.Switch {id} {description} {label} {disabled} bind:checked={value} on:invalid on:change />
11+
<Selector.Switch {id} {description} {label} {disabled} bind:checked={value} on:invalid on:change>
12+
<slot name="description" slot="description" />
13+
</Selector.Switch>

src/lib/helpers/notifications.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const userPreferences = () => get(user)?.prefs;
1919
const notificationPrefs = (): Record<string, NotificationPrefItem> => {
2020
const prefs = userPreferences();
2121

22-
// due to php backend, empty object can be returnd as an empty array
22+
// due to php backend, empty object can be returned as an empty array.
2323
if (!prefs?.notificationPrefs || Array.isArray(prefs.notificationPrefs)) {
2424
return {};
2525
}

src/lib/layout/headerAlert.svelte

+7-1
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,23 @@
55
export let title: string;
66
export let type: 'info' | 'success' | 'warning' | 'error' | 'default' = 'info';
77
8-
let container;
8+
let container: HTMLElement | null = null;
99
1010
function setNavigationHeight() {
1111
const alertHeight = container ? container.getBoundingClientRect().height : 0;
1212
const header: HTMLHeadingElement = document.querySelector('main > header');
1313
const sidebar: HTMLElement = document.querySelector('main > div > nav');
14+
const contentSection: HTMLElement = document.querySelector('main > div > section');
15+
1416
if (header) {
1517
header.style.top = `${alertHeight}px`;
1618
}
1719
if (sidebar) {
1820
sidebar.style.top = `${alertHeight + ($isTabletViewport ? 0 : header.getBoundingClientRect().height)}px`;
1921
}
22+
if (contentSection) {
23+
contentSection.style.paddingBlockStart = `${alertHeight}px`;
24+
}
2025
}
2126
2227
onMount(() => {
@@ -30,6 +35,7 @@
3035
</script>
3136

3237
<svelte:window on:resize={setNavigationHeight} />
38+
3339
<section
3440
bind:this={container}
3541
class="alert is-action is-action-and-top-sticky u-sep-block-end"

src/routes/(console)/account/organizations/+page.svelte

+1-1
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@
107107
</svelte:fragment>
108108
</CardContainer>
109109
{:else}
110-
<Empty single on:click={createOrg}>
110+
<Empty single on:click={createOrg} target="organization">
111111
<p>Create a new organization</p>
112112
</Empty>
113113
{/if}

src/routes/(console)/bottomAlerts.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ if (isCloud) {
2525
},
2626
learnMore: {
2727
text: 'Learn more',
28-
link: () => 'http://appwrite.io/docs/products/databases/backups'
28+
link: () => 'https://appwrite.io/docs/products/databases/backups'
2929
}
3030
});
3131
}

src/routes/(console)/project-[project]/+layout.svelte

+1
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@
122122
<style>
123123
.layout-level-progress-bars {
124124
gap: 1rem;
125+
z-index: 1;
125126
display: flex;
126127
flex-direction: column;
127128

src/routes/(console)/project-[project]/databases/create.svelte

+22-25
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<script lang="ts">
22
import { Submit, trackError, trackEvent } from '$lib/actions/analytics';
3-
import { Alert, CustomId, Modal } from '$lib/components';
3+
import { CustomId, Modal } from '$lib/components';
44
import { Button, InputText } from '$lib/elements/forms';
55
import { addNotification } from '$lib/stores/notifications';
66
import { sdk } from '$lib/stores/sdk';
@@ -12,7 +12,7 @@
1212
import { upgradeURL } from '$lib/stores/billing';
1313
import CreatePolicy from './database-[database]/backups/createPolicy.svelte';
1414
import { cronExpression, type UserBackupPolicy } from '$lib/helpers/backups';
15-
import { Icon, Tag } from '@appwrite.io/pink-svelte';
15+
import { Alert, Icon, Tag } from '@appwrite.io/pink-svelte';
1616
import { IconPencil } from '@appwrite.io/pink-icons-svelte';
1717
1818
export let showCreate = false;
@@ -122,33 +122,30 @@
122122
}}><Icon icon={IconPencil} /> Database ID</Tag>
123123
</div>
124124
{/if}
125+
125126
<CustomId bind:show={showCustomId} name="Database" bind:id autofocus={false} />
126127

127128
{#if isCloud}
128-
<div class="u-flex-vertical u-gap-24 u-padding-block-start-24">
129-
{#if $organization?.billingPlan === BillingPlan.FREE}
130-
{#if showPlanUpgradeAlert}
131-
<Alert
132-
type="warning"
133-
dismissible
134-
on:dismiss={() => (showPlanUpgradeAlert = false)}>
135-
<svelte:fragment slot="title">
136-
This database won't be backed up
137-
</svelte:fragment>
138-
Upgrade your plan to ensure your data stays safe and backed up.
139-
<svelte:fragment slot="buttons">
140-
<Button href={$upgradeURL} text>Upgrade plan</Button>
141-
</svelte:fragment>
142-
</Alert>
143-
{/if}
144-
{:else}
145-
<CreatePolicy
146-
bind:totalPolicies
147-
bind:isShowing={showCreate}
148-
title="Backup policies"
149-
subtitle="Protect your data and ensure quick recovery by adding backup policies." />
129+
{#if $organization?.billingPlan === BillingPlan.FREE}
130+
{#if showPlanUpgradeAlert}
131+
<Alert.Inline
132+
dismissible
133+
title="This database won't be backed up"
134+
status="warning"
135+
on:dismiss={() => (showPlanUpgradeAlert = false)}>
136+
Upgrade your plan to ensure your data stays safe and backed up.
137+
<svelte:fragment slot="actions">
138+
<Button compact href={$upgradeURL}>Upgrade plan</Button>
139+
</svelte:fragment>
140+
</Alert.Inline>
150141
{/if}
151-
</div>
142+
{:else}
143+
<CreatePolicy
144+
bind:totalPolicies
145+
bind:isShowing={showCreate}
146+
title="Backup policies"
147+
subtitle="Protect your data and ensure quick recovery by adding backup policies." />
148+
{/if}
152149
{/if}
153150
<svelte:fragment slot="footer">
154151
<Button secondary on:click={() => (showCreate = false)}>Cancel</Button>

0 commit comments

Comments
 (0)