|
9 | 9 | import { Button, InputSelect } from '$lib/elements/forms'; |
10 | 10 | import DualTimeView from './dualTimeView.svelte'; |
11 | 11 | import type { Models } from '@appwrite.io/console'; |
12 | | - import { calculateSize } from '$lib/helpers/sizeConvertion'; |
| 12 | + import { calculateSize, humanFileSize, sizeToBytes } from '$lib/helpers/sizeConvertion'; |
13 | 13 | import InputSearch from '$lib/elements/forms/inputSearch.svelte'; |
14 | 14 | import { ID, Query, Permission, Role } from '@appwrite.io/console'; |
15 | 15 | import { |
|
34 | 34 | import { showCreateBucket } from '$routes/(console)/project-[region]-[project]/storage/+page.svelte'; |
35 | 35 | import { preferences } from '$lib/stores/preferences'; |
36 | 36 | import { addNotification } from '$lib/stores/notifications'; |
| 37 | + import { isCloud } from '$lib/system'; |
| 38 | + import { currentPlan } from '$lib/stores/organization'; |
37 | 39 |
|
38 | 40 | export let show: boolean; |
39 | 41 | export let mimeTypeQuery: string = 'image/'; |
|
53 | 55 | let fileSelector: HTMLInputElement; |
54 | 56 | let uploading = false; |
55 | 57 | let view: 'grid' | 'list' = 'list'; |
| 58 | + $: planMaxSize = |
| 59 | + isCloud && $currentPlan?.['fileSize'] |
| 60 | + ? sizeToBytes($currentPlan['fileSize'], 'MB', 1000) |
| 61 | + : null; |
56 | 62 |
|
57 | 63 | onMount(() => { |
58 | 64 | const lastSelectedBucket = preferences.getKey('lastSelectedBucket', null); |
|
366 | 372 | direction="row" |
367 | 373 | gap="s"> |
368 | 374 | <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 |
370 | 376 | </Typography.Text> |
371 | 377 | <Tooltip> |
372 | 378 | <Layout.Stack |
|
381 | 387 | : `${allowedExtension} files are allowed`}</svelte:fragment> |
382 | 388 | </Tooltip> |
383 | 389 | </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} |
386 | 396 | </Layout.Stack> |
387 | 397 | </Layout.Stack> |
388 | 398 | </Upload.Dropzone> |
|
0 commit comments