mirror of
https://codeberg.org/Hyperpipe/Hyperpipe
synced 2025-06-27 20:58:01 +02:00
enh: improve compact ui
This commit is contained in:
parent
aca1ce3bb7
commit
88e1e9cadd
7 changed files with 48 additions and 32 deletions
|
@ -131,10 +131,13 @@ onBeforeMount(() => {
|
||||||
if (store.theme)
|
if (store.theme)
|
||||||
document.body.setAttribute('data-theme', useAutoTheme(store.theme));
|
document.body.setAttribute('data-theme', useAutoTheme(store.theme));
|
||||||
|
|
||||||
if (store.compact == 'true') document.body.setAttribute('data-compact', '');
|
if (store.compact == 'true') document.body.classList.add('compact');
|
||||||
|
|
||||||
/* Prefers Reduced Motion */
|
/* Prefers Reduced Motion */
|
||||||
if (store.prm == 'true' || matchMedia('(prefers-reduced-motion)').matches)
|
if (
|
||||||
|
store.prm !== 'false' &&
|
||||||
|
(store.prm === 'true' || matchMedia('(prefers-reduced-motion)').matches)
|
||||||
|
)
|
||||||
document.body.classList.add('prm');
|
document.body.classList.add('prm');
|
||||||
|
|
||||||
/* Set the default locale if set */
|
/* Set the default locale if set */
|
||||||
|
|
|
@ -385,7 +385,7 @@ img {
|
||||||
display: grid;
|
display: grid;
|
||||||
}
|
}
|
||||||
@media (max-width: 530px) {
|
@media (max-width: 530px) {
|
||||||
[data-compact] .grid-3 {
|
body.compact .grid-3 {
|
||||||
--col: 2;
|
--col: 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -393,7 +393,7 @@ img {
|
||||||
.grid-3 {
|
.grid-3 {
|
||||||
--col: 2;
|
--col: 2;
|
||||||
}
|
}
|
||||||
[data-compact] .grid-3 {
|
body.compact .grid-3 {
|
||||||
--col: 3;
|
--col: 3;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -405,7 +405,7 @@ img {
|
||||||
.grid-3 {
|
.grid-3 {
|
||||||
--col: 3;
|
--col: 3;
|
||||||
}
|
}
|
||||||
[data-compact] .grid-3 {
|
body.compact .grid-3 {
|
||||||
--col: 4;
|
--col: 4;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -416,7 +416,7 @@ img {
|
||||||
.grid-3 {
|
.grid-3 {
|
||||||
--col: 4;
|
--col: 4;
|
||||||
}
|
}
|
||||||
[data-compact] .grid-3 {
|
body.compact .grid-3 {
|
||||||
--col: 5;
|
--col: 5;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,15 +50,15 @@ defineEmits(['open-album']);
|
||||||
cursor: default;
|
cursor: default;
|
||||||
}
|
}
|
||||||
|
|
||||||
[data-compact] .card {
|
body.compact .card {
|
||||||
min-height: 12rem;
|
min-height: 12rem;
|
||||||
width: 10rem;
|
width: 10rem;
|
||||||
}
|
}
|
||||||
[data-compact] .card-bg {
|
body.compact .card-bg {
|
||||||
width: 7rem;
|
width: 7rem;
|
||||||
height: 7rem;
|
height: 7rem;
|
||||||
}
|
}
|
||||||
[data-compact] .card-text {
|
body.compact .card-text {
|
||||||
margin-top: 0.25rem;
|
margin-top: 0.25rem;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -83,6 +83,7 @@ p {
|
||||||
--line: 3;
|
--line: 3;
|
||||||
display: -webkit-box;
|
display: -webkit-box;
|
||||||
-webkit-line-clamp: var(--line);
|
-webkit-line-clamp: var(--line);
|
||||||
|
line-clamp: var(--line);
|
||||||
-webkit-box-orient: vertical;
|
-webkit-box-orient: vertical;
|
||||||
hyphens: auto;
|
hyphens: auto;
|
||||||
margin: 1rem;
|
margin: 1rem;
|
||||||
|
|
|
@ -78,10 +78,9 @@ function setCodec(codec) {
|
||||||
window.audioPlayer.configure('preferredAudioCodecs', codec.split(':'));
|
window.audioPlayer.configure('preferredAudioCodecs', codec.split(':'));
|
||||||
}
|
}
|
||||||
|
|
||||||
function setPRM(prm) {
|
function setStoreAndClass(key, val) {
|
||||||
setStore('prm', prm);
|
setStore(key, val);
|
||||||
if (prm) document.body.classList.add('prm');
|
document.body.classList[val ? 'add' : 'remove'](key);
|
||||||
else document.body.classList.remove('prm');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function setPitch(pitch) {
|
function setPitch(pitch) {
|
||||||
|
@ -119,7 +118,7 @@ async function setAuth(e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function setStreamApi(e) {
|
function setStreamApi(e) {
|
||||||
if (e.target.value) store.setItem('streamapi', e.target.value)
|
if (e.target.value) store.setItem('streamapi', e.target.value);
|
||||||
else store.removeItem('streamapi');
|
else store.removeItem('streamapi');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -144,7 +143,7 @@ onMounted(() => {
|
||||||
getStoreBool('next', next, true);
|
getStoreBool('next', next, true);
|
||||||
getStoreBool('hls', hls, false);
|
getStoreBool('hls', hls, false);
|
||||||
getStoreBool('compact', compact, false);
|
getStoreBool('compact', compact, false);
|
||||||
getStoreBool('prm', prm, false);
|
getStoreBool('prm', prm, matchMedia('(prefers-reduced-motion)').matches);
|
||||||
getStoreBool('cc', cc, false);
|
getStoreBool('cc', cc, false);
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
@ -175,7 +174,7 @@ onMounted(() => {
|
||||||
name="pref-chk-compact"
|
name="pref-chk-compact"
|
||||||
id="pref-chk-compact"
|
id="pref-chk-compact"
|
||||||
class="input"
|
class="input"
|
||||||
@change="setStore('compact', $event.target.checked)"
|
@change="setStoreAndClass('compact', $event.target.checked)"
|
||||||
v-model="compact" />
|
v-model="compact" />
|
||||||
<label for="pref-chk-compact">{{ t('pref.compact') }}</label>
|
<label for="pref-chk-compact">{{ t('pref.compact') }}</label>
|
||||||
</div>
|
</div>
|
||||||
|
@ -186,7 +185,7 @@ onMounted(() => {
|
||||||
name="pref-chk-prm"
|
name="pref-chk-prm"
|
||||||
id="pref-chk-prm"
|
id="pref-chk-prm"
|
||||||
class="input"
|
class="input"
|
||||||
@change="setPRM($event.target.checked)"
|
@change="setStoreAndClass('prm', $event.target.checked)"
|
||||||
v-model="prm" />
|
v-model="prm" />
|
||||||
<label for="pref-chk-prm">{{ t('pref.prm') }}</label>
|
<label for="pref-chk-prm">{{ t('pref.prm') }}</label>
|
||||||
</div>
|
</div>
|
||||||
|
@ -418,8 +417,7 @@ onMounted(() => {
|
||||||
type="text"
|
type="text"
|
||||||
@change="setStreamApi"
|
@change="setStreamApi"
|
||||||
:value="getStore('streamapi') || ''"
|
:value="getStore('streamapi') || ''"
|
||||||
placeholder="Default (Piped API)"
|
placeholder="Default (Piped API)" />
|
||||||
/>
|
|
||||||
|
|
||||||
<div class="table-wrap">
|
<div class="table-wrap">
|
||||||
<table>
|
<table>
|
||||||
|
|
|
@ -186,7 +186,7 @@ span.content {
|
||||||
padding: 1rem;
|
padding: 1rem;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: flex-start;
|
align-items: flex-start;
|
||||||
flex-basis: calc(calc(100% - 120px) - 4rem);
|
flex-grow: 1;
|
||||||
}
|
}
|
||||||
span.bi-three-dots-vertical {
|
span.bi-three-dots-vertical {
|
||||||
margin: 2rem;
|
margin: 2rem;
|
||||||
|
@ -214,15 +214,24 @@ button.bi-three-dots-vertical {
|
||||||
color: indianred;
|
color: indianred;
|
||||||
}
|
}
|
||||||
|
|
||||||
[data-compact] .card {
|
body.compact .card {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
|
padding: 0 0.5rem;
|
||||||
}
|
}
|
||||||
[data-compact] .song-bg {
|
body.compact .song-bg {
|
||||||
width: 70px;
|
width: 70px;
|
||||||
height: 70px;
|
height: 70px;
|
||||||
}
|
}
|
||||||
|
body.compact .content :is(h4, a) {
|
||||||
|
overflow: hidden;
|
||||||
|
line-clamp: 1;
|
||||||
|
-webkit-line-clamp: 1;
|
||||||
|
display: -webkit-box;
|
||||||
|
hyphens: auto;
|
||||||
|
-webkit-box-orient: vertical;
|
||||||
|
}
|
||||||
|
|
||||||
.prm .card {
|
body.prm .card {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0.5rem;
|
padding: 0.5rem;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@ import { defineStore } from 'pinia';
|
||||||
|
|
||||||
import en from '@/locales/en.json';
|
import en from '@/locales/en.json';
|
||||||
|
|
||||||
export const SUPPORTED_LOCALES = [
|
export const SUPPORTED_LOCALES = Object.freeze([
|
||||||
{
|
{
|
||||||
code: 'ar',
|
code: 'ar',
|
||||||
name: 'عربي',
|
name: 'عربي',
|
||||||
|
@ -147,7 +147,7 @@ export const SUPPORTED_LOCALES = [
|
||||||
code: 'zh_Hant',
|
code: 'zh_Hant',
|
||||||
name: '中文(繁體)',
|
name: '中文(繁體)',
|
||||||
},
|
},
|
||||||
];
|
]);
|
||||||
|
|
||||||
export const useNav = defineStore('nav', () => {
|
export const useNav = defineStore('nav', () => {
|
||||||
const state = reactive({
|
const state = reactive({
|
||||||
|
@ -176,11 +176,17 @@ export const useI18n = defineStore('i18n', () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
function setupLocale(code) {
|
function setupLocale(code) {
|
||||||
|
if (code === 'en') return setLocale('en');
|
||||||
if (SUPPORTED_LOCALES.some(i => i.code == code))
|
if (SUPPORTED_LOCALES.some(i => i.code == code))
|
||||||
import(`@/locales/${code}.json`)
|
import(`@/locales/${code}.json`)
|
||||||
.then(mod => mod.default)
|
.then(mod => mod.default)
|
||||||
.then(mod => {
|
.then(mod => {
|
||||||
map.value[code] = mod;
|
map.value[code] = mod;
|
||||||
|
setLocale(code);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function setLocale(code) {
|
||||||
locale.value = code;
|
locale.value = code;
|
||||||
localStorage.locale ??= code;
|
localStorage.locale ??= code;
|
||||||
if (localStorage.to_cc == 'true') {
|
if (localStorage.to_cc == 'true') {
|
||||||
|
@ -188,7 +194,6 @@ export const useI18n = defineStore('i18n', () => {
|
||||||
if (cc) localStorage.cc = cc;
|
if (cc) localStorage.cc = cc;
|
||||||
else localStorage.cc = '';
|
else localStorage.cc = '';
|
||||||
} else localStorage.cc = '';
|
} else localStorage.cc = '';
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return { locale, map, t, setupLocale };
|
return { locale, map, t, setupLocale };
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue