📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!
TypeScript chartsclickhousedockergdprgoogle-analyticsmetricsmonitoringmysqlnestjsprivacyredisself-hostedselfhostedstatisticstailwindcssweb-analyticswebanalyticswebsite
some improvements
Blue Mousefa50733039ba
diff --git a/public/locales/en.json b/public/locales/en.jsonindex dd92aba54..d126ca5b7 100644--- a/public/locales/en.json+++ b/public/locales/en.json@@ -53,7 +53,8 @@"delete": "Delete","quit": "Quit","enable": "Enable",- "disable": "Disable"+ "disable": "Disable",+ "copied": "Copied"},"main": {"ukrSupport": "Support the Ukrainian army to fight Russian invasion.",diff --git a/src/pages/UserSettings/UserSettings.jsx b/src/pages/UserSettings/UserSettings.jsxindex 7d9f89c52..b15fdd88c 100644--- a/src/pages/UserSettings/UserSettings.jsx+++ b/src/pages/UserSettings/UserSettings.jsx@@ -1,4 +1,6 @@-import React, { useState, useEffect, memo } from 'react'+import React, {+ useState, useEffect, memo, useRef,+} from 'react'import { useSelector } from 'react-redux'import cx from 'clsx'import _size from 'lodash/size'@@ -365,6 +367,8 @@ const UserSettings = ({const [copied, setCopied] = useState(false)const translatedFrequencies = _map(reportFrequencies, (key) => t(`profileSettings.${key}`)) // useMemo(_map(reportFrequencies, (key) => t(`profileSettings.${key}`)), [t])+ const copyTimerRef = useRef(null)+const validate = () => {const allErrors = {}@@ -390,6 +394,12 @@ const UserSettings = ({validate()}, [form]) // eslint-disable-line+ useEffect(() => {+ return () => {+ clearTimeout(copyTimerRef.current)+ }+ }, [])+const _setTimezone = (value) => {setTimezoneChanged(true)setTimezone(value)@@ -453,17 +463,19 @@ const UserSettings = ({const reportIconExtractor = (_, index) => {if (!isPaidTierUsed && reportFrequencies[index] === WEEKLY_REPORT_FREQUENCY) {- return <CurrencyDollarIcon className='w-5 h-5 mr-1' />+ return (+ <CurrencyDollarIcon className='w-5 h-5 mr-1' />+ )}return null}- const setToClickboard = (value) => {- if (copied !== true) {+ const setToClipboard = (value) => {+ if (!copied) {navigator.clipboard.writeText(value)setCopied(true)- setTimeout(() => {+ copyTimerRef.current = setTimeout(() => {setCopied(false)}, 2000)}@@ -559,7 +571,7 @@ const UserSettings = ({</div></h3>{user.apiKey ? (- <div>+ <><p className='max-w-prose text-base text-gray-900 dark:text-gray-50'>{t('profileSettings.apiKeyWarning')}</p>@@ -581,20 +593,22 @@ const UserSettings = ({<div className='group relative'><Buttontype='button'- onClick={() => setToClickboard(user.apiKey)}+ onClick={() => setToClipboard(user.apiKey)}className='opacity-70 hover:opacity-100'noBorder><ClipboardDocumentIcon className='w-6 h-6' />- {copied && <div className='animate-appear bg-white dark:bg-gray-700 cursor-auto rounded p-1 pl-2 absolute sm:top-0 top-0.5 right-8 text-xs text-green-600'>Copied</div>}-+ {copied && (+ <div className='animate-appear bg-white dark:bg-gray-700 cursor-auto rounded p-1 pl-2 absolute sm:top-0 top-0.5 right-8 text-xs text-green-600'>+ {t('common.copied')}+ </div>+ )}</Button></div></div></div></div>-- </div>+ </>) : (<p className='max-w-prose text-base text-gray-900 dark:text-gray-50'>{t('profileSettings.noApiKey')}diff --git a/tailwind.config.js b/tailwind.config.jsindex 8f624f01c..6bc64c6d7 100644--- a/tailwind.config.js+++ b/tailwind.config.js@@ -23,7 +23,7 @@ module.exports = {},animation: {'ping-slow': 'ping-op 3s cubic-bezier(0, 0, 0.2, 1) infinite',- 'appear': 'appear 0.5s cubic-bezier(0, 0, 0.2, 1) 1'+ 'appear': 'appear 0.5s cubic-bezier(0, 0, 0.2, 1) 1'},keyframes: {'ping-op': {@@ -37,7 +37,7 @@ module.exports = {},'appear': {'0%': {- transform: 'scale(0)',+ transform: 'scale(0)',opacity: 0,},'75%, 100%': {