diff --git a/src/lib/components/alert.svelte b/src/lib/components/alert.svelte
index 69b8721d5..c45d773a2 100644
--- a/src/lib/components/alert.svelte
+++ b/src/lib/components/alert.svelte
@@ -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}
-
-
diff --git a/src/lib/elements/forms/inputCheckbox.svelte b/src/lib/elements/forms/inputCheckbox.svelte
index 75630f033..24b0ee881 100644
--- a/src/lib/elements/forms/inputCheckbox.svelte
+++ b/src/lib/elements/forms/inputCheckbox.svelte
@@ -45,7 +45,8 @@
bind:this={element}
bind:checked={value}
on:invalid={handleInvalid}
- on:click />
+ on:click
+ on:change />
{#if error}
{error}
diff --git a/src/lib/layout/logs.svelte b/src/lib/layout/logs.svelte
index e7d5e3781..21c31dc7f 100644
--- a/src/lib/layout/logs.svelte
+++ b/src/lib/layout/logs.svelte
@@ -10,7 +10,6 @@
TableCellHead,
TableCellText,
TableHeader,
- TableList,
TableRow
} from '$lib/elements/table';
import { beforeNavigate } from '$app/navigation';
diff --git a/src/lib/stores/marketplace.ts b/src/lib/stores/marketplace.ts
index 2c590e51c..774ff4de1 100644
--- a/src/lib/stores/marketplace.ts
+++ b/src/lib/stores/marketplace.ts
@@ -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;
diff --git a/src/lib/wizards/functions/cover.svelte b/src/lib/wizards/functions/cover.svelte
index 4c8ff26b6..db6ebd69e 100644
--- a/src/lib/wizards/functions/cover.svelte
+++ b/src/lib/wizards/functions/cover.svelte
@@ -1,33 +1,7 @@
-
+
+
@@ -59,10 +71,14 @@
-
+
-
-
Total results: {templates.length}
-
+
diff --git a/src/routes/console/project-[project]/functions/templates/+page.ts b/src/routes/console/project-[project]/functions/templates/+page.ts
new file mode 100644
index 000000000..f344e2627
--- /dev/null
+++ b/src/routes/console/project-[project]/functions/templates/+page.ts
@@ -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
(), new Set()]
+ );
+
+ 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)
+ };
+};
diff --git a/src/routes/console/project-[project]/functions/templates/data.json b/src/routes/console/project-[project]/functions/templates/data.json
deleted file mode 100644
index 32baa778f..000000000
--- a/src/routes/console/project-[project]/functions/templates/data.json
+++ /dev/null
@@ -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
- }
- ]
- }
-]
diff --git a/src/routes/console/project-[project]/functions/templates/template-[template]/+layout.ts b/src/routes/console/project-[project]/functions/templates/template-[template]/+layout.ts
new file mode 100644
index 000000000..e0a2cb5e5
--- /dev/null
+++ b/src/routes/console/project-[project]/functions/templates/template-[template]/+layout.ts
@@ -0,0 +1,8 @@
+import Header from './header.svelte';
+import type { LayoutLoad } from './$types';
+
+export const load: LayoutLoad = async () => {
+ return {
+ header: Header
+ };
+};
diff --git a/src/routes/console/project-[project]/functions/templates/template-[template]/+page.svelte b/src/routes/console/project-[project]/functions/templates/template-[template]/+page.svelte
new file mode 100644
index 000000000..9370a48bc
--- /dev/null
+++ b/src/routes/console/project-[project]/functions/templates/template-[template]/+page.svelte
@@ -0,0 +1,61 @@
+
+
+
+
+
+ Use cases
+
+ {#each $template.usecases as useCase}
+
{useCase}
+ {/each}
+
+ Runtimes
+
+ {#each $template.runtimes as runtime}
+
{runtime.name}
+ {/each}
+
+
+
+ Published by
+ {$template.providerOwner}
+
+
+
+
+
+
+
+
+
+ {$template.name}
+
+
+ {$template.tagline}
+
+
+ View source
+
+
+ connectTemplate($template)}>
+ Create function
+
+
+
+ {$template.instructions}
+
+
+
diff --git a/src/routes/console/project-[project]/functions/templates/template-[template]/+page.ts b/src/routes/console/project-[project]/functions/templates/template-[template]/+page.ts
new file mode 100644
index 000000000..7936cc751
--- /dev/null
+++ b/src/routes/console/project-[project]/functions/templates/template-[template]/+page.ts
@@ -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)
+ };
+};
diff --git a/src/routes/console/project-[project]/functions/templates/template-[template]/header.svelte b/src/routes/console/project-[project]/functions/templates/template-[template]/header.svelte
new file mode 100644
index 000000000..00caf218b
--- /dev/null
+++ b/src/routes/console/project-[project]/functions/templates/template-[template]/header.svelte
@@ -0,0 +1,15 @@
+
+
+
+
+
+ {$template.name}
+
+ {$template.id}
+
+
diff --git a/src/routes/console/project-[project]/functions/templates/template-[template]/store.ts b/src/routes/console/project-[project]/functions/templates/template-[template]/store.ts
new file mode 100644
index 000000000..b39b8545b
--- /dev/null
+++ b/src/routes/console/project-[project]/functions/templates/template-[template]/store.ts
@@ -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);