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:
@@ -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 }) => {
|
||||
|
||||
Reference in New Issue
Block a user