import type RealmRepresentation from "@keycloak/keycloak-admin-client/lib/defs/realmRepresentation"; import { ActionGroup, Button, FormGroup, PageSection, Switch, } from "@patternfly/react-core"; import { useEffect } from "react"; import { Controller, useForm, useWatch } from "react-hook-form"; import { useTranslation } from "react-i18next"; import { FormPanel, HelpItem } from "ui-shared"; import { FormAccess } from "../components/form/FormAccess"; import { TimeSelector } from "../components/time-selector/TimeSelector"; import { convertToFormValues } from "../util"; import "./realm-settings-section.css"; type RealmSettingsSessionsTabProps = { realm: RealmRepresentation; save: (realm: RealmRepresentation) => void; }; export const RealmSettingsSessionsTab = ({ realm, save, }: RealmSettingsSessionsTabProps) => { const { t } = useTranslation(); const { setValue, control, handleSubmit, formState } = useForm(); const offlineSessionMaxEnabled = useWatch({ control, name: "offlineSessionMaxLifespanEnabled", }); const setupForm = () => { convertToFormValues(realm, setValue); }; useEffect(setupForm, []); return ( } > ( )} /> } > ( )} /> } > ( )} /> } > ( )} /> } > ( )} /> } > ( )} /> } > ( )} /> } > ( )} /> {offlineSessionMaxEnabled && ( } > ( )} /> )} } > ( )} /> } > ( )} /> ); };