fix nav and folder banner text responsiveness

This commit is contained in:
geoffrey45
2022-08-11 15:14:40 +03:00
parent 992d3a7003
commit 83d4690cd4
8 changed files with 61 additions and 24 deletions
-1
View File
@@ -24,7 +24,6 @@ body {
#app {
width: 100%;
overflow: hidden;
margin: 0 auto;
}
}
+2 -2
View File
@@ -44,8 +44,8 @@ const tabs = useTabStore();
.r-content {
grid-area: content;
// width: 29rem;
width: 100%;
width: 29rem;
// width: 100%;
// @include tablet-landscape {
// display: none;
@@ -5,9 +5,9 @@
<ClearSvg />
<span>Clear</span>
</button>
<button class="shuffle-queue action">
<SaveAsPlaylistSvg />
<span> Save as Playlist </span>
<button class="shuffle-queue action" @click="queue.shuffleQueue">
<ShuffleSvg />
<span>Shuffle</span>
</button>
</div>
<div class="right">
@@ -22,7 +22,7 @@
import useQueueStore from "../../../stores/queue";
import ClearSvg from "@/assets/icons/delete.svg";
import SaveAsPlaylistSvg from "@/assets/icons/sdcard.svg";
import ShuffleSvg from "@/assets/icons/shuffle.svg";
import MoreSvg from "@/assets/icons/more.svg";
const queue = useQueueStore();
@@ -26,7 +26,6 @@ import TracksGrid from "./TracksGrid.vue";
.right-search {
position: relative;
overflow: hidden;
width: auto;
height: 100%;
.heading {
+9 -6
View File
@@ -15,16 +15,16 @@
<div class="center rounded">
<Loader />
</div>
<div class="right">
<!-- <div class="right">
<Search />
</div>
</div> -->
</div>
</template>
<script setup lang="ts">
import NavButtons from "./NavButtons.vue";
import Loader from "../shared/Loader.vue";
import Search from "./Search.vue";
// import Search from "./Search.vue";
import { useRoute } from "vue-router";
import { ref, watch } from "vue";
import { Routes } from "@/composables/enums";
@@ -80,16 +80,19 @@ watch(
<style lang="scss">
.topnav {
display: grid;
grid-template-columns: 1fr min-content max-content;
grid-template-columns: 1fr min-content;
width: 100%;
gap: 1rem;
overflow: hidden;
.left {
display: grid;
grid-template-columns: max-content 1fr;
width: min-content;
overflow: scroll;
overflow: hidden;
.info {
overflow: hidden;
.title {
font-size: 1.5rem;
font-weight: bold;
+5 -3
View File
@@ -37,6 +37,8 @@ onUpdated(() => {
<style lang="scss">
#folder-nav-title {
width: 100%;
.folder {
display: flex;
gap: $small;
@@ -64,9 +66,9 @@ onUpdated(() => {
overflow: auto;
padding-right: $smaller;
@include for-desktop-down {
max-width: 9rem;
}
// @include for-desktop-down {
// max-width: 9rem;
// }
.icon {
height: 2rem;
+32 -6
View File
@@ -12,10 +12,7 @@ import {
Track,
} from "../interfaces";
function writeQueue(
from: fromFolder | fromAlbum | fromPlaylist,
tracks: Track[]
) {
function writeQueue(from: From, tracks: Track[]) {
localStorage.setItem(
"queue",
JSON.stringify({
@@ -46,6 +43,15 @@ const defaultTrack = <Track>{
image: "meh",
};
function shuffle(tracks: Track[]) {
const shuffled = tracks.slice();
for (let i = shuffled.length - 1; i > 0; i--) {
const j = Math.floor(Math.random() * (i + 1));
[shuffled[i], shuffled[j]] = [shuffled[j], shuffled[i]];
}
return shuffled;
}
type From = fromFolder | fromAlbum | fromPlaylist | fromSearch;
export default defineStore("Queue", {
@@ -76,7 +82,7 @@ export default defineStore("Queue", {
const track = this.tracklist[index];
this.currentid = track.trackid;
const uri = state.settings.uri + "/file/" + track.trackid;
const elem = document.getElementById("progress");
const elem = document.getElementById("progress") as HTMLElement;
this.updateCurrent(index);
new Promise((resolve, reject) => {
@@ -173,7 +179,7 @@ export default defineStore("Queue", {
this.currenttrack = track;
this.current = index;
this.currentid = track.trackid;
this.duration.full = track.length;
this.duration.full = track.length || 0;
},
setNewQueue(tracklist: Track[]) {
if (this.tracklist !== tracklist) {
@@ -260,5 +266,25 @@ export default defineStore("Queue", {
writeQueue(this.from, [defaultTrack] as Track[]);
writeCurrent(0);
},
shuffleQueue() {
const Toast = useNotifStore();
if (this.tracklist.length < 2) {
Toast.showNotification("Queue is too short", NotifType.Info);
return;
}
const shuffled = shuffle(this.tracklist);
this.tracklist = shuffled;
this.current = 0;
this.play(this.current);
this.currentid = shuffled[0].trackid;
this.next = 1;
this.prev = this.tracklist.length - 1;
writeQueue(this.from, shuffled);
writeCurrent(0);
},
},
});
+9 -1
View File
@@ -80,19 +80,27 @@ onBeforeRouteUpdate((to, from) => {
pointer-events: none;
user-select: none;
width: 100%;
// display: table-cell;
// vertical-align: bottom;
.text {
bottom: 1rem;
// height: 100%;
left: 1rem;
// right: 1rem;
// width: min-content;
max-width: calc(100% - 2rem);
background-color: $black;
@include for-desktop-down {
max-width: 31rem;
right: 1rem;
}
h3 {
margin: $small;
display: flex;
display: grid;
grid-template-columns: max-content 1fr;
align-items: center;
justify-content: center;
gap: $small;