core skeleton is ready

This commit is contained in:
Christoph Stahl 2022-11-21 08:51:24 +01:00
parent 4832bebc2e
commit ad2e6c8d80
19 changed files with 2710 additions and 220 deletions

2155
package-lock.json generated Normal file

File diff suppressed because it is too large Load diff

View file

@ -9,10 +9,14 @@
"dependencies": { "dependencies": {
"@fortawesome/fontawesome-free": "^6.2.1", "@fortawesome/fontawesome-free": "^6.2.1",
"@fortawesome/fontawesome-svg-core": "^6.2.1", "@fortawesome/fontawesome-svg-core": "^6.2.1",
"@fortawesome/free-brands-svg-icons": "^6.2.1",
"@fortawesome/free-solid-svg-icons": "^6.2.1", "@fortawesome/free-solid-svg-icons": "^6.2.1",
"@fortawesome/vue-fontawesome": "^3.0.2", "@fortawesome/vue-fontawesome": "^3.0.2",
"foundation-sites": "^6.7.5", "foundation-sites": "^6.7.5",
"vue": "^3.2.41" "socket.io": "^4.5.3",
"socket.io-client": "^4.5.3",
"vue": "^3.2.41",
"vue-3-socket.io": "^1.0.5"
}, },
"devDependencies": { "devDependencies": {
"@vitejs/plugin-vue": "^3.1.2", "@vitejs/plugin-vue": "^3.1.2",

View file

@ -1,117 +1,88 @@
<script setup> <script setup>
import SearchTab from './components/SearchTab.vue' import { computed, ref, onMounted, onDeactivated } from 'vue'
import TabHeader from './components/TabHeader.vue' import { io } from "socket.io-client"
import MobileLayout from './components/MobileLayout.vue'
import DesktopLayout from './components/DesktopLayout.vue'
onMounted(() => {
window.addEventListener("resize", resizeBrowserHandler)
})
function resizeBrowserHandler (e) {
is_small.value = (e.target.innerWidth < 768)
}
const is_small = ref(window.innerWidth < 768)
const state = ref({
'search': {'searchTerm': ''},
'queue': [
{'artist': 'Artist A', 'title': 'Songname A', 'album': 'Album A', 'performer': "Performer A"} ,
{'artist': 'Artist B', 'title': 'Songname B', 'album': 'Album B', 'performer': "Performer B"} ,
{'artist': 'Artist C', 'title': 'Songname C', 'album': 'Album C', 'performer': "Performer C"} ,
]
})
function search(val) {
console.log(state.value.search.searchTerm)
}
function updateSearchTerm(val) {
state.value.search.searchTerm = val
}
const socket = io("ws://localhost:8080")
socket.on("connect", () =>
{ socket.emit("register-web", {"room": "ABCD"}) }
)
socket.on("state", (val) => {
console.log(val)
})
</script> </script>
<template> <template>
<div class="page"> <div class="page">
<div class="row" id="main-content"> <div class="row" id="main-content">
<div class="splitter"> <MobileLayout v-show="is_small" :state="state" @update:searchTerm="updateSearchTerm" />
<div class="comp-column"> <DesktopLayout v-show="!is_small" :state="state" @update:searchTerm="updateSearchTerm" @search="search"/>
<div data-tabs class="tabs" id="main-tab">
<TabHeader active="true" link="#simplesearch" icon="fa-magnifying-glass" />
<TabHeader link="#queue-list" icon="fa-list" />
<TabHeader link="#recent-list" icon="fa-history" />
</div>
<div class="tabs-container" data-tabs-content="main-tab">
<SearchTab />
<div class="tabs-panel" id="queue-list">
<div class="vsplit">
<div id="queue-list-wrapper" class="results">
<ul id="queue" class="vertical menu">
<li rv-if="queue.current" id="current">
{% if admin == True -%}
<div class="row">
<div class="columns small-9">
{%- endif %}
<div class="row">
<span class="artist">{ queue.current.artist }</span>
<span class="title">{ queue.current.title }</span>
<span class="album">{ queue.current.album }</span>
</div>
<div class="row">
<span class="singer">{ queue.current.performer }</span>
</div>
{% if admin == True -%}
</div>
<div class="columns small-3">
<div class="button-group">
<button class="button alert fright" rv-on-click="queue.abort"><i class="fa fa-step-forward"></i></button>
<button class="button alert fright" rv-on-click="queue.kill"><i class="fa fa-times"></i></button>
</div>
</div>
</div>
{%- endif %}
</li>
<li rv-each-entry="queue.queue">
{% if admin == True -%}
<div class="row">
<div class="columns small-9">
{%- endif %}
<div class="row">
<span class="artist">{ entry.artist }</span>
<span class="title">{ entry.title }</span>
<span class="album">{ entry.album }</span>
</div>
<div class="row">
<span class="singer">{ entry.performer }</span>
<span class="eta">{ entry.etamin }</span>
</div>
{% if admin == True -%}
</div>
<div class="columns small-3">
<button class="button alert fright" rv-on-click="queue.deleteFromQueue"><i class="fa fa-minus"></i></button>
</div>
</div>
{%- endif %}
</li>
{% if admin == True %}
<li>
<div class="row">
<div class="columns small-12">
<a class="button" download="queue.json" rv-href="queue.data">Save</a>
<label for="small-bulk-upload" class="button bulk-upload-label">Bulk Append</label>
<input type="file" id="small-bulk-upload" rv-on-change="queue.bulk_append" class="show-for-sr">
</div>
</div>
</li>
{% endif %}
</ul>
</div>
</div>
</div>
<div class="tabs-panel" id="recent-list">
<div class="vsplit">
<div id="recent-list-wrapper" class="results">
<ol id="last10" class="vertical menu">
<li rv-each-entry="queue.last10">
<div class="row">
<span class="artist">{ entry.artist }</span>
<span class="title">{ entry.title }</span>
<span class="album">{ entry.album }</span>
</div>
<div class="row">
<span class="singer">{ entry.performer }</span>
</div>
</li>
</ol>
</div>
</div>
</div>
</div>
</div>
</div>
</div> </div>
</div> </div>
</template> </template>
<style scoped> <style scoped>
#app { .page {
height: 100vh;
position: relative;
}
#main-content {
height: 100vh;
max-height: 100vh;
max-width: 100vw;
}
</style>
<style>
.row {
margin:0 !important;
max-width: 100% !important;
}
body {
background: url(../syng.png) fixed; background: url(../syng.png) fixed;
background-color: #8a8a8a; background-color: #8a8a8a;
background-size: auto 50%; background-size: auto 50%;
background-repeat: no-repeat; background-repeat: no-repeat;
background-position: center; background-position: center;
height:100vh;
}
.vsplit {
display: flex;
height: 100%;
flex-direction: column;
}
#large-current, #current, .button, button:focus {
background-color: #008000;
} }
</style> </style>

View file

@ -1,74 +0,0 @@
/* color palette from <https://github.com/vuejs/theme> */
:root {
--vt-c-white: #ffffff;
--vt-c-white-soft: #f8f8f8;
--vt-c-white-mute: #f2f2f2;
--vt-c-black: #181818;
--vt-c-black-soft: #222222;
--vt-c-black-mute: #282828;
--vt-c-indigo: #2c3e50;
--vt-c-divider-light-1: rgba(60, 60, 60, 0.29);
--vt-c-divider-light-2: rgba(60, 60, 60, 0.12);
--vt-c-divider-dark-1: rgba(84, 84, 84, 0.65);
--vt-c-divider-dark-2: rgba(84, 84, 84, 0.48);
--vt-c-text-light-1: var(--vt-c-indigo);
--vt-c-text-light-2: rgba(60, 60, 60, 0.66);
--vt-c-text-dark-1: var(--vt-c-white);
--vt-c-text-dark-2: rgba(235, 235, 235, 0.64);
}
/* semantic color variables for this project */
:root {
--color-background: var(--vt-c-white);
--color-background-soft: var(--vt-c-white-soft);
--color-background-mute: var(--vt-c-white-mute);
--color-border: var(--vt-c-divider-light-2);
--color-border-hover: var(--vt-c-divider-light-1);
--color-heading: var(--vt-c-text-light-1);
--color-text: var(--vt-c-text-light-1);
--section-gap: 160px;
}
@media (prefers-color-scheme: dark) {
:root {
--color-background: var(--vt-c-black);
--color-background-soft: var(--vt-c-black-soft);
--color-background-mute: var(--vt-c-black-mute);
--color-border: var(--vt-c-divider-dark-2);
--color-border-hover: var(--vt-c-divider-dark-1);
--color-heading: var(--vt-c-text-dark-1);
--color-text: var(--vt-c-text-dark-2);
}
}
*,
*::before,
*::after {
box-sizing: border-box;
margin: 0;
position: relative;
font-weight: normal;
}
body {
min-height: 100vh;
color: var(--color-text);
background: var(--color-background);
transition: color 0.5s, background-color 0.5s;
line-height: 1.6;
font-family: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu,
Cantarell, 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
font-size: 15px;
text-rendering: optimizeLegibility;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}

View file

@ -1,35 +1,216 @@
@import './base.css'; li {
opacity: 0.9;
#app { margin-left: 0.2em;
max-width: 1280px; margin-right: 0.2em;
margin: 0 auto;
padding: 2rem;
font-weight: normal;
} }
a, .row {
.green { margin:0 !important;
text-decoration: none; max-width: 100% !important;
color: hsla(160, 100%, 37%, 1);
transition: 0.4s;
} }
@media (hover: hover) { body {
a:hover { height:100vh;
background-color: hsla(160, 100%, 37%, 0.2);
}
} }
@media (min-width: 1024px) { .page {
body { height: 100vh;
position: relative;
}
.header {
background-color: #008000;
font-weight: bold;
color: #ffffff;
display: block;
padding: 1.25rem;
font-size: .75rem;
text-align: center;
line-height: 1;
margin-bottom: .5rem;
}
.splitter {
display: flex; display: flex;
place-items: center; height: 100vh;
} }
#app { .comp-column {
display: grid; max-height: 100vh;
grid-template-columns: 1fr 1fr; flex:1;
padding: 0 2rem; display: flex;
} flex-direction: column;
}
#left-side {
margin: 0.2em 0.1em 0.2em 0.2em;
}
#middle {
margin: 0.2em 0.1em 0.1em 0.2em;
}
#right-side {
margin: 0.2em 0.2em 0.1em 0.2em;
}
#main-content {
height: 100vh;
max-height: 100vh;
max-width: 100vw;
}
.tabs-container {
flex: 1;
position: relative;
overflow: auto;
}
.tabs-panel {
height: 100%;
}
.vsplit {
display: flex;
height: 100%;
flex-direction: column;
}
.results {
flex: 1;
overflow-y: auto;
}
.performer, .album {
font-size: smaller;
font-style: italic;
}
.title {
font-weight: bold;
}
.input-group {
margin-bottom: 0;
}
.menu li {
padding:0.4em;
}
.small-12 {
padding: 0;
}
#search-results div {
vertical-align: middle;
height: 100%
}
.tabs-panel {
padding: 0;
}
.menu li:nth-child(odd) {
background-color: #e6e6e6;
}
.menu li:nth-child(even) {
background-color: #f6f6f6;
}
.current {
background-color: #008000 !important;
}
.button, button:focus {
background-color: #008000;
}
.current::before, #large-current::before{
content: "Now Playing";
text-align: center;
font-weight: bold;
}
.eta {
float: right;
}
.eta::before {
content: "in ";
}
.eta::after {
content: " min";
}
.artist::after{
content: " - ";
}
.button:hover, button:hover{
background-color: #3b3b3b;
}
body {
background: url(../syng.png) fixed;
background-color: #8a8a8a;
background-size: auto 50%;
background-repeat: no-repeat;
background-position: center;
}
.warning {
padding: 10px;
background-color: #a53b2a;
}
.tabs {
border: none;
}
.tabs-title > a{
color: #008000;
}
.tabs-title > a:hover {
background-color: #444444;
color: #FFFFFF;
}
.tabs-title > a:focus, .tabs-title > a[aria-selected="true"]{
color: #FFFFFF;
font-weight: bold;
background-color: #008000;
}
div.tabs {
display: flex;
}
.fright {
float: right;
}
div.tabs .tabs-title {
flex-grow: 1;
text-align: center;
}
.tabs {
margin-bottom: 0.1em;
background-color: #3b3b3b;
}
.bulk-upload-label {
margin-bottom: 0px;
}
.button-group .button {
/* margin-left: 0.5em; */
} }

View file

@ -0,0 +1,36 @@
<script setup>
import SearchDesktop from './SearchDesktop.vue'
import QueueDesktop from './QueueDesktop.vue'
const props = defineProps(['state']);
const emit = defineEmits(['update:searchTerm', 'search'])
</script>
<template>
<div class="splitter">
<SearchDesktop :search="state.search" @update:searchTerm="(val) => $emit('update:searchTerm', val)" @search="$emit('search')" />
<QueueDesktop :queue="state.queue" />
<div class="comp-column" id="right-side">
<div class="header">Recent</div>
<div id="large-recent-list">
<div class="vsplit">
<div id="large-recent-list-wrapper" class="results">
<ol id="large-last10" class="vertical menu">
<li rv-each-entry="queue.last10">
<div class="row">
<span class="artist">{ entry.artist }</span>
<span class="title">{ entry.title }</span>
<span class="album">{ entry.album }</span>
</div>
<div class="row">
<span class="singer">{ entry.performer }</span>
</div>
</li>
</ol>
</div>
</div>
</div>
</div>
</div>
</template>

26
src/components/Entry.vue Normal file
View file

@ -0,0 +1,26 @@
<script>
export default {
props: ['admin', 'artist', 'title', 'album', 'performer', 'current']
}
</script>
<template>
<li :class="{ current: current }">
<div class="grid-x">
<div class="cell" :class="{'small-9': admin}">
<span class="artist">{{ artist }}</span>
<span class="title">{{ title }}</span><br />
<span class="performer">{{ performer }}</span>
</div>
<div v-if="admin" class="cell small-3">
<button class="button alert fright" v-if="!current">
<font-awesome-icon icon="fa-solid fa-step-forward" />
</button>
<button class="button alert fright">
<font-awesome-icon icon="fa-solid fa-times" />
</button>
</div>
</div>
</li>
</template>

View file

@ -0,0 +1,52 @@
<script setup>
import SearchTab from './SearchTab.vue'
import QueueTab from './QueueTab.vue'
import RecentTab from './RecentTab.vue'
import TabHeader from './TabHeader.vue'
const props = defineProps(['state']);
const emit = defineEmits(['update:searchTerm'])
</script>
<template>
<div class="splitter">
<div class="comp-column">
<div data-tabs class="tabs" id="main-tab">
<TabHeader active="true" link="#simplesearch" icon="fa-magnifying-glass" />
<TabHeader link="#queue-list" icon="fa-list" />
<TabHeader link="#recent-list" icon="fa-history" />
</div>
<div class="tabs-container" data-tabs-content="main-tab">
<SearchTab :search="state.search" @update:searchTerm="(val) => $emit('update:searchTerm', val)"/>
<QueueTab :queue="state.queue" />
<RecentTab />
</div>
</div>
</div>
</template>
<style scoped>
.splitter {
display: flex;
height: 100vh;
}
.comp-column {
max-height: 100vh;
flex:1;
display: flex;
flex-direction: column;
}
.tabs-container {
flex: 1;
position: relative;
overflow: auto;
}
</style>
<style>
.tabs-panel {
height: 100%;
}
</style>

View file

@ -0,0 +1,12 @@
<script setup>
import QueueInner from './QueueInner.vue'
const props = defineProps(['queue']);
</script>
<template>
<div class="comp-column" id="middle">
<div class="header">Queue</div>
<QueueInner :queue="queue" />
</div>
</template>

View file

@ -0,0 +1,28 @@
<script setup>
import Entry from './Entry.vue'
</script>
<script>
export default {
props: ['admin', 'queue']
}
</script>
<template>
<div class="vsplit">
<div id="queue-list-wrapper" class="results">
<ul id="queue" class="vertical menu">
<Entry v-for="(entry, index) in queue" :artist="entry.artist" :title="entry.title" :album="entry.album" :performer="entry.performer" :current="index == 0" :admin="admin" />
<li v-if="admin">
<div class="row">
<div class="columns small-12">
<a class="button" download="queue.json" rv-href="queue.data">Save</a>
<label for="small-bulk-upload" class="button bulk-upload-label">Bulk Append</label>
<input type="file" id="small-bulk-upload" rv-on-change="queue.bulk_append" class="show-for-sr">
</div>
</div>
</li>
</ul>
</div>
</div>
</template>

View file

@ -0,0 +1,15 @@
<script setup>
import QueueInner from './QueueInner.vue'
</script>
<script>
export default {
props: ['queue']
}
</script>
<template>
<div class="tabs-panel" id="queue-list">
<QueueInner :queue="queue" />
</div>
</template>

View file

@ -0,0 +1,17 @@
<script setup>
import Entry from './Entry.vue'
</script>
<template>
<div class="tabs-panel" id="recent-list">
<div class="vsplit">
<div id="recent-list-wrapper" class="results">
<ol id="last10" class="vertical menu">
<Entry artist="Artist" title="Title" album="Album" performer="Performer" />
<Entry artist="Artist" title="Title" album="Album" performer="Performer" />
<Entry artist="Artist" title="Title" album="Album" performer="Performer" />
</ol>
</div>
</div>
</div>
</template>

View file

@ -4,33 +4,35 @@ export default {
} }
</script> </script>
<template> <template>
<div class="row"> <div class="grid-x">
<div class="columns small-10"> <div class="cell small-9">
<span class="artist">{{artist}}</span> <span class="artist">{{artist}}</span>
<span class="title">{{title}}</span> <span class="title">{{title}}</span><br />
<span class="album">{{album}}</span> <span class="album">{{album}}</span>
</div> </div>
<div class="columns small-2"> <div class="cell small-3">
<button class="button alert fright"> <button class="button alert fright">
<i class="fa fa-play"></i> <font-awesome-icon icon="fa-brands fa-youtube" />
</button> </button>
<button class="button fright"> <button class="button fright">
<i class="fa fa-plus"></i> <font-awesome-icon icon="fa-solid fa-plus" />
</button> </button>
</div> </div>
</div> </div>
</template> </template>
<style scope> <style scoped>
.artist::after{ .artist::after{
content: " - "; content: " - ";
} }
.album::before { .singer {
content: " ["; font-size: smaller;
font-style: italic;
} }
.album::after {
content: "]"; .title {
font-weight: bold;
} }
</style> </style>

View file

@ -1,10 +1,19 @@
<script setup>
const props = defineProps(['searchTerm']);
const emit = defineEmits(['update:searchTerm', 'search'])
</script>
<template> <template>
<form id="simple-search-form" class="form">
<div class="input-group"> <div class="input-group">
<input id="search-query" class="input-group-field" type="search" placeholder="Search term or YouTube link (https://www.youtube.com/watch?v=...)" name="q" /> <input id="search-query" class="input-group-field" type="search" placeholder="Search term or YouTube link (https://www.youtube.com/watch?v=...)" :value='searchTerm' @input="$emit('update:searchTerm', $event.target.value)"/>
<div class="input-group-button"> <div class="input-group-button">
<button class="button" type="submit"><i class="fa fa-search"></i></button> <button class="button" @click="$emit('search')"><font-awesome-icon icon="fa-solid fa-magnifying-glass" /></button>
</div> </div>
</div> </div>
</form>
</template> </template>
<style scoped>
.input-group {
margin-bottom: 0;
}
</style>

View file

@ -0,0 +1,17 @@
<script setup>
import SearchResults from './SearchResults.vue'
import SearchBar from './SearchBar.vue'
const props = defineProps(['search']);
const emit = defineEmits(['update:searchTerm', 'search'])
</script>
<template>
<div class="comp-column" id="left-side">
<div class="header">Search</div>
<div class="vsplit">
<SearchBar :searchTerm="search.searchTerm" @update:searchTerm="(val) => $emit('update:searchTerm', val)" @search="$emit('search')" />
<SearchResults />
</div>
</div>
</template>

View file

@ -2,6 +2,12 @@
import Result from './Result.vue' import Result from './Result.vue'
</script> </script>
<script>
export default {
props: ['searchResults']
}
</script>
<template> <template>
<div id="search-results" class="results"> <div id="search-results" class="results">
<ul class="vertical menu"> <ul class="vertical menu">
@ -13,6 +19,10 @@
</template> </template>
<style scoped> <style scoped>
#search-results div {
vertical-align: middle;
height: 100%
}
.results { .results {
flex: 1; flex: 1;
overflow-y: auto; overflow-y: auto;

View file

@ -1,12 +1,15 @@
<script setup> <script setup>
import SearchResults from './SearchResults.vue'
import SearchBar from './SearchBar.vue' import SearchBar from './SearchBar.vue'
import SearchResults from './SearchResults.vue'
const props = defineProps(['search']);
const emit = defineEmits(['update:searchTerm'])
</script> </script>
<template> <template>
<div class="tabs-panel is-active" id="simplesearch"> <div class="tabs-panel is-active" id="simplesearch">
<div class="vsplit"> <div class="vsplit">
<SearchBar /> <SearchBar :searchTerm="search.searchTerm" @update:searchTerm="(val) => $emit('update:searchTerm', val)"/>
<SearchResults /> <SearchResults />
</div> </div>
</div> </div>

View file

@ -8,3 +8,24 @@ export default {
<font-awesome-icon :icon="[variant, icon]" /> <font-awesome-icon :icon="[variant, icon]" />
</a></div> </a></div>
</template> </template>
<style scoped>
.tabs-title > a{
color: #008000;
}
.tabs-title > a:hover {
background-color: #444444;
color: #FFFFFF;
}
.tabs-title > a:focus, .tabs-title > a[aria-selected="true"]{
color: #FFFFFF;
font-weight: bold;
background-color: #008000;
}
.tabs-title {
flex-grow: 1;
text-align: center;
}
</style>

View file

@ -4,14 +4,19 @@ import Foundation from 'foundation-sites'
import App from './App.vue' import App from './App.vue'
import { library } from '@fortawesome/fontawesome-svg-core' import { library } from '@fortawesome/fontawesome-svg-core'
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome' import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome'
import { faMagnifyingGlass, faList, faHistory } from '@fortawesome/free-solid-svg-icons' import { faMagnifyingGlass, faList, faHistory, faPlus, faStepForward, faTimes } from '@fortawesome/free-solid-svg-icons'
import { faYoutube } from '@fortawesome/free-brands-svg-icons'
import './assets/main.css'
import 'foundation-sites/dist/css/foundation.min.css' import 'foundation-sites/dist/css/foundation.min.css'
import './assets/main.css'
library.add(faMagnifyingGlass) library.add(faMagnifyingGlass)
library.add(faList) library.add(faList)
library.add(faPlus)
library.add(faHistory) library.add(faHistory)
library.add(faStepForward)
library.add(faYoutube)
library.add(faTimes)
createApp(App) createApp(App)
.component('font-awesome-icon', FontAwesomeIcon) .component('font-awesome-icon', FontAwesomeIcon)