Files
swingmusic-extended/src/stores/tabs.js
T
geoffrey45 658e7cdbb7 move global search input to a general location
- create a global search store
- create a half-baked context menu store
-
2022-03-12 08:56:38 +03:00

35 lines
658 B
JavaScript

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.home,
}),
actions: {
changeTab(tab) {
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);
},
},
});