<template>
	<div v-if="player.episode" class="footer">
		<Loading v-if="!player.loaded" />
		<ProgressBar v-if="player.loaded" />
		<div v-if="player.loaded" class="player">
			<img :src="player.episode.image">
			<Infos class="infos" />
			<Controls class="controls" />
			<Timer class="timer" />
			<Volume class="volume" />
		</div>
	</div>
</template>

<script>
import Controls from './Controls.vue'
import Infos from './Infos.vue'
import Loading from '../Atoms/Loading.vue'
import ProgressBar from './ProgressBar.vue'
import Timer from './Timer.vue'
import Volume from './Volume.vue'

export default {
	name: 'Bar',
	components: {
		Controls,
		Infos,
		Loading,
		ProgressBar,
		Timer,
		Volume,
	},
	computed: {
		player() {
			return this.$store.state.player
		},
	},
}
</script>

<style scoped>
	.footer {
		background-color: rgba(66, 66, 66, .9);
		bottom: 0;
		height: 6rem;
		right: 0;
		position: absolute;
		width: 100%;
		z-index: 2000;
	}

	.player {
		display: flex;
		gap: 1rem;
		height: calc(6rem - 6px);
		justify-content: space-between;
	}

	.timer {
		width: 30%;
	}

	.volume {
		width: 10%;
	}

	@media only screen and (max-width: 768px) {
		.infos {
			flex: 2;
		}

		.timer, .volume {
			display: none;
		}
	}
</style>
