Skip to content

Commit 143a821

Browse files
committed
Merge branch 'feat-pink-v2' into feat-add-designer-role
2 parents f36ba40 + 2bd6b0e commit 143a821

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+893
-494
lines changed

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@
2323
"dependencies": {
2424
"@appwrite.io/console": "https://pkg.pr.new/appwrite/appwrite/@appwrite.io/console@e2f082e",
2525
"@appwrite.io/pink-icons": "0.25.0",
26-
"@appwrite.io/pink-icons-svelte": "https://pkg.pr.new/appwrite/pink/@appwrite.io/pink-icons-svelte@d1ce27d",
26+
"@appwrite.io/pink-icons-svelte": "https://pkg.pr.new/appwrite/pink/@appwrite.io/pink-icons-svelte@6b17cb23",
2727
"@appwrite.io/pink-legacy": "^1.0.3",
28-
"@appwrite.io/pink-svelte": "https://pkg.pr.new/appwrite/pink/@appwrite.io/pink-svelte@d1ce27d",
28+
"@appwrite.io/pink-svelte": "https://pkg.pr.new/appwrite/pink/@appwrite.io/pink-svelte@29b227f",
2929
"@popperjs/core": "^2.11.8",
3030
"@sentry/sveltekit": "^8.38.0",
3131
"@stripe/stripe-js": "^3.5.0",

pnpm-lock.yaml

+14-14
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/lib/actions/analytics.ts

+2
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,8 @@ export function isTrackingAllowed() {
138138
}
139139

140140
export enum Click {
141+
BackupCopyIdClick = 'click_backup_copy_id',
142+
BackupDeleteClick = 'click_backup_delete',
141143
BackupRestoreClick = 'click_backup_restore',
142144
BreadcrumbClick = 'click_breadcrumb',
143145
ConnectRepositoryClick = 'click_connect_repository',

src/lib/components/billing/selectPaymentMethod.svelte

+4-2
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,13 @@
5757
data: [method.brand]
5858
};
5959
})} />
60-
<div>
60+
<Layout.Stack direction="row" alignItems="center">
6161
<Button on:click={() => (showPaymentModal = true)} compact size="s">
6262
<Icon icon={IconPlus} slot="start" size="s" />
6363
Add payment method
6464
</Button>
65-
</div>
65+
<slot name="actions" />
66+
</Layout.Stack>
6667
{:else}
6768
<Card.Base variant="secondary" radius="s" padding="xs">
6869
<Layout.Stack direction="row">
@@ -79,6 +80,7 @@
7980
Add
8081
</Button>
8182
</Layout.Stack>
83+
<slot name="actions" />
8284
</Card.Base>
8385
{/if}
8486
</Layout.Stack>
+89
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
<script lang="ts">
2+
import { page } from '$app/state';
3+
import type { Writable } from 'svelte/store';
4+
import { preferences } from '$lib/stores/preferences';
5+
import { onMount, type Snippet } from 'svelte';
6+
import type { Column } from '$lib/helpers/types';
7+
import { ActionMenu, Layout, Popover, Selector } from '@appwrite.io/pink-svelte';
8+
9+
let {
10+
columns,
11+
isCustomCollection = false,
12+
allowNoColumns = false,
13+
children
14+
}: {
15+
columns: Writable<Column[]>;
16+
isCustomCollection?: boolean;
17+
allowNoColumns?: boolean;
18+
children: Snippet<[toggle: () => void, selectedColumnsNumber: number]>;
19+
} = $props();
20+
21+
onMount(async () => {
22+
if (isCustomCollection) {
23+
const prefs = preferences.getCustomCollectionColumns(page.params.collection);
24+
columns.set(
25+
$columns.map((column) => {
26+
column.hide = prefs?.includes(column.id) ?? false;
27+
return column;
28+
})
29+
);
30+
} else {
31+
const prefs = preferences.get(page.route);
32+
33+
// Override the shown columns only if a preference was set
34+
if (prefs?.columns) {
35+
columns.set(
36+
$columns.map((column) => {
37+
column.hide = prefs.columns?.includes(column.id) ?? false;
38+
return column;
39+
})
40+
);
41+
}
42+
}
43+
44+
columns.subscribe((ctx) => {
45+
const columns = ctx.filter((n) => n.hide === true).map((n) => n.id);
46+
47+
if (isCustomCollection) {
48+
preferences.setCustomCollectionColumns(columns);
49+
} else {
50+
preferences.setColumns(columns);
51+
}
52+
});
53+
});
54+
55+
let selectedColumnsNumber = $derived(
56+
$columns.reduce((acc, column) => {
57+
if (column.hide === true) return acc;
58+
59+
return ++acc;
60+
}, 0)
61+
);
62+
</script>
63+
64+
{#if $columns?.length}
65+
<Popover let:toggle placement="bottom-end" padding="none">
66+
{@render children(toggle, selectedColumnsNumber)}
67+
<svelte:fragment slot="tooltip">
68+
<ActionMenu.Root>
69+
{#each $columns as column}
70+
{#if !column?.exclude}
71+
<ActionMenu.Item.Button
72+
on:click={() => (column.hide = !column.hide)}
73+
disabled={allowNoColumns
74+
? false
75+
: selectedColumnsNumber <= 1 && column.hide !== true}>
76+
<Layout.Stack direction="row" gap="s">
77+
<Selector.Checkbox
78+
checked={!column.hide}
79+
size="s"
80+
on:click={() => (column.hide = !column.hide)} />
81+
{column.title}
82+
</Layout.Stack>
83+
</ActionMenu.Item.Button>
84+
{/if}
85+
{/each}
86+
</ActionMenu.Root>
87+
</svelte:fragment>
88+
</Popover>
89+
{/if}

src/lib/components/dualTimeView.svelte

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
if (!isMouseOverTooltip) {
7070
hideTooltip();
7171
}
72-
}, 50);
72+
}, 150);
7373
}
7474
7575
$: timeToString = time ? timeDifference(time) : 'Invalid time';
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
<script lang="ts">
2+
import { capitalize } from '$lib/helpers/string';
3+
import { IconChevronLeft, IconChevronRight } from '@appwrite.io/pink-icons-svelte';
4+
import { BottomSheet } from '..';
5+
import { addFilterAndApply, type FilterData } from './quickFilters';
6+
import type { Writable } from 'svelte/store';
7+
import type { Column } from '$lib/helpers/types';
8+
9+
let {
10+
openBottomSheet = $bindable(false),
11+
columns,
12+
filterCols = $bindable([]),
13+
analyticsSource
14+
}: {
15+
openBottomSheet: boolean;
16+
columns: Writable<Column[]>;
17+
filterCols: FilterData[];
18+
analyticsSource?: string;
19+
} = $props();
20+
21+
let subSheets = $derived(
22+
filterCols.map((col) => {
23+
return {
24+
title: col.title,
25+
top: {
26+
title: col.title,
27+
trailingIcon: IconChevronRight,
28+
items: col.options.map((o) => {
29+
return {
30+
title: capitalize(o.label),
31+
name: capitalize(o.label),
32+
options: col.options,
33+
checked: o.checked,
34+
onClick: () => {
35+
addFilterAndApply(
36+
col.id,
37+
col.title,
38+
col.operator,
39+
o.value,
40+
generateFilterArrayValue(col, o.value),
41+
$columns,
42+
analyticsSource ?? ''
43+
);
44+
}
45+
};
46+
})
47+
},
48+
bottom: {
49+
name: 'Back',
50+
items: [
51+
{
52+
name: 'Back',
53+
leadingIcon: IconChevronLeft,
54+
navigatePrevious: true
55+
}
56+
]
57+
}
58+
};
59+
})
60+
);
61+
62+
let filtersBottomSheet = $derived({
63+
top: {
64+
title: 'Filters',
65+
items: filterCols.map((col) => {
66+
return {
67+
name: col.title,
68+
onClick: () =>
69+
console.log(subSheets.find((sheet) => sheet?.title === col?.title)),
70+
subMenu: subSheets.find((sheet) => sheet?.title === col?.title),
71+
trailingIcon: IconChevronRight
72+
};
73+
})
74+
},
75+
bottom: {
76+
name: 'Clear All',
77+
items: [
78+
{
79+
name: 'Clear All',
80+
onClick: () => {
81+
filterCols.forEach((col) => {
82+
addFilterAndApply(
83+
col.id,
84+
col.title,
85+
col.operator,
86+
null,
87+
[],
88+
$columns,
89+
analyticsSource ?? ''
90+
);
91+
});
92+
}
93+
}
94+
]
95+
}
96+
});
97+
98+
function generateFilterArrayValue(col: FilterData, value: string) {
99+
if (!col?.array) return [];
100+
101+
if (col.options?.find((opt) => opt.value === value)?.checked) {
102+
return col.options
103+
?.filter((opt) => opt?.checked)
104+
.map((opt) => opt.value)
105+
.filter((item) => item !== value);
106+
} else {
107+
let arrayValue =
108+
col.options?.filter((opt) => opt?.checked)?.map((opt) => opt.value) ?? [];
109+
arrayValue = [...arrayValue, value];
110+
111+
return arrayValue;
112+
}
113+
}
114+
115+
$inspect(subSheets);
116+
</script>
117+
118+
<BottomSheet.Menu bind:isOpen={openBottomSheet} menu={filtersBottomSheet} />

src/lib/components/filters/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ export { default as CustomFilters } from './customFilters.svelte';
44
export { default as QuickFilters } from './quickFilters.svelte';
55
export { default as ParsedTagList } from './parsedTagList.svelte';
66
export { hasPageQueries, queryParamToMap, queries } from '$lib/components/filters/store';
7+
export { default as FiltersBottomSheet } from './filtersBottomSheet.svelte';

src/lib/components/filters/parsedTagList.svelte

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
{#if $parsedTags?.length}
1010
<Layout.Stack direction="row" gap="s" wrap="wrap" alignItems="center" inline>
11-
{#each $parsedTags as tag}
11+
{#each $parsedTags as tag (tag.tag)}
1212
<span>
1313
<Tooltip
1414
disabled={Array.isArray(tag.value) ? tag.value?.length < 3 : true}

0 commit comments

Comments
 (0)