Create chat modal UI & session login for WS auth
Backend: initialize a Django session on token obtain (login) so AuthMiddlewareStack can authenticate WebSocket connections; validate the token serializer and map TokenError -> InvalidToken; call django_logout on logout to destroy the session. Frontend: add a CreateChatModal component (DM/group creation) with user search, selection, validation, API mutation and cache invalidation; wire modal into ChatSidebar and add Czech translations for the new UI strings.
This commit is contained in:
@@ -7,10 +7,12 @@ import Avatar from "@/components/ui/Avatar";
|
||||
import Spinner from "@/components/ui/Spinner";
|
||||
import EmptyState from "@/components/ui/EmptyState";
|
||||
import IconButton from "@/components/ui/IconButton";
|
||||
import CreateChatModal from "./CreateChatModal";
|
||||
|
||||
export default function ChatSidebar() {
|
||||
const { t } = useTranslation("social");
|
||||
const [query, setQuery] = useState("");
|
||||
const [createOpen, setCreateOpen] = useState(false);
|
||||
|
||||
const { data, isLoading } = useApiSocialChatsList(
|
||||
query ? { search: query } : undefined,
|
||||
@@ -24,7 +26,11 @@ export default function ChatSidebar() {
|
||||
<h2 className="text-sm font-semibold text-brand-text">
|
||||
{t("chat.sidebar.title")}
|
||||
</h2>
|
||||
<IconButton icon={<FiPlus size={16} />} label={t("chat.sidebar.new")} />
|
||||
<IconButton
|
||||
icon={<FiPlus size={16} />}
|
||||
label={t("chat.sidebar.new")}
|
||||
onClick={() => setCreateOpen(true)}
|
||||
/>
|
||||
</header>
|
||||
|
||||
<div className="relative px-3 py-2">
|
||||
@@ -86,6 +92,11 @@ export default function ChatSidebar() {
|
||||
))}
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<CreateChatModal
|
||||
open={createOpen}
|
||||
onClose={() => setCreateOpen(false)}
|
||||
/>
|
||||
</aside>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user