getting ready for desktop version

This commit is contained in:
2024-10-03 09:46:23 +02:00
committed by juli0n21
parent 23b6ccb12a
commit 144caf2991
8 changed files with 76 additions and 41 deletions

View File

@@ -1,12 +1,6 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using Microsoft.Win32; using Microsoft.Win32;
using OsuParsers.Beatmaps;
using OsuParsers.Database; using OsuParsers.Database;
using OsuParsers.Database.Objects;
using shitweb; using shitweb;
using System.Collections;
using System.Net;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
public class Osudb public class Osudb

View File

@@ -1,20 +1,20 @@
<script setup lang="ts"> <script setup lang="ts">
import { RouterLink, RouterView } from 'vue-router' import { RouterLink, RouterView } from 'vue-router'
import NowPlaying from './components/NowPlaying.vue' import NowPlaying from './components/NowPlaying.vue'
import NowPlayingView from './views/NowplayingView.vue'
import MenuView from './views/MenuView.vue'
import Footer from './components/Footer.vue' import Footer from './components/Footer.vue'
import { ref, onMounted, watch } from 'vue' import { ref, onMounted, watch, onUnmounted } from 'vue'
import { useRoute } from 'vue-router' import { useRoute } from 'vue-router'
import { defineStore } from 'pinia' import { defineStore } from 'pinia'
import { useHeaderStore } from '@/stores/headerStore'; import { useHeaderStore } from '@/stores/headerStore';
import { isMobile, isPc } from './script/utils.ts'
const headerStore = useHeaderStore(); const headerStore = useHeaderStore();
const showFooter = ref(true); const showFooter = ref(true);
const showNowPlaying = ref(true); const showNowPlaying = ref(true);
const route = useRoute(); const route = useRoute();
function hide() {
showHeader.value = false;
}
watch(route, async (to) => { watch(route, async (to) => {
@@ -45,19 +45,56 @@ function loadColors() {
loadColors(); loadColors();
const screenInfo = ref({
isSmall: false,
isMedium: false,
});
const checkScreenSize = () => {
screenInfo.value.isSmall = isMobile();
screenInfo.value.isMedium = isPc();
};
onMounted(() => {
checkScreenSize(); // Initial check
window.addEventListener('resize', checkScreenSize);
});
onUnmounted(() => {
// Clean up the listener when component is destroyed
window.removeEventListener('resize', checkScreenSize);
});
</script> </script>
<template> <template>
<contentw class="flex flex-col h-screen max-h-screen wrapper info text-xl">
<div v-if="screenInfo.isSmall" class="flex flex-col h-screen max-h-screen wrapper info text-xl ">
<RouterView /> <RouterView />
<Transition> <NowPlaying v-show="showNowPlaying" />
<NowPlaying v-show="showNowPlaying" />
</Transition>
<Footer /> <Footer />
</div>
<div v-if="!screenInfo.isSmall" class="flex flex-col h-screen max-h-screen wrapper info text-xl ">
<main class="flex flex-1 w-full h-full overflow-y-scroll">
<div class="w-1/12">
<MenuView />
</div>
<div class="flex-1 overflow-y-scroll">
<RouterView />
</div>
<div class="w-1/5">
<NowPlayingView />
</div>
</main>
<Footer />
</div>
</contentw>
</template> </template>

View File

@@ -1,12 +1,5 @@
@import './base.css'; @import './base.css';
#app {
max-width: 1280px;
margin: 0 auto;
font-weight: normal;
background-color: rgba(--background-color);
}
a, a,
.green { .green {
text-decoration: none; text-decoration: none;
@@ -20,16 +13,3 @@ a,
background-color: hsla(160, 100%, 37%, 0.2); background-color: hsla(160, 100%, 37%, 0.2);
} }
} }
@media (min-width: 1024px) {
body {
display: flex;
place-items: center;
}
#app {
display: grid;
grid-template-columns: 1fr 1fr;
padding: 0 2rem;
}
}

View File

@@ -1,8 +1,17 @@
<script setup lang="ts">
import { useUserStore } from '@/stores/userStore';
const userStore = useUserStore();
</script>
<template> <template>
<hr> <hr>
<nav class="flex justify-around my-2 text-sm"> <nav class="flex justify-around my-2 text-sm md:text-2xl">
<RouterLink class="p-1 rounded-full backdrop--light shadow-xl hover:text-pink-500" to="/me"> <RouterLink class="p-1 rounded-full backdrop--light shadow-xl hover:text-pink-500" to="/me">
<img src="https://a.ppy.sh/14100399" class="h-6 rounded-full"> <img :src="userStore.User ? userStore.User.avatar_url : 'https://osu.ppy.sh/images/layout/avatar-guest.png'"
class="md:h-12 h-6 rounded-full">
</RouterLink> </RouterLink>
<RouterLink class="flex flex-col justify-center p-2 rounded-full backdrop--light shadow-xl info" to="/menu"><i <RouterLink class="flex flex-col justify-center p-2 rounded-full backdrop--light shadow-xl info" to="/menu"><i

View File

@@ -0,0 +1,15 @@
export const isMobile = () => {
return window.innerWidth < 640;
};
export const isTablet = () => {
return window.innerWidth >= 640 && window.innerWidth < 1024;
};
export const isPc = () => {
return window.innerWidth >= 1024 && window.innerWidth <= 1980;
};
export const matchesBreakpoint = (min, max = Infinity) => {
return window.innerWidth >= min && window.innerWidth <= max;
};

View File

@@ -4,6 +4,6 @@ import SongItem from '../components/SongItem.vue'
<template> <template>
<main class="flex-1 flex-col overflow-scroll"> <main class="flex-1 flex-col overflow-scroll">
<p>Coming Soon...</p>
</main> </main>
</template> </template>

View File

@@ -13,7 +13,7 @@ const headerStore = useHeaderStore();
</script> </script>
<template> <template>
<main class="flex-1 flex flex-col h-full overflow-scroll"> <main class="flex-1 flex flex-col h-full overflow-y-scroll">
<header v-show="true"> <header v-show="true">
<div class="wrapper"> <div class="wrapper">
<nav class="flex justify-start my-2 mx-1 space-x-1 overflow-x-scroll flex-nowrap text-nowrap"> <nav class="flex justify-start my-2 mx-1 space-x-1 overflow-x-scroll flex-nowrap text-nowrap">

View File

@@ -32,7 +32,7 @@ const audioStore = useAudioStore();
<div class="h-1/3 flex flex-col justify-center"> <div class="h-1/3 flex flex-col justify-center">
<div class="flex-1"></div> <div class="flex-1"></div>
<div> <div>
<div class="flex w-screen justify-around"> <div class="flex w-full justify-around">
<i class="fa-solid fa-backward-step text-5xl self-center" @click="audioStore.togglePrev"></i> <i class="fa-solid fa-backward-step text-5xl self-center" @click="audioStore.togglePrev"></i>
<i :class="[audioStore.isPlaying ? 'fa-circle-play' : 'fa-circle-pause']" class="fa-regular text-7xl " <i :class="[audioStore.isPlaying ? 'fa-circle-play' : 'fa-circle-pause']" class="fa-regular text-7xl "
@click="audioStore.togglePlay"></i> @click="audioStore.togglePlay"></i>
@@ -43,7 +43,7 @@ const audioStore = useAudioStore();
<i @click="audioStore.toggleShuffle" :class="[audioStore.shuffle ? 'info' : '']" <i @click="audioStore.toggleShuffle" :class="[audioStore.shuffle ? 'info' : '']"
class="fa-solid fa-shuffle"></i> class="fa-solid fa-shuffle"></i>
<div class="m-4 info flex-1 overflow-idden"> <div class="m-4 info flex-1 overflow-hidden">
<p>{{ audioStore.title }}</p> <p>{{ audioStore.title }}</p>
<RouterLink :to="'search?a=' + audioStore.artist"> <RouterLink :to="'search?a=' + audioStore.artist">