diff --git a/components/WebsiteDetails.js b/components/WebsiteDetails.js index bd8025ee..d58923c2 100644 --- a/components/WebsiteDetails.js +++ b/components/WebsiteDetails.js @@ -1,4 +1,5 @@ import React, { useState } from 'react'; +import { FormattedMessage } from 'react-intl'; import classNames from 'classnames'; import WebsiteChart from 'components/metrics/WebsiteChart'; import WorldMap from 'components/common/WorldMap'; @@ -32,7 +33,9 @@ export default function WebsiteDetails({ websiteId }) { size="xsmall" onClick={() => setExpand(null)} > -
Back
+
+ +
); diff --git a/components/WebsiteList.js b/components/WebsiteList.js index 59573b96..f2a8c3db 100644 --- a/components/WebsiteList.js +++ b/components/WebsiteList.js @@ -1,4 +1,5 @@ import React from 'react'; +import { FormattedMessage } from 'react-intl'; import { useRouter } from 'next/router'; import WebsiteChart from 'components/metrics/WebsiteChart'; import Page from 'components/layout/Page'; @@ -24,9 +25,21 @@ export default function WebsiteList() { ))} {data.length === 0 && ( - + + } + > )} diff --git a/components/common/ButtonGroup.js b/components/common/ButtonGroup.js index 26707fb9..c91bb743 100644 --- a/components/common/ButtonGroup.js +++ b/components/common/ButtonGroup.js @@ -13,17 +13,20 @@ export default function ButtonGroup({ }) { return (
- {items.map(item => ( - - ))} + {items.map(item => { + const { label, value } = item; + return ( + + ); + })}
); } diff --git a/components/common/CopyButton.js b/components/common/CopyButton.js index 8d6b5db6..399da90d 100644 --- a/components/common/CopyButton.js +++ b/components/common/CopyButton.js @@ -1,7 +1,10 @@ import React, { useState } from 'react'; import Button from './Button'; +import { FormattedMessage } from 'react-intl'; -const defaultText = 'Copy to clipboard'; +const defaultText = ( + +); export default function CopyButton({ element, ...props }) { const [text, setText] = useState(defaultText); @@ -10,7 +13,7 @@ export default function CopyButton({ element, ...props }) { if (element?.current) { element.current.select(); document.execCommand('copy'); - setText('Copied!'); + setText(); window.getSelection().removeAllRanges(); } } diff --git a/components/common/DateFilter.js b/components/common/DateFilter.js index 7b7838dd..aaba8725 100644 --- a/components/common/DateFilter.js +++ b/components/common/DateFilter.js @@ -1,16 +1,40 @@ import React from 'react'; import { getDateRange } from 'lib/date'; import DropDown from './DropDown'; +import { FormattedMessage } from 'react-intl'; const filterOptions = [ - { label: 'Last 24 hours', value: '24hour' }, - { label: 'Last 7 days', value: '7day' }, - { label: 'Last 30 days', value: '30day' }, - { label: 'Last 90 days', value: '90day' }, - { label: 'Today', value: '1day' }, - { label: 'This week', value: '1week' }, - { label: 'This month', value: '1month' }, - { label: 'This year', value: '1year' }, + { + label: ( + + ), + value: '24hour', + }, + { + label: ( + + ), + value: '7day', + }, + { + label: ( + + ), + value: '30day', + }, + { + label: ( + + ), + value: '90day', + }, + { label: , value: '1day' }, + { label: , value: '1week' }, + { + label: , + value: '1month', + }, + { label: , value: '1year' }, ]; export default function DateFilter({ value, onChange, className }) { diff --git a/components/forms/AccountEditForm.js b/components/forms/AccountEditForm.js index 96eea3df..16c6fd3f 100644 --- a/components/forms/AccountEditForm.js +++ b/components/forms/AccountEditForm.js @@ -1,4 +1,5 @@ import React, { useState } from 'react'; +import { FormattedMessage } from 'react-intl'; import { Formik, Form, Field } from 'formik'; import { post } from 'lib/web'; import Button from 'components/common/Button'; @@ -18,10 +19,10 @@ const validate = ({ user_id, username, password }) => { const errors = {}; if (!username) { - errors.username = 'Required'; + errors.username = ; } if (!user_id && !password) { - errors.password = 'Required'; + errors.password = ; } return errors; @@ -36,7 +37,11 @@ export default function AccountEditForm({ values, onSave, onClose }) { if (typeof response !== 'string') { onSave(); } else { - setMessage(response || 'Something went wrong'); + setMessage( + response || ( + + ), + ); } }; @@ -50,20 +55,26 @@ export default function AccountEditForm({ values, onSave, onClose }) { {() => (
- + - + + - {message}
diff --git a/components/forms/ChangePasswordForm.js b/components/forms/ChangePasswordForm.js index f3e5927a..e2f225b7 100644 --- a/components/forms/ChangePasswordForm.js +++ b/components/forms/ChangePasswordForm.js @@ -1,4 +1,5 @@ import React, { useState } from 'react'; +import { FormattedMessage } from 'react-intl'; import { Formik, Form, Field } from 'formik'; import { post } from 'lib/web'; import Button from 'components/common/Button'; @@ -19,15 +20,17 @@ const validate = ({ current_password, new_password, confirm_password }) => { const errors = {}; if (!current_password) { - errors.current_password = 'Required'; + errors.current_password = ; } if (!new_password) { - errors.new_password = 'Required'; + errors.new_password = ; } if (!confirm_password) { - errors.confirm_password = 'Required'; + errors.confirm_password = ; } else if (new_password !== confirm_password) { - errors.confirm_password = `Passwords don't match`; + errors.confirm_password = ( + + ); } return errors; @@ -42,7 +45,11 @@ export default function ChangePasswordForm({ values, onSave, onClose }) { if (typeof response !== 'string') { onSave(); } else { - setMessage(response || 'Something went wrong'); + setMessage( + response || ( + + ), + ); } }; @@ -56,25 +63,33 @@ export default function ChangePasswordForm({ values, onSave, onClose }) { {() => (
- + - + - + + - {message}
diff --git a/components/forms/DeleteForm.js b/components/forms/DeleteForm.js index 650e802f..1ba81626 100644 --- a/components/forms/DeleteForm.js +++ b/components/forms/DeleteForm.js @@ -8,12 +8,17 @@ import FormLayout, { FormMessage, FormRow, } from 'components/layout/FormLayout'; +import { FormattedMessage } from 'react-intl'; const validate = ({ confirmation }) => { const errors = {}; if (confirmation !== 'DELETE') { - errors.confirmation = !confirmation ? 'Required' : 'Invalid'; + errors.confirmation = !confirmation ? ( + + ) : ( + + ); } return errors; @@ -28,7 +33,7 @@ export default function DeleteForm({ values, onSave, onClose }) { if (typeof response !== 'string') { onSave(); } else { - setMessage('Something went wrong'); + setMessage(); } }; @@ -42,11 +47,24 @@ export default function DeleteForm({ values, onSave, onClose }) { {() => (
- Are your sure you want to delete {values.name}? + {values.name} }} + /> +
+
+
-
All associated data will be deleted as well.

- Type DELETE in the box below to confirm. + DELETE }} + />

@@ -54,9 +72,11 @@ export default function DeleteForm({ values, onSave, onClose }) { + - {message}
diff --git a/components/forms/LoginForm.js b/components/forms/LoginForm.js index 78e0480e..0cac8ff8 100644 --- a/components/forms/LoginForm.js +++ b/components/forms/LoginForm.js @@ -1,4 +1,5 @@ import React, { useState } from 'react'; +import { FormattedMessage } from 'react-intl'; import { Formik, Form, Field } from 'formik'; import Router from 'next/router'; import { post } from 'lib/web'; @@ -54,18 +55,22 @@ export default function LoginForm() { } size="xlarge" className={styles.icon} />

umami

- + - + {message} diff --git a/components/forms/ShareUrlForm.js b/components/forms/ShareUrlForm.js index 16a9ca4b..ea162f67 100644 --- a/components/forms/ShareUrlForm.js +++ b/components/forms/ShareUrlForm.js @@ -1,7 +1,8 @@ import React, { useRef } from 'react'; +import { FormattedMessage } from 'react-intl'; import Button from 'components/common/Button'; import FormLayout, { FormButtons, FormRow } from 'components/layout/FormLayout'; -import CopyButton from '../common/CopyButton'; +import CopyButton from 'components/common/CopyButton'; export default function TrackingCodeForm({ values, onClose }) { const ref = useRef(); @@ -10,7 +11,11 @@ export default function TrackingCodeForm({ values, onClose }) { return (

- This is the publicly shared URL for {values.name}. + {values.name} }} + />