switch layer
naming to view
to make it less confusing
This commit is contained in:
parent
c85657f8be
commit
641db09c7f
1 changed files with 8 additions and 8 deletions
|
@ -8,7 +8,7 @@ import FuzzyView from "./FuzzyView.svelte";
|
||||||
let selectedChannel = null;
|
let selectedChannel = null;
|
||||||
let guilds = [];
|
let guilds = [];
|
||||||
let user = null;
|
let user = null;
|
||||||
let layer = { type: "CHAT" };
|
let view = { type: "CHAT" };
|
||||||
|
|
||||||
apiClient.getRequest("/users/@self")
|
apiClient.getRequest("/users/@self")
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
|
@ -54,12 +54,12 @@ import FuzzyView from "./FuzzyView.svelte";
|
||||||
if (content.startsWith(":") && content.length > 1) {
|
if (content.startsWith(":") && content.length > 1) {
|
||||||
switch (content[1]) {
|
switch (content[1]) {
|
||||||
case "g": {
|
case "g": {
|
||||||
layer = { type: "GUILD_FUZZY" };
|
view = { type: "GUILD_FUZZY" };
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case "c": {
|
case "c": {
|
||||||
if (selectedGuild) {
|
if (selectedGuild) {
|
||||||
layer = { type: "CHANNEL_FUZZY" };
|
view = { type: "CHANNEL_FUZZY" };
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -107,7 +107,7 @@ import FuzzyView from "./FuzzyView.svelte";
|
||||||
function fuzzySelectedGuild({ detail: id }) {
|
function fuzzySelectedGuild({ detail: id }) {
|
||||||
selectedGuild = guilds.find(e => e.id === id);
|
selectedGuild = guilds.find(e => e.id === id);
|
||||||
selectedChannel = null;
|
selectedChannel = null;
|
||||||
layer = { type: "CHAT" };
|
view = { type: "CHAT" };
|
||||||
}
|
}
|
||||||
|
|
||||||
function fuzzySelectedChannel({ detail: id }) {
|
function fuzzySelectedChannel({ detail: id }) {
|
||||||
|
@ -115,7 +115,7 @@ import FuzzyView from "./FuzzyView.svelte";
|
||||||
return;
|
return;
|
||||||
|
|
||||||
selectedChannel = selectedGuild.channels.find(e => e.id === id);
|
selectedChannel = selectedGuild.channels.find(e => e.id === id);
|
||||||
layer = { type: "CHAT" };
|
view = { type: "CHAT" };
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -134,16 +134,16 @@ import FuzzyView from "./FuzzyView.svelte";
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<main>
|
<main>
|
||||||
{#if layer.type === "CHAT"}
|
{#if view.type === "CHAT"}
|
||||||
<ChatView
|
<ChatView
|
||||||
messageStore={messageStore}
|
messageStore={messageStore}
|
||||||
selectedChannel={selectedChannel}
|
selectedChannel={selectedChannel}
|
||||||
selectedGuild={selectedGuild}
|
selectedGuild={selectedGuild}
|
||||||
on:entermessage={onTextEntryMessage}
|
on:entermessage={onTextEntryMessage}
|
||||||
/>
|
/>
|
||||||
{:else if layer.type === "GUILD_FUZZY"}
|
{:else if view.type === "GUILD_FUZZY"}
|
||||||
<FuzzyView on:selected={fuzzySelectedGuild} elements={guilds} title="Select a guild" />
|
<FuzzyView on:selected={fuzzySelectedGuild} elements={guilds} title="Select a guild" />
|
||||||
{:else if layer.type === "CHANNEL_FUZZY"}
|
{:else if view.type === "CHANNEL_FUZZY"}
|
||||||
<FuzzyView on:selected={fuzzySelectedChannel} elements={selectedGuild ? selectedGuild.channels : []} title={`Select a channel in ${selectedGuild ? selectedGuild.name : "[unknown guild]"}`} />
|
<FuzzyView on:selected={fuzzySelectedChannel} elements={selectedGuild ? selectedGuild.channels : []} title={`Select a channel in ${selectedGuild ? selectedGuild.name : "[unknown guild]"}`} />
|
||||||
{/if}
|
{/if}
|
||||||
</main>
|
</main>
|
||||||
|
|
Loading…
Reference in a new issue