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!

Add feedback to buttons

Blue Mouse5d2985ba7c72
diff --git a/web/app/pages/Project/Settings/Alerts/ProjectAlertsSettings.tsx b/web/app/pages/Project/Settings/Alerts/ProjectAlertsSettings.tsx
index f43e5df9f..b8adbeb97 100644
--- a/web/app/pages/Project/Settings/Alerts/ProjectAlertsSettings.tsx
+++ b/web/app/pages/Project/Settings/Alerts/ProjectAlertsSettings.tsx
@@ -27,6 +27,7 @@ import type { NotificationChannelActionData } from '~/routes/notification-channe
import type { ProjectViewActionData } from '~/routes/projects.$id'
import Button from '~/ui/Button'
import Checkbox from '~/ui/Checkbox'
+import FeedbackButton from '~/ui/FeedbackButton'
import Input from '~/ui/Input'
import Loader from '~/ui/Loader'
import Alert from '~/ui/Alert'
@@ -309,6 +310,14 @@ const ProjectAlertsSettings = ({
form.queryMetric === QUERY_METRIC.CUSTOM_EVENTS &&
form.alertOnEveryCustomEvent
)
+ const saveIntent = isSettings && alertId ? 'update-alert' : 'create-alert'
+ const submittedIntent = fetcher.formData?.get('intent')?.toString()
+ const isSavingAlert =
+ fetcher.state !== 'idle' && submittedIntent === saveIntent
+ const alertSaved =
+ fetcher.state === 'idle' &&
+ fetcher.data?.success &&
+ fetcher.data.intent === saveIntent
useEffect(() => {
if (!shouldIncludeQueryFields) {
@@ -762,7 +771,13 @@ const ProjectAlertsSettings = ({
>
{t('common.cancel')}
</Button>
- <Button type='submit'>{t('common.save')}</Button>
+ <FeedbackButton
+ type='submit'
+ loading={isSavingAlert}
+ succeeded={alertSaved}
+ >
+ {t('common.save')}
+ </FeedbackButton>
</div>
</div>
) : (
@@ -774,7 +789,13 @@ const ProjectAlertsSettings = ({
>
{t('common.cancel')}
</Button>
- <Button type='submit'>{t('common.save')}</Button>
+ <FeedbackButton
+ type='submit'
+ loading={isSavingAlert}
+ succeeded={alertSaved}
+ >
+ {t('common.save')}
+ </FeedbackButton>
</div>
)}
</fetcher.Form>
diff --git a/web/app/pages/UserSettings/UserSettings.tsx b/web/app/pages/UserSettings/UserSettings.tsx
index a8e8b97f0..18db21f46 100644
--- a/web/app/pages/UserSettings/UserSettings.tsx
+++ b/web/app/pages/UserSettings/UserSettings.tsx
@@ -74,6 +74,7 @@ import type {
import Alert from '~/ui/Alert'
import Button from '~/ui/Button'
import Checkbox from '~/ui/Checkbox'
+import FeedbackButton from '~/ui/FeedbackButton'
import HoldToConfirmButton from '~/ui/HoldToConfirmButton'
import Input from '~/ui/Input'
import Loader from '~/ui/Loader'
@@ -605,6 +606,13 @@ const UserSettings = () => {
const pendingToggles = useRef<Map<string, boolean>>(new Map())
const isSubmitting = fetcher.state === 'submitting'
+ const submittedIntent = fetcher.formData?.get('intent')?.toString()
+ const isProfileUpdateSubmitting =
+ fetcher.state !== 'idle' && submittedIntent === 'update-profile'
+ const profileUpdateSucceeded =
+ fetcher.state === 'idle' &&
+ fetcher.data?.success &&
+ fetcher.data.intent === 'update-profile'
const isWebsiteAddonSubmitting = websiteAddonFetcher.state !== 'idle'
const isSessionReplayAddonSubmitting =
sessionReplayAddonFetcher.state !== 'idle'
@@ -1558,9 +1566,14 @@ const UserSettings = () => {
onChange={handleInput}
error={emailBeenSubmitted ? errors.email : null}
/>
- <Button size='lg' onClick={handleEmailSubmit}>
+ <FeedbackButton
+ size='lg'
+ onClick={handleEmailSubmit}
+ loading={isProfileUpdateSubmitting}
+ succeeded={profileUpdateSucceeded}
+ >
{t('profileSettings.update')}
- </Button>
+ </FeedbackButton>
</div>
) : null}
</div>
@@ -1862,15 +1875,17 @@ const UserSettings = () => {
onChange={handleInput}
error={passwordBeenSubmitted ? errors.repeat : null}
/>
- <Button
+ <FeedbackButton
size='lg'
onClick={handlePasswordSubmit}
disabled={
!form.currentPassword || !form.password || !form.repeat
}
+ loading={isProfileUpdateSubmitting}
+ succeeded={profileUpdateSucceeded}
>
{t('profileSettings.updatePassword')}
- </Button>
+ </FeedbackButton>
</div>
</SettingsSection>
diff --git a/web/app/routes/_index.tsx b/web/app/routes/_index.tsx
index 884798bdd..2d1c31f9e 100644
--- a/web/app/routes/_index.tsx
+++ b/web/app/routes/_index.tsx
@@ -606,7 +606,7 @@ const Hero = ({ variant }: { variant: LandingHeroVariant }) => {
return <NewHero stats={stats} />
}
- return <NewHero stats={stats} />
+ return <OldHero stats={stats} />
}
const SOFTWARE_APPLICATION_JSONLD = {
diff --git a/web/app/ui/FeedbackButton.tsx b/web/app/ui/FeedbackButton.tsx
index de7166af7..03c271158 100644
--- a/web/app/ui/FeedbackButton.tsx
+++ b/web/app/ui/FeedbackButton.tsx
@@ -18,8 +18,9 @@ interface FeedbackButtonProps extends Omit<ButtonProps, 'loading'> {
}
const MORPH_LAYER_CLASSES =
- 'col-start-1 row-start-1 flex items-center justify-center transition-[opacity,filter,transform] duration-200 ease-out-quint'
-const MORPH_HIDDEN_CLASSES = 'scale-95 opacity-0 blur-[2px]'
+ 'col-start-1 row-start-1 flex items-center justify-center whitespace-nowrap transition-[opacity,filter,transform] duration-200 ease-out-quint motion-reduce:transition-opacity'
+const MORPH_HIDDEN_CLASSES =
+ 'scale-95 opacity-0 blur-[2px] motion-reduce:scale-100 motion-reduce:blur-0'
/**
* Submit button that morphs its content between idle β†’ loading (spinner) β†’
@@ -78,7 +79,8 @@ const FeedbackButton = ({
phase !== 'loading' && MORPH_HIDDEN_CLASSES,
)}
>
- <Spin inherit className='mr-0! ml-0!' />
+ <Spin inherit />
+ {children}
</span>
<span
aria-hidden={phase !== 'success'}
@@ -87,7 +89,8 @@ const FeedbackButton = ({
phase !== 'success' && MORPH_HIDDEN_CLASSES,
)}
>
- <CheckIcon className='size-4' weight='bold' />
+ <CheckIcon className='mr-2 -ml-1 size-4' weight='bold' />
+ {children}
</span>
</Button>
)