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!

Split project settings into vertical tabs

Blue Mouse9a00dd4eb901
diff --git a/web/app/pages/Project/Settings/Emails/Emails.tsx b/web/app/pages/Project/Settings/Emails/Emails.tsx
index 29874c863..e839a19f1 100644
--- a/web/app/pages/Project/Settings/Emails/Emails.tsx
+++ b/web/app/pages/Project/Settings/Emails/Emails.tsx
@@ -389,10 +389,10 @@ const Emails = ({ projectId }: { projectId: string }) => {
}
return (
- <div className='mt-6 mb-6'>
+ <div>
<div className='mb-3 flex flex-col items-start justify-between gap-y-2 sm:flex-row sm:items-center'>
<div>
- <h3 className='mt-2 text-lg font-bold text-gray-900 dark:text-gray-50'>{t('project.emails.title')}</h3>
+ <h3 className='text-lg font-bold text-gray-900 dark:text-gray-50'>{t('project.emails.title')}</h3>
<p className='text-sm text-gray-500 dark:text-gray-400'>{t('project.emails.description')}</p>
</div>
<Button className='h-8 pl-2 whitespace-nowrap' primary regular type='button' onClick={() => setShowModal(true)}>
diff --git a/web/app/pages/Project/Settings/People/People.tsx b/web/app/pages/Project/Settings/People/People.tsx
index 00ef3e6e7..864340463 100644
--- a/web/app/pages/Project/Settings/People/People.tsx
+++ b/web/app/pages/Project/Settings/People/People.tsx
@@ -266,10 +266,10 @@ const People = ({ project, reloadProject }: PeopleProps) => {
}
return (
- <div className='mt-6 mb-6'>
+ <div>
<div className='mb-3 flex items-center justify-between'>
<div>
- <h3 className='mt-2 flex items-center text-lg font-bold text-gray-900 dark:text-gray-50'>
+ <h3 className='flex items-center text-lg font-bold text-gray-900 dark:text-gray-50'>
{t('project.settings.people')}
</h3>
<p className='text-sm text-gray-500 dark:text-gray-400'>{t('project.settings.inviteCoworkers')}</p>
diff --git a/web/app/pages/Project/Settings/ProjectSettings.tsx b/web/app/pages/Project/Settings/ProjectSettings.tsx
index bfd07f7e9..6c70fa339 100644
--- a/web/app/pages/Project/Settings/ProjectSettings.tsx
+++ b/web/app/pages/Project/Settings/ProjectSettings.tsx
@@ -1,7 +1,6 @@
import { XCircleIcon } from '@heroicons/react/24/outline'
import cx from 'clsx'
import _filter from 'lodash/filter'
-import _find from 'lodash/find'
import _includes from 'lodash/includes'
import _isEmpty from 'lodash/isEmpty'
import _isString from 'lodash/isString'
@@ -12,7 +11,15 @@ import _replace from 'lodash/replace'
import _size from 'lodash/size'
import _split from 'lodash/split'
import _toUpper from 'lodash/toUpper'
-import { ArrowLeftRight, RotateCcw, Trash2Icon } from 'lucide-react'
+import {
+ Settings2Icon,
+ ShieldIcon,
+ LockIcon,
+ UserRoundIcon,
+ MailIcon,
+ TriangleAlertIcon,
+ ChevronLeftIcon,
+} from 'lucide-react'
import React, { useState, useEffect, useMemo, useCallback } from 'react'
import { useTranslation } from 'react-i18next'
import { useLoaderData, useNavigate, Link } from 'react-router'
@@ -35,7 +42,6 @@ import { isSelfhosted, TITLE_SUFFIX, FILTERS_PANELS_ORDER, isBrowser } from '~/l
import { Project } from '~/lib/models/Project'
import { useAuth } from '~/providers/AuthProvider'
import Button from '~/ui/Button'
-import Checkbox from '~/ui/Checkbox'
import DatePicker from '~/ui/Datepicker'
import Dropdown from '~/ui/Dropdown'
import Input from '~/ui/Input'
@@ -43,6 +49,7 @@ import Loader from '~/ui/Loader'
import Modal from '~/ui/Modal'
import MultiSelect from '~/ui/MultiSelect'
import Select from '~/ui/Select'
+// Select is used inside tab components
import countries from '~/utils/isoCountries'
import routes from '~/utils/routes'
@@ -51,6 +58,10 @@ import { getFormatDate } from '../View/ViewProject.helpers'
import Emails from './Emails'
import People from './People'
+import AccessSettings from './tabs/AccessSettings'
+import DangerZone from './tabs/DangerZone'
+import General from './tabs/General'
+import Shields from './tabs/Shields'
const MAX_NAME_LENGTH = 50
const MAX_ORIGINS_LENGTH = 300
@@ -291,6 +302,9 @@ const ProjectSettings = () => {
const [isLoading, setIsLoading] = useState<boolean | null>(null)
const [error, setError] = useState<string | null>(null)
+ const [activeTab, setActiveTab] = useState<'general' | 'shields' | 'access' | 'emails' | 'people' | 'danger'>(
+ 'general',
+ )
// for reset data via filters
const [activeFilter, setActiveFilter] = useState<string[]>([])
@@ -559,6 +573,28 @@ const ProjectSettings = () => {
document.title = `${t('project.settings.settings')} ${form.name} ${TITLE_SUFFIX}`
}, [form, t])
+ const tabs = useMemo(
+ () =>
+ [
+ { id: 'general', label: t('project.settings.tabs.general'), icon: Settings2Icon, visible: true },
+ { id: 'access', label: t('project.settings.tabs.access'), icon: LockIcon, visible: true },
+ { id: 'shields', label: t('project.settings.tabs.shields'), icon: ShieldIcon, visible: true },
+ { id: 'emails', label: t('project.settings.tabs.emails'), icon: MailIcon, visible: !isSelfhosted },
+ { id: 'people', label: t('project.settings.tabs.people'), icon: UserRoundIcon, visible: true },
+ {
+ id: 'danger',
+ label: t('project.settings.tabs.danger'),
+ icon: TriangleAlertIcon,
+ visible: project?.role === 'owner',
+ },
+ ].filter((tab) => tab.visible),
+ [t, project?.role],
+ )
+
+ const currentTabLabel = useMemo(() => {
+ return (tabs.find((t) => t.id === activeTab)?.label as string) || ''
+ }, [tabs, activeTab])
+
if (error && !isLoading) {
return (
<div className='min-h-page bg-gray-50 px-4 py-16 sm:px-6 sm:py-24 md:grid md:place-items-center lg:px-8 dark:bg-slate-900'>
@@ -606,202 +642,145 @@ const ProjectSettings = () => {
return (
<div className='flex min-h-min-footer flex-col bg-gray-50 pb-40 dark:bg-slate-900'>
- <form className='mx-auto w-full max-w-7xl px-4 py-6 sm:px-6 lg:px-8' onSubmit={handleSubmit}>
- <h2 className='mt-2 text-3xl font-bold text-gray-900 dark:text-gray-50'>{title}</h2>
- <h3 className='mt-4 text-lg font-bold text-gray-900 dark:text-gray-50'>{t('profileSettings.general')}</h3>
- <Input
- name='name'
- label={t('project.settings.name')}
- value={form.name}
- placeholder='My awesome project'
- className='mt-2'
- onChange={handleInput}
- error={beenSubmitted ? errors.name : null}
- />
- <Input
- name='id'
- label={t('project.settings.pid')}
- value={form.id}
- className='mt-4'
- onChange={handleInput}
- error={null}
- disabled
- />
- <Input
- name='sharableLink'
- label={t('project.settings.sharableLink')}
- hint={t('project.settings.sharableDesc')}
- value={sharableLink}
- className='mt-4'
- onChange={handleInput}
- error={null}
- disabled
- />
-
- <h3 className='mt-6 text-lg font-bold text-gray-900 dark:text-gray-50'>{t('project.settings.shields')}</h3>
- <Input
- name='origins'
- label={t('project.settings.origins')}
- hint={t('project.settings.originsHint')}
- value={form.origins || ''}
- className='mt-2'
- onChange={handleInput}
- error={beenSubmitted ? errors.origins : null}
- />
- <Input
- name='ipBlacklist'
- label={t('project.settings.ipBlacklist')}
- hint={t('project.settings.ipBlacklistHint')}
- value={form.ipBlacklist || ''}
- className='mt-4'
- onChange={handleInput}
- error={beenSubmitted ? errors.ipBlacklist : null}
- />
- <div className='mt-4'>
- <Select
- id='botsProtectionLevel'
- label={t('project.settings.botsProtectionLevel.title')}
- // @ts-expect-error
- items={botsProtectionLevels}
- title={_find(botsProtectionLevels, (predicate) => predicate.name === form.botsProtectionLevel)?.title || ''}
- labelExtractor={(item: any) => item.title}
- onSelect={(item) => {
- setForm((prevForm) => ({
- ...prevForm,
- botsProtectionLevel: item.name,
- }))
- }}
- capitalise
- />
- </div>
-
- <h3 className='mt-6 text-lg font-bold text-gray-900 dark:text-gray-50'>{t('project.settings.access')}</h3>
- <Checkbox
- checked={Boolean(form.active)}
- onChange={(checked) =>
- setForm((prev) => ({
- ...prev,
- active: checked,
- }))
- }
- name='active'
- classes={{
- label: 'mt-2',
- }}
- label={t('project.settings.enabled')}
- hint={t('project.settings.enabledHint')}
- />
- <Checkbox
- checked={Boolean(form.public)}
- onChange={(checked) => {
- if (!form.isPasswordProtected || !checked) {
- setForm((prev) => ({
- ...prev,
- public: checked,
- }))
- }
- }}
- name='public'
- classes={{
- label: 'mt-4',
- }}
- label={t('project.settings.public')}
- hint={t('project.settings.publicHint')}
- />
- <Checkbox
- checked={Boolean(form.isPasswordProtected)}
- onChange={(checked) => {
- if (!checked) {
- setForm({
- ...form,
- isPasswordProtected: false,
- })
- return
- }
-
- if (!form.public) {
- setShowProtected(true)
- }
- }}
- name='isPasswordProtected'
- classes={{
- label: 'mt-4',
- }}
- label={t('project.settings.protected')}
- hint={t('project.settings.protectedHint')}
- />
- {organisations.length > 1 ? (
- <div className='mt-4'>
+ <div className='mx-auto w-full max-w-7xl px-4 py-6 sm:px-6 lg:px-8'>
+ <Link
+ to={_replace(routes.project, ':id', id)}
+ className='flex max-w-max items-center text-sm text-gray-900 underline decoration-dashed hover:decoration-solid dark:text-gray-100'
+ >
+ <ChevronLeftIcon className='mr-1 size-3' strokeWidth={1.5} />
+ {t('project.backToStats')}
+ </Link>
+ <h2 className='mt-1 text-3xl font-bold text-gray-900 dark:text-gray-50'>{title}</h2>
+
+ <hr className='mt-5 border-gray-200 dark:border-gray-600' />
+
+ <div className='mt-6 flex flex-col gap-6 md:flex-row'>
+ <div className='md:hidden'>
<Select
- items={organisations}
- keyExtractor={(item) => item.id || 'not-set'}
- labelExtractor={(item) => {
- if (item.id === undefined) {
- return <span className='italic'>{t('common.notSet')}</span>
- }
-
- return item.name
- }}
- onSelect={async (item) => {
- await assignOrganisation(item.id)
- setForm((oldForm) => ({
- ...oldForm,
- organisationId: item.id,
- }))
+ id='project-settings-tab-select'
+ title={currentTabLabel}
+ items={tabs}
+ keyExtractor={(item) => item.id}
+ labelExtractor={(item) => item.label}
+ iconExtractor={(item) => {
+ const Icon = item.icon
+ return <Icon className='h-4 w-4' strokeWidth={1.5} />
}}
- label={t('project.settings.organisation')}
- title={organisations.find((org) => org.id === form.organisationId)?.name}
+ onSelect={(item: any) => setActiveTab(item.id as typeof activeTab)}
/>
</div>
- ) : null}
- <div className='mt-8 flex flex-wrap justify-center gap-2 sm:justify-between'>
- <div className='flex flex-wrap items-center gap-2'>
- <Button
- className='border-indigo-100 dark:border-slate-700/50 dark:bg-slate-800 dark:text-gray-50 dark:hover:bg-slate-700'
- as={Link}
- // @ts-expect-error
- to={_replace(routes.project, ':id', id)}
- secondary
- regular
- >
- {t('common.cancel')}
- </Button>
- <Button type='submit' loading={isSaving} primary regular>
- {t('common.save')}
- </Button>
- </div>
- {project.role === 'owner' ? (
- <div className='flex flex-wrap justify-center gap-2'>
- <Button onClick={() => setShowTransfer(true)} semiDanger semiSmall>
- <>
- <ArrowLeftRight className='mr-1 h-5 w-5' />
- {t('project.settings.transfer')}
- </>
- </Button>
- <Button onClick={() => !setResetting && setShowReset(true)} loading={isDeleting} semiDanger semiSmall>
- <>
- <RotateCcw className='mr-1 h-5 w-5' />
- {t('project.settings.reset')}
- </>
- </Button>
- <Button onClick={() => !isDeleting && setShowDelete(true)} loading={isDeleting} danger semiSmall>
- <>
- <Trash2Icon className='mr-1 h-5 w-5' strokeWidth={1.5} />
- {t('project.settings.delete')}
- </>
- </Button>
- </div>
- ) : null}
+
+ <aside className='hidden w-56 shrink-0 md:block'>
+ <nav className='flex flex-col space-y-1' aria-label='Sidebar'>
+ {_map(tabs, (tab) => {
+ const isCurrent = tab.id === activeTab
+ const Icon = tab.icon
+
+ return (
+ <button
+ key={tab.id}
+ type='button'
+ onClick={() => setActiveTab(tab.id as typeof activeTab)}
+ className={cx(
+ 'group flex items-center rounded-md px-3 py-2 text-left text-sm text-gray-900 transition-colors',
+ {
+ 'bg-gray-200 font-semibold dark:bg-slate-800 dark:text-gray-50': isCurrent,
+ 'hover:bg-gray-200 dark:text-gray-200 dark:hover:bg-slate-800 dark:hover:text-gray-50':
+ !isCurrent,
+ },
+ )}
+ aria-current={isCurrent ? 'page' : undefined}
+ >
+ <Icon
+ className={cx('mr-2 h-5 w-5 shrink-0 transition-colors', {
+ 'text-gray-900 dark:text-gray-50': isCurrent,
+ 'text-gray-500 group-hover:text-gray-600 dark:text-gray-400 dark:group-hover:text-gray-300':
+ !isCurrent,
+ })}
+ strokeWidth={1.5}
+ />
+ <span>{tab.label}</span>
+ </button>
+ )
+ })}
+ </nav>
+ </aside>
+
+ <section className='flex-1'>
+ {['general', 'shields', 'access'].includes(activeTab) ? (
+ <form onSubmit={handleSubmit}>
+ {activeTab === 'general' ? (
+ <General
+ form={form}
+ errors={errors}
+ beenSubmitted={beenSubmitted}
+ handleInput={handleInput}
+ sharableLink={sharableLink}
+ />
+ ) : null}
+
+ {activeTab === 'shields' ? (
+ <Shields
+ form={form}
+ errors={errors}
+ beenSubmitted={beenSubmitted}
+ handleInput={handleInput}
+ botsProtectionLevels={botsProtectionLevels}
+ setBotsLevel={(name) =>
+ setForm((prevForm) => ({
+ ...prevForm,
+ // cast to maintain allowed literal types
+ botsProtectionLevel: name as any,
+ }))
+ }
+ />
+ ) : null}
+
+ {activeTab === 'access' ? (
+ <AccessSettings
+ form={form}
+ setForm={setForm as any}
+ organisations={organisations}
+ onAssignOrganisation={assignOrganisation}
+ openPasswordModal={() => setShowProtected(true)}
+ />
+ ) : null}
+
+ <div className='mt-8 flex flex-wrap justify-center gap-2 sm:justify-between'>
+ <div className='flex flex-wrap items-center gap-2'>
+ <Button
+ className='border-indigo-100 dark:border-slate-700/50 dark:bg-slate-800 dark:text-gray-50 dark:hover:bg-slate-700'
+ as={Link}
+ // @ts-expect-error
+ to={_replace(routes.project, ':id', id)}
+ secondary
+ regular
+ >
+ {t('common.cancel')}
+ </Button>
+ <Button type='submit' loading={isSaving} primary regular>
+ {t('common.save')}
+ </Button>
+ </div>
+ </div>
+ </form>
+ ) : null}
+
+ {activeTab === 'emails' && !isSelfhosted ? <Emails projectId={id} /> : null}
+ {activeTab === 'people' ? <People project={project} reloadProject={reloadProject} /> : null}
+
+ {activeTab === 'danger' ? (
+ <DangerZone
+ setShowTransfer={setShowTransfer}
+ setShowReset={setShowReset}
+ setShowDelete={setShowDelete}
+ isDeleting={isDeleting}
+ setResetting={setResetting}
+ />
+ ) : null}
+ </section>
</div>
- {!isSelfhosted ? (
- <>
- <hr className='xs:mt-2 mt-8 border-gray-200 sm:mt-5 dark:border-gray-600' />
- <Emails projectId={id} />
- </>
- ) : null}
- <hr className='mt-2 border-gray-200 sm:mt-5 dark:border-gray-600' />
- <People project={project} reloadProject={reloadProject} />
- </form>
+ </div>
<Modal
onClose={() => setShowDelete(false)}
onSubmit={onDelete}
diff --git a/web/app/pages/Project/Settings/tabs/AccessSettings.tsx b/web/app/pages/Project/Settings/tabs/AccessSettings.tsx
new file mode 100644
index 000000000..1d395b382
--- /dev/null
+++ b/web/app/pages/Project/Settings/tabs/AccessSettings.tsx
@@ -0,0 +1,115 @@
+import React from 'react'
+import { useTranslation } from 'react-i18next'
+
+import { isSelfhosted } from '~/lib/constants'
+import Checkbox from '~/ui/Checkbox'
+import Select from '~/ui/Select'
+
+interface AccessSettingsProps {
+ form: {
+ active?: boolean
+ public?: boolean
+ isPasswordProtected?: boolean
+ organisationId?: string
+ }
+ setForm: (updater: (prev: any) => any) => void
+ organisations: { id?: string; name: string }[]
+ onAssignOrganisation: (id?: string) => Promise<void>
+ openPasswordModal: () => void
+}
+
+const AccessSettings = ({
+ form,
+ setForm,
+ organisations,
+ onAssignOrganisation,
+ openPasswordModal,
+}: AccessSettingsProps) => {
+ const { t } = useTranslation('common')
+
+ return (
+ <>
+ <h3 className='text-lg font-bold text-gray-900 dark:text-gray-50'>{t('project.settings.access')}</h3>
+ <Checkbox
+ checked={Boolean(form.active)}
+ onChange={(checked) =>
+ setForm((prev: any) => ({
+ ...prev,
+ active: checked,
+ }))
+ }
+ name='active'
+ classes={{
+ label: 'mt-2',
+ }}
+ label={t('project.settings.enabled')}
+ hint={t('project.settings.enabledHint')}
+ />
+ <Checkbox
+ checked={Boolean(form.public)}
+ onChange={(checked) => {
+ if (!form.isPasswordProtected || !checked) {
+ setForm((prev: any) => ({
+ ...prev,
+ public: checked,
+ }))
+ }
+ }}
+ name='public'
+ classes={{
+ label: 'mt-4',
+ }}
+ label={t('project.settings.public')}
+ hint={t('project.settings.publicHint')}
+ />
+ <Checkbox
+ checked={Boolean(form.isPasswordProtected)}
+ onChange={(checked) => {
+ if (!checked) {
+ setForm((prev: any) => ({
+ ...prev,
+ isPasswordProtected: false,
+ }))
+ return
+ }
+
+ if (!form.public) {
+ openPasswordModal()
+ }
+ }}
+ name='isPasswordProtected'
+ classes={{
+ label: 'mt-4',
+ }}
+ label={t('project.settings.protected')}
+ hint={t('project.settings.protectedHint')}
+ />
+ {!isSelfhosted && organisations.length > 1 ? (
+ <div className='mt-4'>
+ <Select
+ items={organisations}
+ keyExtractor={(item) => item.id || 'not-set'}
+ labelExtractor={(item) => {
+ if (item.id === undefined) {
+ return <span className='italic'>{t('common.notSet')}</span>
+ }
+
+ return item.name
+ }}
+ onSelect={async (item) => {
+ await onAssignOrganisation(item.id)
+ setForm((oldForm: any) => ({
+ ...oldForm,
+ organisationId: item.id,
+ }))
+ }}
+ label={t('project.settings.organisation')}
+ title={organisations.find((org) => org.id === form.organisationId)?.name}
+ />
+ </div>
+ ) : null}
+ </>
+ )
+}
+
+export default AccessSettings
diff --git a/web/app/pages/Project/Settings/tabs/DangerZone.tsx b/web/app/pages/Project/Settings/tabs/DangerZone.tsx
new file mode 100644
index 000000000..7b204b24c
--- /dev/null
+++ b/web/app/pages/Project/Settings/tabs/DangerZone.tsx
@@ -0,0 +1,80 @@
+import { ArrowLeftRight, RotateCcw, Trash2Icon } from 'lucide-react'
+import React from 'react'
+import { useTranslation } from 'react-i18next'
+
+import Button from '~/ui/Button'
+
+interface DangerZoneProps {
+ setShowTransfer: (show: boolean) => void
+ setShowReset: (show: boolean) => void
+ setShowDelete: (show: boolean) => void
+ isDeleting: boolean
+ setResetting: boolean
+}
+
+const DangerZone = ({ setShowTransfer, setShowReset, setShowDelete, isDeleting, setResetting }: DangerZoneProps) => {
+ const { t } = useTranslation('common')
+
+ return (
+ <div>
+ <h3 className='text-lg font-bold text-gray-900 dark:text-gray-50'>Danger zone</h3>
+
+ <div className='mt-4 space-y-3'>
+ <div className='rounded-md border border-gray-200 p-3 dark:border-gray-800'>
+ <div className='flex items-start'>
+ <ArrowLeftRight className='mt-0.5 h-5 w-5 text-red-600 dark:text-red-400' />
+ <div className='ml-3 flex-1'>
+ <div className='text-sm font-medium text-gray-900 dark:text-gray-50'>
+ {t('project.settings.transfer')}
+ </div>
+ <p className='mt-0.5 text-sm text-gray-500 dark:text-gray-400'>
+ {t('project.settings.transferShort', { defaultValue: 'Transfer ownership to another user.' })}
+ </p>
+ <div className='mt-3'>
+ <Button onClick={() => setShowTransfer(true)} semiDanger semiSmall>
+ {t('project.settings.transfer')}
+ </Button>
+ </div>
+ </div>
+ </div>
+ </div>
+
+ <div className='rounded-md border border-gray-200 p-3 dark:border-gray-800'>
+ <div className='flex items-start'>
+ <RotateCcw className='mt-0.5 h-5 w-5 text-orange-600 dark:text-orange-400' />
+ <div className='ml-3 flex-1'>
+ <div className='text-sm font-medium text-gray-900 dark:text-gray-50'>{t('project.settings.reset')}</div>
+ <p className='mt-0.5 text-sm text-gray-500 dark:text-gray-400'>
+ {t('project.settings.resetShort', { defaultValue: 'Clear analytics data. Keep project settings.' })}
+ </p>
+ <div className='mt-3'>
+ <Button onClick={() => !setResetting && setShowReset(true)} loading={isDeleting} semiDanger semiSmall>
+ {t('project.settings.reset')}
+ </Button>
+ </div>
+ </div>
+ </div>
+ </div>
+
+ <div className='rounded-md border border-gray-200 p-3 dark:border-gray-800'>
+ <div className='flex items-start'>
+ <Trash2Icon className='mt-0.5 h-5 w-5 text-red-700 dark:text-red-500' strokeWidth={1.5} />
+ <div className='ml-3 flex-1'>
+ <div className='text-sm font-medium text-gray-900 dark:text-gray-50'>{t('project.settings.delete')}</div>
+ <p className='mt-0.5 text-sm text-gray-500 dark:text-gray-400'>
+ {t('project.settings.deleteShort', { defaultValue: 'Permanently delete the project and all data.' })}
+ </p>
+ <div className='mt-3'>
+ <Button onClick={() => !isDeleting && setShowDelete(true)} loading={isDeleting} danger semiSmall>
+ {t('project.settings.delete')}
+ </Button>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ )
+}
+
+export default DangerZone
diff --git a/web/app/pages/Project/Settings/tabs/General.tsx b/web/app/pages/Project/Settings/tabs/General.tsx
new file mode 100644
index 000000000..915f2d426
--- /dev/null
+++ b/web/app/pages/Project/Settings/tabs/General.tsx
@@ -0,0 +1,57 @@
+import React from 'react'
+import { useTranslation } from 'react-i18next'
+
+import Input from '~/ui/Input'
+
+interface GeneralProps {
+ form: {
+ name?: string
+ id?: string
+ }
+ errors: {
+ name?: string
+ }
+ beenSubmitted: boolean
+ handleInput: (e: React.ChangeEvent<HTMLInputElement>) => void
+ sharableLink: string
+}
+
+const General = ({ form, errors, beenSubmitted, handleInput, sharableLink }: GeneralProps) => {
+ const { t } = useTranslation('common')
+
+ return (
+ <>
+ <h3 className='text-lg font-bold text-gray-900 dark:text-gray-50'>{t('profileSettings.general')}</h3>
+ <Input
+ name='name'
+ label={t('project.settings.name')}
+ value={form.name}
+ placeholder='My awesome project'
+ className='mt-2'
+ onChange={handleInput}
+ error={beenSubmitted ? errors.name : null}
+ />
+ <Input
+ name='id'
+ label={t('project.settings.pid')}
+ value={form.id}
+ className='mt-4'
+ onChange={handleInput}
+ error={null}
+ disabled
+ />
+ <Input
+ name='sharableLink'
+ label={t('project.settings.sharableLink')}
+ hint={t('project.settings.sharableDesc')}
+ value={sharableLink}
+ className='mt-4'
+ onChange={handleInput}
+ error={null}
+ disabled
+ />
+ </>
+ )
+}
+
+export default General
diff --git a/web/app/pages/Project/Settings/tabs/Shields.tsx b/web/app/pages/Project/Settings/tabs/Shields.tsx
new file mode 100644
index 000000000..95af123b8
--- /dev/null
+++ b/web/app/pages/Project/Settings/tabs/Shields.tsx
@@ -0,0 +1,63 @@
+import React from 'react'
+import { useTranslation } from 'react-i18next'
+
+import Input from '~/ui/Input'
+import Select from '~/ui/Select'
+
+interface ShieldsProps {
+ form: {
+ origins: string | null
+ ipBlacklist: string | null
+ botsProtectionLevel?: string
+ }
+ errors: {
+ origins?: string
+ ipBlacklist?: string
+ }
+ beenSubmitted: boolean
+ handleInput: (e: React.ChangeEvent<HTMLInputElement>) => void
+ botsProtectionLevels: readonly { name: string; title: string }[]
+ setBotsLevel: (name: string) => void
+}
+
+const Shields = ({ form, errors, beenSubmitted, handleInput, botsProtectionLevels, setBotsLevel }: ShieldsProps) => {
+ const { t } = useTranslation('common')
+
+ return (
+ <>
+ <h3 className='text-lg font-bold text-gray-900 dark:text-gray-50'>{t('project.settings.shields')}</h3>
+ <Input
+ name='origins'
+ label={t('project.settings.origins')}
+ hint={t('project.settings.originsHint')}
+ value={form.origins || ''}
+ className='mt-2'
+ onChange={handleInput}
+ error={beenSubmitted ? errors.origins : null}
+ />
+ <Input
+ name='ipBlacklist'
+ label={t('project.settings.ipBlacklist')}
+ hint={t('project.settings.ipBlacklistHint')}
+ value={form.ipBlacklist || ''}
+ className='mt-4'
+ onChange={handleInput}
+ error={beenSubmitted ? errors.ipBlacklist : null}
+ />
+ <div className='mt-4'>
+ <Select
+ id='botsProtectionLevel'
+ label={t('project.settings.botsProtectionLevel.title')}
+ // @ts-expect-error
+ items={botsProtectionLevels}
+ title={botsProtectionLevels.find((predicate) => predicate.name === form.botsProtectionLevel)?.title || ''}
+ labelExtractor={(item: any) => item.title}
+ onSelect={(item) => setBotsLevel(item.name)}
+ capitalise
+ />
+ </div>
+ </>
+ )
+}
+
+export default Shields
diff --git a/web/public/locales/en.json b/web/public/locales/en.json
index 9375774d4..0cab4e155 100644
--- a/web/public/locales/en.json
+++ b/web/public/locales/en.json
@@ -725,6 +725,8 @@
"organisations": {
"create": "Create organisation",
"organisations": "Organisations",
+ "noOrganisations": "No organisations yet",
+ "createOrganisation": "You haven't created or joined any organisations yet. Get started by creating your first organisation.",
"new": "New organisation",
"invite": {
"title": "Invite a user to {{organisation}}",
@@ -789,8 +791,8 @@
"accountLocked": "Your account has been temporarily suspended due to a billing issue.",
"accountLockedTitle": "Account temporarily suspended",
"eventsXPercUsed": "You have used more than {{amount}}% of the available events per your tier for this month.",
- "noProjects": "You have not yet created any projects",
- "createProject": "Create a new project here to start using our service",
+ "noProjects": "No projects yet",
+ "createProject": "You haven't created any projects yet. Get started by creating your first project.",
"active": "Active",
"public": "Public",
"shared": "Shared",
@@ -902,6 +904,7 @@
"support": "Contact support"
},
"project": {
+ "backToStats": "Back to stats",
"directNone": "Direct / None",
"loadingMapData": "Loading map data...",
"copy": "Copy",
@@ -1008,12 +1011,12 @@
"manageSubscription": "Manage subscription"
},
"waiting": {
- "title": "Waiting for your first pageview",
- "desc": "We're waiting for your first pageview! If your integration is set up correctly, you should see it within 1 minute.\n<snippet>Click here</snippet> to view your JavaScript tracking code.\nStill not working? Try <turl>troubleshooting</turl> your integration or <curl>contact us</curl> for help with your setup."
+ "title": "No events yet",
+ "desc": "You haven't tracked any events yet.\n<snippet>Click here</snippet> to view your JavaScript tracking code.\n\nStill not working? Try <turl>troubleshooting</turl> your integration or <curl>contact us</curl> for help with your setup."
},
"waitingError": {
- "title": "Waiting for your first error.. hopefully not :)",
- "desc": "We're waiting for your first error event! If your integration is set up correctly, you should see it within 1 minute when it happens.\n<howto>Click here</howto> to learn how to set up error tracking for your website.\nStill not working? Try <turl>troubleshooting</turl> your integration or <curl>contact us</curl> for help with your setup."
+ "title": "No errors yet",
+ "desc": "You haven't tracked any errors yet.\n<howto>Click here</howto> to learn how to set up error tracking for your website.\n\nStill not working? Try <turl>troubleshooting</turl> your integration or <curl>contact us</curl> for help with your setup."
},
"trendlineTotal": "Pageviews trendline",
"noEvContent": "No events have been recorded for the specified period, please try a different period.",
@@ -1110,6 +1113,14 @@
"organisation": "Organisation",
"shields": "Shields",
"access": "Access settings",
+ "tabs": {
+ "general": "General",
+ "access": "Access",
+ "shields": "Shields",
+ "emails": "Emails",
+ "people": "People",
+ "danger": "Danger zone"
+ },
"botsProtectionLevel": {
"title": "Bots protection level",
"levels": {