import { Form, FormRow } from 'react-basics'; import TimezoneSetting from 'components/pages/settings/profile/TimezoneSetting'; import DateRangeSetting from 'components/pages/settings/profile/DateRangeSetting'; import LanguageSetting from 'components/pages/settings/profile/LanguageSetting'; import ThemeSetting from 'components/pages/settings/profile/ThemeSetting'; import PasswordChangeButton from './PasswordChangeButton'; import useUser from 'hooks/useUser'; import useMessages from 'hooks/useMessages'; import useConfig from 'hooks/useConfig'; import { ROLES } from 'lib/constants'; export function ProfileDetails() { const { user } = useUser(); const { formatMessage, labels } = useMessages(); const { cloudMode } = useConfig(); if (!user) { return null; } const { username, role } = user; const renderRole = value => { if (value === ROLES.user) { return formatMessage(labels.user); } if (value === ROLES.admin) { return formatMessage(labels.admin); } if (value === ROLES.viewOnly) { return formatMessage(labels.viewOnly); } return formatMessage(labels.unknown); }; return (
{username} {renderRole(role)} {!cloudMode && ( )}
); } export default ProfileDetails;