remove legacy components from countwheel etc

This commit is contained in:
Samuel Newman
2026-03-19 11:13:21 +02:00
parent 9b311aa68a
commit 9a367db98d
4 changed files with 18 additions and 22 deletions
+3 -4
View File
@@ -8,10 +8,9 @@ import Animated, {
} from 'react-native-reanimated' } from 'react-native-reanimated'
import {decideShouldRoll} from '#/lib/custom-animations/util' import {decideShouldRoll} from '#/lib/custom-animations/util'
import {s} from '#/lib/styles'
import {Text} from '#/view/com/util/text/Text'
import {atoms as a, useTheme} from '#/alf' import {atoms as a, useTheme} from '#/alf'
import {useFormatPostStatCount} from '#/components/PostControls/util' import {useFormatPostStatCount} from '#/components/PostControls/util'
import {Text} from '#/components/Typography'
const animationConfig = { const animationConfig = {
duration: 400, duration: 400,
@@ -147,7 +146,7 @@ export function CountWheel({
big ? a.text_md : a.text_sm, big ? a.text_md : a.text_sm,
a.user_select_none, a.user_select_none,
isLiked isLiked
? [a.font_semi_bold, s.likeColor] ? [a.font_semi_bold, {color: t.palette.pink}]
: {color: t.palette.contrast_500}, : {color: t.palette.contrast_500},
]}> ]}>
{formattedCount} {formattedCount}
@@ -165,7 +164,7 @@ export function CountWheel({
big ? a.text_md : a.text_sm, big ? a.text_md : a.text_sm,
a.user_select_none, a.user_select_none,
isLiked isLiked
? [a.font_semi_bold, s.likeColor] ? [a.font_semi_bold, {color: t.palette.pink}]
: {color: t.palette.contrast_500}, : {color: t.palette.contrast_500},
]}> ]}>
{formattedPrevCount} {formattedPrevCount}
+11 -12
View File
@@ -3,10 +3,9 @@ import {View} from 'react-native'
import {useReducedMotion} from 'react-native-reanimated' import {useReducedMotion} from 'react-native-reanimated'
import {decideShouldRoll} from '#/lib/custom-animations/util' import {decideShouldRoll} from '#/lib/custom-animations/util'
import {s} from '#/lib/styles'
import {Text} from '#/view/com/util/text/Text'
import {atoms as a, useTheme} from '#/alf' import {atoms as a, useTheme} from '#/alf'
import {useFormatPostStatCount} from '#/components/PostControls/util' import {useFormatPostStatCount} from '#/components/PostControls/util'
import {Text} from '#/components/Typography'
const animationConfig = { const animationConfig = {
duration: 400, duration: 400,
@@ -49,8 +48,8 @@ export function CountWheel({
const shouldAnimate = !useReducedMotion() && hasBeenToggled const shouldAnimate = !useReducedMotion() && hasBeenToggled
const shouldRoll = decideShouldRoll(isLiked, likeCount) const shouldRoll = decideShouldRoll(isLiked, likeCount)
const countView = useRef<HTMLDivElement>(null) const countView = useRef<View>(null)
const prevCountView = useRef<HTMLDivElement>(null) const prevCountView = useRef<View>(null)
const [prevCount, setPrevCount] = useState(likeCount) const [prevCount, setPrevCount] = useState(likeCount)
const prevIsLiked = useRef(isLiked) const prevIsLiked = useRef(isLiked)
@@ -59,17 +58,20 @@ export function CountWheel({
const formattedPrevCount = formatPostStatCount(prevCount) const formattedPrevCount = formatPostStatCount(prevCount)
useEffect(() => { useEffect(() => {
const countViewRef = countView.current as HTMLDivElement | null
const prevCountViewRef = prevCountView.current as HTMLDivElement | null
if (isLiked === prevIsLiked.current) { if (isLiked === prevIsLiked.current) {
return return
} }
const newPrevCount = isLiked ? likeCount - 1 : likeCount + 1 const newPrevCount = isLiked ? likeCount - 1 : likeCount + 1
if (shouldAnimate && shouldRoll) { if (shouldAnimate && shouldRoll) {
countView.current?.animate?.( countViewRef?.animate?.(
isLiked ? enteringUpKeyframe : enteringDownKeyframe, isLiked ? enteringUpKeyframe : enteringDownKeyframe,
animationConfig, animationConfig,
) )
prevCountView.current?.animate?.( prevCountViewRef?.animate?.(
isLiked ? exitingUpKeyframe : exitingDownKeyframe, isLiked ? exitingUpKeyframe : exitingDownKeyframe,
animationConfig, animationConfig,
) )
@@ -84,16 +86,14 @@ export function CountWheel({
return ( return (
<View> <View>
<View <View ref={countView}>
// @ts-expect-error is div
ref={countView}>
<Text <Text
testID="likeCount" testID="likeCount"
style={[ style={[
big ? a.text_md : a.text_sm, big ? a.text_md : a.text_sm,
a.user_select_none, a.user_select_none,
isLiked isLiked
? [a.font_semi_bold, s.likeColor] ? [a.font_semi_bold, {color: t.palette.pink}]
: {color: t.palette.contrast_500}, : {color: t.palette.contrast_500},
]}> ]}>
{formattedCount} {formattedCount}
@@ -103,14 +103,13 @@ export function CountWheel({
<View <View
style={{position: 'absolute', opacity: 0}} style={{position: 'absolute', opacity: 0}}
aria-disabled={true} aria-disabled={true}
// @ts-expect-error is div
ref={prevCountView}> ref={prevCountView}>
<Text <Text
style={[ style={[
big ? a.text_md : a.text_sm, big ? a.text_md : a.text_sm,
a.user_select_none, a.user_select_none,
isLiked isLiked
? [a.font_semi_bold, s.likeColor] ? [a.font_semi_bold, {color: t.palette.pink}]
: {color: t.palette.contrast_500}, : {color: t.palette.contrast_500},
]}> ]}>
{formattedPrevCount} {formattedPrevCount}
+2 -3
View File
@@ -5,7 +5,6 @@ import Animated, {
useReducedMotion, useReducedMotion,
} from 'react-native-reanimated' } from 'react-native-reanimated'
import {s} from '#/lib/styles'
import {useTheme} from '#/alf' import {useTheme} from '#/alf'
import { import {
Heart2_Filled_Stroke2_Corner0_Rounded as HeartIconFilled, Heart2_Filled_Stroke2_Corner0_Rounded as HeartIconFilled,
@@ -86,7 +85,7 @@ export function AnimatedLikeIcon({
{isLiked ? ( {isLiked ? (
<Animated.View <Animated.View
entering={shouldAnimate ? keyframe.duration(300) : undefined}> entering={shouldAnimate ? keyframe.duration(300) : undefined}>
<HeartIconFilled style={s.likeColor} width={size} /> <HeartIconFilled fill={t.palette.pink} width={size} />
</Animated.View> </Animated.View>
) : ( ) : (
<HeartIconOutline <HeartIconOutline
@@ -100,7 +99,7 @@ export function AnimatedLikeIcon({
entering={circle1Keyframe.duration(300)} entering={circle1Keyframe.duration(300)}
style={{ style={{
position: 'absolute', position: 'absolute',
backgroundColor: s.likeColor.color, backgroundColor: t.palette.pink,
top: 0, top: 0,
left: 0, left: 0,
width: size, width: size,
+2 -3
View File
@@ -2,7 +2,6 @@ import {useEffect, useRef} from 'react'
import {View} from 'react-native' import {View} from 'react-native'
import {useReducedMotion} from 'react-native-reanimated' import {useReducedMotion} from 'react-native-reanimated'
import {s} from '#/lib/styles'
import {useTheme} from '#/alf' import {useTheme} from '#/alf'
import { import {
Heart2_Filled_Stroke2_Corner0_Rounded as HeartIconFilled, Heart2_Filled_Stroke2_Corner0_Rounded as HeartIconFilled,
@@ -74,7 +73,7 @@ export function AnimatedLikeIcon({
{isLiked ? ( {isLiked ? (
// @ts-expect-error is div // @ts-expect-error is div
<View ref={likeIconRef}> <View ref={likeIconRef}>
<HeartIconFilled style={s.likeColor} width={size} /> <HeartIconFilled fill={t.palette.pink} width={size} />
</View> </View>
) : ( ) : (
<HeartIconOutline <HeartIconOutline
@@ -87,7 +86,7 @@ export function AnimatedLikeIcon({
ref={circle1Ref} ref={circle1Ref}
style={{ style={{
position: 'absolute', position: 'absolute',
backgroundColor: s.likeColor.color, backgroundColor: t.palette.pink,
top: 0, top: 0,
left: 0, left: 0,
width: size, width: size,