Merge pull request #42 from appwrite/storage-2

feat: add suggested extensions to storage setting screen
This commit is contained in:
Torsten Dittmann authored and GitHub committed 2022-08-22 15:12:50 +02:00
commit 9f73c277da
7 files changed
+249 -242

No files matched your search

+1 -1
View File
@@ -88,7 +88,7 @@
</div>
<input
{id}
{placeholder}
placeholder={!tags.length ? placeholder : ''}
type="text"
class="tags-input-text"
bind:value
+4
View File
@@ -1,5 +1,6 @@
<script lang="ts">
export let disabled = false;
export let selected = false;
export let success = false;
export let warning = false;
export let danger = false;
@@ -18,6 +19,7 @@
rel={external ? 'noopener noreferrer' : ''}
class="tag"
class:is-disabled={disabled}
class:is-selected={selected}
class:is-success={success}
class:is-warning={warning}
class:is-danger={danger}
@@ -31,6 +33,7 @@
type={submit ? 'submit' : 'button'}
class="tag"
class:is-disabled={disabled}
class:is-selected={selected}
class:is-success={success}
class:is-warning={warning}
class:is-danger={danger}
@@ -41,6 +44,7 @@
<div
class="tag"
class:is-disabled={disabled}
class:is-selected={selected}
class:is-success={success}
class:is-warning={warning}
class:is-danger={danger}
+7 -3
View File
@@ -1,9 +1,10 @@
export function bytesToSize(bytes: number, decimals = 1) {
const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
export function calculateSize(bytes: number, decimals = 1) {
if (bytes === 0) return '0 Bytes';
const k = 1024;
const dm = decimals < 0 ? 0 : decimals;
const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
const i = Math.floor(Math.log(bytes) / Math.log(k));
@@ -11,7 +12,10 @@ export function bytesToSize(bytes: number, decimals = 1) {
}
export function sizeToBytes(value: number, unit: string) {
const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
const index = sizes.indexOf(unit);
return value * Math.pow(1024, index);
}
export function bytesToSize(value: number, unit: string) {
const index = sizes.indexOf(unit);
return value / Math.pow(1024, index);
}