about summary refs log tree commit diff
path: root/app/javascript/mastodon/components/animated_number.js
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2020-01-26 20:07:26 +0100
committerGitHub <noreply@github.com>2020-01-26 20:07:26 +0100
commitb9d74d407673a6dbdc87c3310618b22c85358c85 (patch)
treeace3034da9a8d8973ccbbcf3532dee2f597a5364 /app/javascript/mastodon/components/animated_number.js
parent408b3e2b9328f54d471deba346a182f7c8856676 (diff)
Add streaming API updates for announcements being modified or deleted (#12963)
Change `all_day` to be a visual client-side cue only

Publish immediately if `scheduled_at` is in the past

Add `published_at` and `updated_at` to announcements JSON
Diffstat (limited to 'app/javascript/mastodon/components/animated_number.js')
-rw-r--r--app/javascript/mastodon/components/animated_number.js7
1 files changed, 4 insertions, 3 deletions
diff --git a/app/javascript/mastodon/components/animated_number.js b/app/javascript/mastodon/components/animated_number.js
index 2d359fbc6..3bfe86aa6 100644
--- a/app/javascript/mastodon/components/animated_number.js
+++ b/app/javascript/mastodon/components/animated_number.js
@@ -27,7 +27,8 @@ export default class AnimatedNumber extends React.PureComponent {
     }
 
     const styles = [{
-      key: value,
+      key: `${value}`,
+      data: value,
       style: { y: spring(0, { damping: 35, stiffness: 400 }) },
     }];
 
@@ -35,8 +36,8 @@ export default class AnimatedNumber extends React.PureComponent {
       <TransitionMotion styles={styles} willEnter={this.willEnter} willLeave={this.willLeave}>
         {items => (
           <span className='animated-number'>
-            {items.map(({ key, style }) => (
-              <span key={key} style={{ position: style.y > 0 ? 'absolute' : 'static', transform: `translateY(${style.y * 100}%)` }}><FormattedNumber value={key} /></span>
+            {items.map(({ key, data, style }) => (
+              <span key={key} style={{ position: style.y > 0 ? 'absolute' : 'static', transform: `translateY(${style.y * 100}%)` }}><FormattedNumber value={data} /></span>
             ))}
           </span>
         )}