The big CSS refactor

Still doesn't fix the stupid height issue‼️‼️💥
This commit is contained in:
CenTdemeern1 2024-10-20 21:24:43 +02:00
parent 3887be6abb
commit be42a2b008

View file

@ -4,51 +4,51 @@ SPDX-License-Identifier: AGPL-3.0-only
--> -->
<template> <template>
<div v-if="hide" class="flash-player-disabled height-hack" @click="toggleVisible()"> <div v-if="hide" :class="[$style.flash_player_disabled, $style.height_hack]" @click="toggleVisible()">
<div> <div>
<b><i class="ph-eye ph-bold ph-lg"></i> {{ i18n.ts.sensitive }}</b> <b><i class="ph-eye ph-bold ph-lg"></i> {{ i18n.ts.sensitive }}</b>
<span>{{ i18n.ts.clickToShow }}</span> <span>{{ i18n.ts.clickToShow }}</span>
</div> </div>
</div> </div>
<div v-else class="flash-player-enabled height-hack"> <div v-else :class="[$style.flash_player_enabled, $style.height_hack]">
<div class="flash-display"> <div :class="$style.flash_display">
<div v-if="playerHide" class="player-hide" @click="dismissWarning()"> <div v-if="playerHide" :class="$style.player_hide" @click="dismissWarning()">
<b><i class="ph-eye ph-bold ph-lg"></i> Flash Content Hidden</b> <b><i class="ph-eye ph-bold ph-lg"></i> Flash Content Hidden</b>
<span>Powered by Ruffle.</span> <span>Powered by Ruffle.</span>
<span>Always be wary of arbitrary code execution!</span> <span>Always be wary of arbitrary code execution!</span>
<span>{{ i18n.ts.clickToShow }}</span> <span>{{ i18n.ts.clickToShow }}</span>
</div> </div>
<div v-if="ruffleError" class="player-hide"> <div v-if="ruffleError" :class="$style.player_hide">
<b><i class="ph-warning ph-bold ph-lg"></i> Flash Content Failed To Load:</b> <b><i class="ph-warning ph-bold ph-lg"></i> Flash Content Failed To Load:</b>
<code>{{ ruffleError }}</code> <code>{{ ruffleError }}</code>
</div> </div>
<div v-else-if="loadingStatus" class="player-hide"> <div v-else-if="loadingStatus" :class="$style.player_hide">
<b>Flash Content Is Loading<MkEllipsis/></b> <b>Flash Content Is Loading<MkEllipsis/></b>
<MkLoading/> <MkLoading/>
<p>{{ loadingStatus }}</p> <p>{{ loadingStatus }}</p>
</div> </div>
<div ref="ruffleContainer" class="container"></div> <div ref="ruffleContainer" :class="$style.container"></div>
</div> </div>
<div class="controls"> <div :class="$style.controls">
<button :key="playPauseButtonKey" class="play" @click="playPause()"> <button :key="playPauseButtonKey" @click="playPause()">
<i v-if="player?.isPlaying" class="ph-pause ph-bold ph-lg"></i> <i v-if="player?.isPlaying" class="ph-pause ph-bold ph-lg"></i>
<i v-else class="ph-play ph-bold ph-lg"></i> <i v-else class="ph-play ph-bold ph-lg"></i>
</button> </button>
<button class="stop" :disabled="playerHide" @click="stop()"> <button :disabled="playerHide" @click="stop()">
<i class="ph-stop ph-bold ph-lg"></i> <i class="ph-stop ph-bold ph-lg"></i>
</button> </button>
<input v-if="player && !playerHide" v-model="player.volume" type="range" min="0" max="1" step="0.1"/> <input v-if="player && !playerHide" v-model="player.volume" type="range" min="0" max="1" step="0.1"/>
<input v-else type="range" min="0" max="1" value="1" disabled/> <input v-else type="range" min="0" max="1" value="1" disabled/>
<a class="download" :title="i18n.ts.download" :href="flashFile.url" target="_blank"> <a :title="i18n.ts.download" :href="flashFile.url" target="_blank">
<i class="ph-download ph-bold ph-lg"></i> <i class="ph-download ph-bold ph-lg"></i>
</a> </a>
<button class="fullscreen" :disabled="playerHide" @click="fullscreen()"> <button :class="$style.fullscreen" :disabled="playerHide" @click="fullscreen()">
<i class="ph-arrows-out ph-bold ph-lg"></i> <i class="ph-arrows-out ph-bold ph-lg"></i>
</button> </button>
</div> </div>
<div v-if="comment" class="alt" :title="comment">ALT</div> <div v-if="comment" :class="$style.alt" :title="comment">ALT</div>
<i class="hide ph-eye-slash ph-bold ph-lg" @click="toggleVisible()"></i> <i :class="$style.hide" class="ph-eye-slash ph-bold ph-lg" @click="toggleVisible()"></i>
</div> </div>
</template> </template>
@ -228,7 +228,7 @@ onDeactivated(() => {
</script> </script>
<style lang="scss" scoped> <style lang="scss" module>
.hide { .hide {
border-radius: var(--radius-sm) !important; border-radius: var(--radius-sm) !important;
@ -237,10 +237,11 @@ onDeactivated(() => {
font-size: 12px !important; font-size: 12px !important;
} }
.height-hack { .height_hack {
/* HACK: I'm too stupid to do this better apparently. Copy-pasted from MkMediaList.vue */ /* HACK: I'm too stupid to do this better apparently. Copy-pasted from MkMediaList.vue */
/* height: 100% doesn't work */ /* height: 100% doesn't work */
/* FIXME: This breaks with more than one attachment, and the controls start overlapping the note buttons (like, boost, reply, etc) */ /* FIXME: This breaks with more than one attachment, and the controls start overlapping the note buttons (like, boost, reply, etc) */
/* height: 100%; DOESN'T WORK AAAAAA */
height: clamp( height: clamp(
64px, 64px,
50cqh, 50cqh,
@ -248,7 +249,7 @@ onDeactivated(() => {
); );
} }
.flash-player-enabled { .flash_player_enabled {
position: relative; position: relative;
overflow: hidden; overflow: hidden;
display: flex; display: flex;
@ -287,9 +288,10 @@ onDeactivated(() => {
z-index: 4; z-index: 4;
} }
> .flash-display { > .flash_display {
width: 100%; width: 100%;
height: 100%; height: 100%;
flex-grow: 10;
overflow-x: scroll; overflow-x: scroll;
overflow-y: hidden; overflow-y: hidden;
background-color: black; background-color: black;
@ -301,7 +303,7 @@ onDeactivated(() => {
display: none; display: none;
} }
.player-hide { .player_hide {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: center; justify-content: center;
@ -310,6 +312,7 @@ onDeactivated(() => {
backdrop-filter: var(--modalBgFilter); backdrop-filter: var(--modalBgFilter);
color: #fff; color: #fff;
font-size: 12px; font-size: 12px;
border-radius: var(--radius-sm);
position: absolute; position: absolute;
z-index: 4; z-index: 4;
@ -466,7 +469,7 @@ onDeactivated(() => {
} }
} }
.flash-player-disabled { .flash_player_disabled {
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;