Skip to content

Instantly share code, notes, and snippets.

@gre
Created Jun 30, 2018
Embed
What would you like to do?
class Finish extends r.Component {
constructor(...e) {
var t
return (
(t = super(...e)),
Object.defineProperty(this, 'state', {
configurable: !0,
enumerable: !0,
writable: !0,
value: { emit: !1 },
}),
Object.defineProperty(this, 'onMouseUp', {
configurable: !0,
enumerable: !0,
writable: !0,
value: () => this.setState({ emit: !1 }),
}),
Object.defineProperty(this, 'onMouseDown', {
configurable: !0,
enumerable: !0,
writable: !0,
value: () => {
this.setState({ emit: !0 })
},
}),
Object.defineProperty(this, 'onMouseLeave', {
configurable: !0,
enumerable: !0,
writable: !0,
value: () => {
this.setState({ emit: !1 })
},
}),
t
)
}
render() {
const { finish: e, t: t, onboarding: n } = this.props,
{ emit: a } = this.state
return o.a.createElement(
h.c,
{ sticky: !0, justifyContent: 'center' },
o.a.createElement(g.a, {
category: 'Onboarding',
name: 'Finish',
flowType: n.flowType,
deviceType: n.isLedgerNano ? 'Nano S' : 'Blue',
}),
o.a.createElement(
gt,
null,
o.a.createElement(
class extends r.PureComponent {
constructor(...e) {
var t
return (
(t = super(...e)),
Object.defineProperty(this, 'state', {
configurable: !0,
enumerable: !0,
writable: !0,
value: {
confettis: Array(100)
.fill(null)
.map(lt),
},
}),
Object.defineProperty(this, 'interval', {
configurable: !0,
enumerable: !0,
writable: !0,
value: void 0,
}),
Object.defineProperty(this, 'initialInterval', {
configurable: !0,
enumerable: !0,
writable: !0,
value: void 0,
}),
Object.defineProperty(this, 'initialTimeout', {
configurable: !0,
enumerable: !0,
writable: !0,
value: void 0,
}),
t
)
}
componentDidMount() {
this.setEmit(this.props.emit),
(this.initialTimeout = setTimeout(() => {
clearInterval(this.initialInterval)
}, 1e4)),
(this.initialInterval = setInterval(() => {
this.setState(({ confettis: e }) => ({
confettis: e.slice(e.length > 200 ? 1 : 0).concat(lt()),
}))
}, 100))
}
componentDidUpdate(e) {
this.props.emit !== e.emit && this.setEmit(this.props.emit)
}
componentWillUnmount() {
this.setEmit(!1),
clearInterval(this.initialInterval),
clearTimeout(this.initialTimeout)
}
setEmit(e) {
e
? (this.interval = setInterval(() => {
this.setState(({ confettis: e }) => ({
confettis: e.slice(e.length > 200 ? 1 : 0).concat(lt('emit')),
}))
}, 40))
: clearInterval(this.interval)
}
render() {
const { confettis: e } = this.state
return o.a.createElement(
'div',
{ style: { position: 'relative', width: '100%', height: '100%' } },
e.map(e =>
o.a.createElement(
class extends r.PureComponent {
constructor(...e) {
var t
return (
(t = super(...e)),
Object.defineProperty(this, 'state', {
configurable: !0,
enumerable: !0,
writable: !0,
value: { progress: new rt.a.Value(0) },
}),
t
)
}
componentDidMount() {
const { duration: e } = this.props
rt.a
.timing(this.state.progress, {
toValue: 1,
duration: e,
easing: at,
})
.start()
}
render() {
const {
initialXPercent: e,
initialYPercent: t,
initialScale: n,
initialRotation: r,
shape: a,
rotations: i,
delta: c,
} = this.props,
{ progress: s } = this.state,
l = s.interpolate({
inputRange: [0, 1],
outputRange: ['0deg', `${360 * i}deg`],
}),
u = s.interpolate({ inputRange: [0, 1], outputRange: [0, c[0]] }),
f = s.interpolate({ inputRange: [0, 1], outputRange: [0, c[1]] }),
p = s.interpolate({
inputRange: [0.6, 1],
outputRange: [1, 0],
clamp: !0,
})
return o.a.createElement(rt.a.img, {
src: a,
style: {
position: 'absolute',
left: `${(100 * e).toFixed(0)}%`,
top: `${(100 * t).toFixed(0)}%`,
opacity: p,
transformOrigin: 'center center',
transform: [
{ translateX: u },
{ translateY: f },
{ scale: n },
{ rotate: `${r}deg` },
{ rotate: l },
],
},
})
}
},
it({ key: e.id }, e),
),
),
)
}
},
{ emit: a },
),
),
o.a.createElement(
h.c,
{ alignItems: 'center' },
o.a.createElement(
h.c,
{
style: { position: 'relative' },
onMouseDown: this.onMouseDown,
onMouseUp: this.onMouseUp,
onMouseLeave: this.onMouseLeave,
},
o.a.createElement(C, {
style: { width: 64, height: 64 },
icon: o.a.createElement('img', {
draggable: 'false',
alt: '',
src: Object(m.c)('ledgerlive-logo.svg'),
width: 40,
height: 40,
}),
}),
o.a.createElement(
h.c,
{
color: 'positiveGreen',
style: { position: 'absolute', right: 0, bottom: 0 },
},
o.a.createElement(ut.a, { size: 18 }),
),
),
o.a.createElement(
h.c,
{ pt: 5, align: 'center' },
o.a.createElement(E, null, t('onboarding:finish.title')),
o.a.createElement(S, null, t('onboarding:finish.desc')),
),
o.a.createElement(
h.c,
{ p: 5 },
o.a.createElement(
b.a,
{ primary: !0, padded: !0, onClick: () => e() },
t('onboarding:finish.openAppButton'),
),
),
o.a.createElement(
h.c,
{ horizontal: !0, mt: 3, flow: 5, color: 'grey' },
yt.map(e => o.a.createElement(vt, { key: e.key, socMed: e })),
),
),
)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment