Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions src/lib/components/filePicker.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import { Button, InputSelect } from '$lib/elements/forms';
import DualTimeView from './dualTimeView.svelte';
import type { Models } from '@appwrite.io/console';
import { calculateSize } from '$lib/helpers/sizeConvertion';
import { calculateSize, humanFileSize, sizeToBytes } from '$lib/helpers/sizeConvertion';
import InputSearch from '$lib/elements/forms/inputSearch.svelte';
import { ID, Query, Permission, Role } from '@appwrite.io/console';
import {
Expand All @@ -34,6 +34,8 @@
import { showCreateBucket } from '$routes/(console)/project-[region]-[project]/storage/+page.svelte';
import { preferences } from '$lib/stores/preferences';
import { addNotification } from '$lib/stores/notifications';
import { isCloud } from '$lib/system';
import { currentPlan } from '$lib/stores/organization';

export let show: boolean;
export let mimeTypeQuery: string = 'image/';
Expand All @@ -53,6 +55,10 @@
let fileSelector: HTMLInputElement;
let uploading = false;
let view: 'grid' | 'list' = 'list';
$: planMaxSize =
isCloud && $currentPlan?.['fileSize']
? sizeToBytes($currentPlan['fileSize'], 'MB', 1000)
: null;

onMount(() => {
const lastSelectedBucket = preferences.getKey('lastSelectedBucket', null);
Expand Down Expand Up @@ -366,7 +372,7 @@
direction="row"
gap="s">
<Typography.Text variant="l-500">
Drag and drop files here or click to upload
Drag and drop a file here or click to upload
</Typography.Text>
<Tooltip>
<Layout.Stack
Expand All @@ -381,8 +387,12 @@
: `${allowedExtension} files are allowed`}</svelte:fragment>
</Tooltip>
</Layout.Stack>
<Typography.Caption variant="400"
>Max file size: 10MB</Typography.Caption>
{#if planMaxSize}
{@const readableMaxSize = humanFileSize(planMaxSize)}
<Typography.Caption variant="400"
>Max file size: {readableMaxSize.value +
readableMaxSize.unit}</Typography.Caption>
Comment on lines +393 to +394
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Missing space between value and unit

readableMaxSize.value + readableMaxSize.unit produces "50MB" or "5GB" with no space. The existing usage in updateMaxFileSize.svelte does the same thing (line 51: {Math.floor(parseInt(size.value))}{size.unit}), so this is consistent with the codebase convention. That said, the humanFileSize helper returns a space-separated pair from prettyBytes precisely to allow callers to format them separately — displaying "5 GB" is more readable and closer to the format prettyBytes produces internally. Consider adding a space:

Suggested change
>Max file size: {readableMaxSize.value +
readableMaxSize.unit}</Typography.Caption>
>Max file size: {readableMaxSize.value + ' ' +
readableMaxSize.unit}</Typography.Caption>

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

{/if}
</Layout.Stack>
</Layout.Stack>
</Upload.Dropzone>
Expand Down
2 changes: 1 addition & 1 deletion src/lib/components/variables/importVariablesModal.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
<Layout.Stack alignItems="center" gap="s">
<Layout.Stack alignItems="center" justifyContent="center" inline>
<Typography.Text variant="l-500" align="center" inline>
Drag and drop files here or click to upload
Drag and drop a file here or click to upload
<Layout.Stack
style="display: inline-flex; vertical-align: middle;"
inline
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
direction="row"
gap="s">
<Typography.Text variant="l-500">
Drag and drop file here or click to upload
Drag and drop a file here or click to upload
</Typography.Text>
<Tooltip>
<Layout.Stack alignItems="center" justifyContent="center" inline>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@
<Layout.Stack alignItems="center" gap="s">
<Layout.Stack alignItems="center" justifyContent="center" inline>
<Typography.Text variant="l-500" align="center" inline>
Drag and drop file here or click to upload
Drag and drop a file here or click to upload
<Layout.Stack
style="display: inline-flex; vertical-align: middle;"
inline
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
direction="row"
gap="s">
<Typography.Text variant="l-500">
Drag and drop file here or click to upload
Drag and drop a file here or click to upload
</Typography.Text>
<Tooltip>
<Layout.Stack alignItems="center" justifyContent="center" inline>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@
<Layout.Stack alignItems="center" gap="s">
<Layout.Stack alignItems="center" justifyContent="center" inline>
<Typography.Text variant="l-500" align="center" inline>
Drag and drop file here or click to upload
Drag and drop a file here or click to upload
<Layout.Stack
style="display: inline-flex; vertical-align: middle;"
inline
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
direction="row"
gap="s">
<Typography.Text variant="l-500">
Drag and drop file here or click to upload
Drag and drop a file here or click to upload
</Typography.Text>
<Tooltip>
<Layout.Stack alignItems="center" justifyContent="center" inline>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@
extensions={data.bucket.allowedFileExtensions}
on:invalid={handleInvalid}>
<Typography.Text variant="l-500"
>Drag and drop files here or click to upload</Typography.Text>
>Drag and drop a file here or click to upload</Typography.Text>
</Upload.Dropzone>

{#if files}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@
<Layout.Stack alignItems="center" gap="s">
<Layout.Stack alignItems="center" justifyContent="center" inline>
<Typography.Text variant="l-500" align="center" inline>
Drag and drop files here or click to upload
Drag and drop a file here or click to upload
<Layout.Stack
style="display: inline-flex; vertical-align: middle;"
inline
Expand Down
Loading