Skip to content

Commit a6d6223

Browse files
authored
Merge pull request #2406 from appwrite/hmacr/ser-213
2 parents acaff6f + 029c57d commit a6d6223

File tree

2 files changed

+66
-68
lines changed

2 files changed

+66
-68
lines changed
Lines changed: 45 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,51 @@
11
<script>
2-
import { Container } from '$lib/layout';
2+
import { base } from '$app/paths';
33
import { loading } from '$routes/store';
4+
import { app } from '$lib/stores/app';
5+
import { Layout, Typography } from '@appwrite.io/pink-svelte';
46
57
loading.set(false);
68
</script>
79

8-
<Container>
9-
<slot />
10-
</Container>
10+
<Layout.Stack
11+
height="100vh"
12+
direction="column"
13+
alignItems="center"
14+
justifyContent="center"
15+
style="background: var(--bgcolor-neutral-primary, #fff);">
16+
<section class="console-container">
17+
<slot />
18+
</section>
19+
<footer>
20+
<Typography.Eyebrow color="--fgcolor-neutral-secondary">POWERED BY</Typography.Eyebrow>
21+
{#if $app.themeInUse === 'dark'}
22+
<img
23+
src="{base}/images/appwrite-logo-dark.svg"
24+
width="120"
25+
height="22"
26+
alt="Appwrite Logo" />
27+
{:else}
28+
<img
29+
src="{base}/images/appwrite-logo-light.svg"
30+
width="120"
31+
height="22"
32+
alt="Appwrite Logo" />
33+
{/if}
34+
</footer>
35+
</Layout.Stack>
36+
37+
<style lang="scss">
38+
section {
39+
flex: 1;
40+
display: flex;
41+
align-items: center;
42+
}
43+
footer {
44+
padding: 2rem 1rem;
45+
display: flex;
46+
gap: 0.5rem;
47+
justify-content: center;
48+
align-items: center;
49+
flex-wrap: wrap;
50+
}
51+
</style>
Lines changed: 21 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,21 @@
11
<script lang="ts">
2-
import { app } from '$lib/stores/app';
3-
import AppwriteLogoDark from '$lib/images/appwrite-logo-dark.svg';
4-
import AppwriteLogoLight from '$lib/images/appwrite-logo-light.svg';
52
import { Vcs, Client } from '@appwrite.io/console';
63
import { onMount } from 'svelte';
74
import { getApiEndpoint } from '$lib/stores/sdk';
5+
import { Badge, Layout, Typography } from '@appwrite.io/pink-svelte';
6+
import { Button } from '$lib/elements/forms';
87
9-
export let data;
8+
const { data } = $props();
109
1110
const endpoint = getApiEndpoint();
1211
const client = new Client();
1312
const vcs = new Vcs(client);
1413
15-
let installationId: string;
16-
let repositoryId: string;
17-
let providerPullRequestId: string;
18-
19-
let error = '';
20-
let success = '';
21-
let loading = false;
14+
let error = $state('');
15+
let success = $state('');
16+
let loading = $state(false);
2217
2318
onMount(async () => {
24-
repositoryId = data.repositoryId;
25-
installationId = data.installationId;
26-
providerPullRequestId = data.providerPullRequestId;
27-
2819
client.setEndpoint(endpoint).setProject(data.projectId).setMode('admin');
2920
});
3021
@@ -39,9 +30,9 @@
3930
4031
try {
4132
await vcs.updateExternalDeployments({
42-
installationId,
43-
repositoryId,
44-
providerPullRequestId
33+
installationId: data.installationId,
34+
repositoryId: data.repositoryId,
35+
providerPullRequestId: data.providerPullRequestId
4536
});
4637
success = 'Deployment approved successfully! Build will start soon.';
4738
} catch (e) {
@@ -52,49 +43,15 @@
5243
}
5344
</script>
5445

55-
<section class="container" style="display: grid; place-items: center; min-height: 100vh;">
56-
<div class="u-flex u-flex-vertical u-cross-center" style="width: 100%">
57-
<div class="card" style="min-width: 600px; max-width: 100%;">
58-
<h1 class="heading-level-2">Authorize External Deployment</h1>
59-
<small style="margin-block-start: 8px;display: block;"
60-
>The deployment for pull request <code class="inline-code"
61-
>#{providerPullRequestId}</code> is awaiting approval. When authorized, deployments
62-
will be started.
63-
</small>
64-
65-
<div class="with-borders" style="margin-block-start: 1rem;display: block;">
66-
<button disabled={loading} on:click={approveDeployment} class="button" type="button"
67-
>Approve Deployment</button>
68-
</div>
69-
70-
{#if error}
71-
<p style="margin-block-start: 1rem" class="u-color-text-danger">{error}</p>
72-
{/if}
73-
74-
{#if success}
75-
<p style="margin-block-start: 1rem" class="u-color-text-success">{success}</p>
76-
{/if}
77-
</div>
78-
<div class="u-gap-4 u-flex u-main-center u-cross-center" style="margin-block-start: 2rem;">
79-
<span class="text">Powered by</span>
80-
<a
81-
href="https://appwrite.io/"
82-
target="_blank"
83-
style="display: grid;place-items: center;">
84-
{#if $app.themeInUse === 'dark'}
85-
<img
86-
src={AppwriteLogoDark}
87-
width="120"
88-
class="u-block u-only-dark"
89-
alt="Appwrite Logo" />
90-
{:else}
91-
<img
92-
src={AppwriteLogoLight}
93-
width="120"
94-
class="u-block u-only-light"
95-
alt="Appwrite Logo" />
96-
{/if}
97-
</a>
98-
</div>
99-
</div>
100-
</section>
46+
<Layout.Stack gap="l" alignItems="center" style="max-width: 500px;">
47+
{#if success}
48+
<Badge type="success" variant="secondary" content={success} />
49+
{:else if error}
50+
<Badge type="error" variant="secondary" content={error} />
51+
{/if}
52+
<Typography.Title size="l" align="center">
53+
The deployment for pull request #{data.providerPullRequestId}
54+
is awaiting approval. When authorized, deployments will be started.
55+
</Typography.Title>
56+
<Button on:click={approveDeployment} secondary>Approve Deployment</Button>
57+
</Layout.Stack>

0 commit comments

Comments
 (0)