feat(dashboard): enhance dashboard settings UI and add item management scripts

- Updated the dashboard settings partial to include a semi-transparent background for better visibility.
- Introduced a new script for validating the syntax of dashboard item scripts, ensuring better error handling and diagnostics.
- Added a comprehensive JavaScript file for managing dashboard items, including fetching, rendering, editing, and deleting items.
- Implemented various utility functions for handling alerts, rewards, and modal interactions within the item management interface.
- Created temporary scripts for debugging and parsing errors in item scripts, aiding in development and maintenance.
This commit is contained in:
Shni
2025-10-15 15:53:50 -05:00
parent 818dbba654
commit 408ac0e3fb
14 changed files with 441 additions and 772 deletions

20
tmp_token_trace.js Normal file
View File

@@ -0,0 +1,20 @@
const fs=require('fs'); const acorn=require('acorn');
const path='/home/shni/amayo/amayo/src/server/views/partials/dashboard/dashboard_items.ejs';
const s=fs.readFileSync(path,'utf8'); const m=s.match(/<script[^>]*>([\s\S]*?)<\/script>/i); if(!m){ console.error('NO_SCRIPT'); process.exit(2);} const src=m[1];
const tok = acorn.tokenizer(src, {ecmaVersion:2020});
let t; const stack=[];
while((t=tok.getToken()).type.label!=='eof'){
const lb = t.type.label;
if(lb==='(' || lb==='[' || lb==='{'){
stack.push({ch:lb,pos:t.start});
if(t.start>2600 && t.start<3100) console.log('PUSH', lb, 'pos', t.start, 'stacklen', stack.length);
}
if(lb===')' || lb===']' || lb==='}'){
const expected = (lb===')'? '(' : (lb===']'? '[' : '{'));
if(t.start>2600 && t.start<3100) console.log('POP', lb, 'pos', t.start, 'expect', expected, 'stacklen(before)', stack.length);
if(stack.length===0){ console.error('UNMATCHED_CLOSE', lb, 'at', t.start); process.exit(3); }
const top = stack.pop();
if(top.ch !== expected){ console.error('MISMATCH', top, 'vs', lb, 'at', t.start); process.exit(4); }
}
}
console.log('FINISHED, stacklen', stack.length);