Skip to content

📈 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!

user-settings to remix and add routing

Maksim Mrug0f18cddd2a7b
diff --git a/app/pages/UserSettings/UserSettings.tsx b/app/pages/UserSettings/UserSettings.tsx
index 03b6b83fb..889357a5a 100644
--- a/app/pages/UserSettings/UserSettings.tsx
+++ b/app/pages/UserSettings/UserSettings.tsx
@@ -2,7 +2,7 @@
import React, {
useState, useEffect, memo, useRef,
} from 'react'
-import { useHistory } from 'react-router-dom'
+import { useNavigate } from '@remix-run/react'
import { useTranslation } from 'react-i18next'
import _size from 'lodash/size'
import _isEmpty from 'lodash/isEmpty'
@@ -24,7 +24,6 @@ import {
} from 'redux/constants'
import { IUser } from 'redux/models/IUser'
import { ISharedProject } from 'redux/models/ISharedProject'
-import Title from 'components/Title'
import { withAuthentication, auth } from 'hoc/protected'
import Input from 'ui/Input'
import Button from 'ui/Button'
@@ -35,7 +34,7 @@ import Checkbox from 'ui/Checkbox'
import PaidFeature from 'modals/PaidFeature'
import TimezonePicker from 'ui/TimezonePicker'
import { isValidEmail, isValidPassword, MIN_PASSWORD_CHARS } from 'utils/validator'
-import routes from 'routes'
+import routes from 'routesPath'
import { trackCustom } from 'utils/analytics'
import { getCookie, setCookie } from 'utils/cookie'
import {
@@ -89,7 +88,7 @@ const UserSettings = ({
accountUpdated, setAPIKey, user, dontRemember, isPaidTierUsed, // setThemeType, themeType,
linkSSO, unlinkSSO, theme, updateShowLiveVisitorsInTitle,
}: IProps): JSX.Element => {
- const history = useHistory()
+ const navigate = useNavigate()
const { t }: {
t: (key: string, options?: {
[key: string]: string | number | null,
@@ -284,7 +283,7 @@ const UserSettings = ({
const _onDelete = () => {
onDelete(t, () => {
- history.push(routes.main)
+ navigate(routes.main)
})
}
@@ -371,74 +370,73 @@ const UserSettings = ({
}
return (
- <Title title={t('titles.profileSettings')}>
- <div className='min-h-min-footer bg-gray-50 dark:bg-slate-900 flex flex-col py-6 px-4 sm:px-6 lg:px-8'>
- <form className='max-w-7xl w-full mx-auto' onSubmit={handleSubmit}>
- <h2 className='mt-2 text-3xl font-bold text-gray-900 dark:text-gray-50'>
- {t('titles.profileSettings')}
- </h2>
- <h3 className='mt-2 text-lg font-bold text-gray-900 dark:text-gray-50'>
- {t('profileSettings.general')}
- </h3>
- <Input
- name='email'
- id='email'
- type='email'
- label={t('auth.common.email')}
- value={form.email}
- placeholder='[email protected]'
- className='mt-4'
- onChange={handleInput}
- error={beenSubmitted ? errors.email : null}
- disabled={isSelfhosted}
- />
- {!isSelfhosted && (
- <>
- <span
- onClick={toggleShowPasswordFields}
- className='flex items-center cursor-pointer max-w-max text-gray-900 dark:text-gray-50 hover:underline'
- >
- {t('auth.common.changePassword')}
- <ChevronDownIcon
- className={cx('w-4 h-4 ml-2', {
- 'rotate-180': showPasswordFields,
- })}
- />
- </span>
- {showPasswordFields && (
- <div className='grid grid-cols-1 gap-y-6 gap-x-4 sm:grid-cols-6 mt-4'>
- <Input
- name='password'
- id='password'
- type='password'
- label={t('auth.common.password')}
- hint={t('auth.common.hint', { amount: MIN_PASSWORD_CHARS })}
- value={form.password}
- placeholder={t('auth.common.password')}
- className='sm:col-span-3'
- onChange={handleInput}
- error={beenSubmitted ? errors.password : null}
- />
- <Input
- name='repeat'
- id='repeat'
- type='password'
- label={t('auth.common.repeat')}
- value={form.repeat}
- placeholder={t('auth.common.repeat')}
- className='sm:col-span-3'
- onChange={handleInput}
- error={beenSubmitted ? errors.repeat : null}
- />
- </div>
- )}
- <Button className='mt-4' type='submit' primary large>
- {t('profileSettings.update')}
- </Button>
- </>
+ <div className='min-h-min-footer bg-gray-50 dark:bg-slate-900 flex flex-col py-6 px-4 sm:px-6 lg:px-8'>
+ <form className='max-w-7xl w-full mx-auto' onSubmit={handleSubmit}>
+ <h2 className='mt-2 text-3xl font-bold text-gray-900 dark:text-gray-50'>
+ {t('titles.profileSettings')}
+ </h2>
+ <h3 className='mt-2 text-lg font-bold text-gray-900 dark:text-gray-50'>
+ {t('profileSettings.general')}
+ </h3>
+ <Input
+ name='email'
+ id='email'
+ type='email'
+ label={t('auth.common.email')}
+ value={form.email}
+ placeholder='[email protected]'
+ className='mt-4'
+ onChange={handleInput}
+ error={beenSubmitted ? errors.email : null}
+ disabled={isSelfhosted}
+ />
+ {!isSelfhosted && (
+ <>
+ <span
+ onClick={toggleShowPasswordFields}
+ className='flex items-center cursor-pointer max-w-max text-gray-900 dark:text-gray-50 hover:underline'
+ >
+ {t('auth.common.changePassword')}
+ <ChevronDownIcon
+ className={cx('w-4 h-4 ml-2', {
+ 'rotate-180': showPasswordFields,
+ })}
+ />
+ </span>
+ {showPasswordFields && (
+ <div className='grid grid-cols-1 gap-y-6 gap-x-4 sm:grid-cols-6 mt-4'>
+ <Input
+ name='password'
+ id='password'
+ type='password'
+ label={t('auth.common.password')}
+ hint={t('auth.common.hint', { amount: MIN_PASSWORD_CHARS })}
+ value={form.password}
+ placeholder={t('auth.common.password')}
+ className='sm:col-span-3'
+ onChange={handleInput}
+ error={beenSubmitted ? errors.password : null}
+ />
+ <Input
+ name='repeat'
+ id='repeat'
+ type='password'
+ label={t('auth.common.repeat')}
+ value={form.repeat}
+ placeholder={t('auth.common.repeat')}
+ className='sm:col-span-3'
+ onChange={handleInput}
+ error={beenSubmitted ? errors.repeat : null}
+ />
+ </div>
)}
- {/* Theme type switch */}
- {/* <hr className='mt-5 border-gray-200 dark:border-gray-600' />
+ <Button className='mt-4' type='submit' primary large>
+ {t('profileSettings.update')}
+ </Button>
+ </>
+ )}
+ {/* Theme type switch */}
+ {/* <hr className='mt-5 border-gray-200 dark:border-gray-600' />
<h3 className='flex items-center mt-2 text-lg font-bold text-gray-900 dark:text-gray-50'>
{t('profileSettings.theme')}
</h3>
@@ -453,327 +451,326 @@ const UserSettings = ({
/>
</div>
</div> */}
- {/* Timezone selector */}
- <hr className='mt-5 border-gray-200 dark:border-gray-600' />
- <h3 className='mt-2 text-lg font-bold text-gray-900 dark:text-gray-50 flex items-center'>
- {t('profileSettings.timezone')}
- <div className='ml-5'>
- <Beta />
- </div>
- </h3>
- <div className='grid grid-cols-1 gap-y-6 gap-x-4 lg:grid-cols-2 mt-4'>
- <div>
- <TimezonePicker value={timezone} onChange={_setTimezone} />
- </div>
+ {/* Timezone selector */}
+ <hr className='mt-5 border-gray-200 dark:border-gray-600' />
+ <h3 className='mt-2 text-lg font-bold text-gray-900 dark:text-gray-50 flex items-center'>
+ {t('profileSettings.timezone')}
+ <div className='ml-5'>
+ <Beta />
</div>
- <Button className='mt-4' onClick={handleTimezoneSave} primary large>
- {t('common.save')}
- </Button>
- {/* Timeformat selector (12 / 24 hour format) */}
+ </h3>
+ <div className='grid grid-cols-1 gap-y-6 gap-x-4 lg:grid-cols-2 mt-4'>
+ <div>
+ <TimezonePicker value={timezone} onChange={_setTimezone} />
+ </div>
+ </div>
+ <Button className='mt-4' onClick={handleTimezoneSave} primary large>
+ {t('common.save')}
+ </Button>
+ {/* Timeformat selector (12 / 24 hour format) */}
+ <hr className='mt-5 border-gray-200 dark:border-gray-600' />
+ <h3 className='mt-2 text-lg font-bold text-gray-900 dark:text-gray-50'>
+ {t('profileSettings.timeFormat')}
+ </h3>
+ <div className='grid grid-cols-1 gap-y-6 gap-x-4 lg:grid-cols-2 mt-4'>
+ <div>
+ <Select
+ title={t(`profileSettings.${form.timeFormat}`)}
+ label={t('profileSettings.selectTimeFormat')}
+ className='w-full'
+ items={translatedTimeFormat}
+ onSelect={(f) => setForm((prev) => ({ ...prev, timeFormat: timeFormatArray[_findIndex(translatedTimeFormat, (freq) => freq === f)] }))}
+ />
+ </div>
+ </div>
+ <Button className='mt-4' onClick={setAsyncTimeFormat} primary large>
+ {t('common.save')}
+ </Button>
+
+ {!isSelfhosted && (
+ <>
+ {/* Email reports frequency selector (e.g. monthly, weekly, etc.) */}
<hr className='mt-5 border-gray-200 dark:border-gray-600' />
<h3 className='mt-2 text-lg font-bold text-gray-900 dark:text-gray-50'>
- {t('profileSettings.timeFormat')}
+ {t('profileSettings.email')}
</h3>
<div className='grid grid-cols-1 gap-y-6 gap-x-4 lg:grid-cols-2 mt-4'>
<div>
<Select
- title={t(`profileSettings.${form.timeFormat}`)}
- label={t('profileSettings.selectTimeFormat')}
+ title={t(`profileSettings.${reportFrequency}`)}
+ label={t('profileSettings.frequency')}
className='w-full'
- items={translatedTimeFormat}
- onSelect={(f) => setForm((prev) => ({ ...prev, timeFormat: timeFormatArray[_findIndex(translatedTimeFormat, (freq) => freq === f)] }))}
+ items={translatedFrequencies}
+ iconExtractor={reportIconExtractor}
+ onSelect={(f) => _setReportFrequency(
+ reportFrequencies[_findIndex(translatedFrequencies, (freq) => freq === f)],
+ )}
/>
</div>
</div>
- <Button className='mt-4' onClick={setAsyncTimeFormat} primary large>
+ <Button className='mt-4' onClick={handleReportSave} primary large>
{t('common.save')}
</Button>
+ </>
+ )}
+
+ {/* UI Settings */}
+ <hr className='mt-5 border-gray-200 dark:border-gray-600' />
+ <h3 className='mt-2 text-lg font-bold text-gray-900 dark:text-gray-50'>
+ {t('profileSettings.uiSettings')}
+ </h3>
+ <Checkbox
+ checked={user.showLiveVisitorsInTitle}
+ onChange={handleShowLiveVisitorsSave}
+ disabled={settingUpdating}
+ name='active'
+ id='active'
+ className='mt-4'
+ label={t('profileSettings.showVisitorsInTitle')}
+ />
- {!isSelfhosted && (
+ {!isSelfhosted && (
+ <>
+ <hr className='mt-5 border-gray-200 dark:border-gray-600' />
+ {/* Integrations setup */}
+ <h3 id='integrations' className='flex items-center mt-2 text-lg font-bold text-gray-900 dark:text-gray-50'>
+ {t('profileSettings.integrations')}
+ </h3>
+ <Integrations
+ user={user}
+ updateUserData={updateUserData}
+ handleIntegrationSave={handleIntegrationSave}
+ genericError={genericError}
+ />
+ <hr className='mt-5 border-gray-200 dark:border-gray-600' />
+
+ {/* API access setup */}
+ <h3 className='flex items-center mt-2 text-lg font-bold text-gray-900 dark:text-gray-50'>
+ {t('profileSettings.apiKey')}
+ <div className='ml-5'>
+ <Beta />
+ </div>
+ </h3>
+ {user.apiKey ? (
<>
- {/* Email reports frequency selector (e.g. monthly, weekly, etc.) */}
- <hr className='mt-5 border-gray-200 dark:border-gray-600' />
- <h3 className='mt-2 text-lg font-bold text-gray-900 dark:text-gray-50'>
- {t('profileSettings.email')}
- </h3>
- <div className='grid grid-cols-1 gap-y-6 gap-x-4 lg:grid-cols-2 mt-4'>
- <div>
- <Select
- title={t(`profileSettings.${reportFrequency}`)}
- label={t('profileSettings.frequency')}
- className='w-full'
- items={translatedFrequencies}
- iconExtractor={reportIconExtractor}
- onSelect={(f) => _setReportFrequency(
- reportFrequencies[_findIndex(translatedFrequencies, (freq) => freq === f)],
- )}
+ <p className='max-w-prose text-base text-gray-900 dark:text-gray-50'>
+ {t('profileSettings.apiKeyWarning')}
+ </p>
+ <p className='mt-4 max-w-prose text-base text-gray-900 dark:text-gray-50'>
+ {t('profileSettings.apiKey')}
+ </p>
+ <div className='grid grid-cols-1 gap-y-6 gap-x-4 lg:grid-cols-2'>
+ <div className='relative group'>
+ <Input
+ name='apiKey'
+ id='apiKey'
+ type='text'
+ className='pr-9'
+ value={user.apiKey}
+ onChange={handleInput}
+ disabled
/>
+ <div className='absolute right-2 top-3'>
+ <div className='group relative'>
+ <Button
+ type='button'
+ 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-slate-800 cursor-auto rounded p-1 absolute sm:top-0 top-0.5 right-8 text-xs text-green-600'>
+ {t('common.copied')}
+ </div>
+ )}
+ </>
+ </Button>
+ </div>
+ </div>
</div>
</div>
- <Button className='mt-4' onClick={handleReportSave} primary large>
- {t('common.save')}
- </Button>
</>
+ ) : (
+ <p className='max-w-prose text-base text-gray-900 dark:text-gray-50'>
+ {t('profileSettings.noApiKey')}
+ </p>
+ )}
+ {user.apiKey ? (
+ <Button className='mt-4' onClick={() => setShowAPIDeleteModal(true)} danger large>
+ {t('profileSettings.deleteApiKeyBtn')}
+ </Button>
+ ) : (
+ <Button className='mt-4' onClick={onApiKeyGenerate} primary large>
+ {t('profileSettings.addApiKeyBtn')}
+ </Button>
)}
- {/* UI Settings */}
+ {/* 2FA setting */}
<hr className='mt-5 border-gray-200 dark:border-gray-600' />
- <h3 className='mt-2 text-lg font-bold text-gray-900 dark:text-gray-50'>
- {t('profileSettings.uiSettings')}
+ <h3 className='flex items-center mt-2 text-lg font-bold text-gray-900 dark:text-gray-50'>
+ {t('profileSettings.2fa')}
</h3>
- <Checkbox
- checked={user.showLiveVisitorsInTitle}
- onChange={handleShowLiveVisitorsSave}
- disabled={settingUpdating}
- name='active'
- id='active'
- className='mt-4'
- label={t('profileSettings.showVisitorsInTitle')}
+ <TwoFA
+ user={user}
+ dontRemember={dontRemember}
+ updateUserData={updateUserData}
+ genericError={genericError}
/>
- {!isSelfhosted && (
- <>
- <hr className='mt-5 border-gray-200 dark:border-gray-600' />
- {/* Integrations setup */}
- <h3 id='integrations' className='flex items-center mt-2 text-lg font-bold text-gray-900 dark:text-gray-50'>
- {t('profileSettings.integrations')}
- </h3>
- <Integrations
- user={user}
- updateUserData={updateUserData}
- handleIntegrationSave={handleIntegrationSave}
- genericError={genericError}
- />
- <hr className='mt-5 border-gray-200 dark:border-gray-600' />
-
- {/* API access setup */}
- <h3 className='flex items-center mt-2 text-lg font-bold text-gray-900 dark:text-gray-50'>
- {t('profileSettings.apiKey')}
- <div className='ml-5'>
- <Beta />
- </div>
- </h3>
- {user.apiKey ? (
- <>
- <p className='max-w-prose text-base text-gray-900 dark:text-gray-50'>
- {t('profileSettings.apiKeyWarning')}
- </p>
- <p className='mt-4 max-w-prose text-base text-gray-900 dark:text-gray-50'>
- {t('profileSettings.apiKey')}
- </p>
- <div className='grid grid-cols-1 gap-y-6 gap-x-4 lg:grid-cols-2'>
- <div className='relative group'>
- <Input
- name='apiKey'
- id='apiKey'
- type='text'
- className='pr-9'
- value={user.apiKey}
- onChange={handleInput}
- disabled
- />
- <div className='absolute right-2 top-3'>
- <div className='group relative'>
- <Button
- type='button'
- 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-slate-800 cursor-auto rounded p-1 absolute sm:top-0 top-0.5 right-8 text-xs text-green-600'>
- {t('common.copied')}
- </div>
- )}
- </>
- </Button>
- </div>
- </div>
- </div>
- </div>
- </>
- ) : (
- <p className='max-w-prose text-base text-gray-900 dark:text-gray-50'>
- {t('profileSettings.noApiKey')}
- </p>
- )}
- {user.apiKey ? (
- <Button className='mt-4' onClick={() => setShowAPIDeleteModal(true)} danger large>
- {t('profileSettings.deleteApiKeyBtn')}
- </Button>
- ) : (
- <Button className='mt-4' onClick={onApiKeyGenerate} primary large>
- {t('profileSettings.addApiKeyBtn')}
- </Button>
- )}
-
- {/* 2FA setting */}
- <hr className='mt-5 border-gray-200 dark:border-gray-600' />
- <h3 className='flex items-center mt-2 text-lg font-bold text-gray-900 dark:text-gray-50'>
- {t('profileSettings.2fa')}
- </h3>
- <TwoFA
- user={user}
- dontRemember={dontRemember}
- updateUserData={updateUserData}
- genericError={genericError}
- />
-
- {/* Socialisations setup */}
- <hr className='mt-5 border-gray-200 dark:border-gray-600' />
- <h3 id='socialisations' className='flex items-center mt-2 text-lg font-bold text-gray-900 dark:text-gray-50'>
- {t('profileSettings.socialisations')}
- </h3>
- <Socialisations
- user={user}
- genericError={genericError}
- linkSSO={linkSSO}
- unlinkSSO={unlinkSSO}
- theme={theme}
- />
+ {/* Socialisations setup */}
+ <hr className='mt-5 border-gray-200 dark:border-gray-600' />
+ <h3 id='socialisations' className='flex items-center mt-2 text-lg font-bold text-gray-900 dark:text-gray-50'>
+ {t('profileSettings.socialisations')}
+ </h3>
+ <Socialisations
+ user={user}
+ genericError={genericError}
+ linkSSO={linkSSO}
+ unlinkSSO={unlinkSSO}
+ theme={theme}
+ />
- {/* Shared projects setting */}
- <hr className='mt-5 border-gray-200 dark:border-gray-600' />
- <h3 className='flex items-center mt-2 text-lg font-bold text-gray-900 dark:text-gray-50'>
- {t('profileSettings.shared')}
- </h3>
- <div>
- {!_isEmpty(user.sharedProjects) ? (
- <div className='mt-3 flex flex-col'>
- <div className='-my-2 -mx-4 overflow-x-auto sm:-mx-6 lg:-mx-8'>
- <div className='inline-block min-w-full py-2 align-middle md:px-6 lg:px-8'>
- <div className='overflow-hidden shadow ring-1 ring-black ring-opacity-5 md:rounded-lg'>
- <table className='min-w-full divide-y divide-gray-300 dark:divide-gray-600'>
- <thead>
- <tr className='dark:bg-slate-800'>
- <th
- scope='col'
- className='py-3.5 pl-4 pr-3 text-left text-sm font-semibold text-gray-900 sm:pl-6 dark:text-white'
- >
- {t('profileSettings.sharedTable.project')}
- </th>
- <th
- scope='col'
- className='px-3 py-3.5 text-left text-sm font-semibold text-gray-900 dark:text-white'
- >
- {t('profileSettings.sharedTable.role')}
- </th>
- <th
- scope='col'
- className='px-3 py-3.5 text-left text-sm font-semibold text-gray-900 dark:text-white'
- >
- {t('profileSettings.sharedTable.joinedOn')}
- </th>
- <th scope='col' className='relative py-3.5 pl-3 pr-4 sm:pr-6' />
- </tr>
- </thead>
- <tbody className='divide-y divide-gray-300 dark:divide-gray-600'>
- {_map(user.sharedProjects, (item) => (
- <ProjectList
- key={item.id}
- item={item}
- removeProject={removeProject}
- removeShareProject={removeShareProject}
- setUserShareData={setUserShareData}
- setProjectsShareData={setProjectsShareData}
- userSharedUpdate={userSharedUpdate}
- sharedProjectError={sharedProjectError}
- />
- ))}
- </tbody>
- </table>
- </div>
- </div>
+ {/* Shared projects setting */}
+ <hr className='mt-5 border-gray-200 dark:border-gray-600' />
+ <h3 className='flex items-center mt-2 text-lg font-bold text-gray-900 dark:text-gray-50'>
+ {t('profileSettings.shared')}
+ </h3>
+ <div>
+ {!_isEmpty(user.sharedProjects) ? (
+ <div className='mt-3 flex flex-col'>
+ <div className='-my-2 -mx-4 overflow-x-auto sm:-mx-6 lg:-mx-8'>
+ <div className='inline-block min-w-full py-2 align-middle md:px-6 lg:px-8'>
+ <div className='overflow-hidden shadow ring-1 ring-black ring-opacity-5 md:rounded-lg'>
+ <table className='min-w-full divide-y divide-gray-300 dark:divide-gray-600'>
+ <thead>
+ <tr className='dark:bg-slate-800'>
+ <th
+ scope='col'
+ className='py-3.5 pl-4 pr-3 text-left text-sm font-semibold text-gray-900 sm:pl-6 dark:text-white'
+ >
+ {t('profileSettings.sharedTable.project')}
+ </th>
+ <th
+ scope='col'
+ className='px-3 py-3.5 text-left text-sm font-semibold text-gray-900 dark:text-white'
+ >
+ {t('profileSettings.sharedTable.role')}
+ </th>
+ <th
+ scope='col'
+ className='px-3 py-3.5 text-left text-sm font-semibold text-gray-900 dark:text-white'
+ >
+ {t('profileSettings.sharedTable.joinedOn')}
+ </th>
+ <th scope='col' className='relative py-3.5 pl-3 pr-4 sm:pr-6' />
+ </tr>
+ </thead>
+ <tbody className='divide-y divide-gray-300 dark:divide-gray-600'>
+ {_map(user.sharedProjects, (item) => (
+ <ProjectList
+ key={item.id}
+ item={item}
+ removeProject={removeProject}
+ removeShareProject={removeShareProject}
+ setUserShareData={setUserShareData}
+ setProjectsShareData={setProjectsShareData}
+ userSharedUpdate={userSharedUpdate}
+ sharedProjectError={sharedProjectError}
+ />
+ ))}
+ </tbody>
+ </table>
</div>
</div>
- ) : (
- <NoSharedProjects t={t} />
- )}
- </div>
- <hr className='mt-5 border-gray-200 dark:border-gray-600' />
- {!user.isActive && (
- <div
- className='flex cursor-pointer mt-4 pl-0 underline text-blue-600 hover:text-indigo-800 dark:hover:text-indigo-600'
- onClick={() => onEmailConfirm(setError)}
- >
- <EnvelopeIcon className='mt-0.5 mr-2 w-6 h-6 text-blue-500' />
- {t('profileSettings.noLink')}
</div>
- )}
- <div className='flex justify-between mt-4'>
- <Button onClick={() => setShowExportModal(true)} semiSmall primary>
- <>
- <ArrowDownTrayIcon className='w-5 h-5 mr-1' />
- {t('profileSettings.requestExport')}
- </>
- </Button>
- <Button className='ml-3' onClick={() => setShowModal(true)} semiSmall danger>
- <>
- <ExclamationTriangleIcon className='w-5 h-5 mr-1' />
- {t('profileSettings.delete')}
- </>
- </Button>
</div>
- </>
+ ) : (
+ <NoSharedProjects t={t} />
+ )}
+ </div>
+ <hr className='mt-5 border-gray-200 dark:border-gray-600' />
+ {!user.isActive && (
+ <div
+ className='flex cursor-pointer mt-4 pl-0 underline text-blue-600 hover:text-indigo-800 dark:hover:text-indigo-600'
+ onClick={() => onEmailConfirm(setError)}
+ >
+ <EnvelopeIcon className='mt-0.5 mr-2 w-6 h-6 text-blue-500' />
+ {t('profileSettings.noLink')}
+ </div>
)}
- </form>
-
- <PaidFeature isOpened={isPaidFeatureOpened} onClose={() => setIsPaidFeatureOpened(false)} />
- <Modal
- onClose={() => setShowExportModal(false)}
- onSubmit={() => {
- setShowExportModal(false)
- onExport(user.exportedAt)
- }}
- submitText={t('common.continue')}
- closeText={t('common.close')}
- title={t('profileSettings.dataExport')}
- type='info'
- message={t('profileSettings.exportConfirmation')}
- isOpened={showExportModal}
- />
- <Modal
- onClose={() => setShowModal(false)}
- onSubmit={() => {
- setShowModal(false)
- _onDelete()
- }}
- submitText={t('profileSettings.aDelete')}
- closeText={t('common.close')}
- title={t('profileSettings.qDelete')}
- submitType='danger'
- type='error'
- message={t('profileSettings.deactivateConfirmation')}
- isOpened={showModal}
- />
- <Modal
- onClose={() => setShowAPIDeleteModal(false)}
- onSubmit={() => {
- setShowAPIDeleteModal(false)
- onApiKeyDelete()
- }}
- submitText={t('profileSettings.deleteApiKeyBtn')}
- closeText={t('common.close')}
- title={t('profileSettings.apiKeyDelete')}
- submitType='danger'
- type='error'
- message={t('profileSettings.apiKeyDeleteConf')}
- isOpened={showAPIDeleteModal}
- />
- <Modal
- onClose={() => {
- setError(null)
- }}
- closeText={t('common.gotIt')}
- type='error'
- title={t('common.error')}
- message={error}
- isOpened={Boolean(error)}
- />
- </div>
- </Title>
+ <div className='flex justify-between mt-4'>
+ <Button onClick={() => setShowExportModal(true)} semiSmall primary>
+ <>
+ <ArrowDownTrayIcon className='w-5 h-5 mr-1' />
+ {t('profileSettings.requestExport')}
+ </>
+ </Button>
+ <Button className='ml-3' onClick={() => setShowModal(true)} semiSmall danger>
+ <>
+ <ExclamationTriangleIcon className='w-5 h-5 mr-1' />
+ {t('profileSettings.delete')}
+ </>
+ </Button>
+ </div>
+ </>
+ )}
+ </form>
+
+ <PaidFeature isOpened={isPaidFeatureOpened} onClose={() => setIsPaidFeatureOpened(false)} />
+ <Modal
+ onClose={() => setShowExportModal(false)}
+ onSubmit={() => {
+ setShowExportModal(false)
+ onExport(user.exportedAt)
+ }}
+ submitText={t('common.continue')}
+ closeText={t('common.close')}
+ title={t('profileSettings.dataExport')}
+ type='info'
+ message={t('profileSettings.exportConfirmation')}
+ isOpened={showExportModal}
+ />
+ <Modal
+ onClose={() => setShowModal(false)}
+ onSubmit={() => {
+ setShowModal(false)
+ _onDelete()
+ }}
+ submitText={t('profileSettings.aDelete')}
+ closeText={t('common.close')}
+ title={t('profileSettings.qDelete')}
+ submitType='danger'
+ type='error'
+ message={t('profileSettings.deactivateConfirmation')}
+ isOpened={showModal}
+ />
+ <Modal
+ onClose={() => setShowAPIDeleteModal(false)}
+ onSubmit={() => {
+ setShowAPIDeleteModal(false)
+ onApiKeyDelete()
+ }}
+ submitText={t('profileSettings.deleteApiKeyBtn')}
+ closeText={t('common.close')}
+ title={t('profileSettings.apiKeyDelete')}
+ submitType='danger'
+ type='error'
+ message={t('profileSettings.apiKeyDeleteConf')}
+ isOpened={showAPIDeleteModal}
+ />
+ <Modal
+ onClose={() => {
+ setError(null)
+ }}
+ closeText={t('common.gotIt')}
+ type='error'
+ title={t('common.error')}
+ message={error}
+ isOpened={Boolean(error)}
+ />
+ </div>
)
}
diff --git a/app/routes/user-settings.tsx b/app/routes/user-settings.tsx
new file mode 100644
index 000000000..34c4294f0
--- /dev/null
+++ b/app/routes/user-settings.tsx
@@ -0,0 +1,15 @@
+import UserSettings from 'pages/UserSettings'
+import type { V2_MetaFunction } from '@remix-run/node'
+
+export const meta: V2_MetaFunction = () => {
+ return [
+ {
+ title: 'UserSettings',
+ description: 'UserSettings',
+ },
+ ]
+}
+
+export default function Index() {
+ return <UserSettings />
+}
diff --git a/app/routesPath/index.ts b/app/routesPath/index.ts
index 7a080172c..f87b4838a 100644
--- a/app/routesPath/index.ts
+++ b/app/routesPath/index.ts
@@ -7,7 +7,7 @@ const routes = Object.freeze({
confirm_subcription: '/projects/:id/subscribers/invite',
main: '/', // add
dashboard: '/dashboard', // add
- user_settings: '/settings',
+ user_settings: '/user-settings', // add
verify: '/verify-email/:id', // add
change_email: '/change-email/:id', // add
new_project: '/projects/new',