From 045e34cbd5ae0dc9d15a30e0f4324191af59f4b3 Mon Sep 17 00:00:00 2001 From: hippoz <10706925-hippoz@users.noreply.gitlab.com> Date: Wed, 31 May 2023 22:09:36 +0300 Subject: [PATCH] first implementation of "communities" + visual improvements --- frontend/src/components/ChannelView.svelte | 2 +- frontend/src/components/Message.svelte | 2 +- frontend/src/components/MessageInput.svelte | 2 +- frontend/src/components/Messages.svelte | 3 +- .../src/components/PresenceSidebar.svelte | 40 ++-- frontend/src/components/Sidebar.svelte | 148 ++++++++++---- .../components/overlays/AddCommunity.svelte | 50 +++++ .../components/overlays/CreateChannel.svelte | 6 +- .../overlays/OverlayProvider.svelte | 2 + frontend/src/gateway.js | 6 + frontend/src/request.js | 39 ++-- frontend/src/storage.js | 5 +- frontend/src/stores.js | 181 +++++++++++++++--- frontend/src/styles/global.css | 31 ++- src/database/index.ts | 1 + src/database/init.ts | 16 +- src/gateway/gatewaypayloadtype.ts | 4 + src/gateway/index.ts | 30 +-- src/rpc/apis/channels.ts | 22 +-- src/rpc/apis/communities.ts | 114 +++++++++++ src/rpc/index.ts | 10 +- src/rpc/rpc.ts | 4 + src/server.ts | 2 +- 23 files changed, 576 insertions(+), 144 deletions(-) create mode 100644 frontend/src/components/overlays/AddCommunity.svelte create mode 100644 src/rpc/apis/communities.ts diff --git a/frontend/src/components/ChannelView.svelte b/frontend/src/components/ChannelView.svelte index 9874632..bda28d3 100644 --- a/frontend/src/components/ChannelView.svelte +++ b/frontend/src/components/ChannelView.svelte @@ -11,7 +11,7 @@ - - + + + diff --git a/frontend/src/components/overlays/AddCommunity.svelte b/frontend/src/components/overlays/AddCommunity.svelte new file mode 100644 index 0000000..44163e6 --- /dev/null +++ b/frontend/src/components/overlays/AddCommunity.svelte @@ -0,0 +1,50 @@ + + + + + diff --git a/frontend/src/components/overlays/CreateChannel.svelte b/frontend/src/components/overlays/CreateChannel.svelte index 395e68d..aa420d6 100644 --- a/frontend/src/components/overlays/CreateChannel.svelte +++ b/frontend/src/components/overlays/CreateChannel.svelte @@ -6,10 +6,11 @@ let channelName = ""; let createButtonEnabled = true; export let close = () => {}; + export let community = null; const create = async () => { createButtonEnabled = false; - const { ok } = await remoteSignal(methods.createChannel, channelName); + const { ok } = await remoteSignal(methods.createChannel, channelName, community.id !== -1 ? community.id : null); if (!ok) { overlayStore.toast("Couldn't create channel"); } @@ -33,6 +34,9 @@