|
1 | 1 | <script lang="ts"> |
2 | 2 | import { isSelfHosted } from '$lib/system'; |
3 | | - import { connectGitHub } from '$lib/stores/git'; |
| 3 | + import { connectGitHub, connectGitea } from '$lib/stores/git'; |
4 | 4 | import Button from '$lib/elements/forms/button.svelte'; |
5 | 5 | import { IconGithub } from '@appwrite.io/pink-icons-svelte'; |
6 | 6 | import { Alert, Card, Empty, Icon, Layout } from '@appwrite.io/pink-svelte'; |
7 | 7 | import { regionalConsoleVariables } from '$routes/(console)/project-[region]-[project]/store'; |
| 8 | + import IconGitea from './IconGitea.svelte'; |
8 | 9 |
|
9 | 10 | export let callbackState: Record<string, string> = null; |
10 | 11 |
|
11 | 12 | let isVcsEnabled = $regionalConsoleVariables?._APP_VCS_ENABLED === true; |
| 13 | + // Not in the SDK's generated types yet -- server already returns it. |
| 14 | + let vcsProviders = ($regionalConsoleVariables as { _APP_VCS_PROVIDERS?: string[] }) |
| 15 | + ?._APP_VCS_PROVIDERS; |
| 16 | + let isGiteaEnabled = vcsProviders?.includes('gitea') ?? false; |
12 | 17 | </script> |
13 | 18 |
|
14 | 19 | <Layout.Stack> |
|
35 | 40 | title="No installation was added to the project yet" |
36 | 41 | description="Add an installation to connect repositories"> |
37 | 42 | <svelte:fragment slot="actions"> |
38 | | - <Button |
39 | | - secondary |
40 | | - href={connectGitHub(callbackState).toString()} |
41 | | - disabled={!isVcsEnabled}> |
42 | | - <Icon slot="start" icon={IconGithub} /> |
43 | | - Connect to GitHub |
44 | | - </Button> |
| 43 | + <Layout.Stack direction="row"> |
| 44 | + <Button |
| 45 | + secondary |
| 46 | + href={connectGitHub(callbackState).toString()} |
| 47 | + disabled={!isVcsEnabled}> |
| 48 | + <Icon slot="start" icon={IconGithub} /> |
| 49 | + Connect to GitHub |
| 50 | + </Button> |
| 51 | + {#if isGiteaEnabled} |
| 52 | + <Button |
| 53 | + secondary |
| 54 | + href={connectGitea(callbackState).toString()} |
| 55 | + disabled={!isVcsEnabled}> |
| 56 | + <Icon slot="start" icon={IconGitea} /> |
| 57 | + Connect to Gitea |
| 58 | + </Button> |
| 59 | + {/if} |
| 60 | + </Layout.Stack> |
45 | 61 | </svelte:fragment> |
46 | 62 | </Empty> |
47 | 63 | </Card.Base> |
|
0 commit comments