Skip to content

Commit

Permalink
fix: offer link to empty when connection error
Browse files Browse the repository at this point in the history
- fix offer link to empty when connection error
  • Loading branch information
ntsd committed Apr 25, 2023
1 parent 79b6b0d commit 4e5ad68
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
2 changes: 2 additions & 0 deletions src/routes/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,12 @@
dataChannel.onerror = () => {
addToastMessage('WebRTC error', 'error');
isConnecting = false;
offerLink = '';
};
dataChannel.onclose = () => {
addToastMessage('Disconnected', 'error');
isConnecting = false;
offerLink = '';
};
}
Expand Down
16 changes: 12 additions & 4 deletions src/routes/receive/+page.svelte
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script lang="ts">
import { goto } from '$app/navigation';
import { page } from '$app/stores';
import { defaultSendOptions } from '../../configs';
import { defaultSendOptions, githubLink } from '../../configs';
import { addToastMessage } from '../../stores/toastStore';
import Eye from '../../components/Eye.svelte';
import { Message } from '../../proto/message';
Expand Down Expand Up @@ -133,8 +133,16 @@

<Collapse title="1. Answer" isOpen={!isConnecting}>
{#if answerSDP}
<p>Copy and send the answer code to the Offer or scan QR code to connect between peer.</p>
<div class="relative mt-2">
<p>
Copy and send the answer code to the Offer or scan QR code to connect between peer. See
<a
class="link"
href={githubLink + '#how-does-it-work'}
target="_blank"
rel="noopener noreferrer">How does it work?</a
>
</p>
<div class="relative mt-4">
<input
type={showAnswerCode ? 'text' : 'password'}
class="input input-bordered w-full"
Expand All @@ -149,7 +157,7 @@
/>
</div>
</div>
<div class="mt-2 flex gap-2">
<div class="mt-4 flex gap-2">
<button class="btn btn-primary gap-2" on:click={copyAnswerCode}>
<ClipboardIcon />Copy Answer
</button>
Expand Down

0 comments on commit 4e5ad68

Please sign in to comment.