fix: various small things

This commit is contained in:
Arman committed 2023-03-14 17:35:35 +01:00
1 parent 5570941eb1
commit 35aa40b5d6
9 files changed
+148 -68

No files matched your search

+22 -17
View File
@@ -44,23 +44,28 @@
});
</script>
{#if $prefs?.preferredView === 'list'}
<DropList bind:show={showSelectColumns} scrollable={true}>
<Button secondary on:click={() => (showSelectColumns = true)}>
<span class="icon-view-boards u-opacity-50 " aria-hidden="true" aria-label="columns" />
<span class="text">Columns</span>
<span class="inline-tag">{selectedColumnsNumber}</span>
</Button>
<svelte:fragment slot="list">
{#each $columns as column}
<InputChoice
id={column.id}
label={column.title}
bind:value={column.show}
disabled={selectedColumnsNumber <= 1 && column.show} />
{/each}
</svelte:fragment>
</DropList>
{#if $columns?.length}
{#if $prefs?.preferredView === 'list'}
<DropList bind:show={showSelectColumns} scrollable={true}>
<Button secondary on:click={() => (showSelectColumns = true)}>
<span
class="icon-view-boards u-opacity-50 "
aria-hidden="true"
aria-label="columns" />
<span class="text">Columns</span>
<span class="inline-tag">{selectedColumnsNumber}</span>
</Button>
<svelte:fragment slot="list">
{#each $columns as column}
<InputChoice
id={column.id}
label={column.title}
bind:value={column.show}
disabled={selectedColumnsNumber <= 1 && column.show} />
{/each}
</svelte:fragment>
</DropList>
{/if}
{/if}
{#if showToggle}
+6 -8
View File
@@ -19,14 +19,12 @@
onMount(async () => {
loading.set(false);
if (!$prefs) {
await prefs.load();
if (!$prefs?.preferredView) {
prefs.updatePrefs({
preferredView: 'grid',
pageLimit: 6
});
}
await prefs.load();
if (!$prefs?.preferredView) {
prefs.updatePrefs({
preferredView: 'grid',
pageLimit: 6
});
}
setInterval(() => {
@@ -25,7 +25,6 @@ export const load: PageLoad = async ({ params, parent, depends, url }) => {
Query.offset(offset),
Query.orderDesc('$createdAt')
]);
console.log('test');
await redirectOnOffsetOverflow(
offset,
@@ -23,6 +23,7 @@
import { columns } from './store';
import { onMount } from 'svelte';
import RelationshipsModal from './relationshipsModal.svelte';
import CreateAttributeDropdown from '../attributes/createAttributeDropdown.svelte';
export let data: PageData;
const projectId = $page.params.project;
@@ -30,6 +31,8 @@
let showCreateAttribute = false;
let showRelationships = false;
let selectedRelationship: string[] = null;
let showCreateDropdown = false;
let selectedAttribute: string = null;
function openWizard() {
wizard.start(Create);
@@ -178,13 +181,37 @@
on:click={openWizard} />
{/if}
{:else}
<Empty
single
href="https://appwrite.io/docs/databases#attributes"
target="attribute"
on:click={() => (showCreateAttribute = true)} />
<Empty single target="attribute" on:click={() => (showCreateDropdown = true)}>
<div class="u-text-center">
<Heading size="7" tag="h2">Create your first attribute to get started.</Heading>
<p class="body-text-2 u-margin-block-start-4">
Need a hand? Check out our documentation.
</p>
</div>
<div class="u-flex u-gap-16 u-main-center">
<Button
external
href="https://appwrite.io/docs/databases#attributes"
text
event="empty_documentation"
ariaLabel={`create {target}`}>Documentation</Button>
<CreateAttributeDropdown
bind:showCreateDropdown
bind:showCreate={showCreateAttribute}
bind:selectedOption={selectedAttribute}>
<Button
secondary
event="create_attribute"
on:click={() => {
showCreateDropdown = !showCreateDropdown;
}}>
Create attribute
</Button>
</CreateAttributeDropdown>
</div>
</Empty>
{/if}
</Container>
<CreateAttribute bind:showCreate={showCreateAttribute} />
<CreateAttribute bind:showCreate={showCreateAttribute} bind:selectedOption={selectedAttribute} />
<RelationshipsModal bind:show={showRelationships} {selectedRelationship} />
@@ -4,6 +4,8 @@
export let showCreate = false;
export let selectedRelationship: string = null;
const limit = 10;
let offset = 0;
$: if (!showCreate) {
selectedRelationship = null;
@@ -14,11 +16,15 @@
<svelte:fragment slot="header">
{selectedRelationship}
</svelte:fragment>
{#each selectedRelationship as relationship}
{relationship.data} {relationship.id}
{/each}
<svelte:fragment slot="footer">
<Button secondary disabled={!selectedRelationship} on:click={() => (showCreate = false)}>
Prev
</Button>
<Button secondary disabled={!selectedRelationship}>Next</Button>
<Button secondary disabled={!!offset} on:click={() => offset - limit}>Prev</Button>
<Button
secondary
disabled={selectedRelationship?.relationships?.length < offset}
on:click={() => offset + limit}>Next</Button>
</svelte:fragment>
</Modal>
@@ -15,9 +15,9 @@
import Create from '../createAttribute.svelte';
import CreateIndex from '../indexes/createIndex.svelte';
import { attributes, type Attributes } from '../store';
import CreateAttributeDropdown from './createAttributeDropdown.svelte';
import Delete from './deleteAttribute.svelte';
import Edit from './edit.svelte';
import { options } from './store';
let showCreateDropdown = false;
let showDropdown = [];
@@ -33,27 +33,7 @@
<div class="u-flex u-gap-12 common-section u-main-space-between">
<Heading tag="h2" size="5">Attributes</Heading>
<DropList bind:show={showCreateDropdown}>
<Button
on:click={() => (showCreateDropdown = !showCreateDropdown)}
event="create_attribute">
<span class="icon-plus" aria-hidden="true" />
<span class="text">Create attribute</span>
</Button>
<svelte:fragment slot="list">
{#each options as attribute}
<DropListItem
icon={attribute.icon}
on:click={() => {
selectedOption = attribute.name;
showCreateDropdown = false;
showCreate = true;
}}>
{attribute.name}
</DropListItem>
{/each}
</svelte:fragment>
</DropList>
<CreateAttributeDropdown bind:showCreateDropdown bind:selectedOption bind:showCreate />
</div>
{#if $attributes.length}
@@ -0,0 +1,34 @@
<script lang="ts">
import { DropList, DropListItem } from '$lib/components';
import { Button } from '$lib/elements/forms';
import { options } from './store';
export let showCreateDropdown = false;
export let selectedOption: string = null;
export let showCreate = false;
</script>
<DropList bind:show={showCreateDropdown}>
<slot>
<Button
on:click={() => (showCreateDropdown = !showCreateDropdown)}
event="create_attribute">
<span class="icon-plus" aria-hidden="true" />
<span class="text">Create attribute</span>
</Button>
</slot>
<svelte:fragment slot="list">
{#each options as attribute}
<DropListItem
icon={attribute.icon}
on:click={() => {
selectedOption = attribute.name;
showCreateDropdown = false;
showCreate = true;
}}>
{attribute.name}
</DropListItem>
{/each}
</svelte:fragment>
</DropList>
@@ -64,11 +64,15 @@
<Modal size="big" bind:show={showCreate} on:submit={submit} icon={$option?.icon}>
<svelte:fragment slot="header">
{selectedOption}
{#if selectedOption === 'Relationship'}
<div class="tag eyebrow-heading-3">
<span class="text u-x-small">Beta</span>
</div>
<span class="u-flex u-gap-16 u-cross-center">
{selectedOption}
<div class="tag eyebrow-heading-3">
<span class="text u-x-small">Beta</span>
</div>
</span>
{:else}
{selectedOption}
{/if}
</svelte:fragment>
<FormList>
@@ -20,6 +20,7 @@
import { invalidate } from '$app/navigation';
import { Dependencies } from '$lib/constants';
import { Button } from '$lib/elements/forms';
import CreateAttributeDropdown from '../attributes/createAttributeDropdown.svelte';
let showDropdown = [];
let selectedIndex: Models.Index = null;
@@ -27,6 +28,8 @@
let showOverview = false;
let showDelete = false;
let showCreateAttribute = false;
let showCreateDropdown = false;
let selectedAttribute: string = null;
const handleDelete = async () => {
invalidate(Dependencies.COLLECTION);
@@ -124,11 +127,35 @@
on:click={() => (showCreateIndex = true)} />
{/if}
{:else}
<Empty
single
target="attribute"
href="https://appwrite.io/docs/databases#attributes"
on:click={() => (showCreateAttribute = true)} />
<Empty single target="attribute" on:click={() => (showCreateDropdown = true)}>
<div class="u-text-center">
<Heading size="7" tag="h2">Create your first attribute to get started.</Heading>
<p class="body-text-2 u-margin-block-start-4">
Need a hand? Check out our documentation.
</p>
</div>
<div class="u-flex u-gap-16 u-main-center">
<Button
external
href="https://appwrite.io/docs/databases#attributes"
text
event="empty_documentation"
ariaLabel={`create {target}`}>Documentation</Button>
<CreateAttributeDropdown
bind:showCreateDropdown
bind:showCreate={showCreateAttribute}
bind:selectedOption={selectedAttribute}>
<Button
secondary
event="create_attribute"
on:click={() => {
showCreateDropdown = !showCreateDropdown;
}}>
Create attribute
</Button>
</CreateAttributeDropdown>
</div>
</Empty>
{/if}
</Container>
@@ -139,4 +166,4 @@
<Overview bind:showOverview {selectedIndex} />
{/if}
<CreateAttribute bind:showCreate={showCreateAttribute} />
<CreateAttribute bind:showCreate={showCreateAttribute} bind:selectedOption={selectedAttribute} />