π 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!
TypeScript chartsclickhousedockergdprgoogle-analyticsmetricsmonitoringmysqlnestjsprivacyredisself-hostedselfhostedstatisticstailwindcssweb-analyticswebanalyticswebsite
More animations
Blue Moused8246ab9598e
diff --git a/web/app/pages/Dashboard/Dashboard.tsx b/web/app/pages/Dashboard/Dashboard.tsxindex 7917c18c5..91bfd6acb 100644--- a/web/app/pages/Dashboard/Dashboard.tsx+++ b/web/app/pages/Dashboard/Dashboard.tsx@@ -9,6 +9,7 @@ import {XIcon,FolderPlusIcon,} from '@phosphor-icons/react'+import { AnimatePresence, motion } from 'motion/react'import React, {useState,useEffect,@@ -549,27 +550,49 @@ const Dashboard = () => {: 'grid-cols-1',)}>- {_map(projects, (project) => (- <ProjectCard- key={`${project.id}-${project.name}`}- project={project}- live={- liveStats[project.id] ??- (_isEmpty(liveStats) ? null : 'N/A')- }- overallStats={overallStats[project.id]}- activePeriod={activePeriod}- viewMode={_viewMode}- refetchProjects={refetchProjects}- />- ))}- {_size(projects) % 12 !== 0 ? (- <AddProject- sitesCount={_size(projects)}- onClick={onNewProject}- viewMode={_viewMode}- />- ) : null}+ <AnimatePresence mode='popLayout' initial={false}>+ {_map(projects, (project) => (+ <motion.div+ key={`${project.id}-${project.name}`}+ layout+ initial={{ opacity: 0, scale: 0.97 }}+ animate={{ opacity: 1, scale: 1 }}+ exit={{ opacity: 0, scale: 0.97 }}+ transition={{ duration: 0.15, ease: [0.23, 1, 0.32, 1] }}+ // Single-cell grid so the card stretches to fill the row+ className='grid'+ >+ <ProjectCard+ project={project}+ live={+ liveStats[project.id] ??+ (_isEmpty(liveStats) ? null : 'N/A')+ }+ overallStats={overallStats[project.id]}+ activePeriod={activePeriod}+ viewMode={_viewMode}+ refetchProjects={refetchProjects}+ />+ </motion.div>+ ))}+ {_size(projects) % 12 !== 0 ? (+ <motion.div+ key='add-project'+ layout+ initial={{ opacity: 0, scale: 0.97 }}+ animate={{ opacity: 1, scale: 1 }}+ exit={{ opacity: 0, scale: 0.97 }}+ transition={{ duration: 0.15, ease: [0.23, 1, 0.32, 1] }}+ className='grid'+ >+ <AddProject+ sitesCount={_size(projects)}+ onClick={onNewProject}+ viewMode={_viewMode}+ />+ </motion.div>+ ) : null}+ </AnimatePresence></div>)}{paginationTotal > PAGE_SIZE_OPTIONS[0] ? (diff --git a/web/app/pages/Dashboard/ProjectCard.tsx b/web/app/pages/Dashboard/ProjectCard.tsxindex 24c37f3bc..95bd0de17 100644--- a/web/app/pages/Dashboard/ProjectCard.tsx+++ b/web/app/pages/Dashboard/ProjectCard.tsx@@ -1,3 +1,4 @@+import NumberFlow from '@number-flow/react'import cx from 'clsx'import _find from 'lodash/find'import _isNumber from 'lodash/isNumber'@@ -15,6 +16,11 @@ import { Link } from '~/ui/Link'import { useFetcher, useNavigate } from 'react-router'import { toast } from 'sonner'+import {+ FLOW_TIMING,+ FLOW_VALUE_CLASS,+ useFlowValue,+} from '~/hooks/useFlowValue'import { OverallObject, Project } from '~/lib/models/Project'import { useAuth } from '~/providers/AuthProvider'import type { DashboardActionData } from '~/routes/dashboard'@@ -22,7 +28,11 @@ import { Badge, BadgeProps } from '~/ui/Badge'import Spin from '~/ui/icons/Spin'import Modal from '~/ui/Modal'import { Text } from '~/ui/Text'-import { nFormatter, calculateRelativePercentage } from '~/utils/generic'+import {+ nFormatter,+ nFormatterSeparated,+ calculateRelativePercentage,+} from '~/utils/generic'import { getFaviconHost, getFaviconUrl } from '~/utils/referrers'import routes from '~/utils/routes'@@ -58,14 +68,41 @@ interface ProjectCardProps {refetchProjects: () => void}+// Rolls the live visitor count in on load and on every live-stats refresh+const FlowingNumber = ({ value }: { value: number }) => {+ const flowValue = useFlowValue(value)+ const [num, symbol] = nFormatterSeparated(flowValue, 1) as [+ number,+ string | null,+ ]++ return (+ <NumberFlow+ className={FLOW_VALUE_CLASS}+ {...FLOW_TIMING}+ value={num}+ suffix={symbol ?? undefined}+ format={{ maximumFractionDigits: 1 }}+ willChange+ />+ )+}+interface MiniCardProps {labelTKey: stringtotal?: number | string | nullpercChange?: numberhasData?: boolean+ flow?: boolean}-const MiniCard = ({ labelTKey, total, percChange, hasData }: MiniCardProps) => {+const MiniCard = ({+ labelTKey,+ total,+ percChange,+ hasData,+ flow,+}: MiniCardProps) => {const { t } = useTranslation('common')const statsDidGrowUp = percChange ? percChange >= 0 : falseconst isLoading = total === null@@ -91,7 +128,13 @@ const MiniCard = ({ labelTKey, total, percChange, hasData }: MiniCardProps) => {) : (<><Text as='p' weight='bold' size='base' colour='secondary'>- {_isNumber(total) ? nFormatter(total) : total}+ {!_isNumber(total) ? (+ total+ ) : flow ? (+ <FlowingNumber value={total} />+ ) : (+ nFormatter(total)+ )}</Text>{_isNumber(percChange) && percChange !== 0 ? (<Text@@ -461,6 +504,7 @@ export const ProjectCard = ({<MiniCardlabelTKey='dashboard.liveVisitors'total={live}+ flowhasData={project?.isDataExists ||project?.isErrorDataExists ||diff --git a/web/app/pages/Project/Settings/ProjectSettings.tsx b/web/app/pages/Project/Settings/ProjectSettings.tsxindex 96e83d5d6..b14ed8080 100644--- a/web/app/pages/Project/Settings/ProjectSettings.tsx+++ b/web/app/pages/Project/Settings/ProjectSettings.tsx@@ -49,6 +49,7 @@ import DatePicker from '~/ui/Datepicker'import Dropdown from '~/ui/Dropdown'import GoogleGSVG from '~/ui/icons/GoogleG'import GoogleSearchConsoleSVG from '~/ui/icons/GoogleSearchConsole'+import HoldToConfirmButton from '~/ui/HoldToConfirmButton'import Input from '~/ui/Input'import Loader from '~/ui/Loader'import Modal from '~/ui/Modal'@@ -1869,20 +1870,31 @@ const ProjectSettings = () => {</div><ModalonClose={() => setShowDelete(false)}- onSubmit={onDelete}- submitText={t('project.settings.delete')}+ customButtons={+ <HoldToConfirmButton+ onConfirm={onDelete}+ className='w-full justify-center sm:w-auto'+ >+ {t('common.holdToDelete')}+ </HoldToConfirmButton>+ }closeText={t('common.close')}title={t('project.settings.qDelete')}message={t('project.settings.deleteHint')}- submitType='danger'type='error'isOpened={showDelete}/><ModalonClose={() => setShowReset(false)}- onSubmit={handleReset}+ customButtons={+ <HoldToConfirmButton+ onConfirm={handleReset}+ className='w-full justify-center sm:w-auto'+ >+ {t('common.holdToReset')}+ </HoldToConfirmButton>+ }size='large'- submitText={t('project.settings.reset')}closeText={t('common.close')}title={t('project.settings.qReset')}message={@@ -1899,7 +1911,6 @@ const ProjectSettings = () => {fetchFilters={fetchFilters}/>}- submitType='danger'type='error'isOpened={showReset}/>diff --git a/web/app/pages/Project/View/Panels.tsx b/web/app/pages/Project/View/Panels.tsxindex 245a1c2c8..0036e1718 100644--- a/web/app/pages/Project/View/Panels.tsx+++ b/web/app/pages/Project/View/Panels.tsx@@ -31,6 +31,7 @@ import {ArrowLineLeftIcon,MagnifyingGlassIcon,} from '@phosphor-icons/react'+import { motion } from 'motion/react'import React, {memo,useState,@@ -38,6 +39,7 @@ import React, {useMemo,useCallback,Fragment,+ useId,useRef,} from 'react'import { useTranslation } from 'react-i18next'@@ -96,6 +98,24 @@ const getPercentage = (value: number, total: number, precision = 2) => {return Number.isFinite(percentage) ? _round(percentage, precision) : 0}+const panelBarStyle = (pct: number) =>+ ({ '--panel-bar-width': `${pct}%` }) as React.CSSProperties++/**+ * Active-tab underline shared between a panel's tab buttons: rendering it+ * with a common layoutId makes it glide from the old tab to the new one.+ * The layoutId must be unique per panel instance β multiple panels render+ * their tab bars simultaneously.+ */+const PanelTabUnderline = ({ layoutId }: { layoutId: string }) => (+ <motion.span+ aria-hidden+ layoutId={layoutId}+ transition={{ duration: 0.2, ease: [0.23, 1, 0.32, 1] }}+ className='absolute inset-x-0 -bottom-0.5 h-0.5 bg-slate-900 dark:bg-gray-50'+ />+)+const getDocsEmptyStateVariant = (id: string,activeTab: keyof typeof PROJECT_TABS,@@ -209,6 +229,7 @@ const PanelContainer = ({dropdownPlaceholder,}: PanelContainerProps) => {const { t } = useTranslation('common')+ const underlineId = useId()return (<div@@ -251,7 +272,14 @@ const PanelContainer = ({return (<Dropdownkey={`dropdown-${index}`}- title={dropdownTitle}+ title={+ <>+ {dropdownTitle}+ {activeDropdownTab ? (+ <PanelTabUnderline layoutId={underlineId} />+ ) : null}+ </>+ }items={dropdownTabs}labelExtractor={(item) => item.label}keyExtractor={(item) => item.id}@@ -259,12 +287,12 @@ const PanelContainer = ({onTabChange(item.id)}}buttonClassName={cx(- 'relative border-b-2 px-0 py-1 text-sm font-bold whitespace-nowrap transition-all duration-200 md:px-0',+ 'relative border-b-2 border-transparent px-0 py-1 text-sm font-bold whitespace-nowrap transition-colors duration-200 md:px-0',{- 'border-slate-900 text-slate-900 dark:border-gray-50 dark:text-gray-50':- dropdownTabs.some((t) => t.id === activeTabId),- 'border-transparent text-gray-500 hover:border-gray-200 hover:text-gray-700 dark:text-gray-400 dark:hover:border-gray-200 dark:hover:text-gray-300':- !dropdownTabs.some((t) => t.id === activeTabId),+ 'text-slate-900 dark:text-gray-50':+ !!activeDropdownTab,+ 'text-gray-500 hover:border-gray-200 hover:text-gray-700 dark:text-gray-400 dark:hover:border-gray-200 dark:hover:text-gray-300':+ !activeDropdownTab,},)}headless@@ -282,16 +310,19 @@ const PanelContainer = ({onTabChange(tab.id)}}className={cx(- 'relative border-b-2 py-1 text-sm font-bold whitespace-nowrap transition-all duration-200',+ 'relative border-b-2 border-transparent py-1 text-sm font-bold whitespace-nowrap transition-colors duration-200',{- 'border-slate-900 text-slate-900 dark:border-gray-50 dark:text-gray-50':+ 'text-slate-900 dark:text-gray-50':activeTabId === tab.id,- 'border-transparent text-gray-500 hover:border-gray-200 hover:text-gray-700 dark:text-gray-400 dark:hover:border-gray-200 dark:hover:text-gray-300':+ 'text-gray-500 hover:border-gray-200 hover:text-gray-700 dark:text-gray-400 dark:hover:border-gray-200 dark:hover:text-gray-300':activeTabId !== tab.id,},)}>{tab.label}+ {activeTabId === tab.id ? (+ <PanelTabUnderline layoutId={underlineId} />+ ) : null}</button>)})}@@ -986,10 +1017,10 @@ const CustomEvents = ({}}><div- className='absolute inset-0 rounded-sm bg-blue-50 dark:bg-blue-900/10'- style={{- width: `${getPercentage(eventsData[ev], maxValue)}%`,- }}+ className='panel-bar absolute inset-0 rounded-sm bg-blue-50 dark:bg-blue-900/10'+ style={panelBarStyle(+ getPercentage(eventsData[ev], maxValue),+ )}/><div className='relative z-10 flex w-4/6 min-w-0 items-center'>@@ -1472,8 +1503,8 @@ const MetadataKeyBody = ({}}><div- className='absolute inset-0 rounded-sm bg-blue-50 dark:bg-blue-900/10'- style={{ width: `${getPercentage(count, maxValue)}%` }}+ className='panel-bar absolute inset-0 rounded-sm bg-blue-50 dark:bg-blue-900/10'+ style={panelBarStyle(getPercentage(count, maxValue))}/><div className='relative z-10 w-2/6 min-w-0 truncate'>@@ -1560,8 +1591,8 @@ const MetadataKeyBody = ({}}><div- className='absolute inset-0 rounded-sm bg-blue-50 dark:bg-blue-900/10'- style={{ width: `${getPercentage(count, maxValue)}%` }}+ className='panel-bar absolute inset-0 rounded-sm bg-blue-50 dark:bg-blue-900/10'+ style={panelBarStyle(getPercentage(count, maxValue))}/><div className='relative z-10 flex w-4/6 min-w-0 items-center'>@@ -1675,6 +1706,7 @@ const CombinedMetadataPanel = ({const [canShowDetails, setCanShowDetails] = useState(false)const [detailsTrigger, setDetailsTrigger] = useState(0)+ const underlineId = useId()const activeDropdownTab = dropdownItems.find((item) => item.id === activeSection.activeKey,@@ -1703,16 +1735,18 @@ const CombinedMetadataPanel = ({type='button'onClick={() => setActiveMode(tab.id)}className={cx(- 'relative border-b-2 py-1 text-sm font-bold whitespace-nowrap transition-all duration-200',+ 'relative border-b-2 border-transparent py-1 text-sm font-bold whitespace-nowrap transition-colors duration-200',{- 'border-slate-900 text-slate-900 dark:border-gray-50 dark:text-gray-50':- activeMode === tab.id,- 'border-transparent text-gray-500 hover:border-gray-200 hover:text-gray-700 dark:text-gray-400 dark:hover:border-gray-200 dark:hover:text-gray-300':+ 'text-slate-900 dark:text-gray-50': activeMode === tab.id,+ 'text-gray-500 hover:border-gray-200 hover:text-gray-700 dark:text-gray-400 dark:hover:border-gray-200 dark:hover:text-gray-300':activeMode !== tab.id,},)}>{tab.label}+ {activeMode === tab.id ? (+ <PanelTabUnderline layoutId={underlineId} />+ ) : null}</button>))}{!_isEmpty(dropdownItems) ? (@@ -1723,7 +1757,7 @@ const CombinedMetadataPanel = ({keyExtractor={(item) => item.id}onSelect={(item) => activeSection.onKeyChange(item.id)}buttonClassName={cx(- 'relative border-b-2 px-0 py-1 text-sm font-bold whitespace-nowrap transition-all duration-200 md:px-0',+ 'relative border-b-2 px-0 py-1 text-sm font-bold whitespace-nowrap transition-colors duration-200 md:px-0',{'border-slate-900 text-slate-900 dark:border-gray-50 dark:text-gray-50':!!activeDropdownTab,@@ -2395,7 +2429,7 @@ const Panel = ({role='presentation'><div- className={cx('absolute inset-0 rounded-sm', {+ className={cx('panel-bar absolute inset-0 rounded-sm', {'bg-blue-50 dark:bg-blue-900/30':highlightColour === 'blue','bg-red-50 dark:bg-slate-500/15':@@ -2403,7 +2437,7 @@ const Panel = ({'bg-orange-50 dark:bg-slate-500/15':highlightColour === 'orange',})}- style={{ width: `${perc}%` }}+ style={panelBarStyle(perc)}/><div className='relative z-10 flex min-w-0 flex-1 items-center'>@@ -2542,15 +2576,18 @@ const Panel = ({)}><div- className={cx('absolute inset-0 rounded-sm', {- 'bg-blue-50 dark:bg-blue-900/10':- highlightColour === 'blue',- 'bg-red-50 dark:bg-slate-600/15':- highlightColour === 'red',- 'bg-orange-50 dark:bg-slate-600/15':- highlightColour === 'orange',- })}- style={{ width: `${versionPerc}%` }}+ className={cx(+ 'panel-bar absolute inset-0 rounded-sm',+ {+ 'bg-blue-50 dark:bg-blue-900/10':+ highlightColour === 'blue',+ 'bg-red-50 dark:bg-slate-600/15':+ highlightColour === 'red',+ 'bg-orange-50 dark:bg-slate-600/15':+ highlightColour === 'orange',+ },+ )}+ style={panelBarStyle(versionPerc)}/><div className='relative z-10 flex min-w-0 flex-1 items-center'>diff --git a/web/app/pages/Project/tabs/SEO/seo-chart-options.ts b/web/app/pages/Project/tabs/SEO/seo-chart-options.tsindex c4db13df1..f3306692d 100644--- a/web/app/pages/Project/tabs/SEO/seo-chart-options.ts+++ b/web/app/pages/Project/tabs/SEO/seo-chart-options.ts@@ -49,9 +49,7 @@ const getSEOMetricValue = (entry: DateSeriesEntry, metric: SEOMetricKey) => {return entry[metric] ?? 0}-const getAnnotationLines = (- annotations?: Annotation[],-): GridLineOptions[] => {+const getAnnotationLines = (annotations?: Annotation[]): GridLineOptions[] => {return (annotations || []).map<GridLineOptions>((annotation) => ({value: dayjs(annotation.date).toDate(),text:diff --git a/web/app/pages/UserSettings/UserSettings.tsx b/web/app/pages/UserSettings/UserSettings.tsxindex 5d5092e02..a8e8b97f0 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 HoldToConfirmButton from '~/ui/HoldToConfirmButton'import Input from '~/ui/Input'import Loader from '~/ui/Loader'import Modal from '~/ui/Modal'@@ -2785,16 +2786,21 @@ const UserSettings = () => {setDeletionPassword('')setShowModal(false)}}- onSubmit={() => {- setShowModal(false)- onAccountDelete()- }}- submitText={t('profileSettings.aDelete')}+ customButtons={+ <HoldToConfirmButton+ onConfirm={() => {+ setShowModal(false)+ onAccountDelete()+ }}+ disabled={!deletionPassword}+ className='w-full justify-center sm:w-auto'+ >+ {t('common.holdToDelete')}+ </HoldToConfirmButton>+ }closeText={t('common.close')}title={t('profileSettings.qDelete')}- submitType='danger'type='error'- submitDisabled={!deletionPassword}message={<>{t('profileSettings.deactivateConfirmation')}diff --git a/web/app/styles/tailwind.css b/web/app/styles/tailwind.cssindex a1d2023ed..b458574f5 100644--- a/web/app/styles/tailwind.css+++ b/web/app/styles/tailwind.css@@ -29,6 +29,9 @@--min-height-including-header: calc(100vh - var(--header-total-height));--default-transition-duration: 200ms;++ /* Signature easing curve (easeOutQuint) β use for all UI animations */+ --ease-out-quint: cubic-bezier(0.23, 1, 0.32, 1);}/* Custom Animations */@@ -118,138 +121,82 @@}/* Tooltip animations */-@keyframes tooltipSlideDownAndFadeIn {- 0% {- opacity: 0;- transform: translateY(-4px);- }- 100% {- opacity: 1;- transform: translateY(0);- }-}--@keyframes tooltipSlideUpAndFadeIn {- 0% {- opacity: 0;- transform: translateY(4px);- }- 100% {- opacity: 1;- transform: translateY(0);- }-}--@keyframes tooltipSlideLeftAndFadeIn {- 0% {- opacity: 0;- transform: translateX(4px);- }- 100% {- opacity: 1;- transform: translateX(0);- }-}--@keyframes tooltipSlideRightAndFadeIn {- 0% {- opacity: 0;- transform: translateX(-4px);- }- 100% {- opacity: 1;- transform: translateX(0);- }-}--@keyframes tooltipSlideDownAndFadeOut {- 0% {- opacity: 1;- transform: translateY(0);- }- 100% {- opacity: 0;- transform: translateY(-4px);- }-}--@keyframes tooltipSlideUpAndFadeOut {- 0% {- opacity: 1;- transform: translateY(0);- }- 100% {- opacity: 0;- transform: translateY(4px);- }-}--@keyframes tooltipSlideLeftAndFadeOut {- 0% {- opacity: 1;- transform: translateX(0);- }- 100% {+@keyframes tooltip-in {+ from {opacity: 0;- transform: translateX(4px);+ transform: scale(0.97);}}-@keyframes tooltipSlideRightAndFadeOut {- 0% {- opacity: 1;- transform: translateX(0);- }- 100% {+@keyframes tooltip-out {+ to {opacity: 0;- transform: translateX(-4px);}}@layer utilities {- /* Base class to enable smooth transform/opacity animations */.tooltip-content {will-change: transform, opacity;}- /* Open animations (handle both delayed and instant) */- .tooltip-content[data-state='delayed-open'][data-side='top'],- .tooltip-content[data-state='instant-open'][data-side='top'] {- animation: tooltipSlideUpAndFadeIn var(--default-transition-duration, 250ms)- cubic-bezier(0.16, 1, 0.3, 1);- }- .tooltip-content[data-state='delayed-open'][data-side='bottom'],- .tooltip-content[data-state='instant-open'][data-side='bottom'] {- animation: tooltipSlideDownAndFadeIn- var(--default-transition-duration, 250ms) cubic-bezier(0.16, 1, 0.3, 1);- }- .tooltip-content[data-state='delayed-open'][data-side='left'],- .tooltip-content[data-state='instant-open'][data-side='left'] {- animation: tooltipSlideLeftAndFadeIn- var(--default-transition-duration, 250ms) cubic-bezier(0.16, 1, 0.3, 1);- }- .tooltip-content[data-state='delayed-open'][data-side='right'],- .tooltip-content[data-state='instant-open'][data-side='right'] {- animation: tooltipSlideRightAndFadeIn- var(--default-transition-duration, 250ms) cubic-bezier(0.16, 1, 0.3, 1);- }-- /* Close animations */- .tooltip-content[data-state='closed'][data-side='top'] {- animation: tooltipSlideUpAndFadeOut- var(--default-transition-duration, 250ms) cubic-bezier(0.16, 1, 0.3, 1);- }- .tooltip-content[data-state='closed'][data-side='bottom'] {- animation: tooltipSlideDownAndFadeOut- var(--default-transition-duration, 250ms) cubic-bezier(0.16, 1, 0.3, 1);- }- .tooltip-content[data-state='closed'][data-side='left'] {- animation: tooltipSlideLeftAndFadeOut- var(--default-transition-duration, 250ms) cubic-bezier(0.16, 1, 0.3, 1);- }- .tooltip-content[data-state='closed'][data-side='right'] {- animation: tooltipSlideRightAndFadeOut- var(--default-transition-duration, 250ms) cubic-bezier(0.16, 1, 0.3, 1);+ @media (prefers-reduced-motion: no-preference) {+ /* Only animate delayed opens β when a sibling tooltip was recently open,+ the next one opens instantly (data-state='instant-open') and must+ appear with no delay and no animation. */+ .tooltip-content[data-state='delayed-open'] {+ animation: tooltip-in 125ms var(--ease-out-quint);+ }+ .tooltip-content[data-state='closed'] {+ animation: tooltip-out 100ms ease-out;+ }+ }++ /* Panel row background bars: animate width retargets, and sweep in from+ zero when rows first mount (entering rows / panel tab switches). */+ .panel-bar {+ width: var(--panel-bar-width, 0%);++ @media (prefers-reduced-motion: no-preference) {+ transition: width 400ms var(--ease-out-quint);++ @starting-style {+ width: 0%;+ }+ }+ }+}++/* Landing page scroll-driven animations. Progressive enhancement only:+ browsers without scroll timelines (or reduced-motion users) render the+ final, fully visible state β content is never hidden without JS. */+@media (prefers-reduced-motion: no-preference) {+ @supports (animation-timeline: scroll()) {+ @keyframes hero-parallax {+ to {+ transform: translateY(40px);+ }+ }++ .hero-parallax {+ animation: hero-parallax linear both;+ animation-timeline: scroll(root block);+ animation-range: 0 100vh;+ }+ }++ @supports (animation-timeline: view()) {+ @keyframes scroll-reveal-rise {+ from {+ opacity: 0;+ transform: translateY(12px);+ }+ }++ .scroll-reveal {+ animation: scroll-reveal-rise both var(--ease-out-quint);+ animation-timeline: view();+ animation-range: entry 10% entry 50%;+ }}}diff --git a/web/app/ui/Button.tsx b/web/app/ui/Button.tsxindex 24618d21e..6c8fcc13c 100644--- a/web/app/ui/Button.tsx+++ b/web/app/ui/Button.tsx@@ -42,7 +42,7 @@ type ButtonVariant =*/type ButtonSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl'-interface ButtonProps extends Omit<+export interface ButtonProps extends Omit<React.ComponentPropsWithoutRef<typeof HeadlessButton>,'children'> {@@ -109,7 +109,7 @@ export const buttonClasses = ({const isIcon = variant === 'icon'return cn('relative inline-flex items-center rounded-md border leading-4 font-medium select-none',- 'transition-[background-color,color,box-shadow,transform] duration-150 ease-out active:scale-[0.98]',+ 'transition-[background-color,color,box-shadow,transform] duration-150 ease-out-quint active:scale-[0.98]',focus &&'focus-visible:ring-2 focus-visible:ring-slate-900 focus-visible:ring-offset-2 focus-visible:outline-hidden dark:focus-visible:ring-slate-300 dark:focus-visible:ring-offset-slate-950','disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50',diff --git a/web/app/ui/Dropdown.tsx b/web/app/ui/Dropdown.tsxindex 162cf7de9..2d5428e9e 100644--- a/web/app/ui/Dropdown.tsx+++ b/web/app/ui/Dropdown.tsx@@ -1,13 +1,7 @@-import {- Menu,- MenuButton,- MenuItems,- MenuItem,- Transition,-} from '@headlessui/react'+import { Menu, MenuButton, MenuItems, MenuItem } from '@headlessui/react'import _isEmpty from 'lodash/isEmpty'import _map from 'lodash/map'-import React, { memo, Fragment, Key } from 'react'+import React, { memo, Key } from 'react'import { useTranslation } from 'react-i18next'import { cn } from '~/utils/generic'@@ -78,11 +72,11 @@ function Dropdown<T>({onClick={onClick}disabled={disabled}className={cn(- 'transition-[background-color,color,box-shadow] duration-150 ease-out',+ 'transition-[background-color,color,box-shadow,transform] duration-150 ease-out-quint',{'justify-between': aside,'justify-center': !aside,- 'inline-flex w-full rounded-md border-0 bg-white px-3 py-2 text-sm font-medium ring-1 ring-gray-300 ring-inset hover:bg-gray-50 hover:ring-gray-400 focus-visible:ring-2 focus-visible:ring-slate-900 focus-visible:outline-hidden md:px-4 dark:bg-slate-950 dark:text-gray-50 dark:ring-slate-700/80 dark:hover:bg-slate-900 dark:hover:ring-slate-600 dark:focus-visible:ring-slate-300':+ 'inline-flex w-full rounded-md border-0 bg-white px-3 py-2 text-sm font-medium ring-1 ring-gray-300 ring-inset hover:bg-gray-50 hover:ring-gray-400 focus-visible:ring-2 focus-visible:ring-slate-900 focus-visible:outline-hidden active:scale-[0.98] md:px-4 dark:bg-slate-950 dark:text-gray-50 dark:ring-slate-700/80 dark:hover:bg-slate-900 dark:hover:ring-slate-600 dark:focus-visible:ring-slate-300':!headless,'group inline-flex w-full px-3 py-2 text-sm font-medium outline-hidden md:px-4':headless,@@ -118,67 +112,58 @@ function Dropdown<T>({) : null}</MenuButton>- <Transition- show={open}- as={Fragment}- enter='transition-[opacity,transform] ease-out duration-150'- enterFrom='transform opacity-0 scale-95 -translate-y-0.5'- enterTo='transform opacity-100 scale-100 translate-y-0'- leave='transition-[opacity,transform] ease-out duration-100'- leaveFrom='transform opacity-100 scale-100 translate-y-0'- leaveTo='transform opacity-0 scale-95 -translate-y-0.5'+ <MenuItems+ anchor={{+ to: position === 'down' ? 'bottom end' : 'top end',+ offset: 6,+ }}+ modal={false}+ transition+ className={cn(+ 'z-50 w-40 min-w-max rounded-lg bg-white p-1 shadow-lg ring-1 ring-gray-200/80 focus:outline-hidden dark:bg-slate-900 dark:ring-slate-700/60',+ // Scale in from the corner nearest the trigger, not the center+ position === 'down' ? 'origin-top-right' : 'origin-bottom-right',+ 'transition-[opacity,transform] duration-150 ease-out-quint data-closed:scale-95 data-closed:opacity-0 data-leave:duration-100',+ menuItemsClassName,+ )}>- <MenuItems- anchor={{- to: position === 'down' ? 'bottom end' : 'top end',- offset: 6,- }}- modal={false}- className={cn(- 'z-50 w-40 min-w-max rounded-lg bg-white p-1 shadow-lg ring-1 ring-gray-200/80 focus:outline-hidden dark:bg-slate-900 dark:ring-slate-700/60',- menuItemsClassName,- )}- >- {header ? (- <>- <p className='px-2 pt-1.5 pb-1 text-xs font-medium tracking-wide text-gray-500 uppercase dark:text-gray-400'>- {header}- </p>- <div className='mb-1 h-px bg-gray-100 dark:bg-slate-800' />- </>- ) : null}- {loading ? (- <div className='flex items-center justify-center px-4 py-3'>- <Spin className='mr-0! ml-0!' />- <span className='sr-only'>{t('common.loading')}</span>- </div>- ) : (- _map(items, (item) => (- <MenuItem- key={- keyExtractor ? keyExtractor(item, close) : (item as Key)+ {header ? (+ <>+ <p className='px-2 pt-1.5 pb-1 text-xs font-medium tracking-wide text-gray-500 uppercase dark:text-gray-400'>+ {header}+ </p>+ <div className='mb-1 h-px bg-gray-100 dark:bg-slate-800' />+ </>+ ) : null}+ {loading ? (+ <div className='flex items-center justify-center px-4 py-3'>+ <Spin className='mr-0! ml-0!' />+ <span className='sr-only'>{t('common.loading')}</span>+ </div>+ ) : (+ _map(items, (item) => (+ <MenuItem+ key={keyExtractor ? keyExtractor(item, close) : (item as Key)}+ >+ <span+ className={cn(+ 'block cursor-pointer rounded-md px-2 py-1.5 text-sm text-gray-700 transition-colors duration-100 ease-out hover:bg-gray-100 hover:text-gray-900 data-focus:bg-gray-100 data-focus:text-gray-900 dark:text-gray-50 dark:hover:bg-slate-800 dark:hover:text-white dark:data-focus:bg-slate-800 dark:data-focus:text-white',+ selectItemClassName,+ )}+ role='menuitem'+ tabIndex={0}+ onClick={(e: React.MouseEvent<HTMLElement>) =>+ onSelect(item, e, close)}>- <span- className={cn(- 'block cursor-pointer rounded-md px-2 py-1.5 text-sm text-gray-700 transition-colors duration-100 ease-out hover:bg-gray-100 hover:text-gray-900 data-focus:bg-gray-100 data-focus:text-gray-900 dark:text-gray-50 dark:hover:bg-slate-800 dark:hover:text-white dark:data-focus:bg-slate-800 dark:data-focus:text-white',- selectItemClassName,- )}- role='menuitem'- tabIndex={0}- onClick={(e: React.MouseEvent<HTMLElement>) =>- onSelect(item, e, close)- }- >- {labelExtractor- ? labelExtractor(item, close)- : (item as React.ReactNode)}- </span>- </MenuItem>- ))- )}- </MenuItems>- </Transition>+ {labelExtractor+ ? labelExtractor(item, close)+ : (item as React.ReactNode)}+ </span>+ </MenuItem>+ ))+ )}+ </MenuItems></>)}</Menu>diff --git a/web/app/ui/FeedbackButton.tsx b/web/app/ui/FeedbackButton.tsxnew file mode 100644index 000000000..de7166af7--- /dev/null+++ b/web/app/ui/FeedbackButton.tsx@@ -0,0 +1,96 @@+import { CheckIcon } from '@phosphor-icons/react'+import React, { useEffect, useRef, useState } from 'react'++import { cn } from '~/utils/generic'++import Button, { ButtonProps } from './Button'+import Spin from './icons/Spin'++type FeedbackPhase = 'idle' | 'loading' | 'success'++interface FeedbackButtonProps extends Omit<ButtonProps, 'loading'> {+ loading?: boolean+ /**+ * Outcome of the submission that just finished. Pass `false` to skip the+ * success checkmark when the request failed (the error toast still shows).+ */+ succeeded?: boolean+}++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]'++/**+ * Submit button that morphs its content between idle β loading (spinner) β+ * success (checkmark, auto-reverts after 1.5s). The three states are stacked+ * in one grid cell so the button never changes width.+ */+const FeedbackButton = ({+ loading,+ succeeded,+ disabled,+ className,+ children,+ ...props+}: FeedbackButtonProps) => {+ const [phase, setPhase] = useState<FeedbackPhase>('idle')+ const prevLoading = useRef(false)+ const revertTimer = useRef<ReturnType<typeof setTimeout> | undefined>(+ undefined,+ )++ useEffect(() => {+ if (loading && !prevLoading.current) {+ clearTimeout(revertTimer.current)+ setPhase('loading')+ } else if (!loading && prevLoading.current) {+ if (succeeded === false) {+ setPhase('idle')+ } else {+ setPhase('success')+ revertTimer.current = setTimeout(() => setPhase('idle'), 1500)+ }+ }+ prevLoading.current = !!loading+ }, [loading, succeeded])++ useEffect(() => () => clearTimeout(revertTimer.current), [])++ return (+ <Button+ {...props}+ disabled={disabled || phase === 'loading'}+ className={cn('grid', className)}+ >+ <span+ className={cn(+ MORPH_LAYER_CLASSES,+ phase !== 'idle' && MORPH_HIDDEN_CLASSES,+ )}+ >+ {children}+ </span>+ <span+ aria-hidden={phase !== 'loading'}+ className={cn(+ MORPH_LAYER_CLASSES,+ phase !== 'loading' && MORPH_HIDDEN_CLASSES,+ )}+ >+ <Spin inherit className='mr-0! ml-0!' />+ </span>+ <span+ aria-hidden={phase !== 'success'}+ className={cn(+ MORPH_LAYER_CLASSES,+ phase !== 'success' && MORPH_HIDDEN_CLASSES,+ )}+ >+ <CheckIcon className='size-4' weight='bold' />+ </span>+ </Button>+ )+}++export default FeedbackButtondiff --git a/web/app/ui/HoldToConfirmButton.tsx b/web/app/ui/HoldToConfirmButton.tsxnew file mode 100644index 000000000..4abc30fa5--- /dev/null+++ b/web/app/ui/HoldToConfirmButton.tsx@@ -0,0 +1,106 @@+import React, { useRef, useState } from 'react'++import { cn } from '~/utils/generic'++import { buttonClasses } from './Button'++const HOLD_DURATION_MS = 1500++const prefersReducedMotion = () =>+ typeof window !== 'undefined' &&+ window.matchMedia('(prefers-reduced-motion: reduce)').matches++interface HoldToConfirmButtonProps {+ onConfirm: () => void+ children: React.ReactNode+ disabled?: boolean+ className?: string+}++/**+ * Destructive confirmation button: press and hold until the red fill sweeps+ * across, then the action fires. Releasing early snaps the fill back.+ *+ * Keyboard activation (Enter/Space) and `prefers-reduced-motion` users get a+ * plain click β the surrounding confirmation modal is their safety net.+ */+const HoldToConfirmButton = ({+ onConfirm,+ children,+ disabled,+ className,+}: HoldToConfirmButtonProps) => {+ const [pressing, setPressing] = useState(false)+ const activePointerId = useRef<number | null>(null)+ const lastConfirmAt = useRef(0)++ const confirm = () => {+ // Enter keydown auto-repeats clicks; debounce repeated activations+ if (Date.now() - lastConfirmAt.current < 500) return+ lastConfirmAt.current = Date.now()+ onConfirm()+ }++ const stopHold = (e: React.PointerEvent<HTMLButtonElement>) => {+ if (e.pointerId !== activePointerId.current) return+ activePointerId.current = null+ setPressing(false)+ }++ return (+ <button+ type='button'+ disabled={disabled}+ className={cn(+ buttonClasses({ variant: 'danger', size: 'lg' }),+ 'touch-none overflow-hidden',+ pressing && 'scale-[0.97]',+ className,+ )}+ onPointerDown={(e) => {+ // Keyboard & reduced-motion users confirm with a plain click instead+ if (disabled || prefersReducedMotion()) return+ // Ignore additional touch points while a hold is in progress+ if (activePointerId.current !== null) return+ if (e.button !== 0) return++ activePointerId.current = e.pointerId+ // Capture so releasing outside the button still ends the hold+ e.currentTarget.setPointerCapture(e.pointerId)+ setPressing(true)+ }}+ onPointerUp={stopHold}+ onPointerCancel={stopHold}+ onClick={(e) => {+ // detail === 0 β keyboard-triggered click (Enter/Space)+ if (e.detail === 0 || prefersReducedMotion()) {+ confirm()+ }+ }}+ onContextMenu={(e) => {+ // Long-press on touch devices must not open the context menu+ if (pressing) e.preventDefault()+ }}+ >+ <span+ aria-hidden+ className='pointer-events-none absolute inset-0 rounded-[inherit] bg-red-800'+ style={{+ clipPath: pressing ? 'inset(0 0 0 0)' : 'inset(0 100% 0 0)',+ transition: pressing+ ? `clip-path ${HOLD_DURATION_MS}ms linear`+ : 'clip-path 200ms var(--ease-out-quint)',+ }}+ onTransitionEnd={(e) => {+ if (e.propertyName !== 'clip-path' || !pressing) return+ activePointerId.current = null+ setPressing(false)+ confirm()+ }}+ />+ <span className='relative z-10'>{children}</span>+ </button>+ )+}++export default HoldToConfirmButtondiff --git a/web/app/ui/Modal.tsx b/web/app/ui/Modal.tsxindex b83e06f76..ce0bb423c 100644--- a/web/app/ui/Modal.tsx+++ b/web/app/ui/Modal.tsx@@ -95,7 +95,7 @@ const Modal = ({><DialogBackdroptransition- className='fixed inset-0 bg-gray-900/40 backdrop-blur-[2px] transition-opacity duration-200 data-closed:opacity-0 data-enter:ease-out data-leave:ease-in dark:bg-black/60'+ className='fixed inset-0 bg-gray-900/40 backdrop-blur-[2px] transition-opacity duration-200 ease-out-quint data-closed:opacity-0 data-leave:duration-150 dark:bg-black/60'/><div className='fixed inset-0 z-10 w-screen overflow-y-auto'>@@ -103,8 +103,8 @@ const Modal = ({<DialogPaneltransitionclassName={cn(- 'inline-block w-full transform rounded-xl bg-white px-5 pt-5 pb-4 text-left align-bottom shadow-2xl ring-1 ring-gray-200/80 transition-all sm:my-8 sm:align-middle dark:bg-slate-950 dark:ring-slate-700/60',- 'duration-200 data-closed:translate-y-2 data-closed:scale-[0.98] data-closed:opacity-0 data-enter:ease-out data-leave:ease-in',+ 'inline-block w-full transform rounded-xl bg-white px-5 pt-5 pb-4 text-left align-bottom shadow-2xl ring-1 ring-gray-200/80 transition-[opacity,transform] sm:my-8 sm:align-middle dark:bg-slate-950 dark:ring-slate-700/60',+ 'origin-center duration-200 ease-out-quint data-closed:scale-[0.97] data-closed:opacity-0 data-leave:duration-150',{'sm:max-w-lg': size === 'regular','sm:max-w-2xl': size === 'medium',diff --git a/web/app/ui/Select.tsx b/web/app/ui/Select.tsxindex d084a398a..693155c5b 100644--- a/web/app/ui/Select.tsx+++ b/web/app/ui/Select.tsx@@ -1,6 +1,5 @@import {Listbox,- Transition,Label,ListboxButton,ListboxOptions,@@ -9,7 +8,7 @@ import {import { CheckIcon, CaretUpDownIcon } from '@phosphor-icons/react'import cx from 'clsx'import _map from 'lodash/map'-import React, { Fragment, Key, memo } from 'react'+import React, { Key, memo } from 'react'import { Text } from './Text'interface SelectProps<T> {@@ -82,7 +81,7 @@ function Select<T>({onChange={onSelect}disabled={disabled}>- {({ open }) => (+ {() => (<>{label ? (<Label className={cx('block', fieldLabelClassName)}>@@ -115,7 +114,7 @@ function Select<T>({<ListboxButtonaria-describedby={hintId}className={cx(- 'relative w-full rounded-md border-0 bg-white py-2 pr-9 pl-3 text-left text-sm font-medium text-gray-900 ring-1 ring-gray-300 transition-[background-color,box-shadow] duration-150 ease-out ring-inset hover:ring-gray-400 focus-visible:ring-2 focus-visible:ring-slate-900 focus-visible:outline-hidden dark:bg-slate-950 dark:text-gray-50 dark:ring-slate-700/80 dark:hover:ring-slate-600 dark:focus-visible:ring-slate-300',+ 'relative w-full rounded-md border-0 bg-white py-2 pr-9 pl-3 text-left text-sm font-medium text-gray-900 ring-1 ring-gray-300 transition-[background-color,box-shadow,transform] duration-150 ease-out-quint ring-inset hover:ring-gray-400 focus-visible:ring-2 focus-visible:ring-slate-900 focus-visible:outline-hidden active:scale-[0.99] dark:bg-slate-950 dark:text-gray-50 dark:ring-slate-700/80 dark:hover:ring-slate-600 dark:focus-visible:ring-slate-300',disabled &&'cursor-not-allowed opacity-60 hover:ring-gray-300 dark:hover:ring-slate-700/80',buttonClassName,@@ -155,114 +154,103 @@ function Select<T>({</span></ListboxButton>- <Transition- show={open}- as={Fragment}- enter='transition-[opacity,transform] ease-out duration-150'- enterFrom='opacity-0 scale-[0.98] -translate-y-0.5'- enterTo='opacity-100 scale-100 translate-y-0'- leave='transition-[opacity,transform] ease-out duration-100'- leaveFrom='opacity-100 scale-100 translate-y-0'- leaveTo='opacity-0 scale-[0.98] -translate-y-0.5'+ <ListboxOptions+ modal={false}+ transition+ className='absolute z-30 mt-1.5 max-h-72 w-full origin-top-left overflow-auto rounded-lg bg-white py-1 text-sm shadow-lg ring-1 ring-gray-200/80 transition-[opacity,transform] duration-150 ease-out-quint focus:outline-hidden data-closed:scale-95 data-closed:opacity-0 data-leave:duration-100 dark:bg-slate-950 dark:ring-slate-700/60'>- <ListboxOptions- static- modal={false}- className='absolute z-30 mt-1.5 max-h-72 w-full overflow-auto rounded-lg bg-white py-1 text-sm shadow-lg ring-1 ring-gray-200/80 focus:outline-hidden dark:bg-slate-950 dark:ring-slate-700/60'- >- {_map(items, (item, index) => {- const selected = isItemSelected(item)- const disabled = disabledItemExtractor?.(item, index) || false- const itemDescription = descriptionExtractor- ? descriptionExtractor(item, index)- : null- return (- <ListboxOption- key={- keyExtractor ? keyExtractor(item, index) : (item as Key)- }- className={({ focus }) =>- cx(- 'relative mx-1 cursor-pointer rounded-md pr-8 pl-3 transition-colors duration-100 ease-out select-none',- hasDescriptions ? 'py-2.5' : 'py-2',+ {_map(items, (item, index) => {+ const selected = isItemSelected(item)+ const disabled = disabledItemExtractor?.(item, index) || false+ const itemDescription = descriptionExtractor+ ? descriptionExtractor(item, index)+ : null+ return (+ <ListboxOption+ key={+ keyExtractor ? keyExtractor(item, index) : (item as Key)+ }+ className={({ focus }) =>+ cx(+ 'relative mx-1 cursor-pointer rounded-md pr-8 pl-3 transition-colors duration-100 ease-out select-none',+ hasDescriptions ? 'py-2.5' : 'py-2',+ {+ 'cursor-not-allowed text-gray-400 dark:text-slate-600':+ disabled && !selected,+ 'bg-gray-100 dark:bg-slate-900': focus || selected,+ 'text-gray-700 dark:text-gray-50':+ !focus && !selected && !disabled,+ 'text-gray-900 dark:text-white': focus || selected,+ },+ )+ }+ disabled={disabled}+ value={item}+ >+ <>+ {iconExtractor ? (+ <span+ className={cx(+ 'absolute left-2 flex items-center',+ hasDescriptions ? 'top-2.5' : 'inset-y-0',+ )}+ >+ {iconExtractor(item, index)}+ </span>+ ) : null}++ <Text+ as='span'+ size='sm'+ weight={selected ? 'semibold' : 'normal'}+ colour='inherit'+ className={cx(+ 'block wrap-break-word',+ iconExtractor && 'pl-6',{- 'cursor-not-allowed text-gray-400 dark:text-slate-600':- disabled && !selected,- 'bg-gray-100 dark:bg-slate-900': focus || selected,- 'text-gray-700 dark:text-gray-50':- !focus && !selected && !disabled,- 'text-gray-900 dark:text-white': focus || selected,+ 'first-letter:capitalize': capitalise,},- )- }- disabled={disabled}- value={item}- >- <>- {iconExtractor ? (- <span- className={cx(- 'absolute left-2 flex items-center',- hasDescriptions ? 'top-2.5' : 'inset-y-0',- )}- >- {iconExtractor(item, index)}- </span>- ) : null}+ labelClassName,+ )}+ >+ {labelExtractor+ ? labelExtractor(item, index)+ : (item as React.ReactNode)}+ </Text>+ {itemDescription ? (<Textas='span'- size='sm'- weight={selected ? 'semibold' : 'normal'}- colour='inherit'+ size='xs'+ colour='secondary'className={cx(- 'block wrap-break-word',+ 'mt-0.5 block leading-snug wrap-break-word',iconExtractor && 'pl-6',- {- 'first-letter:capitalize': capitalise,- },- labelClassName,)}>- {labelExtractor- ? labelExtractor(item, index)- : (item as React.ReactNode)}+ {itemDescription}</Text>+ ) : null}- {itemDescription ? (- <Text- as='span'- size='xs'- colour='secondary'- className={cx(- 'mt-0.5 block leading-snug wrap-break-word',- iconExtractor && 'pl-6',- )}- >- {itemDescription}- </Text>- ) : null}-- {selected ? (- <span- className={cx(- 'absolute right-2 flex items-center text-slate-900 dark:text-slate-100',- hasDescriptions ? 'top-2.5' : 'inset-y-0',- )}- >- <CheckIcon- weight='bold'- className='size-4'- aria-hidden='true'- />- </span>- ) : null}- </>- </ListboxOption>- )- })}- </ListboxOptions>- </Transition>+ {selected ? (+ <span+ className={cx(+ 'absolute right-2 flex items-center text-slate-900 dark:text-slate-100',+ hasDescriptions ? 'top-2.5' : 'inset-y-0',+ )}+ >+ <CheckIcon+ weight='bold'+ className='size-4'+ aria-hidden='true'+ />+ </span>+ ) : null}+ </>+ </ListboxOption>+ )+ })}+ </ListboxOptions></div></>)}diff --git a/web/app/ui/Tooltip.tsx b/web/app/ui/Tooltip.tsxindex ff476353a..81d26ac88 100644--- a/web/app/ui/Tooltip.tsx+++ b/web/app/ui/Tooltip.tsx@@ -1,6 +1,6 @@import * as TooltipPrimitive from '@radix-ui/react-tooltip'import { QuestionIcon } from '@phosphor-icons/react'-import React, { forwardRef, memo } from 'react'+import React, { forwardRef, memo, useState } from 'react'import { useTranslation } from 'react-i18next'import { cn } from '~/utils/generic'@@ -11,6 +11,23 @@ const TooltipRoot = TooltipPrimitive.Rootconst TooltipTrigger = TooltipPrimitive.Trigger+/**+ * Skip-delay grace period shared across ALL tooltip instances (each renders+ * its own Radix provider, so Radix's built-in skipDelayDuration can't help).+ * While any tooltip is open β or was open within the last 300ms β hovering+ * another tooltip shows it instantly: no open delay and (via the+ * `data-state='instant-open'` CSS) no entry animation.+ */+const SKIP_DELAY_WINDOW_MS = 300+let lastTooltipActivityAt = 0++const markTooltipActivity = () => {+ lastTooltipActivityAt = Date.now()+}++const isWithinSkipDelayWindow = () =>+ Date.now() - lastTooltipActivityAt < SKIP_DELAY_WINDOW_MS+type TooltipContentVariant = 'default' | 'chart'const TOOLTIP_CONTENT_VARIANT_CLASSES: Record<TooltipContentVariant, string> = {@@ -112,22 +129,25 @@ const Tooltip = ({contentClassName,arrowClassName,contentVariant = 'default',- delay = 50,+ delay = 300,disableHoverableContent,}: TooltipProps) => {const { t } = useTranslation()const triggerAriaLabel = ariaLabel || t('common.learnMore')+ // Decided on pointer enter, before Radix starts its open timer+ const [instant, setInstant] = useState(false)return (<TooltipProvider- delayDuration={delay}+ delayDuration={instant ? 0 : delay}disableHoverableContent={disableHoverableContent}>- <TooltipRoot>+ <TooltipRoot onOpenChange={markTooltipActivity}><TooltipTriggerasChild={asChild}className={className}aria-label={triggerAriaLabel}+ onPointerEnter={() => setInstant(isWithinSkipDelayWindow())}>{tooltipNode || (<QuestionIcon className='size-4 cursor-help fill-slate-700 stroke-gray-50 dark:fill-slate-200 dark:stroke-slate-800' />diff --git a/web/public/locales/en.json b/web/public/locales/en.jsonindex 695350aa6..fba61409f 100644--- a/web/public/locales/en.json+++ b/web/public/locales/en.json@@ -86,6 +86,8 @@"save": "Save","continue": "Continue","confirm": "Confirm",+ "holdToDelete": "Hold to delete",+ "holdToReset": "Hold to reset","amount": "Amount","date": "Date","success": "Success",