Apply repository-wide ESLint auto-fix formatting pass
Co-Authored-By: Codex <codex@openai.com>
This commit is contained in:
+52
-33
@@ -23,56 +23,65 @@ const printPageAdminLog = false;
|
||||
* page refreshes. Manages pending states for SweetAlert2 modal
|
||||
* confirmation flows.
|
||||
*/
|
||||
export const usePageAdminStore = defineStore('pageAdminStore', {
|
||||
export const usePageAdminStore = defineStore("pageAdminStore", {
|
||||
state: () => ({
|
||||
activePage: 'MAP',
|
||||
previousPage: 'MAP',
|
||||
pendingActivePage: 'FILES',
|
||||
isPagePending: false,
|
||||
shouldKeepPreviousPage: false, // false -- meaning modal is not pressed as "NO"
|
||||
activePageComputedByRoute: "MAP",
|
||||
currentMapFile: '',
|
||||
activePage: "MAP",
|
||||
previousPage: "MAP",
|
||||
pendingActivePage: "FILES",
|
||||
isPagePending: false,
|
||||
shouldKeepPreviousPage: false, // false -- meaning modal is not pressed as "NO"
|
||||
activePageComputedByRoute: "MAP",
|
||||
currentMapFile: "",
|
||||
}),
|
||||
getters: {
|
||||
},
|
||||
getters: {},
|
||||
actions: {
|
||||
/**
|
||||
* Sets the active page based on the last matched route record.
|
||||
* @param {Array} routeMatched - The route.matched array.
|
||||
*/
|
||||
setActivePageComputedByRoute(routeMatched){
|
||||
if (routeMatched.length && routeMatched[routeMatched.length - 1]
|
||||
&& routeMatched[routeMatched.length - 1].name) {
|
||||
printPageAdminLog && console.log('setActivePageComputedByRoute()', mapPageNameToCapitalUnifiedName(routeMatched[routeMatched.length - 1].name));
|
||||
setActivePageComputedByRoute(routeMatched) {
|
||||
if (
|
||||
routeMatched.length &&
|
||||
routeMatched[routeMatched.length - 1] &&
|
||||
routeMatched[routeMatched.length - 1].name
|
||||
) {
|
||||
printPageAdminLog &&
|
||||
console.log(
|
||||
"setActivePageComputedByRoute()",
|
||||
mapPageNameToCapitalUnifiedName(
|
||||
routeMatched[routeMatched.length - 1].name,
|
||||
),
|
||||
);
|
||||
this.activePageComputedByRoute = mapPageNameToCapitalUnifiedName(
|
||||
routeMatched[routeMatched.length - 1].name);
|
||||
routeMatched[routeMatched.length - 1].name,
|
||||
);
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Set Active Page; the page which the user is currently visiting
|
||||
* @param {string} activePage
|
||||
* @param {string} activePage
|
||||
*/
|
||||
setActivePage(activePage) {
|
||||
printPageAdminLog && console.log("setActivePage", activePage)
|
||||
printPageAdminLog && console.log("setActivePage", activePage);
|
||||
this.activePage = mapPageNameToCapitalUnifiedName(activePage);
|
||||
},
|
||||
/**
|
||||
* Specify previous page state value.
|
||||
* @param {string} prevPage
|
||||
* @param {string} prevPage
|
||||
*/
|
||||
setPreviousPage(prevPage) {
|
||||
this.previousPage = mapPageNameToCapitalUnifiedName(prevPage);
|
||||
},
|
||||
/**
|
||||
* Set the previous(usually current) pages to the ones we just decide.
|
||||
*/
|
||||
* Set the previous(usually current) pages to the ones we just decide.
|
||||
*/
|
||||
setPreviousPageUsingActivePage() {
|
||||
this.previousPage = this.activePage;
|
||||
},
|
||||
/**
|
||||
* Set the boolean value of status of pending state of the pate
|
||||
* For the control of Swal popup
|
||||
* @param {boolean} boolVal
|
||||
* @param {boolean} boolVal
|
||||
*/
|
||||
setIsPagePendingBoolean(boolVal) {
|
||||
this.isPagePending = boolVal;
|
||||
@@ -81,49 +90,59 @@ export const usePageAdminStore = defineStore('pageAdminStore', {
|
||||
* Copy(transit) the value of pendingActivePage to activePage
|
||||
*/
|
||||
copyPendingPageToActivePage() {
|
||||
printPageAdminLog && console.log('pinia copying this.pendingActivePage', this.pendingActivePage);
|
||||
printPageAdminLog &&
|
||||
console.log(
|
||||
"pinia copying this.pendingActivePage",
|
||||
this.pendingActivePage,
|
||||
);
|
||||
this.activePage = this.pendingActivePage;
|
||||
},
|
||||
},
|
||||
/**
|
||||
* Set Pending active Page, meaning we are not sure if user will chang her mind later on.
|
||||
* Also, start pending state.
|
||||
* Often, user triggers the modal and the pending state starts.
|
||||
* Note: String conversion is needed. For Example, CheckMap is converted into MAP
|
||||
* @param {string} pendingActivePage
|
||||
* @param {string} pendingActivePage
|
||||
*/
|
||||
setPendingActivePage(argPendingActivePage) {
|
||||
printPageAdminLog && console.log('pinia setting this.pendingActivePage', this.pendingActivePage);
|
||||
this.pendingActivePage = mapPageNameToCapitalUnifiedName(argPendingActivePage);
|
||||
printPageAdminLog &&
|
||||
console.log(
|
||||
"pinia setting this.pendingActivePage",
|
||||
this.pendingActivePage,
|
||||
);
|
||||
this.pendingActivePage =
|
||||
mapPageNameToCapitalUnifiedName(argPendingActivePage);
|
||||
},
|
||||
/**
|
||||
* Set Pending active Page to empty string; we call this right after we just decide an active page.
|
||||
* Also, stop pending state.
|
||||
*/
|
||||
clearPendingActivePage(){
|
||||
this.pendingActivePage = '';
|
||||
clearPendingActivePage() {
|
||||
this.pendingActivePage = "";
|
||||
},
|
||||
/**
|
||||
* When user dismiss the popup modal, we don't apply the new page,
|
||||
* instead, we apply the previous page.
|
||||
*/
|
||||
keepPreviousPage() {
|
||||
printPageAdminLog && console.log('pinia keeping this.previousPage', this.previousPage);
|
||||
printPageAdminLog &&
|
||||
console.log("pinia keeping this.previousPage", this.previousPage);
|
||||
this.activePage = this.previousPage;
|
||||
this.shouldKeepPreviousPage = true;
|
||||
},
|
||||
/**
|
||||
* Clean up the state of the boolean related to modal showing phase
|
||||
*/
|
||||
clearShouldKeepPreviousPageBoolean(){
|
||||
printPageAdminLog && console.log('clearShouldKeepPreviousPageBoolean()');
|
||||
clearShouldKeepPreviousPageBoolean() {
|
||||
printPageAdminLog && console.log("clearShouldKeepPreviousPageBoolean()");
|
||||
this.shouldKeepPreviousPage = false;
|
||||
},
|
||||
/**
|
||||
* Stores the name of the currently opened map file.
|
||||
* @param {string} fileName - The file name.
|
||||
*/
|
||||
setCurrentMapFile(fileName){
|
||||
setCurrentMapFile(fileName) {
|
||||
this.currentMapFile = fileName;
|
||||
},
|
||||
},
|
||||
})
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user