From 2f91713c1181f368f675dc4c474f9789e827964d Mon Sep 17 00:00:00 2001 From: Gabriel Garcia Date: Tue, 7 Oct 2025 15:55:24 -0400 Subject: [PATCH] ui: consistency across pages and better autofocus - Consistency achieved across all pages on header items, icons, and margins / positions. Kinda hacked together quite a bit, may need to focus on a consistent style guide across components via utility classes - Autofocus on MessageInput. Refs were giving problems, ended up using DOM queries and focus is now achieved on ChatPage load and when replying to a user. Not ideal and should be changed to Refs again at some point - CreateChannelModal now loads categories, still fails the actual POST request though - Removed extrenuous console.log statements - Laid groundwork for permissions system - New more consistent look and feel overall --- .../src/components/channel/ChannelItem.tsx | 5 - .../src/components/channel/ChannelList.tsx | 2 +- .../src/components/common/ErrorBoundary.tsx | 9 +- .../src/components/layout/AppLayout.tsx | 4 +- .../src/components/layout/ChannelSidebar.tsx | 29 +- .../src/components/layout/MemberList.tsx | 12 +- .../src/components/layout/ServerSidebar.tsx | 49 ++- .../src/components/layout/UserPanel.tsx | 2 +- .../src/components/message/MessageInput.tsx | 55 ++- .../components/modals/CreateChannelModal.tsx | 94 +++-- .../src/components/server/ServerIcon.tsx | 338 +----------------- concord-client/src/hooks/useMessages.ts | 10 - concord-client/src/lib/api-client.ts | 2 + concord-client/src/main.tsx | 20 -- concord-client/src/pages/ChatPage.tsx | 43 ++- concord-client/src/pages/SettingsPage.tsx | 12 +- concord-client/src/stores/voiceStore.ts | 13 - 17 files changed, 190 insertions(+), 509 deletions(-) diff --git a/concord-client/src/components/channel/ChannelItem.tsx b/concord-client/src/components/channel/ChannelItem.tsx index 567fc96..b06f892 100644 --- a/concord-client/src/components/channel/ChannelItem.tsx +++ b/concord-client/src/components/channel/ChannelItem.tsx @@ -38,11 +38,6 @@ const ChannelItem: React.FC = ({ channel }) => { if (isConnectedToThisChannel) { leaveChannel(); } else if (currentUser && token) { - console.log({ - channelId: channel.id, - currentUser: currentUser.id, - token: token, - }); joinChannel(channel.id, currentUser.id, token); } } diff --git a/concord-client/src/components/channel/ChannelList.tsx b/concord-client/src/components/channel/ChannelList.tsx index 0c3ec13..6862c86 100644 --- a/concord-client/src/components/channel/ChannelList.tsx +++ b/concord-client/src/components/channel/ChannelList.tsx @@ -18,7 +18,7 @@ const CategoryHeader: React.FC = ({ return ( - - - - + ); }; diff --git a/concord-client/src/components/layout/MemberList.tsx b/concord-client/src/components/layout/MemberList.tsx index 1e9f700..776143c 100644 --- a/concord-client/src/components/layout/MemberList.tsx +++ b/concord-client/src/components/layout/MemberList.tsx @@ -206,16 +206,16 @@ const MemberList: React.FC = () => { ); return ( -
+
{/* Header */} -
-
- -

+

+
+ +

Members

-

+

{members.length}

diff --git a/concord-client/src/components/layout/ServerSidebar.tsx b/concord-client/src/components/layout/ServerSidebar.tsx index a1b46e8..4ef3a90 100644 --- a/concord-client/src/components/layout/ServerSidebar.tsx +++ b/concord-client/src/components/layout/ServerSidebar.tsx @@ -51,17 +51,17 @@ const ServerSidebar: React.FC = () => { return ( -
+
{/* Home/DM Button */} + + +

Add a Server

+
+
+ )}
- - {/* Add Server Button - Only show if user can create servers */} - {canCreateServer && ( - - - - - -

Add a Server

-
-
- )}
); diff --git a/concord-client/src/components/layout/UserPanel.tsx b/concord-client/src/components/layout/UserPanel.tsx index c1befa2..0d45c2c 100644 --- a/concord-client/src/components/layout/UserPanel.tsx +++ b/concord-client/src/components/layout/UserPanel.tsx @@ -133,7 +133,7 @@ const UserPanel: React.FC = () => { useVoiceStore(); return ( -
+
{/* User Info */}
diff --git a/concord-client/src/components/message/MessageInput.tsx b/concord-client/src/components/message/MessageInput.tsx index 734b1be..32213d9 100644 --- a/concord-client/src/components/message/MessageInput.tsx +++ b/concord-client/src/components/message/MessageInput.tsx @@ -1,9 +1,8 @@ -// src/components/message/MessageInput.tsx - import { Message } from "@/lib/api-client"; -import { useState, useRef, useEffect } from "react"; // Keep useRef +import { useState, useRef, useEffect } from "react"; import { useSendMessage } from "@/hooks/useMessages"; import { Button } from "@/components/ui/button"; +import { Textarea } from "@/components/ui/textarea"; interface MessageUser { id: string; @@ -27,24 +26,21 @@ export const MessageInput: React.FC = ({ replyingToUser, }) => { const [content, setContent] = useState(""); - const textareaRef = useRef(null); const formRef = useRef(null); // Use the API hook for sending messages const sendMessageMutation = useSendMessage(); - // Auto-resize textarea and focus when replying + // Auto-resize textarea (using direct DOM access as a fallback, no ref needed) useEffect(() => { - if (textareaRef.current) { - textareaRef.current.style.height = "auto"; - textareaRef.current.style.height = `${textareaRef.current.scrollHeight}px`; - - // Focus the input when a reply is initiated - if (replyingTo) { - textareaRef.current.focus(); - } + const textarea = document.getElementById( + "message-input-textarea", + ) as HTMLTextAreaElement | null; + if (textarea) { + textarea.style.height = "auto"; + textarea.style.height = `${textarea.scrollHeight}px`; } - }, [content, replyingTo]); + }, [content]); const handleSubmit = async (e: React.FormEvent) => { e.preventDefault(); @@ -71,7 +67,7 @@ export const MessageInput: React.FC = ({ }; return ( -
+
{replyingTo && replyingToUser && (
@@ -97,26 +93,15 @@ export const MessageInput: React.FC = ({ )}
-
-