mirror of
https://codeberg.org/Hyperpipe/Hyperpipe
synced 2025-06-28 05:08:00 +02:00
Closes #110, Added support for Portuguese
This commit is contained in:
parent
7c5be09194
commit
c6c20eac1f
7 changed files with 55 additions and 33 deletions
|
@ -6,7 +6,7 @@ import SongItem from './SongItem.vue';
|
|||
import AlbumItem from './AlbumItem.vue';
|
||||
|
||||
import { getJsonPiped, getPipedQuery } from '@/scripts/fetch.js';
|
||||
import { useRoute, useWrap } from '@/scripts/util.js';
|
||||
import { useRoute, useWrap, useShare } from '@/scripts/util.js';
|
||||
import { useCreatePlaylist, useRemovePlaylist } from '@/scripts/db.js';
|
||||
|
||||
import { useResults, useArtist } from '@/stores/results.js';
|
||||
|
@ -77,9 +77,18 @@ const shuffleAdd = () => {
|
|||
removeSong = i => {
|
||||
console.log(i);
|
||||
|
||||
try {
|
||||
results.items.songs.items.splice(i, 1);
|
||||
} catch {}
|
||||
results.items.songs.items.splice(i, 1);
|
||||
},
|
||||
shareAlbum = () => {
|
||||
const data = {
|
||||
title: `View ${results.items?.songs?.title} on Hyperpipe`,
|
||||
url:
|
||||
location.origin +
|
||||
(results.album.startsWith('/') ? '' : '/') +
|
||||
results.album,
|
||||
};
|
||||
|
||||
useShare(data);
|
||||
},
|
||||
saveAlbum = () => {
|
||||
const urls = results.items?.songs?.items?.map(item => ({
|
||||
|
@ -234,6 +243,8 @@ onDeactivated(() => {
|
|||
class="bi bi-bookmark-plus clickable"
|
||||
@click="saveAlbum"></button>
|
||||
|
||||
<button class="bi bi-share clickable" @click="shareAlbum"></button>
|
||||
|
||||
<button
|
||||
class="bi bi-plus-lg clickable"
|
||||
@click="
|
||||
|
|
|
@ -3,7 +3,7 @@ import { ref, onMounted } from 'vue';
|
|||
|
||||
import { getJsonAuth } from '@/scripts/fetch.js';
|
||||
import { useRand } from '@/scripts/colors.js';
|
||||
import { useStore } from '@/scripts/util.js';
|
||||
import { useStore, useShare } from '@/scripts/util.js';
|
||||
import { useUpdatePlaylist } from '@/scripts/db.js';
|
||||
|
||||
import { useResults, useArtist } from '@/stores/results.js';
|
||||
|
@ -85,29 +85,13 @@ const openSong = el => {
|
|||
emit('remove', props.index),
|
||||
);
|
||||
},
|
||||
Share = async () => {
|
||||
if ('share' in navigator) {
|
||||
const data = {
|
||||
title: `Listen to ${props.title} by ${props.author} on Hyperpipe`,
|
||||
url: location.origin + props.play,
|
||||
};
|
||||
Share = () => {
|
||||
const data = {
|
||||
title: `Listen to ${props.title} by ${props.author} on Hyperpipe`,
|
||||
url: location.origin + props.play,
|
||||
};
|
||||
|
||||
try {
|
||||
await navigator.share(data);
|
||||
console.log('Done Sharing!');
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
}
|
||||
} else {
|
||||
navigator.clipboard.writeText(location.host + props.play).then(
|
||||
() => {
|
||||
alert('Copied to Clipboard');
|
||||
},
|
||||
err => {
|
||||
console.log(err);
|
||||
},
|
||||
);
|
||||
}
|
||||
useShare(data);
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue