Skip to content

Commit e217393

Browse files
committed
🫧 feat: remove the min 2 seconds taken to connect to discord and leave just the bouce animationw
1 parent bf50a74 commit e217393

File tree

1 file changed

+3
-23
lines changed

1 file changed

+3
-23
lines changed

src/components/DiscordDisconnect.svelte

+3-23
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
<script lang='ts'>
2-
import { get } from 'svelte/store'
3-
42
import discordBlueIcon from '@/assets/discord_blue.svg'
53
import reloadIcon from '@/assets/reload.svg'
64
@@ -9,29 +7,11 @@
97
import { DiscordState } from '@/models/DiscordState.ts'
108
119
12-
let state = $conn?.discordState
13-
let mutable = true
14-
15-
16-
const reconnectDiscord = () => {
17-
mutable = false
18-
state = DiscordState.Connecting
19-
10+
const reconnectDiscord = () =>
2011
browser.runtime.sendMessage({ type: 'reconnect discord' })
21-
22-
setTimeout(() => {
23-
mutable = true
24-
state = get(conn)?.discordState ?? DiscordState.Disconnected
25-
}, 2000)
26-
}
27-
28-
29-
conn.subscribe(conn => {
30-
if (conn && mutable) state = conn.discordState
31-
})
3212
</script>
3313

34-
<div id='discord-connection' class:invalid={state === DiscordState.Disconnected}>
14+
<div id='discord-connection' class:invalid={$conn?.discordState === DiscordState.Disconnected}>
3515
<img src={discordBlueIcon} alt='Discord icon' />
3616

3717
<div>
@@ -45,7 +25,7 @@
4525
{/if}
4626
</div>
4727

48-
{#if state === DiscordState.Disconnected}
28+
{#if $conn?.discordState === DiscordState.Disconnected}
4929
<button on:click={reconnectDiscord} aria-label='Reconnect'>
5030
<img src={reloadIcon} alt='Reconnect icon' />
5131
</button>

0 commit comments

Comments
 (0)