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!

fix checkbox and disabled public when protected on

kruzhambus9cdbf631816b
diff --git a/src/pages/Project/Settings/ProjectSettings.tsx b/src/pages/Project/Settings/ProjectSettings.tsx
index f363d0cbd..7fb5dfe93 100644
--- a/src/pages/Project/Settings/ProjectSettings.tsx
+++ b/src/pages/Project/Settings/ProjectSettings.tsx
@@ -458,7 +458,12 @@ const ProjectSettings = ({
/>
<Checkbox
checked={Boolean(form.public)}
- onChange={handleInput}
+ onChange={(e) => {
+ if (!form.isPasswordProtected) {
+ handleInput(e)
+ }
+ }}
+ disabled={form?.isPasswordProtected}
name='public'
id='public'
className='mt-4'
@@ -468,8 +473,11 @@ const ProjectSettings = ({
<Checkbox
checked={Boolean(form.isPasswordProtected)}
onChange={() => {
- setShowProtected(true)
+ if (!form.public) {
+ setShowProtected(true)
+ }
}}
+ disabled={form?.public}
name='isPasswordProtected'
id='isPasswordProtected'
className='mt-4'
diff --git a/src/ui/Checkbox.tsx b/src/ui/Checkbox.tsx
index bfb57ab95..e0305c909 100644
--- a/src/ui/Checkbox.tsx
+++ b/src/ui/Checkbox.tsx
@@ -29,14 +29,15 @@ const Checkbox = ({
id={identifier}
aria-describedby={identifier}
name={name}
+ disabled={disabled}
type='checkbox'
checked={checked}
onChange={onChange}
- className={cx('focus:ring-indigo-500 h-4 w-4 text-indigo-600 border-gray-300 dark:border-slate-800 dark:bg-slate-700 dark:checked:bg-indigo-600 rounded cursor-pointer', { 'cursor-not-allowed': disabled, 'opacity-50': disabled })}
+ className={cx('focus:ring-indigo-500 h-4 w-4 text-indigo-600 border-gray-300 dark:border-slate-800 dark:bg-slate-700 dark:checked:bg-indigo-600 rounded cursor-pointer', { '!cursor-not-allowed': disabled, 'opacity-50': disabled })}
/>
</div>
<div className='ml-3 text-sm'>
- <label htmlFor={identifier} className={cx('font-medium text-gray-700 dark:text-gray-200 cursor-pointer', { 'cursor-not-allowed': disabled })}>{label}</label>
+ <label htmlFor={identifier} className={cx('font-medium text-gray-700 dark:text-gray-200 cursor-pointer', { '!cursor-not-allowed': disabled })}>{label}</label>
{hint && (
<p id={`${identifier}-description`} className={cx('text-gray-500 dark:text-gray-300', hintClassName)}>{hint}</p>
)}