diff --git a/flottform/demo/src/routes/custom-ui-client/[endpointId]/+page.svelte b/flottform/demo/src/routes/custom-ui-client/[endpointId]/+page.svelte new file mode 100644 index 0000000..24bedad --- /dev/null +++ b/flottform/demo/src/routes/custom-ui-client/[endpointId]/+page.svelte @@ -0,0 +1,169 @@ + + +
+

Flottform "multiple Inputs Form" client

+

Use this form to send a file from this device to the open form on the main device.

+ +
+
+ + + {#if currentState === 'sending'} +
+ + + +
+ {:else if currentState === 'done'} +
+ + + +

Your file is successfully sent

+
+ {:else if currentState === 'connected'} + + {:else if currentState === 'error'} +

Ouch!

+

There was an error connecting to flottform! 😬

+

Please try again with a new QR code by clicking the button again on the main form.

+ {/if} +
+
+ +
Connection state: {currentState}
+
+ + diff --git a/flottform/demo/src/routes/custom-ui/+page.svelte b/flottform/demo/src/routes/custom-ui/+page.svelte new file mode 100644 index 0000000..e16002c --- /dev/null +++ b/flottform/demo/src/routes/custom-ui/+page.svelte @@ -0,0 +1,486 @@ + + + + Flottform DEMO + + +
+ +
+

Returns and complaints

+

+ Welcome to our support section. We acknowledge you're here because you want something fixed. + One of our products broke down or didn't arrive in the shape you expected it to. Please let us + know about the issue below and we will try our best to support you! +

+

+ * This is a demo. Your data will only be stored temporarily. Uploads will be cleaned + up every few hours. +

+
+
+
+ + +
+
+ + +
+
+
+
+ + +
+
+ + +
+
+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+
+
+ + +
+
+
+ + + {#if highlighted} + + {/if} +
+ +
+
+ +
+
+
+ + +
+ {flottformStatusWrapper} +
+ qrCode{flottformLinkOffer} + +

{flottformDialogDescription}

+ + +
+ + diff --git a/flottform/forms/src/flottform-file-input-host.ts b/flottform/forms/src/flottform-file-input-host.ts index 2dc21e3..e882d34 100644 --- a/flottform/forms/src/flottform-file-input-host.ts +++ b/flottform/forms/src/flottform-file-input-host.ts @@ -109,6 +109,8 @@ export class FlottformFileInputHost extends EventEmitter { this.filesMetaData = message.filesQueue; this.currentFile = { index: 0, receivedSize: 0, arrayBuffer: [] }; this.filesTotalSize = message.totalSize; + // Emit the start of receiving data + this.emit('receive'); } else if (message.type === 'transfer-complete') { this.emit('done'); this.channel?.close(); diff --git a/flottform/forms/src/flottform-styles.ts b/flottform/forms/src/flottform-styles.ts index 05f4d18..cecc1fd 100644 --- a/flottform/forms/src/flottform-styles.ts +++ b/flottform/forms/src/flottform-styles.ts @@ -27,7 +27,7 @@ const defaultColors = { stateBackground: { new: '#FFFFFF', 'waiting-for-client': '#F9F871', - 'waiting-for-file': '#D4F1EF', + 'waiting-for-data': '#D4F1EF', 'receiving-data': '#7EA4FF', done: '#FFFFFF', error: '#F57C6B' diff --git a/flottform/forms/src/flottform-text-input-host.ts b/flottform/forms/src/flottform-text-input-host.ts index 525faef..8e3d65b 100644 --- a/flottform/forms/src/flottform-text-input-host.ts +++ b/flottform/forms/src/flottform-text-input-host.ts @@ -81,6 +81,7 @@ export class FlottformTextInputHost extends EventEmitter { }; private handleIncomingData = (e: MessageEvent) => { + this.emit('receive'); // We suppose that the data received is small enough to be all included in 1 message this.emit('done', e.data); };