mirror of
https://github.com/tcsenpai/swingmusic.git
synced 2025-07-29 14:12:21 +00:00
setup artist page boilerplate code
This commit is contained in:
parent
f3c4f0310a
commit
da852e72f3
@ -3,11 +3,7 @@
|
|||||||
class="a-header rounded"
|
class="a-header rounded"
|
||||||
ref="albumheaderthing"
|
ref="albumheaderthing"
|
||||||
:style="{
|
:style="{
|
||||||
backgroundImage: album.colors
|
backgroundColor: album.colors ? album.colors[0] : '',
|
||||||
? `linear-gradient(
|
|
||||||
37deg, ${album.colors[2]}, ${album.colors[2]}
|
|
||||||
)`
|
|
||||||
: '',
|
|
||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
@ -18,7 +14,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
class="info"
|
class="info"
|
||||||
:class="{ nocontrast: album.colors ? isLight(album.colors[2]) : false }"
|
:class="{ nocontrast: album.colors ? isLight(album.colors[0]) : false }"
|
||||||
>
|
>
|
||||||
<div class="album-info">
|
<div class="album-info">
|
||||||
<div class="top">
|
<div class="top">
|
||||||
@ -41,10 +37,7 @@
|
|||||||
{{ formatSeconds(album.duration, true) }}
|
{{ formatSeconds(album.duration, true) }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<PlayBtnRect
|
<PlayBtnRect :source="playSources.album" :store="useAlbumStore" />
|
||||||
:source="playSources.album"
|
|
||||||
:store="useAlbumStore"
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="art" v-if="!albumHeaderSmall">
|
<div class="art" v-if="!albumHeaderSmall">
|
||||||
|
9
src/components/ArtistView/Header.vue
Normal file
9
src/components/ArtistView/Header.vue
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<template>
|
||||||
|
<div class="artist-page-header">
|
||||||
|
This is the header
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts"></script>
|
||||||
|
|
||||||
|
<style lang="scss"></style>
|
@ -18,31 +18,6 @@ interface BtnColor {
|
|||||||
isDark: boolean;
|
isDark: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the first contrasting color in the album colors.
|
|
||||||
*
|
|
||||||
* @param {string[]} colors The album colors to choose from.
|
|
||||||
* @returns {BtnColor} A color to use as the play button background
|
|
||||||
*/
|
|
||||||
export function getButtonColor(colors: string[], index: number): BtnColor {
|
|
||||||
const fallback = {
|
|
||||||
color: "#234ece",
|
|
||||||
isDark: true,
|
|
||||||
};
|
|
||||||
|
|
||||||
if (!colors || colors.length === 0) return fallback;
|
|
||||||
|
|
||||||
for (let i = 0; i < colors.length; i++) {
|
|
||||||
if (theyContrast(colors[index], colors[i])) {
|
|
||||||
return {
|
|
||||||
color: colors[i],
|
|
||||||
isDark: isLight(colors[i]),
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return fallback;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the luminance of a color.
|
* Returns the luminance of a color.
|
||||||
|
@ -72,6 +72,11 @@ const routes = [
|
|||||||
name: "ArtistsView",
|
name: "ArtistsView",
|
||||||
component: () => import("@/views/ArtistsExplorer.vue"),
|
component: () => import("@/views/ArtistsExplorer.vue"),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: "/artists/:hash",
|
||||||
|
name: "ArtistView",
|
||||||
|
component: () => import("@/views/ArtistView"),
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: "/settings",
|
path: "/settings",
|
||||||
name: "SettingsView",
|
name: "SettingsView",
|
||||||
@ -90,7 +95,7 @@ const routes = [
|
|||||||
{
|
{
|
||||||
name: "NotFound",
|
name: "NotFound",
|
||||||
path: "/:pathMatch(.*)",
|
path: "/:pathMatch(.*)",
|
||||||
component: () => import("../views/NotFound.vue"),
|
component: () => import("@/views/NotFound.vue"),
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
49
src/views/ArtistView/Main.vue
Normal file
49
src/views/ArtistView/Main.vue
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
<template>
|
||||||
|
<div
|
||||||
|
class="artist-page v-scroll-page"
|
||||||
|
style="height: 100%"
|
||||||
|
:class="{ isSmall, isMedium }"
|
||||||
|
>
|
||||||
|
<RecycleScroller
|
||||||
|
class="scroller"
|
||||||
|
:items="scrollerItems"
|
||||||
|
:item-size="null"
|
||||||
|
key-field="id"
|
||||||
|
v-slot="{ item }"
|
||||||
|
style="height: 100%"
|
||||||
|
>
|
||||||
|
<component :is="item.component" v-bind="item.props" />
|
||||||
|
</RecycleScroller>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { isMedium, isSmall } from "@/stores/content-width";
|
||||||
|
|
||||||
|
import Header from "@/components/ArtistView/Header.vue";
|
||||||
|
import { computed } from "vue";
|
||||||
|
|
||||||
|
interface ScrollerItem {
|
||||||
|
id: string | number;
|
||||||
|
component: typeof Header;
|
||||||
|
// props: Record<string, unknown>;
|
||||||
|
size: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
const header: ScrollerItem = {
|
||||||
|
id: "artist-header",
|
||||||
|
component: Header,
|
||||||
|
size: 19 * 16,
|
||||||
|
};
|
||||||
|
|
||||||
|
const scrollerItems = computed(() => {
|
||||||
|
return [header];
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
.artist-page {
|
||||||
|
border: solid 1px;
|
||||||
|
|
||||||
|
}
|
||||||
|
</style>
|
3
src/views/ArtistView/index.ts
Normal file
3
src/views/ArtistView/index.ts
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
import ArtistView from "./Main.vue";
|
||||||
|
|
||||||
|
export default ArtistView;
|
@ -45,9 +45,6 @@ interface ScrollerItem {
|
|||||||
const header: ScrollerItem = {
|
const header: ScrollerItem = {
|
||||||
id: "header",
|
id: "header",
|
||||||
component: Header,
|
component: Header,
|
||||||
// props: {
|
|
||||||
// info: playlist.info,
|
|
||||||
// },
|
|
||||||
size: 19 * 16,
|
size: 19 * 16,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user