import React, { useState } from 'react'; import { FormattedMessage } from 'react-intl'; import { useDispatch, useSelector } from 'react-redux'; import PageHeader from 'components/layout/PageHeader'; import Button from 'components/common/Button'; import Modal from 'components/common/Modal'; import Toast from 'components/common/Toast'; import ChangePasswordForm from 'components/forms/ChangePasswordForm'; import DateFilter from 'components/common/DateFilter'; import Dots from 'assets/ellipsis-h.svg'; import { getTimezone } from 'lib/date'; import { setItem } from 'lib/web'; import useDateRange from 'hooks/useDateRange'; import { setDateRange } from 'redux/actions/websites'; import styles from './ProfileSettings.module.css'; export default function ProfileSettings() { const dispatch = useDispatch(); const user = useSelector(state => state.user); const [changePassword, setChangePassword] = useState(false); const [message, setMessage] = useState(); const { user_id } = user; const timezone = getTimezone(); const dateRange = useDateRange(0); const { startDate, endDate, value } = dateRange; function handleSave() { setChangePassword(false); setMessage(); } function handleDateChange(values) { const { value } = values; setItem(`umami.date-range`, value === 'custom' ? values : value); dispatch(setDateRange(0, values)); } return ( <>
{user.username}
{timezone}
{changePassword && ( } > setChangePassword(false)} /> )} {message && setMessage(null)} />} ); }