import React, { useEffect } from "react";
import { useAppDispatch, useAppSelector } from "../hooks/hooks";
import { fetchAdminConversations, selectAdminConversations } from "./features/adminConversationsSlice";
import { ChatTab } from "./ChatTab";
import styles from "./AdminApp.module.scss";
export function AdminApp() {
const dispatch = useAppDispatch();
const params = new URLSearchParams(window.location.search);
const currentTab = params.get('page');
console.log("DEBUG - currentTab is:", currentTab);
const { perPage, list: conversations, selectedId } = useAppSelector(selectAdminConversations);
const selectedConv = conversations.find((c) => c.id === selectedId) || null;
// Default to the ChatTab
let activeView =