Files
swingmusic-extended/src/stores/tabs.ts
T
geoffrey45 9432332243 default to qeueu tab in right sidebar
- fix progress bar issue on chrome
- fix image not showing on media notification
2022-05-11 20:37:52 +03:00

35 lines
667 B
TypeScript

import { defineStore } from "pinia";
import perks from "../composables/perks";
const tablist = {
home: "home",
search: "search",
queue: "queue",
};
export default defineStore("tabs", {
state: () => ({
tabs: tablist,
current: tablist.queue,
}),
actions: {
changeTab(tab: string) {
if (tab === this.tabs.queue) {
setTimeout(() => {
perks.focusCurrent();
}, 500);
}
this.current = tab;
},
switchToQueue() {
this.changeTab(tablist.queue);
},
switchToSearch() {
this.changeTab(tablist.search);
},
switchToHome() {
this.changeTab(tablist.home);
},
},
});