import { useTranslation } from "react-i18next";
import { PageSection, Tab, TabTitleText } from "@patternfly/react-core";
import { ViewHeader } from "../components/view-header/ViewHeader";
import { useRealm } from "../context/realm-context/RealmContext";
import helpUrls from "../help-urls";
import { PermissionsTab } from "../components/permission-tab/PermissionTab";
import { UserDataTable } from "../components/users/UserDataTable";
import { toUsers, UserTab } from "./routes/Users";
import {
RoutableTabs,
useRoutableTab,
} from "../components/routable-tabs/RoutableTabs";
import useIsFeatureEnabled, { Feature } from "../utils/useIsFeatureEnabled";
import "./user-section.css";
export default function UsersSection() {
const { t } = useTranslation("users");
const { realm: realmName } = useRealm();
const isFeatureEnabled = useIsFeatureEnabled();
const useTab = (tab: UserTab) =>
useRoutableTab(
toUsers({
realm: realmName,
tab,
}),
);
const listTab = useTab("list");
const permissionsTab = useTab("permissions");
return (
<>
{t("userList")}}
{...listTab}
>
{isFeatureEnabled(Feature.AdminFineGrainedAuthz) && (
{t("common:permissions")}}
{...permissionsTab}
>
)}
>
);
}