|
@ -65,33 +65,20 @@ |
|
|
{ player1: "Alice", player2: "Bob", id: "3" }, |
|
|
{ player1: "Alice", player2: "Bob", id: "3" }, |
|
|
]; |
|
|
]; |
|
|
|
|
|
|
|
|
// CHAT |
|
|
|
|
|
let isChatOpen = false; |
|
|
|
|
|
function clickChat() { |
|
|
|
|
|
isChatOpen = true; |
|
|
|
|
|
} |
|
|
|
|
|
let chatMessages: Array<chatMessagesType> = [ |
|
|
|
|
|
{ name: "Alice", text: "Bob" }, |
|
|
|
|
|
{ name: "Alice", text: "Bob" }, |
|
|
|
|
|
{ name: "Alice", text: "Bob" }, |
|
|
|
|
|
{ name: "Alice", text: "Bob" }, |
|
|
|
|
|
{ name: "Alice", text: "Bob" }, |
|
|
|
|
|
{ name: "Alice", text: "Bob" }, |
|
|
|
|
|
]; |
|
|
|
|
|
|
|
|
|
|
|
// CHANNELS |
|
|
// CHANNELS |
|
|
let isChannelsOpen = false; |
|
|
let isChannelsOpen = false; |
|
|
function clickChannels() { |
|
|
function clickChannels() { |
|
|
isChannelsOpen = true; |
|
|
isChannelsOpen = true; |
|
|
} |
|
|
} |
|
|
let channels: Array<ChannelsType> = [ |
|
|
let channels: Array<ChannelsType> = [ |
|
|
{ name: "My Imaginary Friends", id: "1" }, |
|
|
{ id: "1", name: "General", messages: [] }, |
|
|
{ name: "Chamber of Secrets", id: "4" }, |
|
|
{ id: "2", name: "Lobby", messages: [] }, |
|
|
{ name: "Meme Team", id: "6" }, |
|
|
{ id: "3", name: "Game", messages: [] }, |
|
|
{ name: "Chat 8", id: "8" }, |
|
|
|
|
|
{ name: "F.R.I.E.N.D.S.", id: "2" }, |
|
|
|
|
|
{ name: "Chat 3", id: "3" }, |
|
|
|
|
|
]; |
|
|
]; |
|
|
|
|
|
let selectedChannel: ChannelsType; |
|
|
|
|
|
const handleSelectChannel = (channel: ChannelsType) => { |
|
|
|
|
|
selectedChannel = channel; |
|
|
|
|
|
}; |
|
|
</script> |
|
|
</script> |
|
|
|
|
|
|
|
|
<main> |
|
|
<main> |
|
@ -100,25 +87,23 @@ |
|
|
{clickHistory} |
|
|
{clickHistory} |
|
|
{clickFriends} |
|
|
{clickFriends} |
|
|
{clickSpectate} |
|
|
{clickSpectate} |
|
|
{clickChat} |
|
|
|
|
|
{clickChannels} |
|
|
{clickChannels} |
|
|
/> |
|
|
/> |
|
|
{#if isChatOpen} |
|
|
{#if isChannelsOpen} |
|
|
<div |
|
|
{#if selectedChannel} |
|
|
on:click={() => (isChatOpen = false)} |
|
|
<div on:click={() => (selectedChannel = undefined)} on:keydown={() => (selectedChannel = undefined)}> |
|
|
on:keydown={() => (isChatOpen = false)} |
|
|
<Chat2 chatMessages={selectedChannel.messages} /> |
|
|
> |
|
|
|
|
|
<Chat2 {chatMessages} /> |
|
|
|
|
|
</div> |
|
|
</div> |
|
|
{/if} |
|
|
{/if} |
|
|
{#if isChannelsOpen} |
|
|
{#if !selectedChannel} |
|
|
<div |
|
|
<div |
|
|
on:click={() => (isChannelsOpen = false)} |
|
|
on:click={() => (isChannelsOpen = false)} |
|
|
on:keydown={() => (isChannelsOpen = false)} |
|
|
on:keydown={() => (isChannelsOpen = false)} |
|
|
> |
|
|
> |
|
|
<Channels {channels} /> |
|
|
<Channels channels={channels} onSelectChannel={handleSelectChannel} /> |
|
|
</div> |
|
|
</div> |
|
|
{/if} |
|
|
{/if} |
|
|
|
|
|
{/if} |
|
|
{#if isSpectateOpen} |
|
|
{#if isSpectateOpen} |
|
|
<div |
|
|
<div |
|
|
on:click={() => (isSpectateOpen = false)} |
|
|
on:click={() => (isSpectateOpen = false)} |
|
|