Skip to content

Commit

Permalink
added results filtering, UI fixes, updated neutralino binaries
Browse files Browse the repository at this point in the history
  • Loading branch information
bocchilorenzo committed Nov 27, 2022
1 parent 671219e commit 4d46629
Show file tree
Hide file tree
Showing 13 changed files with 521 additions and 309 deletions.
10 changes: 5 additions & 5 deletions neutralino.config.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"applicationId": "js.neutralino.xradio",
"version": "0.1.0",
"version": "0.2.0",
"defaultMode": "window",
"documentRoot": "/xradio-vue/dist/",
"port": 6498,
Expand All @@ -19,8 +19,8 @@
"modes": {
"window": {
"title": "XRadio",
"width": 800,
"height": 500,
"width": 900,
"height": 640,
"minWidth": 400,
"minHeight": 200,
"resizable": false,
Expand All @@ -36,8 +36,8 @@
"resourcesPath": "/xradio-vue/dist/",
"extensionsPath": "/extensions/",
"clientLibrary": "/xradio-vue/public/neutralino.js",
"binaryVersion": "4.6.0",
"clientVersion": "3.5.0",
"binaryVersion": "4.9.0",
"clientVersion": "3.8.0",
"frontendLibrary": {
"patchFile": "/xradio-vue/public/index.html",
"devUrl": "http://localhost:8080"
Expand Down
2 changes: 1 addition & 1 deletion xradio-vue/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "xradio",
"version": "0.1.0",
"version": "0.2.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
Expand Down
2 changes: 1 addition & 1 deletion xradio-vue/public/neutralino.js

Large diffs are not rendered by default.

31 changes: 18 additions & 13 deletions xradio-vue/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,19 @@
<main
class="
min-h-screen
bg-white
relative
text-nord-gray1
dark:text-nord-white3 dark:bg-nord-gray1
dark:text-nord-white3
dark:bg-nord-gray1
bg-white
transition-colors
duration-300
ease-out
select-none
"
@contextmenu.prevent="null"
>
<navbar-2 />
<nav-bar-2 />
<button
@click="switchTheme"
class="
Expand Down Expand Up @@ -44,7 +45,7 @@
</svg>
</button>
<transition name="slideLeft">
<snackbar v-if="showSnack" :msg="snackMsg" />
<snack-bar v-if="showSnack" :msg="snackMsg" />
</transition>
<transition name="slideLeft">
<update-banner
Expand Down Expand Up @@ -86,18 +87,18 @@

<script>
import axios from "axios";
//import Navbar from "./components/navbar.vue";
//import Navbar from "./components/NavBar.vue";
import { Howl, Howler } from "howler/dist/howler.core.min";
import Player from "./components/player.vue";
import Snackbar from "./components/snackbar.vue";
import Navbar2 from "./components/navbar2.vue";
import UpdateBanner from "./components/updateBanner.vue";
import Player from "./components/Player.vue";
import SnackBar from "./components/SnackBar.vue";
import NavBar2 from "./components/NavBar2.vue";
import UpdateBanner from "./components/UpdateBanner.vue";
export default {
components: {
//Navbar,
Player,
Snackbar,
Navbar2,
SnackBar,
NavBar2,
UpdateBanner,
},
data() {
Expand Down Expand Up @@ -156,9 +157,13 @@ export default {
if (localStorage.getItem("volume")) {
this.$store.dispatch("volume", parseInt(localStorage.getItem("volume")));
}
if (localStorage.getItem("selectedCountries")) {
this.$store.dispatch("setSelectedCountries", JSON.parse(localStorage.getItem("selectedCountries")));
}
this.dns();
Neutralino.events.on("baseHost", (event) => {
this.baseUrl = event.detail;
this.$store.dispatch("setBase", this.baseUrl);
this.initRequests();
this.checkUpdate();
});
Expand Down Expand Up @@ -226,9 +231,9 @@ export default {
url: this.baseUrl + this.$store.state.urls.click + station.stationuuid,
headers: { "User-Agent": "XRadio/" + this.config.version },
})
.then((res) => {
/* .then((res) => {
console.log(res.data);
})
}) */
.catch((err) => {
console.error(err);
});
Expand Down
178 changes: 178 additions & 0 deletions xradio-vue/src/components/FilterModal.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,178 @@
<template>
<div
class="flex items-center justify-center fixed left-0 bottom-0 w-full h-full bg-gray-800 bg-opacity-50 z-20"
@click="toggleModal"
>
<div
tabindex="-1"
id="modal"
class="bg-white dark:bg-nord-gray4 rounded-lg w-5/6 max-w-3xl overflow-y-auto overscroll-none"
@click.stop
>
<div class="flex flex-col p-4">
<div class="flex w-full">
<div class="font-bold text-lg">Filter results</div>
<button
class="ml-auto rounded p-1 hover:bg-nord-white1 dark:hover:bg-nord-gray4 transition-colors duration-100 ease-out"
@click="toggleModal"
>
<svg
class="m-auto fill-current w-6 h-6"
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 18 18"
>
<path
d="M14.53 4.53l-1.06-1.06L9 7.94 4.53 3.47 3.47 4.53 7.94 9l-4.47 4.47 1.06 1.06L9 10.06l4.47 4.47 1.06-1.06L10.06 9z"
/>
</svg>
<span class="sr-only">Close</span>
</button>
</div>
<div class="py-2">
<!-- <button
id="dropCountry"
class="rounded-md flex content-center items-center justify-between w-full p-1 hover:bg-nord-white2 dark:hover:bg-nord-gray2 transition-colors duration-100 ease-out"
@click="showCountries = !showCountries"
>
Choose countries
<svg
class="w-4 h-4"
aria-hidden="true"
fill="none"
stroke="currentColor"
viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg"
>
<path
stroke-linecap="round"
stroke-linejoin="round"
stroke-width="2"
d="M19 9l-7 7-7-7"
></path>
</svg>
</button> -->
<p class="pb-2">
Choose countries
</p>
<div
:class="showCountries ? '' : 'hidden'"
class="z-20 w-full max-h-72 overflow-y-scroll mx-3"
>
<button
class="rounded-md py-1 px-2 hover:bg-nord-white2 dark:hover:bg-nord-gray2 transition-colors duration-100 ease-out"
@click="toggleCountries"
>
Toggle all
</button>
<ul
class="text-sm"
v-for="country in $store.state.countries"
:key="country"
>
<li>
<div
class="flex items-center p-2 rounded hover:bg-nord-white2 dark:hover:bg-nord-gray2"
>
<input
:id="country.iso_3166_1"
type="checkbox"
:value="country.iso_3166_1"
:checked="selectedCountries.has(country.iso_3166_1)"
class="w-4 h-4 text-blue-600 bg-nord-frost1 rounded border-nord-frost1 focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-700 focus:ring-2"
@change="changeCountrySelection"
/>
<label
:for="country.iso_3166_1"
class="ml-2 w-full text-sm font-medium text-gray-900 rounded dark:text-gray-300"
>
<img
class="w-6 inline mr-1"
:src="
'https://flagcdn.com/w20/' +
country.iso_3166_1.toLowerCase() +
'.png'
"
:srcset="
'https://flagcdn.com/w40/' +
country.iso_3166_1.toLowerCase() +
'.png 2x'
"
:alt="country.iso_3166_1"
/>{{ country.name }}
</label>
</div>
</li>
</ul>
</div>
</div>

<div class="ml-auto flex flex-col xs2:flex-row">
<button
class="ripple transition-colors duration-100 ease-out hover:bg-nord-white1 dark:hover:bg-nord-gray4 mt-2 xs2:mt-0 xs2:ml-2 py-2 px-4 rounded"
@click="toggleModal"
>
Close
</button>
</div>
</div>
</div>
</div>
</template>

<script>
export default {
data() {
return {
loading: false,
changed: false,
showCountries: true,
showQualities: false,
selectedCountries: new Set(),
}
},
created() {
this.selectedCountries = this.$store.state.selectedCountries
},
mounted() {
window.addEventListener("keydown", this.keyboardEvent)
},
methods: {
keyboardEvent(event) {
if (event.code == "Escape") {
this.toggleModal()
}
},
toggleModal() {
if(this.changed){
this.$store.dispatch("setSelectedCountries", this.selectedCountries);
}
this.$emit("close", this.changed)
},
toggleCountries(){
this.changed = true
if(this.selectedCountries.size != this.$store.state.countries.length){
for(let i = 0; i < this.$store.state.countries.length; i++){
this.selectedCountries.add(this.$store.state.countries[i].iso_3166_1)
}
}
else{
this.selectedCountries.clear()
}
},
changeCountrySelection(element){
this.changed = true
if (element.target.checked){
this.selectedCountries.add(element.target.value)
}
else{
if(selectedCountries.has(element.target.value)){
this.selectedCountries.delete(element.target.value)
}
}
}
},
beforeUnmount() {
window.removeEventListener("keydown", this.keyboardEvent)
},
}
</script>
7 changes: 4 additions & 3 deletions xradio-vue/src/components/stationCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,14 @@
>
<img
v-if="station.favicon != ''"
class="h-20 rounded object-contain"
class="h-16 rounded object-contain
dark:bg-white"
:src="station.favicon"
alt="Logo"
/>
<svg
v-else
class="fill-current h-20 rounded dark:text-nord-white3"
class="fill-current h-16 rounded dark:text-nord-white3"
viewBox="0 0 24 24"
alt="Logo"
>
Expand All @@ -38,7 +39,7 @@
<div>
<span v-if="station.countrycode != ''">
<img
class="w-6 inline"
class="w-6 inline mr-1"
:src="
'https://flagcdn.com/w20/' +
station.countrycode.toLowerCase() +
Expand Down
8 changes: 3 additions & 5 deletions xradio-vue/src/components/stationList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
>
<img
v-if="station.favicon != ''"
class="h-10 w-10 rounded object-contain"
class="h-10 w-10 rounded object-contain dark:bg-white"
:src="station.favicon"
alt="Logo"
/>
Expand All @@ -42,19 +42,17 @@
dark:text-nord-white3
w-full
font-bold
content-center
items-center
truncate
col-span-4
sm:col-span-7
"
>
<h2>
<h2 class="truncate" :title="station.name">
{{ station.name }}
</h2>
<img
v-if="station.countrycode != ''"
class="w-6 inline"
class="w-6 inline mr-1"
:class="station.homepage != '' ? '' : 'col-span-2'"
:src="
'https://flagcdn.com/w20/' +
Expand Down
10 changes: 5 additions & 5 deletions xradio-vue/src/router/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { createRouter, createWebHashHistory } from 'vue-router'
import home from '../views/home.vue'
import home from '../views/Home.vue'

const routes = [
{
Expand All @@ -11,28 +11,28 @@ const routes = [
path: '/about',
name: 'about',
component: function () {
return import(/* webpackChunkName: "about" */ '../views/about.vue')
return import(/* webpackChunkName: "about" */ '../views/About.vue')
}
},
{
path: '/favorites',
name: 'favorites',
component: function () {
return import(/* webpackChunkName: "favorites" */ '../views/favorites.vue')
return import(/* webpackChunkName: "favorites" */ '../views/Favorites.vue')
}
},
{
path: '/searchHub',
name: 'searchHub',
component: function () {
return import(/* webpackChunkName: "search" */ '../views/searchHub.vue')
return import(/* webpackChunkName: "search" */ '../views/SearchHub.vue')
}
},
{
path: '/search/:mode/:q',
name: 'search',
component: function () {
return import(/* webpackChunkName: "search" */ '../views/search.vue')
return import(/* webpackChunkName: "search" */ '../views/Search.vue')
}
}
]
Expand Down
Loading

0 comments on commit 4d46629

Please sign in to comment.