Skip to content

Commit

Permalink
Merge pull request #643 from appwrite/feat-messaging-push-preview
Browse files Browse the repository at this point in the history
Update push and SMS previews to look like a mobile device
  • Loading branch information
TorstenDittmann authored Jan 2, 2024
2 parents 6b371da + 8530a2a commit e6f1846
Show file tree
Hide file tree
Showing 30 changed files with 601 additions and 209 deletions.
26 changes: 26 additions & 0 deletions src/lib/components/emptyFilter.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<script lang="ts">
import { Button } from '$lib/elements/forms';
import { EmptySearch } from '.';
import { queries } from './filters';
export let resource;
</script>

<EmptySearch hidePages>
<div class="common-section">
<div class="u-text-center common-section">
<b class="body-text-2 u-bold">Sorry, we couldn't find any {resource}.</b>
<p>There are no {resource} that match your filters.</p>
</div>
<div class="u-flex common-section u-main-center">
<Button
secondary
on:click={() => {
queries.clearAll();
queries.apply();
}}>
Clear filters
</Button>
</div>
</div>
</EmptySearch>
10 changes: 6 additions & 4 deletions src/lib/components/filters/content.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,12 @@
<div class="selects u-flex u-gap-8 u-margin-block-start-16">
<InputSelect
id="column"
options={$columns.map((c) => ({
label: c.title,
value: c.id
}))}
options={$columns
.filter((c) => c.filter !== false)
.map((c) => ({
label: c.title,
value: c.id
}))}
placeholder="Select column"
bind:value={columnId} />
<InputSelect
Expand Down
3 changes: 2 additions & 1 deletion src/lib/components/filters/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export { default as filters } from './filters.svelte';
export { default as Filters } from './filters.svelte';
export { hasPageQueries, queryParamToMap, queries } from '$lib/components/filters/store';
1 change: 1 addition & 0 deletions src/lib/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export { default as UploadBox } from './uploadBox.svelte';
export { default as List } from './list.svelte';
export { default as ListItem } from './listItem.svelte';
export { default as Empty } from './empty.svelte';
export { default as EmptyFilter } from './emptyFilter.svelte';
export { default as EmptySearch } from './emptySearch.svelte';
export { default as Drop } from './drop.svelte';
export { default as DropList } from './dropList.svelte';
Expand Down
7 changes: 7 additions & 0 deletions src/lib/helpers/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@ export type Column = {
id: string;
title: string;
type: ColumnType;
/**
* Set to false to hide by default
*/
show: boolean;
width?: number;
/**
* Set to false to disable filtering for this column
*/
filter?: boolean;
};
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
<script lang="ts">
import { page } from '$app/stores';
import { Empty, EmptySearch, Heading, PaginationWithLimit } from '$lib/components';
import Filters from '$lib/components/filters/filters.svelte';
import { hasPageQueries, queries } from '$lib/components/filters/store';
import { Filters, hasPageQueries, queries } from '$lib/components/filters';
import ViewSelector from '$lib/components/viewSelector.svelte';
import { Button } from '$lib/elements/forms';
import type { ColumnType } from '$lib/helpers/types';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { getLimit, getPage, getQuery, getView, pageToOffset, View } from '$lib/h
import { sdk } from '$lib/stores/sdk';
import { Query } from '@appwrite.io/console';
import type { PageLoad } from './$types';
import { queries, queryParamToMap } from '$lib/components/filters/store';
import { queries, queryParamToMap } from '$lib/components/filters';

export const load: PageLoad = async ({ params, depends, url, route }) => {
depends(Dependencies.DOCUMENTS);
Expand Down
5 changes: 4 additions & 1 deletion src/routes/console/project-[project]/messaging/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import { page } from '$app/stores';
import {
Empty,
EmptyFilter,
EmptySearch,
FloatingActionBar,
Heading,
Expand Down Expand Up @@ -30,7 +31,7 @@
import MessageStatusPill from './messageStatusPill.svelte';
import CreateMessageDropdown from './createMessageDropdown.svelte';
import ProviderType, { ProviderTypes } from './providerType.svelte';
import Filters from '$lib/components/filters/filters.svelte';
import { Filters, hasPageQueries } from '$lib/components/filters';
import FailedModal from './failedModal.svelte';
export let data: PageData;
Expand Down Expand Up @@ -183,6 +184,8 @@
limit={data.limit}
offset={data.offset}
total={data.messages.total} />
{:else if $hasPageQueries}
<EmptyFilter resource="messages" />
<!-- TODO: remove data.search != 'empty' when the API is ready with data -->
{:else if data.search && data.search != 'empty'}
<EmptySearch>
Expand Down
2 changes: 1 addition & 1 deletion src/routes/console/project-[project]/messaging/+page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { messages as data, providersById } from './store';
import type { Message } from './store';
import { Query } from '@appwrite.io/console';
import { sdk } from '$lib/stores/sdk';
import { queries, queryParamToMap } from '$lib/components/filters/store';
import { queries, queryParamToMap } from '$lib/components/filters';

export const load: PageLoad = async ({ url, route }) => {
const page = getPage(url);
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
export let showCreateDropdown = false;
</script>

<DropList bind:show={showCreateDropdown} scrollable>
<DropList bind:show={showCreateDropdown} scrollable placement="bottom-end">
<slot>
<Button on:click={() => (showCreateDropdown = !showCreateDropdown)} event="create_message">
<span class="icon-plus" aria-hidden="true" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
<CardGrid>
<div class="grid-1-2-col-1 u-flex-vertical u-cross-start u-gap-16">
<Heading tag="h6" size="7">Preview</Heading>
<PushPhone title={$message.data.title} body={$message.data.body} />
<div class="u-flex u-main-center u-margin-block-start-24 u-width-full-line">
<PushPhone title={$message.data.title} body={$message.data.body} />
</div>
</div>
<svelte:fragment slot="aside">
<FormList>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@
SearchQuery,
PaginationWithLimit,
Heading,
ViewSelector
ViewSelector,
EmptyFilter
} from '$lib/components';
import { Container } from '$lib/layout';
import type { PageData } from './$types';
import { columns } from './store';
import Filters from '$lib/components/filters/filters.svelte';
import { Filters, hasPageQueries } from '$lib/components/filters';
import CreateProviderDropdown from './createProviderDropdown.svelte';
import Table from './table.svelte';
Expand Down Expand Up @@ -68,6 +69,8 @@
limit={data.limit}
offset={data.offset}
total={data.providers.total} />
{:else if $hasPageQueries}
<EmptyFilter resource="providers" />
{:else if data.search && data.search != 'empty'}
<EmptySearch>
<div class="u-text-center">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
} from '$lib/helpers/load';
import { Dependencies, PAGE_LIMIT } from '$lib/constants';
import { providersById, type Provider } from '../store';
import { queries, queryParamToMap } from '$lib/components/filters/store';
import { queries, queryParamToMap } from '$lib/components/filters';

const providers = Object.values(providersById);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
): value is T[keyof T] => Object.values<string>(enumType).includes(value);
</script>

<DropList bind:show={showCreateDropdown} scrollable>
<DropList bind:show={showCreateDropdown} scrollable placement="bottom-end">
<slot>
<Button on:click={() => (showCreateDropdown = !showCreateDropdown)} event="create_provider">
<span class="icon-plus" aria-hidden="true" />
Expand Down
Loading

0 comments on commit e6f1846

Please sign in to comment.