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!

ui: enable project sharing for selfhosted

Blue Mouse8f19a58baf70
diff --git a/web/app/pages/Project/Settings/ProjectSettings.tsx b/web/app/pages/Project/Settings/ProjectSettings.tsx
index fe3158af4..5ef32afa1 100644
--- a/web/app/pages/Project/Settings/ProjectSettings.tsx
+++ b/web/app/pages/Project/Settings/ProjectSettings.tsx
@@ -762,14 +762,12 @@ const ProjectSettings = () => {
</div>
{project.role === 'owner' ? (
<div className='flex flex-wrap justify-center gap-2'>
- {!isSelfhosted ? (
- <Button onClick={() => setShowTransfer(true)} semiDanger semiSmall>
- <>
- <ArrowLeftRight className='mr-1 h-5 w-5' />
- {t('project.settings.transfer')}
- </>
- </Button>
- ) : null}
+ <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' />
@@ -791,12 +789,8 @@ const ProjectSettings = () => {
<Emails projectId={id} />
</>
) : null}
- {!isSelfhosted ? (
- <>
- <hr className='mt-2 border-gray-200 sm:mt-5 dark:border-gray-600' />
- <People project={project} />
- </>
- ) : null}
+ <hr className='mt-2 border-gray-200 sm:mt-5 dark:border-gray-600' />
+ <People project={project} />
</form>
<Modal
onClose={() => setShowDelete(false)}
diff --git a/web/app/pages/UserSettings/UserSettings.tsx b/web/app/pages/UserSettings/UserSettings.tsx
index 41f00d737..d169ab6d1 100644
--- a/web/app/pages/UserSettings/UserSettings.tsx
+++ b/web/app/pages/UserSettings/UserSettings.tsx
@@ -412,6 +412,59 @@ const UserSettings = () => {
setShowPasswordFields((prev) => !prev)
}
+ const SharedProjects = () => (
+ <>
+ <hr className='mt-5 border-gray-200 dark:border-gray-600' />
+ <h3 className='mt-2 flex items-center 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='-mx-4 -my-2 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 ring-1 ring-black/10 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 pr-3 pl-4 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 pr-4 pl-3 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} />
+ ))}
+ </tbody>
+ </table>
+ </div>
+ </div>
+ </div>
+ </div>
+ ) : (
+ <NoSharedProjects />
+ )}
+ </div>
+ </>
+ )
+
return (
<div className='min-h-min-footer flex flex-col bg-gray-50 px-4 py-6 sm:px-6 lg:px-8 dark:bg-slate-900'>
<form className='mx-auto w-full max-w-7xl' onSubmit={handleSubmit}>
@@ -531,6 +584,9 @@ const UserSettings = () => {
{t('profileSettings.addApiKeyBtn')}
</Button>
)}
+
+ {/* Shared projects setting */}
+ <SharedProjects />
</>
) : (
<>
@@ -628,54 +684,7 @@ const UserSettings = () => {
<Socialisations />
{/* Shared projects setting */}
- <hr className='mt-5 border-gray-200 dark:border-gray-600' />
- <h3 className='mt-2 flex items-center 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='-mx-4 -my-2 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 ring-1 ring-black/10 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 pr-3 pl-4 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 pr-4 pl-3 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} />
- ))}
- </tbody>
- </table>
- </div>
- </div>
- </div>
- </div>
- ) : (
- <NoSharedProjects />
- )}
- </div>
+ <SharedProjects />
{/* Organisations setting */}
<hr className='mt-5 border-gray-200 dark:border-gray-600' />