push: remaining function templates

This commit is contained in:
Torsten Dittmann committed 2023-08-16 15:24:41 +02:00
1 parent 1452fa1f05
commit c090d16bec
16 files changed
+318 -361

No files matched your search

-7
View File
@@ -4,7 +4,6 @@
export let dismissible = false;
export let type: 'info' | 'success' | 'warning' | 'error' = 'info';
export let standalone = false;
export let buttons: Buttons[] = [];
export let isAction = false;
export let isStandalone = false;
@@ -65,9 +64,3 @@
{/if}
</div>
</section>
<style lang="scss">
.is-inline {
background-color: white;
}
</style>
+2 -1
View File
@@ -45,7 +45,8 @@
bind:this={element}
bind:checked={value}
on:invalid={handleInvalid}
on:click />
on:click
on:change />
</div>
{#if error}
<Helper type="warning">{error}</Helper>
-1
View File
@@ -10,7 +10,6 @@
TableCellHead,
TableCellText,
TableHeader,
TableList,
TableRow
} from '$lib/elements/table';
import { beforeNavigate } from '$app/navigation';
+14
View File
@@ -8,6 +8,7 @@ export const marketplace = [
events: [],
cron: '',
timeout: 15,
usecases: ['placeholder'],
runtimes: [
{
name: 'node-18.0',
@@ -64,6 +65,7 @@ export const marketplace = [
events: [],
cron: '',
timeout: 15,
usecases: ['placeholder'],
runtimes: [
{
name: 'node-18.0',
@@ -103,6 +105,7 @@ export const marketplace = [
events: [],
cron: '',
timeout: 15,
usecases: ['placeholder'],
runtimes: [
{
name: 'node-18.0',
@@ -136,6 +139,7 @@ export const marketplace = [
events: [],
cron: '',
timeout: 15,
usecases: ['placeholder'],
runtimes: [
{
name: 'node-18.0',
@@ -168,6 +172,7 @@ export const marketplace = [
events: [],
cron: '',
timeout: 15,
usecases: ['placeholder'],
runtimes: [
{
name: 'node-18.0',
@@ -192,6 +197,7 @@ export const marketplace = [
events: [],
cron: '',
timeout: 15,
usecases: ['placeholder'],
runtimes: [
{
name: 'node-18.0',
@@ -225,6 +231,7 @@ export const marketplace = [
events: [],
cron: '',
timeout: 15,
usecases: ['placeholder'],
runtimes: [
{
name: 'node-18.0',
@@ -264,6 +271,7 @@ export const marketplace = [
events: [],
cron: '',
timeout: 15,
usecases: ['placeholder'],
runtimes: [
{
name: 'node-18.0',
@@ -317,6 +325,7 @@ export const marketplace = [
events: [],
cron: '',
timeout: 15,
usecases: ['placeholder'],
runtimes: [
{
name: 'node-18.0',
@@ -386,6 +395,7 @@ export const marketplace = [
events: [],
cron: '',
timeout: 15,
usecases: ['placeholder'],
runtimes: [
{
name: 'node-18.0',
@@ -461,6 +471,7 @@ export const marketplace = [
events: [],
cron: '',
timeout: 15,
usecases: ['placeholder'],
runtimes: [
{
name: 'node-18.0',
@@ -511,6 +522,7 @@ export const marketplace = [
events: [],
cron: '',
timeout: 15,
usecases: ['placeholder'],
runtimes: [
{
name: 'node-18.0',
@@ -561,6 +573,7 @@ export const marketplace = [
events: [],
cron: '',
timeout: 15,
usecases: ['placeholder'],
runtimes: [
{
name: 'node-18.0',
@@ -641,6 +654,7 @@ export type MarketplaceTemplate = {
events: string[];
cron: string;
timeout: number;
usecases: string[];
runtimes: Runtime[];
instructions: string;
vcsProvider: string;
+29 -28
View File
@@ -1,33 +1,7 @@
<script lang="ts">
import { base } from '$app/paths';
import { Heading } from '$lib/components';
import { clickOnEnter } from '$lib/helpers/a11y';
import WizardCover from '$lib/layout/wizardCover.svelte';
import { app } from '$lib/stores/app';
import { wizard } from '$lib/stores/wizard';
import type { Models } from '@appwrite.io/console';
import Repositories from './components/repositories.svelte';
import CreateManual from './createManual.svelte';
import { repository, templateConfig, template as templateStore } from './store';
import CreateGit from './createGit.svelte';
import { marketplace, type MarketplaceTemplate } from '$lib/stores/marketplace';
import { sdk } from '$lib/stores/sdk';
<script context="module" lang="ts">
import CreateTemplate from './createTemplate.svelte';
let hasInstallations: boolean;
let selectedRepository: string;
const quickStart = marketplace.find((template) => template.id === 'starter');
const templates = marketplace
.filter((template) => template.id !== 'starter')
.filter((_template, index) => index < 3);
function connect(event: CustomEvent<Models.ProviderRepository>) {
repository.set(event.detail);
wizard.start(CreateGit);
}
function connectTemplate(template: MarketplaceTemplate, runtime: string | null = null) {
export function connectTemplate(template: MarketplaceTemplate, runtime: string | null = null) {
const variables: any = {};
template.variables.forEach((variable) => {
variables[variable.name] = variable.value ?? '';
@@ -50,6 +24,33 @@
});
wizard.start(CreateTemplate);
}
</script>
<script lang="ts">
import { base } from '$app/paths';
import { Heading } from '$lib/components';
import { clickOnEnter } from '$lib/helpers/a11y';
import WizardCover from '$lib/layout/wizardCover.svelte';
import { app } from '$lib/stores/app';
import { wizard } from '$lib/stores/wizard';
import { repository, templateConfig, template as templateStore } from './store';
import { marketplace, type MarketplaceTemplate } from '$lib/stores/marketplace';
import { sdk } from '$lib/stores/sdk';
import type { Models } from '@appwrite.io/console';
import Repositories from './components/repositories.svelte';
import CreateManual from './createManual.svelte';
import CreateGit from './createGit.svelte';
let hasInstallations: boolean;
let selectedRepository: string;
const quickStart = marketplace.find((template) => template.id === 'starter');
const templates = marketplace.filter((template) => template.id !== 'starter').slice(0, 3);
function connect(event: CustomEvent<Models.Repository>) {
repository.set(event.detail);
wizard.start(CreateGit);
}
async function loadRuntimes() {
let runtimes = await sdk.forProject.functions.listRuntimes();
@@ -1,12 +1,7 @@
<script lang="ts">
import { page } from '$app/stores';
import Alert from '$lib/components/alert.svelte';
import CustomId from '$lib/components/customId.svelte';
import Button from '$lib/elements/forms/button.svelte';
import FormList from '$lib/elements/forms/formList.svelte';
import InputSelect from '$lib/elements/forms/inputSelect.svelte';
import InputText from '$lib/elements/forms/inputText.svelte';
import Pill from '$lib/elements/pill.svelte';
import { CustomId } from '$lib/components';
import { Pill } from '$lib/elements';
import { FormList, InputSelect, InputText } from '$lib/elements/forms';
import { WizardStep } from '$lib/layout';
import { sdk } from '$lib/stores/sdk';
import { template, templateConfig } from '../store';
@@ -36,7 +36,6 @@
});
});
$: $registerCommands([
{
label: 'Create deployment',
@@ -37,7 +37,7 @@
});
});
function showLogs(execution: Models.Execution) {
function showLogs(execution: Models.Execution<Record<string, string>>) {
$log.show = true;
$log.func = $func;
$log.data = execution;
@@ -50,7 +50,7 @@
</div>
{#if !$func.logging}
<div class="common-section">
<Alert type="info" standalone>
<Alert type="info" isStandalone>
<svelte:fragment slot="title">Your execution logs are disabled</svelte:fragment>
To see the latest execution logs, enable them in your
@@ -120,7 +120,7 @@
<Button text external href="https://appwrite.io/docs/functions#execute">
Documentation
</Button>
<Create bind:showCreate />
<Create bind:showCreateManual={showCreate} />
</div>
</EmptySearch>
{/if}
@@ -1,54 +1,66 @@
<script lang="ts">
import { Collapsible, CollapsibleItem } from '$lib/components/index.js';
import { CARD_LIMIT } from '$lib/constants';
import { InputCheckbox } from '$lib/elements/forms';
import { goto } from '$app/navigation';
import { base } from '$app/paths';
import { page } from '$app/stores';
import { Collapsible, CollapsibleItem, Pagination } from '$lib/components';
import { Container } from '$lib/layout';
import data from './data.json';
import { app } from '$lib/stores/app';
import { connectTemplate } from '$lib/wizards/functions/cover.svelte';
let search = '';
let page = 1;
export let data;
const filter = {
runtimes: {},
useCases: {}
};
let searchElement: HTMLInputElement;
const [runtimes, useCases] = data.reduce(
([rt, uc], next) => {
next.runtimes.forEach((runtime) => rt.add(runtime.name));
next.useCases.forEach((useCase) => uc.add(useCase));
return [rt, uc];
},
[new Set<string>(), new Set<string>()]
);
function applyFilter(filter: string, value: string, event: Event) {
const add = (event.target as EventTarget & HTMLInputElement).checked;
const target = new URL($page.url);
if (add) {
target.searchParams.append(filter, value);
} else {
const previous = target.searchParams.getAll(filter).filter((n) => n !== value);
target.searchParams.delete(filter);
previous.forEach((n) => target.searchParams.append(filter, n));
}
target.searchParams.delete('page');
goto(target.toString());
}
$: templates = data
.filter((template) => {
const hasRuntime = template.runtimes.some(
(runtime) => filter.runtimes[runtime.name] ?? false
);
if (Object.values(filter.runtimes).some((n) => n) && !hasRuntime) {
return false;
}
function applySearch(event: Event) {
const value = (event.target as EventTarget & HTMLInputElement).value;
const target = new URL($page.url);
const hasUseCase = template.useCases.some(
(useCase) => filter.useCases[useCase] ?? false
);
if (Object.values(filter.useCases).some((n) => n) && !hasUseCase) {
return false;
}
if (value.length > 0) {
target.searchParams.set('search', value);
} else {
target.searchParams.delete('search');
}
target.searchParams.delete('page');
goto(target.toString(), { keepFocus: true });
}
return template.name.toLowerCase().includes(search.toLowerCase());
})
.splice((page - 1) * CARD_LIMIT, CARD_LIMIT);
function clearSearch() {
const target = new URL($page.url);
target.searchParams.delete('page');
target.searchParams.delete('search');
searchElement.value = '';
goto(target.toString());
}
/**
* Reset filters on pagination
*/
$: {
filter;
search;
page = 1;
function getIconFromRuntime(runtime: string) {
switch (true) {
case runtime.includes('node'):
return 'node';
case runtime.includes('php'):
return 'php';
case runtime.includes('ruby'):
return 'ruby';
case runtime.includes('python'):
return 'python';
case runtime.includes('dart'):
return 'dart';
default:
return undefined;
}
}
</script>
@@ -59,10 +71,14 @@
<div
class="input-text-wrapper is-with-end-button u-width-full-line u-max-width-500 u-margin-block-start-12"
style="--amount-of-buttons:1">
<input bind:value={search} type="search" placeholder="Search templates" />
<input
bind:this={searchElement}
on:input={applySearch}
type="search"
placeholder="Search templates" />
<div class="icon-search" aria-hidden="true" />
<button
on:click={() => (search = '')}
on:click={clearSearch}
class="button is-text is-only-icon"
aria-label="Clear search"
style="--button-size:1.5rem;">
@@ -72,20 +88,37 @@
<Collapsible>
<CollapsibleItem>
<svelte:fragment slot="title">Use case</svelte:fragment>
{#each [...useCases] as useCase}
<InputCheckbox
id={`useCase-${useCase}`}
label={useCase}
bind:value={filter.useCases[useCase]} />
{#each [...data.useCases] as useCase}
<div class="input-text-wrapper">
<input
id={`useCase-${useCase}`}
type="checkbox"
value={$page.url.searchParams.getAll('useCase').includes(useCase)}
on:change={(e) => applyFilter('useCase', useCase, e)} />
<label for={`useCase-${useCase}`}>{useCase}</label>
</div>
{/each}
</CollapsibleItem>
<CollapsibleItem>
<svelte:fragment slot="title">Runtime</svelte:fragment>
{#each [...runtimes] as runtime}
<InputCheckbox
id={`runtime-${runtime}`}
label={runtime}
bind:value={filter.runtimes[runtime]} />
{#each [...data.runtimes] as runtime}
{@const icon = getIconFromRuntime(runtime)}
<div class="u-flex">
<input
id={`runtime-${runtime}`}
type="checkbox"
checked={$page.url.searchParams.getAll('runtime').includes(runtime)}
on:change={(e) => applyFilter('runtime', runtime, e)} />
<div class="avatar is-size-x-small">
<img
style:--p-text-size="16px"
src={`${base}/icons/${$app.themeInUse}/color/${icon}.svg`}
alt={icon}
aria-hidden="true"
aria-label={icon} />
</div>
<label for={`runtime-${runtime}`}>{runtime}</label>
</div>
{/each}
</CollapsibleItem>
</Collapsible>
@@ -105,24 +138,28 @@
<ul
class="grid-box"
style="--grid-item-size:22rem; --grid-item-size-small-screens:19rem">
{#each templates as template}
{#each data.templates as template}
<li>
<article class="card">
<div class="u-flex u-gap-16">
<h2 class="body-text-1 u-bold u-trim">
{template.name}
</h2>
<ul class="avatars-group is-with-border">
{#each template.runtimes as runtime}
<li class="avatars-group-item">
<div class="avatar is-size-small">
<span
class={`icon-${runtime.name}`}
aria-hidden="true"
aria-label="GitHub" />
</div>
</li>
{@const icon = getIconFromRuntime(runtime.name)}
{#if icon}
<li class="avatars-group-item">
<div class="avatar is-size-small">
<img
style:--p-text-size="20px"
src={`${base}/icons/${$app.themeInUse}/color/${icon}.svg`}
alt={icon}
aria-hidden="true"
aria-label={icon} />
</div>
</li>
{/if}
{/each}
</ul>
</div>
@@ -132,10 +169,14 @@
</p>
<div class="u-flex u-gap-16 u-main-end u-margin-block-start-24">
<button class="button is-text">
<a
href={`${base}/console/project-${$page.params.project}/functions/templates/template-${template.id}`}
class="button is-text">
<span class="text">View details</span>
</button>
<button class="button is-secondary">
</a>
<button
class="button is-secondary"
on:click={() => connectTemplate(template)}>
<span class="text">Create function</span>
</button>
</div>
@@ -145,24 +186,9 @@
</ul>
</section>
</div>
<div class="u-flex common-section u-main-space-between">
<p class="text">Total results: {templates.length}</p>
<nav class="pagination">
<button class="button is-text" aria-label="prev page" on:click={() => page--}>
<span class="icon-cheveron-left" aria-hidden="true" />
<span class="text">Prev</span>
</button>
<ol class="pagination-list is-only-desktop">
<li class="pagination-item">
<button class="button" aria-label="page">
<span class="text">1</span>
</button>
</li>
</ol>
<button class="button is-text" aria-label="next page" on:click={() => page++}>
<span class="text">Next</span>
<span class="icon-cheveron-right" aria-hidden="true" />
</button>
</nav>
<div class="u-flex u-margin-block-start-32 u-flex-wrap">
<div class="u-margin-inline-start-auto">
<Pagination limit={data.limit} offset={data.offset} sum={data.sum} />
</div>
</div>
</Container>
@@ -0,0 +1,58 @@
import { CARD_LIMIT } from '$lib/constants';
import { getPage, getSearch, getView, pageToOffset, View } from '$lib/helpers/load';
import { marketplace } from '$lib/stores/marketplace';
import type { PageLoad } from './$types';
export const load: PageLoad = async ({ url, route }) => {
const limit = CARD_LIMIT;
const page = getPage(url);
const search = getSearch(url);
const view = getView(url, route, View.Grid);
const offset = pageToOffset(page, limit);
const filter = {
useCases: url.searchParams.getAll('useCase'),
runtimes: url.searchParams.getAll('runtime')
};
const [runtimes, useCases] = marketplace.reduce(
([rt, uc], next) => {
next.runtimes.forEach((runtime) => rt.add(runtime.name));
next.usecases.forEach((useCase) => uc.add(useCase));
return [rt, uc];
},
[new Set<string>(), new Set<string>()]
);
const templates = marketplace.filter((template) => {
if (
filter.runtimes.length > 0 &&
!template.runtimes.some((n) => filter.runtimes.includes(n.name))
) {
return false;
}
if (
filter.useCases.length > 0 &&
!template.usecases.some((n) => filter.useCases.includes(n))
) {
return false;
}
if (search) {
return template.name.toLowerCase().includes(search.toLowerCase());
} else {
console.log(template.name);
return true;
}
});
return {
offset,
limit,
view,
filter,
runtimes,
useCases,
sum: templates.length,
templates: templates.splice(((page === 0 ? 1 : page) - 1) * limit, limit)
};
};
@@ -1,226 +0,0 @@
[
{
"icon": "algolia",
"id": "sync-with-algolia",
"name": "Sync with Algolia",
"tagline": "Search your Appwrite Database with Algolia.",
"permissions": ["any"],
"events": ["users.*.create"],
"useCases": ["AI"],
"cron": "0 * * * *",
"timeout": 15,
"runtimes": [
{
"name": "node-18",
"entrypoint": "src/main.js",
"commands": "npm install"
}
],
"instructions": "# Some markdown stuff",
"vcsProvider": "github",
"vcsRepositoryName": "templates-for-node",
"vcsOwnerName": "loks0n",
"vcsRootDirectory": "sync-with-algolia",
"variables": [
{
"name": "ALGOLIA_API_KEY",
"description": "Algolia read-write API key.",
"value": "",
"placeholder": "sk_1df...h9jef",
"required": true
}
]
},
{
"icon": "algolia",
"id": "sync-with-algolia",
"name": "Sync with Algolia",
"tagline": "Search your Appwrite Database with Algolia.",
"permissions": ["any"],
"events": ["users.*.create"],
"useCases": ["AI", "Web3"],
"cron": "0 * * * *",
"timeout": 15,
"runtimes": [
{
"name": "node-16",
"entrypoint": "src/main.js",
"commands": "npm install"
}
],
"instructions": "# Some markdown stuff",
"vcsProvider": "github",
"vcsRepositoryName": "templates-for-node",
"vcsOwnerName": "loks0n",
"vcsRootDirectory": "sync-with-algolia",
"variables": [
{
"name": "ALGOLIA_API_KEY",
"description": "Algolia read-write API key.",
"value": "",
"placeholder": "sk_1df...h9jef",
"required": true
}
]
},
{
"icon": "algolia",
"id": "sync-with-algolia",
"name": "Sync with Algolia",
"tagline": "Search your Appwrite Database with Algolia.",
"permissions": ["any"],
"events": ["users.*.create"],
"useCases": ["AI"],
"cron": "0 * * * *",
"timeout": 15,
"runtimes": [
{
"name": "node-18",
"entrypoint": "src/main.js",
"commands": "npm install"
}
],
"instructions": "# Some markdown stuff",
"vcsProvider": "github",
"vcsRepositoryName": "templates-for-node",
"vcsOwnerName": "loks0n",
"vcsRootDirectory": "sync-with-algolia",
"variables": [
{
"name": "ALGOLIA_API_KEY",
"description": "Algolia read-write API key.",
"value": "",
"placeholder": "sk_1df...h9jef",
"required": true
}
]
},
{
"icon": "algolia",
"id": "sync-with-algolia",
"name": "Sync with Algolia",
"tagline": "Search your Appwrite Database with Algolia.",
"permissions": ["any"],
"events": ["users.*.create"],
"useCases": ["AI"],
"cron": "0 * * * *",
"timeout": 15,
"runtimes": [
{
"name": "node-18",
"entrypoint": "src/main.js",
"commands": "npm install"
}
],
"instructions": "# Some markdown stuff",
"vcsProvider": "github",
"vcsRepositoryName": "templates-for-node",
"vcsOwnerName": "loks0n",
"vcsRootDirectory": "sync-with-algolia",
"variables": [
{
"name": "ALGOLIA_API_KEY",
"description": "Algolia read-write API key.",
"value": "",
"placeholder": "sk_1df...h9jef",
"required": true
}
]
},
{
"icon": "algolia",
"id": "sync-with-algolia",
"name": "Sync with Algolia",
"tagline": "Search your Appwrite Database with Algolia.",
"permissions": ["any"],
"events": ["users.*.create"],
"useCases": ["AI"],
"cron": "0 * * * *",
"timeout": 15,
"runtimes": [
{
"name": "node-18",
"entrypoint": "src/main.js",
"commands": "npm install"
}
],
"instructions": "# Some markdown stuff",
"vcsProvider": "github",
"vcsRepositoryName": "templates-for-node",
"vcsOwnerName": "loks0n",
"vcsRootDirectory": "sync-with-algolia",
"variables": [
{
"name": "ALGOLIA_API_KEY",
"description": "Algolia read-write API key.",
"value": "",
"placeholder": "sk_1df...h9jef",
"required": true
}
]
},
{
"icon": "algolia",
"id": "sync-with-algolia",
"name": "Sync with Algolia",
"tagline": "Search your Appwrite Database with Algolia.",
"permissions": ["any"],
"events": ["users.*.create"],
"useCases": ["AI"],
"cron": "0 * * * *",
"timeout": 15,
"runtimes": [
{
"name": "node-18",
"entrypoint": "src/main.js",
"commands": "npm install"
}
],
"instructions": "# Some markdown stuff",
"vcsProvider": "github",
"vcsRepositoryName": "templates-for-node",
"vcsOwnerName": "loks0n",
"vcsRootDirectory": "sync-with-algolia",
"variables": [
{
"name": "ALGOLIA_API_KEY",
"description": "Algolia read-write API key.",
"value": "",
"placeholder": "sk_1df...h9jef",
"required": true
}
]
},
{
"icon": "algolia",
"id": "sync-with-algolia",
"name": "Sync with Algolia",
"tagline": "Search your Appwrite Database with Algolia.",
"permissions": ["any"],
"events": ["users.*.create"],
"useCases": ["AI"],
"cron": "0 * * * *",
"timeout": 15,
"runtimes": [
{
"name": "node-18",
"entrypoint": "src/main.js",
"commands": "npm install"
}
],
"instructions": "# Some markdown stuff",
"vcsProvider": "github",
"vcsRepositoryName": "templates-for-node",
"vcsOwnerName": "loks0n",
"vcsRootDirectory": "sync-with-algolia",
"variables": [
{
"name": "ALGOLIA_API_KEY",
"description": "Algolia read-write API key.",
"value": "",
"placeholder": "sk_1df...h9jef",
"required": true
}
]
}
]
@@ -0,0 +1,8 @@
import Header from './header.svelte';
import type { LayoutLoad } from './$types';
export const load: LayoutLoad = async () => {
return {
header: Header
};
};
@@ -0,0 +1,61 @@
<script lang="ts">
import { Card, Heading } from '$lib/components';
import { Pill } from '$lib/elements';
import { Button } from '$lib/elements/forms';
import { Container } from '$lib/layout';
import { connectTemplate } from '$lib/wizards/functions/cover.svelte';
import { template } from './store';
</script>
<Container>
<div class="grid-300px-1fr">
<section>
<h3 class="body-text-1 u-bold">Use cases</h3>
<div class="u-margin-block-start-8 u-flex u-flex-wrap u-gap-8">
{#each $template.usecases as useCase}
<Pill>{useCase}</Pill>
{/each}
</div>
<h3 class="body-text-1 u-bold u-margin-block-start-8">Runtimes</h3>
<div class="u-margin-block-start-8 u-flex u-flex-wrap u-gap-8">
{#each $template.runtimes as runtime}
<Pill>{runtime.name}</Pill>
{/each}
</div>
<section class="card u-margin-block-start-24">
<h4 class="body-text-1 u-bold">Published by</h4>
{$template.providerOwner}
</section>
</section>
<section>
<Card>
<Heading size="7" tag="h3">
<span class="u-flex u-cross-center u-gap-8">
<div class="avatar is-size-small">
<span
style:--p-text-size="20px"
class={$template.icon}
aria-hidden="true" />
</div>
{$template.name}
</span>
</Heading>
<p class="u-margin-block-start-24">{$template.tagline}</p>
<div class="u-flex u-gap-16 u-main-end u-margin-block-start-24">
<Button
text
href={`https://github.com/${$template.providerOwner}/${$template.providerRepositoryId}`}
external>
View source
<span class="icon-external-link" />
</Button>
<Button secondary on:click={() => connectTemplate($template)}>
Create function
</Button>
</div>
</Card>
<Card>{$template.instructions}</Card>
</section>
</div>
</Container>
@@ -0,0 +1,8 @@
import { marketplace } from '$lib/stores/marketplace';
import type { PageLoad } from './$types';
export const load: PageLoad = async ({ params }) => {
return {
template: marketplace.find((template) => template.id === params.template)
};
};
@@ -0,0 +1,15 @@
<script lang="ts">
import { page } from '$app/stores';
import { Id } from '$lib/components';
import { Cover, CoverTitle } from '$lib/layout';
import { template } from './store';
</script>
<Cover>
<svelte:fragment slot="header">
<CoverTitle href={`/console/project-${$page.params.project}/functions/templates`}>
{$template.name}
</CoverTitle>
<Id value={$template.id} event="user">{$template.id}</Id>
</svelte:fragment>
</Cover>
@@ -0,0 +1,5 @@
import { page } from '$app/stores';
import type { MarketplaceTemplate } from '$lib/stores/marketplace';
import { derived } from 'svelte/store';
export const template = derived(page, ($page) => $page.data.template as MarketplaceTemplate);