|
@ -171,109 +171,104 @@ |
|
|
} |
|
|
} |
|
|
</script> |
|
|
</script> |
|
|
|
|
|
|
|
|
<div> |
|
|
<div> |
|
|
{#if $store === null} |
|
|
{#if $store === null} |
|
|
<div class="login-div"> |
|
|
<div class="login-div"> |
|
|
<h3 class="test"> |
|
|
<h3 class="test">Please log in with 42 api to access the website.</h3> |
|
|
Please log in with 42 api to access the website. |
|
|
<img |
|
|
</h3> |
|
|
class="img-42" |
|
|
<img class="img-42" src="https://translate.intra.42.fr/assets/42_logo-7dfc9110a5319a308863b96bda33cea995046d1731cebb735e41b16255106c12.svg" alt="logo_42"> |
|
|
src="https://translate.intra.42.fr/assets/42_logo-7dfc9110a5319a308863b96bda33cea995046d1731cebb735e41b16255106c12.svg" |
|
|
<button class="login-button" type="button" on:click={login}>Log In</button> |
|
|
alt="logo_42" |
|
|
</div> |
|
|
|
|
|
{:else if $store.twoFA === true && $store.isVerified === false} |
|
|
|
|
|
<h1><button type="button" on:click={verify}>verify</button></h1> |
|
|
|
|
|
{:else} |
|
|
|
|
|
<Navbar |
|
|
|
|
|
{clickProfile} |
|
|
|
|
|
{clickHistory} |
|
|
|
|
|
{clickFriends} |
|
|
|
|
|
{clickChannels} |
|
|
|
|
|
{clickLeaderboard} |
|
|
|
|
|
/> |
|
|
/> |
|
|
{#if appState.includes(APPSTATE.CHANNELS)} |
|
|
<button class="login-button" type="button" on:click={login}>Log In</button |
|
|
{#if appState.replace(APPSTATE.CHANNELS, "") !== ""} |
|
|
> |
|
|
<div |
|
|
</div> |
|
|
on:click={() => setAppState(APPSTATE.CHANNELS)} |
|
|
{:else if $store.twoFA === true && $store.isVerified === false} |
|
|
on:keydown={() => setAppState(APPSTATE.CHANNELS)} |
|
|
<h1><button type="button" on:click={verify}>verify</button></h1> |
|
|
> |
|
|
{:else} |
|
|
<Chat |
|
|
<Navbar |
|
|
chatMessages={selectedChannel.messages} |
|
|
{clickProfile} |
|
|
on:view-profile={openIdProfile} |
|
|
{clickHistory} |
|
|
on:add-friend={addFriend} |
|
|
{clickFriends} |
|
|
on:invite-to-game={pong.inviteToGame} |
|
|
{clickChannels} |
|
|
/> |
|
|
{clickLeaderboard} |
|
|
</div> |
|
|
/> |
|
|
{:else} |
|
|
{#if appState.includes(APPSTATE.CHANNELS)} |
|
|
<div on:click={resetAppState} on:keydown={resetAppState}> |
|
|
{#if appState.replace(APPSTATE.CHANNELS, "") !== ""} |
|
|
<Channels {channels} onSelectChannel={handleSelectChannel} /> |
|
|
|
|
|
</div> |
|
|
|
|
|
{/if} |
|
|
|
|
|
{/if} |
|
|
|
|
|
{#if appState === APPSTATE.LEADERBOARD} |
|
|
|
|
|
<div on:click={resetAppState} on:keydown={resetAppState}> |
|
|
|
|
|
<Leaderboard {leaderboard} /> |
|
|
|
|
|
</div> |
|
|
|
|
|
{/if} |
|
|
|
|
|
{#if appState === APPSTATE.FRIENDS} |
|
|
|
|
|
<div |
|
|
<div |
|
|
on:click={() => { |
|
|
on:click={() => setAppState(APPSTATE.CHANNELS)} |
|
|
resetAppState(); |
|
|
on:keydown={() => setAppState(APPSTATE.CHANNELS)} |
|
|
clearInterval(friendsInterval); |
|
|
|
|
|
}} |
|
|
|
|
|
on:keydown={() => { |
|
|
|
|
|
resetAppState(); |
|
|
|
|
|
clearInterval(friendsInterval); |
|
|
|
|
|
}} |
|
|
|
|
|
> |
|
|
> |
|
|
<Friends {friends} {invits} /> |
|
|
<Chat |
|
|
</div> |
|
|
chatMessages={selectedChannel.messages} |
|
|
{/if} |
|
|
on:view-profile={openIdProfile} |
|
|
{#if appState === APPSTATE.HISTORY} |
|
|
on:add-friend={addFriend} |
|
|
<div on:click={resetAppState} on:keydown={resetAppState}> |
|
|
on:invite-to-game={pong.inviteToGame} |
|
|
<MatchHistory /> |
|
|
|
|
|
</div> |
|
|
|
|
|
{/if} |
|
|
|
|
|
{#if appState === APPSTATE.HISTORY_ID} |
|
|
|
|
|
<div |
|
|
|
|
|
on:click={() => setAppState(APPSTATE.PROFILE)} |
|
|
|
|
|
on:keydown={() => setAppState(APPSTATE.PROFILE)} |
|
|
|
|
|
> |
|
|
|
|
|
<MatchHistory username={userProfile.username} /> |
|
|
|
|
|
</div> |
|
|
|
|
|
{/if} |
|
|
|
|
|
{#if appState === APPSTATE.PROFILE} |
|
|
|
|
|
<div on:click={resetAppState} on:keydown={resetAppState}> |
|
|
|
|
|
<Profile |
|
|
|
|
|
user={userProfile} |
|
|
|
|
|
edit={1} |
|
|
|
|
|
on:view-history={openIdHistory} |
|
|
|
|
|
/> |
|
|
/> |
|
|
</div> |
|
|
</div> |
|
|
{/if} |
|
|
{:else} |
|
|
{#if appState === APPSTATE.PROFILE_ID} |
|
|
<div on:click={resetAppState} on:keydown={resetAppState}> |
|
|
<div |
|
|
<Channels {channels} onSelectChannel={handleSelectChannel} /> |
|
|
on:click={() => |
|
|
|
|
|
setAppState(APPSTATE.CHANNELS + "#" + selectedChannel.name)} |
|
|
|
|
|
on:keydown={() => |
|
|
|
|
|
setAppState(APPSTATE.CHANNELS + "#" + selectedChannel.name)} |
|
|
|
|
|
> |
|
|
|
|
|
<Profile |
|
|
|
|
|
user={userProfile} |
|
|
|
|
|
edit={0} |
|
|
|
|
|
on:view-history={openIdHistory} |
|
|
|
|
|
/> |
|
|
|
|
|
</div> |
|
|
</div> |
|
|
{/if} |
|
|
{/if} |
|
|
|
|
|
{/if} |
|
|
|
|
|
{#if appState === APPSTATE.LEADERBOARD} |
|
|
|
|
|
<div on:click={resetAppState} on:keydown={resetAppState}> |
|
|
|
|
|
<Leaderboard {leaderboard} /> |
|
|
|
|
|
</div> |
|
|
|
|
|
{/if} |
|
|
|
|
|
{#if appState === APPSTATE.FRIENDS} |
|
|
|
|
|
<div |
|
|
|
|
|
on:click={() => { |
|
|
|
|
|
resetAppState(); |
|
|
|
|
|
clearInterval(friendsInterval); |
|
|
|
|
|
}} |
|
|
|
|
|
on:keydown={() => { |
|
|
|
|
|
resetAppState(); |
|
|
|
|
|
clearInterval(friendsInterval); |
|
|
|
|
|
}} |
|
|
|
|
|
> |
|
|
|
|
|
<Friends {friends} {invits} /> |
|
|
|
|
|
</div> |
|
|
|
|
|
{/if} |
|
|
|
|
|
{#if appState === APPSTATE.HISTORY} |
|
|
|
|
|
<div on:click={resetAppState} on:keydown={resetAppState}> |
|
|
|
|
|
<MatchHistory /> |
|
|
|
|
|
</div> |
|
|
|
|
|
{/if} |
|
|
|
|
|
{#if appState === APPSTATE.HISTORY_ID} |
|
|
|
|
|
<div |
|
|
|
|
|
on:click={() => setAppState(APPSTATE.PROFILE)} |
|
|
|
|
|
on:keydown={() => setAppState(APPSTATE.PROFILE)} |
|
|
|
|
|
> |
|
|
|
|
|
<MatchHistory username={userProfile.username} /> |
|
|
|
|
|
</div> |
|
|
|
|
|
{/if} |
|
|
|
|
|
{#if appState === APPSTATE.PROFILE} |
|
|
|
|
|
<div on:click={resetAppState} on:keydown={resetAppState}> |
|
|
|
|
|
<Profile user={userProfile} edit={1} on:view-history={openIdHistory} /> |
|
|
|
|
|
</div> |
|
|
|
|
|
{/if} |
|
|
|
|
|
{#if appState === APPSTATE.PROFILE_ID} |
|
|
|
|
|
<div |
|
|
|
|
|
on:click={() => |
|
|
|
|
|
setAppState(APPSTATE.CHANNELS + "#" + selectedChannel.name)} |
|
|
|
|
|
on:keydown={() => |
|
|
|
|
|
setAppState(APPSTATE.CHANNELS + "#" + selectedChannel.name)} |
|
|
|
|
|
> |
|
|
|
|
|
<Profile user={userProfile} edit={0} on:view-history={openIdHistory} /> |
|
|
|
|
|
</div> |
|
|
|
|
|
{/if} |
|
|
|
|
|
|
|
|
{#if fakemenu} |
|
|
{#if fakemenu} |
|
|
<FakeLogin bind:username={usernameFake} bind:ftId={ftIdFake} /> |
|
|
<FakeLogin bind:username={usernameFake} bind:ftId={ftIdFake} /> |
|
|
<button on:click={impersonate}>Impersonate</button> |
|
|
<button on:click={impersonate}>Impersonate</button> |
|
|
<button on:click={() => (fakemenu = false)}>No impersonate</button> |
|
|
<button on:click={() => (fakemenu = false)}>No impersonate</button> |
|
|
{:else} |
|
|
{:else} |
|
|
<Pong bind:this={pong} {appState} {setAppState} {fakeUser} /> |
|
|
<Pong bind:this={pong} {appState} {setAppState} {fakeUser} /> |
|
|
{/if} |
|
|
|
|
|
{/if} |
|
|
{/if} |
|
|
</div> |
|
|
{/if} |
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
<style> |
|
|
<style> |
|
|
.login-div { |
|
|
.login-div { |
|
|