Improved nav

This commit is contained in:
2025-12-10 22:16:26 +01:00
parent e585aa9458
commit 31bd4f32f8
4 changed files with 12 additions and 0 deletions
+1
View File
@@ -37,6 +37,7 @@ export default function Server() {
);
useEffect(() => {
app.setServer(server);
const channelId = searchParams.get("ch");
if (channelId) {
app.setCurrentChannel(
+5
View File
@@ -21,6 +21,11 @@ export function ChannelItem({ channel, app }: { channel: Channel; app: App }) {
<Card
className="p-2 flex flex-row px-3 items-center gap-2 cursor-pointer hover:bg-accent"
onClick={() => {
window.history.replaceState(
null,
"",
`/server/${app.server?.id}?ch=${channel.id}`
);
app.setCurrentChannel(channel);
app.setSidebarOpen(false);
}}
+3
View File
@@ -19,6 +19,7 @@ export default function useApp(): App {
const [dms, setDms] = useState<UserProfile[]>([]);
const [servers, setServers] = useState<StringMap<Server>>({});
const [currentChannel, setCurrentChannel] = useState<Channel | null>(null);
const [server, setServer] = useState<Server>();
useEffect(() => {
const stored = Cookies.get("servers");
@@ -39,6 +40,8 @@ export default function useApp(): App {
return {
currentChannel,
setCurrentChannel,
server,
setServer,
servers,
setServers,
dms,
+3
View File
@@ -10,6 +10,9 @@ export default interface App {
node: RefObject<WebSocket | null>;
profile: UserProfile | null;
server: Server | undefined;
setServer: SetState<Server | undefined>;
clientSettings: ClientSettings;
setClientSettings: SetState<ClientSettings>;