Skip to content

Commit d740f24

Browse files
committed
fix: switch to lottie-react
This library is better maintained and is vastly more popular Funnily, this is the reverse of Sofie-Automation@34b59ba
1 parent 82fdd0c commit d740f24

File tree

5 files changed

+33
-33
lines changed

5 files changed

+33
-33
lines changed

packages/webui/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
"license-validate": "run -T sofie-licensecheck"
3131
},
3232
"dependencies": {
33-
"@crello/react-lottie": "0.0.9",
3433
"@fortawesome/fontawesome-free": "^7.1.0",
3534
"@fortawesome/fontawesome-svg-core": "^7.1.0",
3635
"@fortawesome/free-solid-svg-icons": "^7.1.0",
@@ -52,6 +51,7 @@
5251
"i18next-browser-languagedetector": "^8.2.0",
5352
"i18next-http-backend": "^3.0.2",
5453
"immutability-helper": "^3.1.1",
54+
"lottie-react": "^2.4.1",
5555
"moment": "^2.30.1",
5656
"motion": "^12.31.0",
5757
"promise.allsettled": "^1.0.7",

packages/webui/src/client/lib/LottieButton.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as React from 'react'
22

3-
import { Lottie } from '@crello/react-lottie'
3+
import Lottie, { LottieComponentProps } from 'lottie-react'
44

55
interface IProps {
66
inAnimation?: any
@@ -26,8 +26,8 @@ export class LottieButton extends React.Component<React.PropsWithChildren<IProps
2626
}
2727

2828
// Setup in `buildAnimationObjects`
29-
overAnimation!: { animationData: object } & object
30-
outAnimation!: { animationData: object } & object
29+
overAnimation!: LottieComponentProps
30+
outAnimation!: LottieComponentProps
3131

3232
constructor(props: IProps) {
3333
super(props)
@@ -77,7 +77,7 @@ export class LottieButton extends React.Component<React.PropsWithChildren<IProps
7777
onClick={this.onClick}
7878
tabIndex={0}
7979
>
80-
<Lottie config={this.state.hover ? this.overAnimation : this.outAnimation} />
80+
<Lottie {...(this.state.hover ? this.overAnimation : this.outAnimation)} />
8181
{this.props.children}
8282
<div
8383
style={{ position: 'absolute', top: '0', left: '0', right: '0', bottom: '0' }}

packages/webui/src/client/lib/ui/icons/looping.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React, { JSX } from 'react'
2-
import * as loopAnimation from './icon-loop.json'
3-
import { Lottie } from '@crello/react-lottie'
2+
import loopAnimation from './icon-loop.json'
3+
import Lottie, { LottieComponentProps } from 'lottie-react'
44

55
export function LoopingIcon(props?: Readonly<React.SVGProps<SVGSVGElement>>): JSX.Element {
66
return (
@@ -28,12 +28,12 @@ export function LoopingPieceIcon({
2828
}: Readonly<{ className?: string; playing: boolean }>): JSX.Element {
2929
return (
3030
<div className={`${className} label-icon label-loop-icon`}>
31-
<Lottie config={LOOPING_PIECE_ICON} width="24px" height="24px" playingState={playing ? 'playing' : 'stopped'} />
31+
<Lottie {...LOOPING_PIECE_ICON} width="24px" height="24px" autoplay={playing} />
3232
</div>
3333
)
3434
}
3535

36-
const LOOPING_PIECE_ICON = {
36+
const LOOPING_PIECE_ICON: LottieComponentProps = {
3737
loop: true,
3838
autoplay: false,
3939
animationData: loopAnimation,

packages/webui/src/client/ui/RundownView/RundownRightHandControls.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ import {
77
} from '@sofie-automation/corelib/dist/dataModel/Studio'
88
import { RewindAllSegmentsIcon } from '../../lib/ui/icons/rewindAllSegmentsIcon.js'
99

10-
import { Lottie } from '@crello/react-lottie'
10+
import Lottie, { LottieComponentProps } from 'lottie-react'
1111
import { NotificationCenterPanelToggle } from '../../lib/notifications/NotificationCenterPanel.js'
1212

13-
import * as On_Air_MouseOut from './On_Air_MouseOut.json'
14-
import * as On_Air_MouseOver from './On_Air_MouseOver.json'
13+
import On_Air_MouseOut from './On_Air_MouseOut.json'
14+
import On_Air_MouseOver from './On_Air_MouseOver.json'
1515
import { SupportPopUpToggle } from '../SupportPopUp.js'
1616
import classNames from 'classnames'
1717
import { NoticeLevel } from '../../lib/notifications/notifications.js'
@@ -54,7 +54,7 @@ interface IProps {
5454
hideRundownHeader?: boolean
5555
}
5656

57-
const ANIMATION_TEMPLATE = {
57+
const ANIMATION_TEMPLATE: LottieComponentProps = {
5858
loop: false,
5959
autoplay: true,
6060
animationData: {},
@@ -63,11 +63,11 @@ const ANIMATION_TEMPLATE = {
6363
},
6464
}
6565

66-
const ONAIR_OUT = {
66+
const ONAIR_OUT: LottieComponentProps = {
6767
...ANIMATION_TEMPLATE,
6868
animationData: On_Air_MouseOut,
6969
}
70-
const ONAIR_OVER = {
70+
const ONAIR_OVER: LottieComponentProps = {
7171
...ANIMATION_TEMPLATE,
7272
animationData: On_Air_MouseOver,
7373
}
@@ -195,7 +195,7 @@ export function RundownRightHandControls(props: Readonly<IProps>): JSX.Element {
195195
tabIndex={0}
196196
aria-label={t('Go to On Air Segment')}
197197
>
198-
{onAirHover ? <Lottie config={ONAIR_OVER} /> : <Lottie config={ONAIR_OUT} />}
198+
{onAirHover ? <Lottie {...ONAIR_OVER} /> : <Lottie {...ONAIR_OUT} />}
199199
</button>
200200
)}
201201
</div>

packages/yarn.lock

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2221,18 +2221,6 @@ __metadata:
22212221
languageName: node
22222222
linkType: hard
22232223

2224-
"@crello/react-lottie@npm:0.0.9":
2225-
version: 0.0.9
2226-
resolution: "@crello/react-lottie@npm:0.0.9"
2227-
dependencies:
2228-
lottie-web: "npm:5.5.9"
2229-
peerDependencies:
2230-
react: ~16.9.0
2231-
react-dom: ~16.9.0
2232-
checksum: 10/13e751a5995184f44bc01fee7ca70354164564e4c37e063d363bd262756cdd60f3032f2c4b6bbb91cd5f8ef5fb8e75cd60086a6d253ca0c2737651fc40a93cd6
2233-
languageName: node
2234-
linkType: hard
2235-
22362224
"@cspotcode/source-map-support@npm:^0.8.0":
22372225
version: 0.8.1
22382226
resolution: "@cspotcode/source-map-support@npm:0.8.1"
@@ -7272,7 +7260,6 @@ __metadata:
72727260
resolution: "@sofie-automation/webui@workspace:webui"
72737261
dependencies:
72747262
"@babel/preset-env": "npm:^7.29.0"
7275-
"@crello/react-lottie": "npm:0.0.9"
72767263
"@fortawesome/fontawesome-free": "npm:^7.1.0"
72777264
"@fortawesome/fontawesome-svg-core": "npm:^7.1.0"
72787265
"@fortawesome/free-solid-svg-icons": "npm:^7.1.0"
@@ -7312,6 +7299,7 @@ __metadata:
73127299
i18next-browser-languagedetector: "npm:^8.2.0"
73137300
i18next-http-backend: "npm:^3.0.2"
73147301
immutability-helper: "npm:^3.1.1"
7302+
lottie-react: "npm:^2.4.1"
73157303
moment: "npm:^2.30.1"
73167304
motion: "npm:^12.31.0"
73177305
promise.allsettled: "npm:^1.0.7"
@@ -19888,10 +19876,22 @@ asn1@evs-broadcast/node-asn1:
1988819876
languageName: node
1988919877
linkType: hard
1989019878

19891-
"lottie-web@npm:5.5.9":
19892-
version: 5.5.9
19893-
resolution: "lottie-web@npm:5.5.9"
19894-
checksum: 10/b7d05b58468fdf52a9f25581edc292d0ac47b0508d965c3debf2ee691d2a94593b61f096fe14eaefb8f09e0b869b158131aeea51541a3cff7e2dbfa5da996930
19879+
"lottie-react@npm:^2.4.1":
19880+
version: 2.4.1
19881+
resolution: "lottie-react@npm:2.4.1"
19882+
dependencies:
19883+
lottie-web: "npm:^5.10.2"
19884+
peerDependencies:
19885+
react: ^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0
19886+
react-dom: ^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0
19887+
checksum: 10/d1c54c3d90e322db988ea1dc92900a122e699e1d833368b8a817f4bd2ccc6d5600ab3cd0f34aa6e0bcbab28425f6de514b6d567e13164693cbde2c82af08fa06
19888+
languageName: node
19889+
linkType: hard
19890+
19891+
"lottie-web@npm:^5.10.2":
19892+
version: 5.13.0
19893+
resolution: "lottie-web@npm:5.13.0"
19894+
checksum: 10/ccc65b91ddc569c874de265252ef41cb546798515dd63c5ee366844efd1e10335c080c483ce4305faba0cebd54c4afd6bb918fd0d6f4394dcc284fc0c3944941
1989519895
languageName: node
1989619896
linkType: hard
1989719897

0 commit comments

Comments
 (0)