<template>
	<div v-if="player.episode" class="footer">
		<img class="background" :src="player.episode.image">
		<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>
	.background {
		filter: blur(1rem) brightness(50%);
		height: auto;
		left: 0;
		opacity: .4;
		position: absolute;
		top: 0;
		width: 100%;
		z-index: -1;
	}

	.footer {
		background-color: var(--color-main-background);
		bottom: 0;
		height: 6rem;
		right: 0;
		position: absolute;
		width: 100%;
		z-index: 2000;
	}

	.player {
		display: flex;
		gap: 1rem;
		height: 6rem;
		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>
