mirror of
https://github.com/appwrite/console.git
synced 2026-11-18 20:47:21 +00:00
feat: sort frameworks, sort domains
This commit is contained in:
1 parent
16939ce1e4
commit
1ccc279ddb
3 files changed
+50
-25
No files matched your search
@@ -12,28 +12,37 @@
|
||||
export let hideQRCode = true;
|
||||
|
||||
const dispatch = createEventDispatcher();
|
||||
|
||||
$: sortedDomains = domains?.rules?.sort((a, b) => {
|
||||
if (a?.trigger === 'manual' && b?.trigger !== 'manual') {
|
||||
return -1;
|
||||
} else if (a?.trigger !== 'manual' && b?.trigger === 'manual') {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
});
|
||||
</script>
|
||||
|
||||
<Layout.Stack gap="xxs" direction="row" alignItems="center">
|
||||
{#if domains?.total}
|
||||
<Link external href={`${$protocol}${domains.rules[0]?.domain}`} variant="muted">
|
||||
<Link external href={`${$protocol}${sortedDomains[0]?.domain}`} variant="muted">
|
||||
<Layout.Stack gap="xxs" direction="row" alignItems="center">
|
||||
<Trim alternativeTrim>
|
||||
<Typography.Text variant="m-400" color="--fgcolor-neutral-primary">
|
||||
{domains.rules[0]?.domain}
|
||||
{sortedDomains[0]?.domain}
|
||||
</Typography.Text>
|
||||
</Trim>
|
||||
</Layout.Stack>
|
||||
</Link>
|
||||
|
||||
{#if domains.rules.length > 1}
|
||||
{#if sortedDomains.length > 1}
|
||||
<Popover padding="none" let:toggle>
|
||||
<Tag size="xs" on:click={toggle}>
|
||||
+{domains.rules.length - 1}
|
||||
+{sortedDomains.length - 1}
|
||||
</Tag>
|
||||
<svelte:fragment slot="tooltip">
|
||||
<ActionMenu.Root>
|
||||
{#each domains.rules as rule, i}
|
||||
{#each sortedDomains as rule, i}
|
||||
{#if i !== 0}
|
||||
<ActionMenu.Item.Anchor
|
||||
href={`${$protocol}${rule.domain}`}
|
||||
|
||||
@@ -107,31 +107,17 @@
|
||||
<Accordion title="Framework" open>
|
||||
<Layout.Stack>
|
||||
{#each [...data.frameworks] as framework}
|
||||
{#if !framework.toLowerCase().includes('other')}
|
||||
<Layout.Stack direction="row" gap="s">
|
||||
<Selector.Checkbox
|
||||
id={framework}
|
||||
size="s"
|
||||
label={framework?.split('-')?.join(' ')}
|
||||
checked={page.url.searchParams
|
||||
.getAll('framework')
|
||||
.includes(framework)}
|
||||
on:change={(e) => applyFilter('framework', framework, e)} />
|
||||
</Layout.Stack>
|
||||
{/if}
|
||||
{/each}
|
||||
{#if data.frameworks.includes('Other')}
|
||||
<Layout.Stack direction="row" gap="s">
|
||||
<Selector.Checkbox
|
||||
id="other"
|
||||
id={framework}
|
||||
size="s"
|
||||
label="Other"
|
||||
label={framework?.split('-')?.join(' ')}
|
||||
checked={page.url.searchParams
|
||||
.getAll('framework')
|
||||
.includes('Other')}
|
||||
on:change={(e) => applyFilter('framework', 'Other', e)} />
|
||||
.includes(framework)}
|
||||
on:change={(e) => applyFilter('framework', framework, e)} />
|
||||
</Layout.Stack>
|
||||
{/if}
|
||||
{/each}
|
||||
</Layout.Stack>
|
||||
</Accordion>
|
||||
</Layout.Stack>
|
||||
|
||||
@@ -19,7 +19,37 @@ export const load = async ({ url, route }) => {
|
||||
[new Set<string>(), new Set<string>()]
|
||||
);
|
||||
|
||||
const frameworks = Array.from(frameworksSet).sort((a, b) => a.localeCompare(b));
|
||||
const frameworkOrder = [
|
||||
'Next.js',
|
||||
'Nuxt',
|
||||
'SvelteKit',
|
||||
'Astro',
|
||||
'Remix',
|
||||
'Flutter',
|
||||
'React',
|
||||
'Vue.js',
|
||||
'Svelte',
|
||||
'Lynx',
|
||||
'Angular',
|
||||
'Analog',
|
||||
'Vite',
|
||||
'Other'
|
||||
];
|
||||
const frameworks = Array.from(frameworksSet)
|
||||
.sort((a, b) => a.localeCompare(b))
|
||||
.sort((a, b) => {
|
||||
const aIndex = frameworkOrder.indexOf(a);
|
||||
const bIndex = frameworkOrder.indexOf(b);
|
||||
if (aIndex === -1 && bIndex === -1) {
|
||||
return a.localeCompare(b);
|
||||
} else if (aIndex === -1) {
|
||||
return 1;
|
||||
} else if (bIndex === -1) {
|
||||
return -1;
|
||||
}
|
||||
return aIndex - bIndex;
|
||||
});
|
||||
|
||||
const useCases = Array.from(useCasesSet).sort((a, b) => a.localeCompare(b));
|
||||
|
||||
const templates = siteTemplatesList.templates.filter((template) => {
|
||||
|
||||
Reference in new issue
Block a user