mirror of
https://github.com/stoatchat/for-legacy-web.git
synced 2026-03-07 01:15:28 +00:00
feat(mobx): server notification options + data store
This commit is contained in:
@@ -117,7 +117,7 @@
|
||||
}
|
||||
|
||||
&[data-muted="true"] {
|
||||
color: var(--tertiary-foreground);
|
||||
opacity: 0.4;
|
||||
}
|
||||
|
||||
&[data-alert="true"],
|
||||
|
||||
@@ -199,7 +199,7 @@ interface Props {
|
||||
|
||||
export const ServerListSidebar = observer(({ unreads }: Props) => {
|
||||
const client = useClient();
|
||||
const layout = useApplicationState().layout;
|
||||
const state = useApplicationState();
|
||||
|
||||
const { server: server_id } = useParams<{ server?: string }>();
|
||||
const server = server_id ? client.servers.get(server_id) : undefined;
|
||||
@@ -210,6 +210,7 @@ export const ServerListSidebar = observer(({ unreads }: Props) => {
|
||||
|
||||
const unreadChannels = channels
|
||||
.filter((x) => x.unread)
|
||||
.filter((x) => !state.notifications.isMuted(x.channel))
|
||||
.map((x) => x.channel?._id);
|
||||
|
||||
const servers = activeServers.map((server) => {
|
||||
@@ -268,7 +269,7 @@ export const ServerListSidebar = observer(({ unreads }: Props) => {
|
||||
<ServerList>
|
||||
<ConditionalLink
|
||||
active={homeActive}
|
||||
to={layout.getLastHomePath()}>
|
||||
to={state.layout.getLastHomePath()}>
|
||||
<ServerEntry home active={homeActive}>
|
||||
<Swoosh />
|
||||
<div
|
||||
@@ -300,7 +301,7 @@ export const ServerListSidebar = observer(({ unreads }: Props) => {
|
||||
<ConditionalLink
|
||||
key={entry.server._id}
|
||||
active={active}
|
||||
to={layout.getServerPath(entry.server._id)}>
|
||||
to={state.layout.getServerPath(entry.server._id)}>
|
||||
<ServerEntry
|
||||
active={active}
|
||||
onContextMenu={attachContextMenu("Menu", {
|
||||
|
||||
@@ -28,7 +28,6 @@ import ConnectionStatus from "../items/ConnectionStatus";
|
||||
|
||||
interface Props {
|
||||
unreads: Unreads;
|
||||
notifications: Notifications;
|
||||
}
|
||||
|
||||
const ServerBase = styled.div`
|
||||
@@ -59,7 +58,7 @@ const ServerList = styled.div`
|
||||
|
||||
const ServerSidebar = observer((props: Props) => {
|
||||
const client = useClient();
|
||||
const layout = useApplicationState().layout;
|
||||
const state = useApplicationState();
|
||||
const { server: server_id, channel: channel_id } =
|
||||
useParams<{ server: string; channel?: string }>();
|
||||
|
||||
@@ -85,7 +84,7 @@ const ServerSidebar = observer((props: Props) => {
|
||||
if (!channel_id) return;
|
||||
if (!server_id) return;
|
||||
|
||||
layout.setLastOpened(server_id, channel_id);
|
||||
state.layout.setLastOpened(server_id, channel_id);
|
||||
}, [channel_id, server_id]);
|
||||
|
||||
const uncategorised = new Set(server.channel_ids);
|
||||
@@ -96,7 +95,6 @@ const ServerSidebar = observer((props: Props) => {
|
||||
if (!entry) return;
|
||||
|
||||
const active = channel?._id === entry._id;
|
||||
const muted = props.notifications[id] === "none";
|
||||
|
||||
return (
|
||||
<ConditionalLink
|
||||
@@ -120,7 +118,7 @@ const ServerSidebar = observer((props: Props) => {
|
||||
// ! FIXME: pull it out directly
|
||||
alert={mapChannelWithUnread(entry, props.unreads).unread}
|
||||
compact
|
||||
muted={muted}
|
||||
muted={state.notifications.isMuted(entry)}
|
||||
/>
|
||||
</ConditionalLink>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user