umami/components/pages/settings/profile/ProfileDetails.js

48 lines
1.5 KiB
JavaScript
Raw Normal View History

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';
2023-03-24 00:33:10 +01:00
import PasswordChangeButton from './PasswordChangeButton';
import useUser from 'hooks/useUser';
2023-03-22 05:28:36 +01:00
import useMessages from 'hooks/useMessages';
2023-03-24 00:33:10 +01:00
import useConfig from 'hooks/useConfig';
export default function ProfileDetails() {
const { user } = useUser();
2023-03-22 05:28:36 +01:00
const { formatMessage, labels } = useMessages();
2023-03-24 00:33:10 +01:00
const { cloudMode } = useConfig();
if (!user) {
return null;
}
const { username, role } = user;
return (
<Form>
2023-01-25 16:42:46 +01:00
<FormRow label={formatMessage(labels.username)}>{username}</FormRow>
2023-03-22 05:28:36 +01:00
<FormRow label={formatMessage(labels.role)}>
{formatMessage(labels[role] || labels.unknown)}
</FormRow>
2023-03-24 00:33:10 +01:00
{!cloudMode && (
<FormRow label={formatMessage(labels.password)}>
<PasswordChangeButton />
</FormRow>
)}
2023-01-31 06:44:07 +01:00
<FormRow label={formatMessage(labels.defaultDateRange)}>
<DateRangeSetting />
</FormRow>
<FormRow label={formatMessage(labels.language)}>
<LanguageSetting />
</FormRow>
<FormRow label={formatMessage(labels.timezone)}>
<TimezoneSetting />
</FormRow>
2023-01-25 16:42:46 +01:00
<FormRow label={formatMessage(labels.theme)}>
<ThemeSetting />
</FormRow>
</Form>
);
}