Add JSDoc documentation and file headers to all source files
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
+29
-5
@@ -1,12 +1,28 @@
|
||||
// The Lucia project.
|
||||
// Copyright 2023-2026 DSP, inc. All rights reserved.
|
||||
// Authors:
|
||||
// chiayin.kuo@dsp.im (chiayin), 2023/1/31
|
||||
// imacat.yang@dsp.im (imacat), 2023/9/23
|
||||
// cindy.chang@dsp.im (Cindy Chang), 2024/5/30
|
||||
/**
|
||||
* @module stores/pageAdmin Navigation state management for tracking
|
||||
* active, previous, and pending page states across route transitions
|
||||
* and SweetAlert2 modal interactions.
|
||||
*/
|
||||
|
||||
import { defineStore } from "pinia";
|
||||
import { mapPageNameToCapitalUnifiedName } from "../utils/pageUtils";
|
||||
|
||||
/** @constant {boolean} Enable console logging for page admin debugging. */
|
||||
const printPageAdminLog = false;
|
||||
|
||||
// There are at least two ways to trigger a page navigation:
|
||||
// clicking the navigation button and refreshing the page.
|
||||
// Therefore, we need to handle page transitions caused by both of these methods.
|
||||
// 至少有兩種方式引起畫面的導向: 點選導覽按鈕與重新整理網頁
|
||||
// 因此至少要處理這兩種方式所引起的畫面切換
|
||||
/**
|
||||
* Pinia store for managing navigation page state transitions.
|
||||
*
|
||||
* Handles two navigation triggers: clicking navigation buttons and
|
||||
* page refreshes. Manages pending states for SweetAlert2 modal
|
||||
* confirmation flows.
|
||||
*/
|
||||
export const usePageAdminStore = defineStore('pageAdminStore', {
|
||||
state: () => ({
|
||||
activePage: 'MAP',
|
||||
@@ -20,6 +36,10 @@ export const usePageAdminStore = defineStore('pageAdminStore', {
|
||||
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) {
|
||||
@@ -98,6 +118,10 @@ export const usePageAdminStore = defineStore('pageAdminStore', {
|
||||
printPageAdminLog && console.log('clearShouldKeepPreviousPageBoolean()');
|
||||
this.shouldKeepPreviousPage = false;
|
||||
},
|
||||
/**
|
||||
* Stores the name of the currently opened map file.
|
||||
* @param {string} fileName - The file name.
|
||||
*/
|
||||
setCurrentMapFile(fileName){
|
||||
this.currentMapFile = fileName;
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user