import { View } from "react-native";
import { useLocalSearchParams } from "expo-router";

import { AdminAccountsTable } from "@/components/features/admins/AdminAccountsTable";
import { useAppSelector } from "@/store/hooks";
import { selectIsMobile } from "@/store/screen/screenSizeSlice";

export const AdminsPage = () => {
  const isMobile = useAppSelector(selectIsMobile);
  const params = useLocalSearchParams<{ q?: string }>();
  const initialSearchQuery = params.q ?? "";

  return (
    <View className="flex-1 bg-primaryPurpleLight">
      <View className={`${isMobile ? "p-1" : "p-5"} flex-1`}>
        <AdminAccountsTable initialSearchQuery={initialSearchQuery} />
      </View>
    </View>
  );
};
