diff --git a/src/components/LoadingSpinner.svelte b/src/components/LoadingSpinner.svelte index 3d39702..f1fef54 100644 --- a/src/components/LoadingSpinner.svelte +++ b/src/components/LoadingSpinner.svelte @@ -6,23 +6,14 @@ - + viewBox="0 0 24 24"> + + d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z" /> diff --git a/src/components/RTCMessage.svelte b/src/components/RTCMessage.svelte index af3fe53..0a6435e 100644 --- a/src/components/RTCMessage.svelte +++ b/src/components/RTCMessage.svelte @@ -1,14 +1,10 @@ -

+ {#if ($room !== null && $ws.status === WebsocketConnectionState.CONNECTED && $room.connectionState === RoomConnectionState.CONNECTED) || $room.connectionState === RoomConnectionState.RECONNECTING} -

+
+ class="flex-grow flex flex-col overflow-y-auto mb-4 p-2 bg-surface rounded relative whitespace-break-spaces wrap-anywhere"> {#if !$initialConnectionComplete || $room.connectionState === RoomConnectionState.RECONNECTING || $room.participants !== 2 || $dataChannelReady === false || !$canCloseLoadingOverlay}
+ class="absolute top-0 left-0 bottom-0 right-0 flex justify-center items-center flex-col bg-black/55 backdrop-blur-md z-10 text-center"> {#if !$isRTCConnected}

Waiting for peer to connect...

{:else if !$dataChannelReady && !$initialConnectionComplete} @@ -247,20 +242,11 @@ {:else if !$keyExchangeDone}

Establishing a secure connection with the peer...

{:else if $room.connectionState === RoomConnectionState.RECONNECTING} -

- Disconnect from peer, attempting to reconnecting... -

+

Disconnect from peer, attempting to reconnecting...

{:else if $room.participants !== 2 || $dataChannelReady === false} -

- Peer has disconnected, waiting for other peer to - reconnect... -

+

Peer has disconnected, waiting for other peer to reconnect...

{:else} -

- - Successfully established a secure connection to - peer! -

+

Successfully established a secure connection to peer!

{/if}
{#if !$keyExchangeDone || $room.participants !== 2 || $dataChannelReady === false || $room.connectionState === RoomConnectionState.RECONNECTING} @@ -269,43 +255,38 @@ class="animate-spin -ml-1 mr-3 h-5 w-5 text-white" xmlns="http://www.w3.org/2000/svg" fill="none" - viewBox="0 0 24 24" - > + viewBox="0 0 24 24"> + stroke-width="4" /> + d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z" /> {:else} + viewBox="0 0 24 24"> + d="M5 13l4 4L19 7" /> {/if}
{/if} - {#each $messages as msg} + {#each $messages as msg, index}

{#if msg.initiator} @@ -317,45 +298,120 @@ {#if msg.type === MessageType.TEXT}

{msg.data}

{:else if msg.type === MessageType.FILE_OFFER} -
- {#if msg.data.text !== null} -

- {msg.data.text} -

- {/if} -
-

- {msg.data.fileName} -

-

- {msg.data.fileSize} bytes -

- - {#if !msg.initiator} - +
+ + {#if msg.data.fileType.startsWith("image/")} + {#if $settingsStore.autoDownloadImages || $downloadedImageFiles.has(msg.data.id) || msg.initiator} + {#if msg.initiator} + + {msg.data.fileName} + {:else} + + {#if $downloadedImageFiles.has(msg.data.id)} + {msg.data.fileName} + {:else} +
+ +
+ {/if} + {/if} {/if} -
+ {:else} + {#if msg.data.text !== null} +

+ {msg.data.text} +

+ {/if} +
+

+ {msg.data.fileName} +

+

+ {msg.data.fileSize} bytes +

+ + {#if !msg.initiator} +
+ {#if msg.data.fileType.startsWith("image/")} + + {/if} + +
+ {/if} +
+ {/if}
{:else}

Unknown message type: {msg.type}

@@ -367,17 +423,14 @@ type="file" bind:files={$inputFile} bind:this={inputFileElement} - class="absolute opacity-0 -top-[9999px] -left-[9999px]" - /> -
+ class="absolute opacity-0 -top-[9999px] -left-[9999px]" /> +
+ class="border rounded border-[#2c3444] focus-within:border-[#404c63] transition-colors flex-grow flex flex-col bg-[#232b3e]"> {#if $inputFile}
+ class="p-2 flex flex-col gap-2 w-48 border rounded-md border-[#2c3444] relative">
+ >
-

+

{$inputFile[0].name}

@@ -408,8 +455,7 @@ onclick={() => { $inputFile = null; }} - class="absolute right-2 top-2 p-1 border border-[#2c3444] text-paragraph hover:bg-surface/70 transition-colors rounded disabled:opacity-50 cursor-pointer disabled:cursor-not-allowed" - > + class="absolute right-2 top-2 p-1 border border-[#2c3444] text-paragraph hover:bg-surface/70 transition-colors rounded disabled:opacity-50 cursor-pointer disabled:cursor-not-allowed"> + d="M18 6L6 18M6 6l12 12" />
@@ -433,12 +477,9 @@