2023-01-11 02:18:59 +01:00
|
|
|
import { Form, FormRow } from 'react-basics';
|
|
|
|
import { useIntl, defineMessages } from 'react-intl';
|
2022-12-27 01:57:59 +01:00
|
|
|
import TimezoneSetting from 'components/settings/TimezoneSetting';
|
2023-01-11 02:18:59 +01:00
|
|
|
import DateRangeSetting from 'components/settings/DateRangeSetting';
|
|
|
|
import LanguageSetting from 'components/settings/LanguageSetting';
|
|
|
|
import ThemeSetting from 'components/settings/ThemeSetting';
|
2022-12-27 01:57:59 +01:00
|
|
|
import useUser from 'hooks/useUser';
|
2022-12-29 00:43:22 +01:00
|
|
|
|
2023-01-11 02:18:59 +01:00
|
|
|
const messages = defineMessages({
|
|
|
|
username: { id: 'label.username', defaultMessage: 'Username' },
|
|
|
|
role: { id: 'label.role', defaultMessage: 'Role' },
|
|
|
|
timezone: { id: 'label.timezone', defaultMessage: 'Timezone' },
|
|
|
|
dateRange: { id: 'label.default-date-range', defaultMessage: 'Default date range' },
|
|
|
|
language: { id: 'label.language', defaultMessage: 'Language' },
|
|
|
|
theme: { id: 'label.theme', defaultMessage: 'Theme' },
|
|
|
|
});
|
2022-12-27 01:57:59 +01:00
|
|
|
|
|
|
|
export default function ProfileDetails() {
|
2022-12-29 00:43:22 +01:00
|
|
|
const user = useUser();
|
2023-01-11 02:18:59 +01:00
|
|
|
const { formatMessage } = useIntl();
|
2022-12-27 01:57:59 +01:00
|
|
|
|
|
|
|
if (!user) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2023-01-11 02:18:59 +01:00
|
|
|
const { username, role } = user;
|
2022-12-27 01:57:59 +01:00
|
|
|
|
|
|
|
return (
|
2023-01-11 02:18:59 +01:00
|
|
|
<Form>
|
|
|
|
<FormRow label={formatMessage(messages.username)}>{username}</FormRow>
|
|
|
|
<FormRow label={formatMessage(messages.role)}>{role}</FormRow>
|
|
|
|
<FormRow label={formatMessage(messages.language)} inline>
|
|
|
|
<LanguageSetting />
|
|
|
|
</FormRow>
|
|
|
|
<FormRow label={formatMessage(messages.timezone)} inline>
|
|
|
|
<TimezoneSetting />
|
|
|
|
</FormRow>
|
|
|
|
<FormRow label={formatMessage(messages.dateRange)} inline>
|
|
|
|
<DateRangeSetting />
|
|
|
|
</FormRow>
|
|
|
|
<FormRow label={formatMessage(messages.theme)}>
|
|
|
|
<ThemeSetting />
|
|
|
|
</FormRow>
|
|
|
|
</Form>
|
2022-12-27 01:57:59 +01:00
|
|
|
);
|
|
|
|
}
|