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!

better buttons style

Blue Mouse00e71ba5cf6e
diff --git a/web/app/pages/Project/Experiments/View/ExperimentResults.tsx b/web/app/pages/Project/Experiments/View/ExperimentResults.tsx
index 7a4f44c7a..42e2e9255 100644
--- a/web/app/pages/Project/Experiments/View/ExperimentResults.tsx
+++ b/web/app/pages/Project/Experiments/View/ExperimentResults.tsx
@@ -741,23 +741,27 @@ const ExperimentResults = ({
showLiveVisitors={false}
rightContent={
// Backend forbids updating running/completed experiments; keep button visible (disabled) to make this explicit.
- <Button
- type='button'
- onClick={() => setIsSettingsOpen(true)}
- disabled={results.status === 'running' || results.status === 'completed'}
- title={
+ <Tooltip
+ text={
results.status === 'running'
- ? 'Pause this experiment to edit settings.'
+ ? t('experiments.editDisabledRunning')
: results.status === 'completed'
- ? 'Completed experiments can’t be edited.'
+ ? t('experiments.editDisabledCompleted')
: t('common.edit')
}
- secondary
- small
- >
- <PencilIcon className='mr-1 size-4' strokeWidth={1.5} />
- {t('common.edit')}
- </Button>
+ tooltipNode={
+ <Button
+ type='button'
+ onClick={() => setIsSettingsOpen(true)}
+ disabled={results.status === 'running' || results.status === 'completed'}
+ ghost
+ small
+ >
+ <PencilIcon className='mr-1 size-4' strokeWidth={1.5} />
+ {t('common.edit')}
+ </Button>
+ }
+ />
}
leftContent={
<div className='flex items-center gap-2'>
diff --git a/web/app/pages/Project/Experiments/View/ExperimentsView.tsx b/web/app/pages/Project/Experiments/View/ExperimentsView.tsx
index 855d765f4..b8888b5c5 100644
--- a/web/app/pages/Project/Experiments/View/ExperimentsView.tsx
+++ b/web/app/pages/Project/Experiments/View/ExperimentsView.tsx
@@ -13,7 +13,6 @@ import {
PauseIcon,
CheckCircleIcon,
BarChart3Icon,
- ChevronDownIcon,
} from 'lucide-react'
import { useState, useEffect, useRef, useCallback, memo } from 'react'
import { useTranslation } from 'react-i18next'
@@ -33,7 +32,6 @@ import {
import DashboardHeader from '~/pages/Project/View/components/DashboardHeader'
import { useViewProjectContext } from '~/pages/Project/View/ViewProject'
import { useCurrentProject } from '~/providers/CurrentProjectProvider'
-import { Badge } from '~/ui/Badge'
import Button from '~/ui/Button'
import Spin from '~/ui/icons/Spin'
import Loader from '~/ui/Loader'
@@ -162,23 +160,23 @@ const ExperimentRow = ({
</div>
</div>
</div>
- <div className='flex shrink-0 items-center gap-x-2'>
+ <div className='flex shrink-0 items-center gap-x-1'>
{/* Action buttons based on status */}
- {experiment.status === 'draft' && (
+ {experiment.status === 'draft' ? (
<Button
onClick={handleStart}
disabled={actionLoading || !experiment.goalId}
title={!experiment.goalId ? t('experiments.needGoal') : undefined}
- primary
+ ghost
small
>
{actionLoading ? <Spin className='size-4' /> : <PlayIcon className='mr-1 size-4' strokeWidth={1.5} />}
{t('experiments.start')}
</Button>
- )}
- {experiment.status === 'running' && (
+ ) : null}
+ {experiment.status === 'running' ? (
<>
- <Button onClick={handlePause} disabled={actionLoading} secondary small>
+ <Button onClick={handlePause} disabled={actionLoading} ghost small>
{actionLoading ? (
<Spin className='size-4' />
) : (
@@ -186,30 +184,30 @@ const ExperimentRow = ({
)}
{t('experiments.pause')}
</Button>
- <Button onClick={() => onViewResults(experiment.id)} secondary small>
+ <Button onClick={() => onViewResults(experiment.id)} ghost small>
<BarChart3Icon className='mr-1 size-4' strokeWidth={1.5} />
{t('experiments.results')}
</Button>
</>
- )}
- {experiment.status === 'paused' && (
+ ) : null}
+ {experiment.status === 'paused' ? (
<>
- <Button onClick={handleStart} disabled={actionLoading} primary small>
+ <Button onClick={handleStart} disabled={actionLoading} ghost small>
{actionLoading ? <Spin className='size-4' /> : <PlayIcon className='mr-1 size-4' strokeWidth={1.5} />}
{t('experiments.resume')}
</Button>
- <Button onClick={() => setShowCompleteModal(true)} disabled={actionLoading} secondary small>
+ <Button onClick={() => setShowCompleteModal(true)} disabled={actionLoading} ghost small>
<CheckCircleIcon className='mr-1 size-4' strokeWidth={1.5} />
{t('experiments.complete')}
</Button>
</>
- )}
- {experiment.status === 'completed' && (
- <Button onClick={() => onViewResults(experiment.id)} primary small>
+ ) : null}
+ {experiment.status === 'completed' ? (
+ <Button onClick={() => onViewResults(experiment.id)} ghost small>
<BarChart3Icon className='mr-1 size-4' strokeWidth={1.5} />
{t('experiments.viewResults')}
</Button>
- )}
+ ) : null}
{/* Edit/Delete buttons */}
<div className='flex items-center gap-1 border-l border-gray-200 pl-2 dark:border-slate-700'>
diff --git a/web/app/ui/Button.tsx b/web/app/ui/Button.tsx
index 88c9d298a..21c1e8253 100644
--- a/web/app/ui/Button.tsx
+++ b/web/app/ui/Button.tsx
@@ -22,6 +22,7 @@ interface ButtonProps extends React.ComponentPropsWithoutRef<typeof HeadlessButt
focus?: boolean
noBorder?: boolean
title?: string
+ ghost?: boolean
}
const Button = ({
@@ -43,6 +44,7 @@ const Button = ({
noBorder,
focus = true,
disabled,
+ ghost,
...props
}: ButtonProps) => (
<HeadlessButton
@@ -59,6 +61,8 @@ const Button = ({
'border-transparent bg-red-500 text-gray-50 hover:bg-red-600 dark:bg-red-600 dark:hover:bg-red-700': danger,
'border-1 border-red-600 text-red-500 hover:bg-red-500 hover:text-white dark:border-red-500 dark:text-red-200 dark:hover:bg-red-600':
semiDanger,
+ 'border-transparent bg-transparent text-gray-700 hover:border-gray-300 hover:bg-white dark:text-gray-200 dark:hover:border-slate-700/80 dark:hover:bg-slate-800':
+ ghost,
'border-none text-gray-700 focus:border-none focus:ring-0 focus:ring-offset-0 dark:text-white': noBorder,
'px-2.5 py-1.5 text-xs': small,
'px-2.5 py-1.5 text-sm': semiSmall,
diff --git a/web/public/locales/en.json b/web/public/locales/en.json
index e7f9d255b..de475b2d1 100644
--- a/web/public/locales/en.json
+++ b/web/public/locales/en.json
@@ -1063,6 +1063,8 @@
"description": "Run A/B tests to compare variants and find what works best.\nCreate experiments linked to goals and let Bayesian statistics determine the winner.",
"create": "Create Experiment",
"edit": "Edit Experiment",
+ "editDisabledRunning": "Pause this experiment to edit settings.",
+ "editDisabledCompleted": "Completed experiments can't be edited.",
"delete": "Delete experiment",
"deleted": "Experiment has been deleted",
"created": "Experiment has been created",