convert state.js -> typescript

This commit is contained in:
geoffrey45 2022-03-14 21:04:28 +03:00
parent fb4b248553
commit d98257de90

View File

@ -1,65 +1,48 @@
import { ref } from "@vue/reactivity"; import { ref } from "@vue/reactivity";
import { reactive } from "vue"; import { reactive } from "vue";
import * as i from "../interfaces";
const search_query = ref(""); const search_query = ref("");
const queue = ref([ const queue = ref(
{ Array<i.Track>({
title: "Nothing played yet", title: "Nothing played yet",
artists: ["... blah blah blah"], artists: ["... blah blah blah"],
image: "http://0.0.0.0:8900/images/defaults/5.webp", image: "http://0.0.0.0:8900/images/thumbnails/4.webp",
_id: { trackid: "",
$oid: "", })
}, );
},
]);
const folder_song_list = ref([]); const folder_song_list = ref([]);
const folder_list = ref([]); const folder_list = ref([]);
const current = ref({ const current = ref(<i.Track>{
title: "Nothing played yet", title: "Nothing played yet",
artists: ["... blah blah blah"], artists: ["... blah blah blah"],
image: "http://0.0.0.0:8900/images/defaults/1.webp", image: "http://0.0.0.0:8900/images/thumbnails/4.webp",
_id: { trackid: "",
$oid: "",
},
}); });
const prev = ref({ const prev = ref(<i.Track>{
title: "The previous song", title: "Nothing played yet",
artists: ["... blah blah blah"], artists: ["... blah blah blah"],
_id: { image: "http://0.0.0.0:8900/images/thumbnails/4.webp",
$oid: "", trackid: "",
},
}); });
const album = reactive({ const album = reactive({
tracklist: [], tracklist: Array<i.Track>(),
info: {}, info: <i.AlbumInfo>{},
artists: [], artists: Array<i.Artist>(),
bio: "", bio: "",
}); });
const filters = ref([]);
const magic_flag = ref(false);
const loading = ref(false); const loading = ref(false);
const is_playing = ref(false); const is_playing = ref(false);
const settings = reactive({ const settings = reactive({
uri: "http://0.0.0.0:9876", uri: "http://0.0.0.0:9876",
}); });
const tablist = {
home: "home",
search: "search",
queue: "queue",
};
const current_tab = ref(tablist.home);
export default { export default {
search_query, search_query,
queue, queue,
@ -67,12 +50,8 @@ export default {
folder_list, folder_list,
current, current,
prev, prev,
filters,
magic_flag,
loading, loading,
is_playing, is_playing,
album, album,
settings, settings,
current_tab,
tablist
}; };