mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-05-03 13:36:04 +02:00
feat: add breadcrumb components and main dialog layout functionality
This commit is contained in:
+55
-1
@@ -27,6 +27,7 @@ export const useUiStore = defineStore('Ui', () => {
|
||||
const notifiedMenus = ref([]);
|
||||
const shiftHeld = ref(false);
|
||||
const trayIconNotify = ref(false);
|
||||
const dialogCrumbs = ref([]);
|
||||
|
||||
watch(ctrlR, (isPressed) => {
|
||||
if (isPressed) {
|
||||
@@ -58,6 +59,54 @@ export const useUiStore = defineStore('Ui', () => {
|
||||
}
|
||||
});
|
||||
|
||||
function pushDialogCrumb(type, id, label = '') {
|
||||
if (!type || !id) {
|
||||
return;
|
||||
}
|
||||
const items = dialogCrumbs.value;
|
||||
const last = items[items.length - 1];
|
||||
if (last && last.type === type && last.id === id) {
|
||||
if (label && last.label !== label) {
|
||||
last.label = label;
|
||||
}
|
||||
return;
|
||||
}
|
||||
const existingIndex = items.findIndex(
|
||||
(item) => item.type === type && item.id === id
|
||||
);
|
||||
if (existingIndex !== -1) {
|
||||
items.splice(existingIndex + 1);
|
||||
if (label) {
|
||||
items[existingIndex].label = label;
|
||||
}
|
||||
return;
|
||||
}
|
||||
items.push({ type, id, label: label || id });
|
||||
}
|
||||
|
||||
function setDialogCrumbLabel(type, id, label) {
|
||||
if (!type || !id || !label) {
|
||||
return;
|
||||
}
|
||||
const item = dialogCrumbs.value.find(
|
||||
(entry) => entry.type === type && entry.id === id
|
||||
);
|
||||
if (item) {
|
||||
item.label = label;
|
||||
}
|
||||
}
|
||||
|
||||
function jumpDialogCrumb(index) {
|
||||
if (index < 0 || index >= dialogCrumbs.value.length) {
|
||||
return;
|
||||
}
|
||||
dialogCrumbs.value.splice(index + 1);
|
||||
}
|
||||
|
||||
function clearDialogCrumbs() {
|
||||
dialogCrumbs.value = [];
|
||||
}
|
||||
|
||||
// Make sure file drops outside of the screenshot manager don't navigate to the file path dropped.
|
||||
// This issue persists on prompts created with prompt(), unfortunately. Not sure how to fix that.
|
||||
document.body.addEventListener('drop', function (e) {
|
||||
@@ -133,10 +182,15 @@ export const useUiStore = defineStore('Ui', () => {
|
||||
return {
|
||||
notifiedMenus,
|
||||
shiftHeld,
|
||||
dialogCrumbs,
|
||||
|
||||
notifyMenu,
|
||||
removeNotify,
|
||||
showConsole,
|
||||
updateTrayIconNotify
|
||||
updateTrayIconNotify,
|
||||
pushDialogCrumb,
|
||||
setDialogCrumbLabel,
|
||||
jumpDialogCrumb,
|
||||
clearDialogCrumbs
|
||||
};
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user