Skip to content

Commit a363ed6

Browse files
authored
Merge pull request #2955 from appwrite/fix-csv-import-max-file-size
fix: show correct max file size in CSV import dialog
2 parents 3aae061 + 9c5725b commit a363ed6

File tree

9 files changed

+22
-12
lines changed

9 files changed

+22
-12
lines changed

src/lib/components/filePicker.svelte

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import { Button, InputSelect } from '$lib/elements/forms';
1010
import DualTimeView from './dualTimeView.svelte';
1111
import type { Models } from '@appwrite.io/console';
12-
import { calculateSize } from '$lib/helpers/sizeConvertion';
12+
import { calculateSize, humanFileSize, sizeToBytes } from '$lib/helpers/sizeConvertion';
1313
import InputSearch from '$lib/elements/forms/inputSearch.svelte';
1414
import { ID, Query, Permission, Role } from '@appwrite.io/console';
1515
import {
@@ -34,6 +34,8 @@
3434
import { showCreateBucket } from '$routes/(console)/project-[region]-[project]/storage/+page.svelte';
3535
import { preferences } from '$lib/stores/preferences';
3636
import { addNotification } from '$lib/stores/notifications';
37+
import { isCloud } from '$lib/system';
38+
import { currentPlan } from '$lib/stores/organization';
3739
3840
export let show: boolean;
3941
export let mimeTypeQuery: string = 'image/';
@@ -53,6 +55,10 @@
5355
let fileSelector: HTMLInputElement;
5456
let uploading = false;
5557
let view: 'grid' | 'list' = 'list';
58+
$: planMaxSize =
59+
isCloud && $currentPlan?.['fileSize']
60+
? sizeToBytes($currentPlan['fileSize'], 'MB', 1000)
61+
: null;
5662
5763
onMount(() => {
5864
const lastSelectedBucket = preferences.getKey('lastSelectedBucket', null);
@@ -366,7 +372,7 @@
366372
direction="row"
367373
gap="s">
368374
<Typography.Text variant="l-500">
369-
Drag and drop files here or click to upload
375+
Drag and drop a file here or click to upload
370376
</Typography.Text>
371377
<Tooltip>
372378
<Layout.Stack
@@ -381,8 +387,12 @@
381387
: `${allowedExtension} files are allowed`}</svelte:fragment>
382388
</Tooltip>
383389
</Layout.Stack>
384-
<Typography.Caption variant="400"
385-
>Max file size: 10MB</Typography.Caption>
390+
{#if planMaxSize}
391+
{@const readableMaxSize = humanFileSize(planMaxSize)}
392+
<Typography.Caption variant="400"
393+
>Max file size: {readableMaxSize.value +
394+
readableMaxSize.unit}</Typography.Caption>
395+
{/if}
386396
</Layout.Stack>
387397
</Layout.Stack>
388398
</Upload.Dropzone>

src/lib/components/variables/importVariablesModal.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
<Layout.Stack alignItems="center" gap="s">
6565
<Layout.Stack alignItems="center" justifyContent="center" inline>
6666
<Typography.Text variant="l-500" align="center" inline>
67-
Drag and drop files here or click to upload
67+
Drag and drop a file here or click to upload
6868
<Layout.Stack
6969
style="display: inline-flex; vertical-align: middle;"
7070
inline

src/routes/(console)/organization-[organization]/domains/domain-[domain]/importRecordModal.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@
8989
direction="row"
9090
gap="s">
9191
<Typography.Text variant="l-500">
92-
Drag and drop file here or click to upload
92+
Drag and drop a file here or click to upload
9393
</Typography.Text>
9494
<Tooltip>
9595
<Layout.Stack alignItems="center" justifyContent="center" inline>

src/routes/(console)/project-[region]-[project]/functions/create-function/manual/+page.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@
206206
<Layout.Stack alignItems="center" gap="s">
207207
<Layout.Stack alignItems="center" justifyContent="center" inline>
208208
<Typography.Text variant="l-500" align="center" inline>
209-
Drag and drop file here or click to upload
209+
Drag and drop a file here or click to upload
210210
<Layout.Stack
211211
style="display: inline-flex; vertical-align: middle;"
212212
inline

src/routes/(console)/project-[region]-[project]/functions/function-[function]/(modals)/createManual.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@
9393
direction="row"
9494
gap="s">
9595
<Typography.Text variant="l-500">
96-
Drag and drop file here or click to upload
96+
Drag and drop a file here or click to upload
9797
</Typography.Text>
9898
<Tooltip>
9999
<Layout.Stack alignItems="center" justifyContent="center" inline>

src/routes/(console)/project-[region]-[project]/sites/create-site/manual/+page.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@
210210
<Layout.Stack alignItems="center" gap="s">
211211
<Layout.Stack alignItems="center" justifyContent="center" inline>
212212
<Typography.Text variant="l-500" align="center" inline>
213-
Drag and drop file here or click to upload
213+
Drag and drop a file here or click to upload
214214
<Layout.Stack
215215
style="display: inline-flex; vertical-align: middle;"
216216
inline

src/routes/(console)/project-[region]-[project]/sites/site-[site]/deployments/createManualDeploymentModal.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@
9393
direction="row"
9494
gap="s">
9595
<Typography.Text variant="l-500">
96-
Drag and drop file here or click to upload
96+
Drag and drop a file here or click to upload
9797
</Typography.Text>
9898
<Tooltip>
9999
<Layout.Stack alignItems="center" justifyContent="center" inline>

src/routes/(console)/project-[region]-[project]/storage/bucket-[bucket]/create/+page.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@
122122
extensions={data.bucket.allowedFileExtensions}
123123
on:invalid={handleInvalid}>
124124
<Typography.Text variant="l-500"
125-
>Drag and drop files here or click to upload</Typography.Text>
125+
>Drag and drop a file here or click to upload</Typography.Text>
126126
</Upload.Dropzone>
127127

128128
{#if files}

src/routes/(console)/project-[region]-[project]/uploadVariablesModal.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@
148148
<Layout.Stack alignItems="center" gap="s">
149149
<Layout.Stack alignItems="center" justifyContent="center" inline>
150150
<Typography.Text variant="l-500" align="center" inline>
151-
Drag and drop files here or click to upload
151+
Drag and drop a file here or click to upload
152152
<Layout.Stack
153153
style="display: inline-flex; vertical-align: middle;"
154154
inline

0 commit comments

Comments
 (0)