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 { FormAccess } from "../components/form-access/FormAccess"; import { HelpItem } from "ui-shared"; import { FormPanel } from "../components/scroll-form/FormPanel"; 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("realm-settings"); const { setValue, control, handleSubmit, formState } = useForm(); const offlineSessionMaxEnabled = useWatch({ control, name: "offlineSessionMaxLifespanEnabled", }); const setupForm = () => { convertToFormValues(realm, setValue); }; useEffect(setupForm, []); return ( } > ( )} /> } > ( )} /> } > ( )} /> } > ( )} /> } > ( )} /> } > ( )} /> } > ( )} /> } > ( )} /> {offlineSessionMaxEnabled && ( } > ( )} /> )} } > ( )} /> } > ( )} /> ); };