Compare commits
No commits in common. "871ed876877fa7a51e62c0d1b0c2babe83c0ce04" and "f17fd0174bbd686601c710cbbfa0ed788fe75fd8" have entirely different histories.
871ed87687
...
f17fd0174b
16 changed files with 26 additions and 84 deletions
|
@ -196,7 +196,7 @@ body {
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
color: var(--foreground-color-2);
|
color: var(--foreground-color-3);
|
||||||
text-align: center;
|
text-align: center;
|
||||||
border: none;
|
border: none;
|
||||||
border-radius: var(--radius-md);
|
border-radius: var(--radius-md);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script>
|
<script>
|
||||||
import Main from "./Main.svelte";
|
import Main from "./pages/main/Main.svelte";
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Main />
|
<Main />
|
||||||
|
|
|
@ -11,14 +11,9 @@
|
||||||
const close = () => overlayStore.close('createChannel');
|
const close = () => overlayStore.close('createChannel');
|
||||||
const create = async () => {
|
const create = async () => {
|
||||||
createButtonEnabled = false;
|
createButtonEnabled = false;
|
||||||
const { ok } = await request("POST", apiRoute("channels"), true, {
|
await request("POST", apiRoute("channels"), true, {
|
||||||
name: channelName
|
name: channelName
|
||||||
});
|
});
|
||||||
if (!ok) {
|
|
||||||
overlayStore.open("toast", {
|
|
||||||
message: "Couldn't create channel"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
close();
|
close();
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
|
@ -13,24 +13,14 @@
|
||||||
const close = () => overlayStore.close('editChannel');
|
const close = () => overlayStore.close('editChannel');
|
||||||
const save = async () => {
|
const save = async () => {
|
||||||
buttonsEnabled = false;
|
buttonsEnabled = false;
|
||||||
const { ok } = await request("PUT", apiRoute(`channels/${channel.id}`), true, {
|
await request("PUT", apiRoute(`channels/${channel.id}`), true, {
|
||||||
name: channelName
|
name: channelName
|
||||||
});
|
});
|
||||||
if (!ok) {
|
|
||||||
overlayStore.open("toast", {
|
|
||||||
message: "Couldn't edit channel"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
close();
|
close();
|
||||||
};
|
};
|
||||||
const deleteChannel = async () => {
|
const deleteChannel = async () => {
|
||||||
buttonsEnabled = false;
|
buttonsEnabled = false;
|
||||||
const { ok } = await request("DELETE", apiRoute(`channels/${channel.id}`), true);
|
await request("DELETE", apiRoute(`channels/${channel.id}`), true);
|
||||||
if (!ok) {
|
|
||||||
overlayStore.open("toast", {
|
|
||||||
message: "Couldn't delete channel"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
close();
|
close();
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
@ -58,7 +48,7 @@
|
||||||
|
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<button class="button modal-secondary-action" on:click="{ close }">Cancel</button>
|
<button class="button modal-secondary-action" on:click="{ close }">Cancel</button>
|
||||||
<button class="button modal-secondary-action delete-button" on:click="{ deleteChannel }" disabled="{ !buttonsEnabled }">Delete</button>
|
<button class="button modal-secondary-action delete-button" on:click="{ deleteChannel }">Delete</button>
|
||||||
<button class="button button-accent modal-primary-action" on:click="{ save }" disabled="{ !buttonsEnabled }">Save</button>
|
<button class="button button-accent modal-primary-action" on:click="{ save }" disabled="{ !buttonsEnabled }">Save</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
|
@ -1,16 +0,0 @@
|
||||||
<script>
|
|
||||||
import { overlayStore } from "../../stores";
|
|
||||||
import EditChannel from "./EditChannel.svelte";
|
|
||||||
import CreateChannel from "./CreateChannel.svelte";
|
|
||||||
import Toast from "./Toast.svelte";
|
|
||||||
</script>
|
|
||||||
|
|
||||||
{#if $overlayStore.createChannel}
|
|
||||||
<CreateChannel { ...$overlayStore.createChannel } />
|
|
||||||
{/if}
|
|
||||||
{#if $overlayStore.editChannel}
|
|
||||||
<EditChannel { ...$overlayStore.editChannel } />
|
|
||||||
{/if}
|
|
||||||
{#if $overlayStore.toast}
|
|
||||||
<Toast { ...$overlayStore.toast } />
|
|
||||||
{/if}
|
|
|
@ -1,32 +0,0 @@
|
||||||
<script>
|
|
||||||
import { XIcon } from "svelte-feather-icons";
|
|
||||||
import { quintInOut } from "svelte/easing";
|
|
||||||
import { fly } from "svelte/transition";
|
|
||||||
import { overlayStore } from "../../stores";
|
|
||||||
|
|
||||||
export let message;
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style>
|
|
||||||
.toast {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
position: absolute;
|
|
||||||
top: 5.5em;
|
|
||||||
left: 50%;
|
|
||||||
background-color: var(--purple-1);
|
|
||||||
transform: translate(-50%, -50%);
|
|
||||||
padding: var(--space-sm);
|
|
||||||
border-radius: var(--radius-md);
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
||||||
{#key message}
|
|
||||||
<div class="toast" transition:fly="{{ duration: 300, easing: quintInOut, y: 10 }}">
|
|
||||||
<span>{ message }</span>
|
|
||||||
<button class="icon-button" on:click="{ () => overlayStore.close('toast') }">
|
|
||||||
<XIcon />
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
{/key}
|
|
|
@ -1,8 +1,8 @@
|
||||||
<script>
|
<script>
|
||||||
import { CloudIcon } from "svelte-feather-icons";
|
import { CloudIcon } from "svelte-feather-icons";
|
||||||
import { gatewayStatus, selectedChannel } from "../stores";
|
import { gatewayStatus, selectedChannel } from "../../../stores";
|
||||||
import ChannelView from "./ChannelView.svelte";
|
import ChannelView from "./ChannelView.svelte";
|
||||||
import OverlayProvider from "./overlays/OverlayProvider.svelte";
|
import OverlayProvider from "./OverlayProvider.svelte";
|
||||||
import Sidebar from "./Sidebar.svelte";
|
import Sidebar from "./Sidebar.svelte";
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<script>
|
<script>
|
||||||
import request from "../request";
|
import request from "../../../request";
|
||||||
import { apiRoute } from "../storage";
|
import { apiRoute } from "../../../storage";
|
||||||
import { messagesStoreProvider, overlayStore, userInfoStore } from "../stores";
|
import { messagesStoreProvider, userInfoStore } from "../../../stores";
|
||||||
|
|
||||||
export let channel;
|
export let channel;
|
||||||
let messageInput = "";
|
let messageInput = "";
|
||||||
|
@ -39,9 +39,6 @@
|
||||||
messages.deleteMessage({
|
messages.deleteMessage({
|
||||||
id: optimisticMessageId
|
id: optimisticMessageId
|
||||||
});
|
});
|
||||||
overlayStore.open("toast", {
|
|
||||||
message: "Couldn't send message"
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
|
@ -1,6 +1,6 @@
|
||||||
<script>
|
<script>
|
||||||
import { afterUpdate, beforeUpdate, onMount } from "svelte";
|
import { afterUpdate, beforeUpdate, onMount } from "svelte";
|
||||||
import { messagesStoreProvider } from "../stores.js";
|
import { messagesStoreProvider } from "../../../stores.js";
|
||||||
import Message from "./Message.svelte";
|
import Message from "./Message.svelte";
|
||||||
|
|
||||||
export let channelId;
|
export let channelId;
|
12
frontend/src/components/pages/main/OverlayProvider.svelte
Normal file
12
frontend/src/components/pages/main/OverlayProvider.svelte
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
<script>
|
||||||
|
import { overlayStore } from "../../../stores";
|
||||||
|
import EditChannel from "../../modals/EditChannel.svelte";
|
||||||
|
import CreateChannel from "../../modals/CreateChannel.svelte";
|
||||||
|
</script>
|
||||||
|
|
||||||
|
{#if $overlayStore.createChannel}
|
||||||
|
<CreateChannel { ...$overlayStore.createChannel } />
|
||||||
|
{/if}
|
||||||
|
{#if $overlayStore.editChannel}
|
||||||
|
<EditChannel { ...$overlayStore.editChannel } />
|
||||||
|
{/if}
|
|
@ -1,6 +1,6 @@
|
||||||
<script>
|
<script>
|
||||||
import { HashIcon, PlusIcon, MoreVerticalIcon } from "svelte-feather-icons";
|
import { HashIcon, PlusIcon, MoreVerticalIcon } from "svelte-feather-icons";
|
||||||
import { channels, overlayStore, selectedChannel } from "../stores";
|
import { channels, overlayStore, selectedChannel } from "../../../stores";
|
||||||
import UserTopBar from "./UserTopBar.svelte";
|
import UserTopBar from "./UserTopBar.svelte";
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<script>
|
<script>
|
||||||
import { AtSignIcon } from "svelte-feather-icons";
|
import { AtSignIcon } from "svelte-feather-icons";
|
||||||
import { userInfoStore } from "../stores";
|
import { userInfoStore } from "../../../stores";
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="top-bar">
|
<div class="top-bar">
|
|
@ -182,10 +182,6 @@ class MessageStore extends Store {
|
||||||
res.json.reverse();
|
res.json.reverse();
|
||||||
this.value = res.json.concat(this.value);
|
this.value = res.json.concat(this.value);
|
||||||
this.updated();
|
this.updated();
|
||||||
} else {
|
|
||||||
overlayStore.open("toast", {
|
|
||||||
message: "Messages failed to load"
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue