refactor: remove redundant far-left [S][@] selector

ServerBar already has [@] at the top and server icons below.
The far-left w-16 div was a duplicate layer. ServerBar now
navigates on server/DM clicks.
This commit is contained in:
2026-07-02 09:02:40 -04:00
parent c0686d4ca3
commit 67ce6bbfd9
2 changed files with 14 additions and 40 deletions
+14 -10
View File
@@ -1,13 +1,14 @@
import { useEffect, useState } from 'react';
import { useServerStore } from '../stores/server.ts';
import { useChannelStore } from '../stores/channel.ts';
import { useLayoutStore } from '../stores/layout.ts';
import { CreateServerModal } from './CreateServerModal.tsx';
import { JoinServerModal } from './JoinServerModal.tsx';
import { ServerSettingsModal } from './ServerSettingsModal.tsx';
import { InviteModal } from './InviteModal.tsx';
import { useContextMenu } from './ContextMenu.tsx';
import { api } from '../lib/api.ts';
import { useEffect, useState } from "react";
import { useNavigate } from "react-router-dom";
import { useServerStore } from "../stores/server.ts";
import { useChannelStore } from "../stores/channel.ts";
import { useLayoutStore } from "../stores/layout.ts";
import { CreateServerModal } from "./CreateServerModal.tsx";
import { JoinServerModal } from "./JoinServerModal.tsx";
import { ServerSettingsModal } from "./ServerSettingsModal.tsx";
import { InviteModal } from "./InviteModal.tsx";
import { useContextMenu } from "./ContextMenu.tsx";
import { api } from "../lib/api.ts";
function getInitials(name: string): string {
const words = name.trim().split(/\s+/);
@@ -24,6 +25,7 @@ export function ServerBar() {
const setActiveServer = useServerStore((state) => state.setActiveServer);
const setActiveChannel = useChannelStore((state) => state.setActiveChannel);
const { isDM, setDM } = useLayoutStore();
const navigate = useNavigate();
const [showCreate, setShowCreate] = useState(false);
const [showJoin, setShowJoin] = useState(false);
const [settingsServerId, setSettingsServerId] = useState<string | null>(null);
@@ -39,12 +41,14 @@ export function ServerBar() {
setActiveServer(id);
setActiveChannel(null);
setDM(false);
navigate('/');
};
const handleDM = () => {
setActiveServer(null);
setActiveChannel(null);
setDM(true);
navigate('/dm');
};
const handleServerContextMenu = (e: React.MouseEvent, server: { id: string; name: string }) => {