Skip to content

Commit 999568c

Browse files
authored
Merge pull request #14 from encryption4all/download-flow
Implement download/decrypt flow
2 parents 759da90 + fdf2f0d commit 999568c

8 files changed

Lines changed: 867 additions & 102 deletions

File tree

src/lib/components/filesharing/Done.svelte

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import type { EncryptState } from '$lib/types/filesharing/attributes'
44
import HelpToggle from '$lib/components/HelpToggle.svelte'
55
import Chip from '$lib/components/Chip.svelte'
6+
import FileList from '$lib/components/filesharing/FileList.svelte'
67
import airplane from '$lib/assets/images/airplane.svg'
78
89
interface props {
@@ -16,15 +17,7 @@
1617
<h2>{$_('filesharing.encryptPanel.succes')}</h2>
1718

1819
<!-- Files box -->
19-
<div class="info-box">
20-
<h3>{$_('filesharing.encryptPanel.filesHeader')}</h3>
21-
<div class="divider"></div>
22-
<div class="files-list">
23-
{#each EncryptState.files as file}
24-
<div class="file-item">{file.name}</div>
25-
{/each}
26-
</div>
27-
</div>
20+
<FileList files={EncryptState.files.map(f => f.name)} />
2821

2922
<!-- Recipients box -->
3023
<div class="info-box">
@@ -36,8 +29,8 @@
3629
<div class="recipient-email">{recipient.email}</div>
3730
{#if recipient.extra.length > 0}
3831
<div class="recipient-attributes">
39-
{#each recipient.extra as attr}
40-
<Chip text={attr.v} size="sm" variant="default" />
32+
{#each recipient.extra.filter(a => a.v) as attr}
33+
<Chip text={attr.v!} size="sm" variant="default" />
4134
{/each}
4235
</div>
4336
{/if}
@@ -106,28 +99,18 @@
10699
margin: 0rem 0rem;
107100
}
108101
109-
.files-list,
110102
.recipients-list {
111103
display: flex;
112104
flex-direction: column;
113105
}
114106
115-
.file-item,
116107
.recipient-item {
117108
padding: 0.3rem 0 0.4rem 1rem;
118109
margin: 0 0rem;
119110
font-family: var(--pg-font-family);
120111
font-size: 1rem;
121112
color: var(--pg-text);
122113
border-bottom: 1px solid var(--pg-strong-background);
123-
}
124-
125-
.file-item:last-child,
126-
.recipient-item:last-child {
127-
border-bottom: none;
128-
}
129-
130-
.recipient-item {
131114
display: flex;
132115
flex-direction: column;
133116
gap: 0.25rem;
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<script lang="ts">
2+
import { _ } from 'svelte-i18n'
3+
4+
interface props {
5+
files: string[]
6+
}
7+
8+
let { files }: props = $props()
9+
</script>
10+
11+
{#if files.length > 0}
12+
<div class="file-list">
13+
<div class="file-list-header">{$_('filesharing.encryptPanel.filesHeader')}</div>
14+
{#each files as filename}
15+
<div class="file-list-item">{filename}</div>
16+
{/each}
17+
</div>
18+
{/if}
19+
20+
<style>
21+
.file-list {
22+
width: 100%;
23+
background: var(--pg-soft-background);
24+
border: 1px solid var(--pg-strong-background);
25+
border-radius: var(--pg-border-radius-lg);
26+
overflow: hidden;
27+
}
28+
29+
.file-list-header {
30+
font-weight: 700;
31+
font-size: 0.95rem;
32+
padding: 0.5rem 1rem;
33+
color: var(--pg-text);
34+
border-bottom: 1px solid var(--pg-strong-background);
35+
font-family: var(--pg-font-family);
36+
}
37+
38+
.file-list-item {
39+
padding: 0.4rem 1rem;
40+
font-size: 0.95rem;
41+
color: var(--pg-text);
42+
font-family: var(--pg-font-family);
43+
44+
&:not(:last-child) {
45+
border-bottom: 1px solid var(--pg-strong-background);
46+
}
47+
}
48+
</style>

src/lib/components/filesharing/YiviQRCode.svelte

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@
44
55
interface props {
66
mode?: 'qr' | 'deeplink'
7+
id?: string
8+
responsive?: boolean
79
}
810
9-
let { mode = 'qr' }: props = $props()
11+
let { mode = 'qr', id = 'crypt-irma-qr', responsive = false }: props = $props()
1012
1113
let qrLoaded = $state(false)
1214
let containerEl: HTMLDivElement
@@ -47,7 +49,7 @@
4749
})
4850
</script>
4951

50-
<div id="crypt-irma-qr" class="yivi-qr-container" bind:this={containerEl}>
52+
<div {id} class="yivi-qr-container" class:responsive bind:this={containerEl}>
5153
{#if !qrLoaded}
5254
<svg class="spinner" viewBox="0 0 24 24" width="32" height="32">
5355
<circle class="spinner-circle" cx="12" cy="12" r="10" fill="none" stroke="currentColor" stroke-width="3"></circle>
@@ -83,6 +85,18 @@
8385
padding: 10px;
8486
}
8587
88+
.yivi-qr-container.responsive {
89+
/* width: 100%; */
90+
height: auto;
91+
min-height: 200px;
92+
}
93+
94+
.yivi-qr-container.responsive :global(canvas),
95+
.yivi-qr-container.responsive :global(svg) {
96+
width: 100% !important;
97+
height: auto !important;
98+
}
99+
86100
/* Hide everything except the QR canvas/svg */
87101
.yivi-qr-container :global(:not(canvas, svg, div:has(canvas), div:has(svg))) {
88102
display: none !important;

src/lib/locales/en.json

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,19 +88,24 @@
8888
"cancel": "Cancel"
8989
},
9090
"decryptpanel": {
91-
"header": "Decrypt your files",
91+
"header": "Download your files",
92+
"pageDescription": "To download the files, you need to decrypt them. You do this by proving who you are with Yivi.",
9293
"downloadDecrypt": "Downloading & Decrypting...",
93-
"irmaInstructionHeaderQr": "Scan QR-code with Yivi",
94+
"irmaInstructionHeaderQr": "Decrypt",
9495
"irmaInstructionHeaderMobile": "Prove your identity with Yivi",
95-
"irmaInstructionQr": "Decrypt the files by verifying your e-mail address. Please scan the QR-code below with the identification app Yivi.",
96+
"irmaInstructionQr": "Scan this QR code with your Yivi app.",
9697
"irmaInstructionMobile": "Decrypt the files by verifying your e-mail address. Please click the button below to open the Yivi-app.",
9798
"noIrma": "Don't have the Yivi-app yet?",
9899
"decrypting": "Your files are being downloaded and decrypted afterwards.",
99100
"succes": "Successfully downloaded and decrypted",
100101
"askDownload": "Download",
101102
"askDownloadText": "Press the button below to start decrypting and downloading your files",
103+
"doneMessage": "Your files are being downloaded and decrypted",
102104
"verifiedEmail": "The files are from",
103-
"verifiedExtra": "The files were signed using"
105+
"verifiedExtra": "The files were signed using",
106+
"notFoundTitle": "These files no longer exist",
107+
"notFoundSubtitle": "The link may have expired, or there may be an error in it.",
108+
"notFoundMessage": "Ask the sender to send the files <strong>once more</strong>."
104109
},
105110
"encryptPanel": {
106111
"fileBox": {

src/lib/locales/nl.json

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -88,22 +88,27 @@
8888
"cancel": "Annuleren"
8989
},
9090
"decryptpanel": {
91-
"header": "DOWNLOAD & ONTSLEUTEL",
91+
"header": "Download je bestanden",
92+
"pageDescription": "Om de bestanden te downloaden, moet je ze ontsleutelen. Dit doe je door te bewijzen wie je bent met Yivi.",
9293
"downloadDecrypt": "Downloading & ontsleutelen...",
93-
"irmaInstructionHeaderQr": "Scan QR-code met Yivi",
94+
"irmaInstructionHeaderQr": "Ontsleutel",
9495
"irmaInstructionHeaderMobile": "Bewijs identiteit met Yivi",
95-
"irmaInstructionQr": "Ontsleutel het bestand door je e-mailadres te tonen. Scan daarvoor de onderstaande QR-code met de identificatie app Yivi.",
96+
"irmaInstructionQr": "Scan deze QR code met je Yivi app.",
9697
"irmaInstructionMobile": "Ontsleutel het bestand door je e-mailadres te tonen. Click daarvoor op de onderstaande knop om naar de identificatie app Yivi te gaan.",
9798
"noIrma": "Nog geen Yivi-app?",
9899
"decrypting": "Jouw bestand wordt gedownload en vervolgens ontsleuteld.",
99100
"succes": "Succesvol gedownload en ontsleuteld",
100101
"askDownload": "Download",
101102
"askDownloadText": "Druk op onderstaande knop om de bestanden te ontsleutelen en downloaden.",
102-
"verifiedEmail": "De bestanden zijn afkomstig van",
103-
"verifiedExtra": "De bestanden zijn ondertekend met"
103+
"doneMessage": "Je bestanden worden gedownload en ontsleuteld",
104+
"verifiedEmail": "De bestanden komen van",
105+
"verifiedExtra": "De bestanden zijn ondertekend met",
106+
"notFoundTitle": "Deze bestanden bestaan niet (meer)",
107+
"notFoundSubtitle": "Het kan zijn dat de link is verlopen, of dat er een fout in zit.",
108+
"notFoundMessage": "Vraag de verzender de bestanden <strong>nog een keer te versturen</strong>."
104109
},
105110
"encryptPanel": {
106-
"fileBox": {
111+
"fileBox": {
107112
"tagline": "Verstuur je bestanden veilig",
108113
"upperTextDropZone": "Sleep bestanden hierheen <br/> of",
109114
"lowerTextDropZone": "klik om te uploaden <br/> (max. 2GB)",

0 commit comments

Comments
 (0)