monkeeShark/src/web/app/common/views/components/stream-indicator.vue

75 lines
1.4 KiB
Vue
Raw Normal View History

2018-02-07 06:16:01 +00:00
<template>
<div>
<p v-if=" stream.state == 'initializing' ">
%fa:spinner .pulse%
<span>%i18n:common.tags.mk-stream-indicator.connecting%<mk-ellipsis/></span>
</p>
<p v-if=" stream.state == 'reconnecting' ">
%fa:spinner .pulse%
<span>%i18n:common.tags.mk-stream-indicator.reconnecting%<mk-ellipsis/></span>
</p>
<p v-if=" stream.state == 'connected' ">
%fa:check%
<span>%i18n:common.tags.mk-stream-indicator.connected%</span>
</p>
</div>
</template>
2018-02-07 09:47:29 +00:00
<script lang="typescript">
2018-02-13 00:27:57 +00:00
import * as anime from 'animejs';
2018-02-07 06:16:01 +00:00
import Ellipsis from './ellipsis.vue';
export default {
props: ['stream'],
2018-02-08 05:25:49 +00:00
created() {
2018-02-07 06:16:01 +00:00
if (this.stream.state == 'connected') {
this.root.style.opacity = 0;
}
this.stream.on('_connected_', () => {
setTimeout(() => {
anime({
targets: this.root,
opacity: 0,
easing: 'linear',
duration: 200
});
}, 1000);
});
this.stream.on('_closed_', () => {
anime({
targets: this.root,
opacity: 1,
easing: 'linear',
duration: 100
});
});
}
};
</script>
2018-02-07 09:30:17 +00:00
<style lang="stylus" scoped>
2018-02-07 06:16:01 +00:00
> div
display block
pointer-events none
position fixed
z-index 16384
bottom 8px
right 8px
margin 0
padding 6px 12px
font-size 0.9em
color #fff
background rgba(0, 0, 0, 0.8)
border-radius 4px
> p
display block
margin 0
> [data-fa]
margin-right 0.25em
</style>