|
1 | 1 | <script lang="ts"> |
2 | 2 | import { page } from '$app/state'; |
| 3 | + import AuthUtilityLayout from '$lib/components/auth/AuthUtilityLayout.svelte'; |
3 | 4 | import { inject } from '@gitbutler/core/context'; |
4 | 5 | import { LOGIN_SERVICE } from '@gitbutler/shared/login/loginService'; |
5 | | - import { Button, SectionCard } from '@gitbutler/ui'; |
| 6 | + import { Button, InfoMessage, EmailTextbox } from '@gitbutler/ui'; |
6 | 7 |
|
7 | 8 | let error = $state<string>(); |
8 | | - let notice = $state<string>(); |
| 9 | + let message = $state<string>(); |
9 | 10 |
|
10 | 11 | const loginService = inject(LOGIN_SERVICE); |
11 | 12 |
|
|
31 | 32 | error = response.errorMessage; |
32 | 33 | console.error('Failed to resend confirmation email:', response.raw ?? response.errorMessage); |
33 | 34 | } else { |
34 | | - notice = 'Confirmation email resent. Please check your inbox.'; |
| 35 | + message = 'Confirmation email resent. Please check your inbox.'; |
35 | 36 | } |
36 | 37 | } |
37 | 38 | </script> |
38 | 39 |
|
39 | 40 | <svelte:head> |
40 | | - <title>GitButler | Sign Up</title> |
| 41 | + <title>GitButler | Resend Confirmation</title> |
41 | 42 | </svelte:head> |
42 | 43 |
|
43 | | -{#if banner} |
44 | | - <div class="banner"> |
45 | | - <span>{banner}</span> |
46 | | - </div> |
47 | | -{/if} |
48 | | - |
49 | | -<div class="resend-confirmation-email"> |
50 | | - <SectionCard> |
51 | | - <h1 class="title">Resend Confirmation Email</h1> |
52 | | - {#if email} |
53 | | - <p> |
54 | | - We will send a confirmation email to <strong>{email}</strong>. |
55 | | - </p> |
56 | | - {:else} |
57 | | - <p>Please provide your email address to resend the confirmation email.</p> |
58 | | - |
59 | | - <div class="field"> |
60 | | - <label for="email">Email</label> |
61 | | - <input id="email" type="email" bind:value={inputEmail} required /> |
62 | | - </div> |
63 | | - {/if} |
64 | | - |
65 | | - <Button style="pop" disabled={!emailToSendTo} onclick={resendConfirmationEmail} |
66 | | - >Resend Confirmation Email</Button |
67 | | - > |
68 | | - |
69 | | - {#if error} |
70 | | - <div class="error-message"> |
71 | | - <span> |
72 | | - {error} |
73 | | - </span> |
74 | | - </div> |
75 | | - {/if} |
76 | | - |
77 | | - {#if notice} |
78 | | - <div class="notice-message"> |
79 | | - <span> |
80 | | - {notice} |
81 | | - </span> |
82 | | - </div> |
83 | | - {/if} |
84 | | - </SectionCard> |
85 | | -</div> |
86 | | - |
87 | | -<style lang="postcss"> |
88 | | - .banner { |
89 | | - display: flex; |
90 | | - align-items: center; |
91 | | - justify-content: center; |
92 | | - max-width: 400px; |
93 | | - margin: 0 auto; |
94 | | - margin-bottom: 16px; |
95 | | - padding: 16px; |
96 | | - border: var(--clr-scale-err-60) 1px solid; |
97 | | - border-radius: var(--radius-m); |
98 | | - background-color: var(--clr-theme-err-bg-muted); |
99 | | - color: var(--clr-scale-err-10); |
100 | | - font-size: 14px; |
101 | | - } |
102 | | -
|
103 | | - .resend-confirmation-email { |
104 | | - display: flex; |
105 | | - flex-direction: column; |
106 | | - max-width: 400px; |
107 | | - margin: 0 auto; |
108 | | - gap: 16px; |
109 | | - } |
110 | | -
|
111 | | - .title { |
112 | | - align-self: flex-start; |
113 | | - color: var(--clr-scale-ntrl-0); |
114 | | - font-weight: 600; |
115 | | - font-size: 24px; |
116 | | - } |
117 | | -
|
118 | | - .field { |
119 | | - display: flex; |
120 | | - flex-direction: column; |
121 | | - gap: 4px; |
122 | | -
|
123 | | - label { |
124 | | - color: var(--clr-scale-ntrl-30); |
125 | | - font-size: 14px; |
126 | | - } |
127 | | -
|
128 | | - input { |
129 | | - padding: 8px 12px; |
130 | | - border: 1px solid var(--clr-border-2); |
131 | | - border-radius: var(--radius-m); |
132 | | - background-color: var(--clr-bg-1); |
133 | | - color: var(--clr-scale-ntrl-0); |
134 | | - font-size: 14px; |
135 | | -
|
136 | | - &:read-only { |
137 | | - cursor: not-allowed; |
138 | | - opacity: 0.7; |
139 | | - } |
140 | | -
|
141 | | - &:not(:read-only) { |
142 | | - &:focus { |
143 | | - border-color: var(--clr-scale-pop-70); |
144 | | - outline: none; |
145 | | - } |
146 | | - } |
147 | | - } |
148 | | - } |
149 | | -
|
150 | | - .error-message { |
151 | | - display: flex; |
152 | | - flex-direction: column; |
153 | | - padding: 8px; |
154 | | - gap: 8px; |
155 | | - border: 1px solid var(--clr-scale-err-60); |
156 | | - border-radius: var(--radius-m); |
157 | | -
|
158 | | - background-color: var(--clr-theme-err-bg-muted); |
159 | | - color: var(--clr-scale-err-10); |
160 | | - font-size: 14px; |
161 | | - } |
162 | | -
|
163 | | - .notice-message { |
164 | | - display: flex; |
165 | | - flex-direction: column; |
166 | | - padding: 8px; |
167 | | - gap: 8px; |
168 | | - border: 1px solid var(--clr-scale-succ-60); |
169 | | - border-radius: var(--radius-m); |
170 | | -
|
171 | | - background-color: var(--clr-theme-succ-bg-muted); |
172 | | - color: var(--clr-scale-succ-10); |
173 | | - font-size: 14px; |
174 | | - } |
175 | | -</style> |
| 44 | +<AuthUtilityLayout title="Resend Confirmation"> |
| 45 | + {#if email} |
| 46 | + <p class="text-13 text-body"> |
| 47 | + We send a confirmation email to <i class="clr-text-2">{email}</i>. |
| 48 | + </p> |
| 49 | + {:else} |
| 50 | + <div class="stack-v gap-16"> |
| 51 | + <EmailTextbox |
| 52 | + bind:value={inputEmail} |
| 53 | + label="Email" |
| 54 | + helperText="Your email to resend confirmation" |
| 55 | + /> |
| 56 | + |
| 57 | + {#if error} |
| 58 | + <InfoMessage filled outlined={false} style="error"> |
| 59 | + {#snippet content()} |
| 60 | + {error} |
| 61 | + {/snippet} |
| 62 | + </InfoMessage> |
| 63 | + {/if} |
| 64 | + |
| 65 | + {#if message} |
| 66 | + <InfoMessage filled outlined={false} style="success"> |
| 67 | + {#snippet content()} |
| 68 | + {message} |
| 69 | + {/snippet} |
| 70 | + </InfoMessage> |
| 71 | + {/if} |
| 72 | + |
| 73 | + {#if banner} |
| 74 | + <InfoMessage filled outlined={false} style="warning"> |
| 75 | + {#snippet content()} |
| 76 | + {banner} |
| 77 | + {/snippet} |
| 78 | + </InfoMessage> |
| 79 | + {/if} |
| 80 | + |
| 81 | + <Button style="pop" disabled={!emailToSendTo} onclick={resendConfirmationEmail} |
| 82 | + >Resend Confirmation Email</Button |
| 83 | + > |
| 84 | + </div> |
| 85 | + {/if} |
| 86 | +</AuthUtilityLayout> |
0 commit comments