File tree Expand file tree Collapse file tree 3 files changed +38
-0
lines changed
routes/(console)/project-[region]-[project]/sites/create-site
templates/template-[template] Expand file tree Collapse file tree 3 files changed +38
-0
lines changed Original file line number Diff line number Diff line change
1
+ import type { Models } from '@appwrite.io/console' ;
2
+
3
+ /**
4
+ * Build VCS repo URL from the template response model.
5
+ * Example (GitHub): https://github.com/appwrite/templates-for-sites
6
+ */
7
+ export function getTemplateSourceUrl (
8
+ t : Models . TemplateSite | Models . TemplateFunction
9
+ ) : string | null {
10
+ const owner = t . providerOwner ;
11
+ const repo = t . providerRepositoryId ;
12
+ const provider = t . vcsProvider ; // e.g., "github"
13
+
14
+ if ( ! owner || ! repo || ! provider ) return null ;
15
+
16
+ // Map provider → host (extend if needed)
17
+ const hostMap : Record < string , string > = {
18
+ github : 'github.com' ,
19
+ gitlab : 'gitlab.com' ,
20
+ bitbucket : 'bitbucket.org'
21
+ } ;
22
+
23
+ const host = hostMap [ provider . toLowerCase ( ) ] ?? provider ; // fallback
24
+
25
+ return `https://${ host } /${ owner } /${ repo } ` ;
26
+ }
Original file line number Diff line number Diff line change 62
62
</Typography .Text >
63
63
</Layout .Stack >
64
64
</Layout .Stack >
65
+ <slot name =" framework-actions" />
65
66
{/if }
66
67
67
68
{#if domain && showAfter }
Original file line number Diff line number Diff line change 37
37
import { connectGitHub } from ' $lib/stores/git' ;
38
38
import { getFrameworkIcon } from ' $lib/stores/sites' ;
39
39
import { regionalConsoleVariables } from ' $routes/(console)/project-[region]-[project]/store' ;
40
+ import { getTemplateSourceUrl } from ' $lib/helpers/templateSource' ;
40
41
41
42
export let data;
42
43
351
352
alt ={data .template .name }
352
353
ratio =" 16/9" />
353
354
</Layout .Stack >
355
+
356
+ <svelte:fragment slot =" framework-actions" >
357
+ {@const sourceUrl = getTemplateSourceUrl (data .template )}
358
+ {#if sourceUrl }
359
+ <Button secondary size ="s" external href ={sourceUrl }>
360
+ View source
361
+ <Icon icon ={IconExternalLink } slot =" end" size =" s" />
362
+ </Button >
363
+ {/if }
364
+ </svelte:fragment >
354
365
</Aside >
355
366
</svelte:fragment >
356
367
You can’t perform that action at this time.
0 commit comments