diff --git a/src/components/UserAggregationList/index.tsx b/src/components/UserAggregationList/index.tsx index 69ef209..5b7a04a 100644 --- a/src/components/UserAggregationList/index.tsx +++ b/src/components/UserAggregationList/index.tsx @@ -1,8 +1,8 @@ import { FormattedTimestamp } from '@/components/FormattedTimestamp' import { Button } from '@/components/ui/button' import { Skeleton } from '@/components/ui/skeleton' -import UserAvatar from '@/components/UserAvatar' -import Username from '@/components/Username' +import UserAvatar, { SimpleUserAvatar } from '@/components/UserAvatar' +import Username, { SimpleUsername } from '@/components/Username' import { isMentioningMutedUsers } from '@/lib/event' import { toNote, toUserAggregationDetail } from '@/lib/link' import { cn, isTouchDevice } from '@/lib/utils' @@ -371,6 +371,7 @@ function UserAggregationItem({ onClick: () => void }) { const { t } = useTranslation() + const supportTouch = useMemo(() => isTouchDevice(), []) const [hasNewEvents, setHasNewEvents] = useState(true) const [isPinned, setIsPinned] = useState(userAggregationService.isPinned(aggregation.pubkey)) @@ -418,14 +419,26 @@ function UserAggregationItem({ className="group relative flex items-center gap-4 px-4 py-3 border-b hover:bg-accent/30 cursor-pointer transition-all duration-200" onClick={onClick} > - + {supportTouch ? ( + + ) : ( + + )}
- + {supportTouch ? ( + + ) : ( + + )} isTouchDevice(), []) + + const trigger = ( + e.stopPropagation()}> + + + ) + + if (supportTouch) { + return trigger + } + return ( - - e.stopPropagation()}> - - - + {trigger} diff --git a/src/components/Username/index.tsx b/src/components/Username/index.tsx index 57161e2..5216372 100644 --- a/src/components/Username/index.tsx +++ b/src/components/Username/index.tsx @@ -2,10 +2,11 @@ import { HoverCard, HoverCardContent, HoverCardTrigger } from '@/components/ui/h import { Skeleton } from '@/components/ui/skeleton' import { useFetchProfile } from '@/hooks' import { toProfile } from '@/lib/link' -import { cn } from '@/lib/utils' +import { cn, isTouchDevice } from '@/lib/utils' import { SecondaryPageLink } from '@/PageManager' import ProfileCard from '../ProfileCard' import TextWithEmojis from '../TextWithEmojis' +import { useMemo } from 'react' export default function Username({ userId, @@ -21,6 +22,7 @@ export default function Username({ withoutSkeleton?: boolean }) { const { profile, isFetching } = useFetchProfile(userId) + const supportTouch = useMemo(() => isTouchDevice(), []) if (!profile && isFetching && !withoutSkeleton) { return (
@@ -30,20 +32,26 @@ export default function Username({ } if (!profile) return null + const trigger = ( +
+ e.stopPropagation()} + > + {showAt && '@'} + + +
+ ) + + if (supportTouch) { + return trigger + } + return ( - -
- e.stopPropagation()} - > - {showAt && '@'} - - -
-
+ {trigger}