fix: correct flag group open state logic for better user experience
Browse files- static/index.html +2 -2
static/index.html
CHANGED
|
@@ -4482,7 +4482,7 @@ function drawFlags(){
|
|
| 4482 |
head.append(mark("meta",`${pending.length} ${pending.length===1?"讚讬讜讜讞":"讚讬讜讜讞讬诐"} 诪志${byUser.size} ${byUser.size===1?"诪讚讜讜讞/转":"诪讚讜讜讞讬诐"}, 诪拽讜讘爪讬诐 诇驻讬 讛诪讚讜讜讞/转.`,"p"));
|
| 4483 |
for(const [who,flags] of [...byUser].sort((a,b)=>b[1].length-a[1].length||a[0].localeCompare(b[0]))){ // the most reports first
|
| 4484 |
const group=document.createElement("details"), summary=document.createElement("summary");
|
| 4485 |
-
group.className="flag-group"; group.open=flagGroupOpen[who]
|
| 4486 |
summary.append(mark("",who||"诇诇讗 诪砖转诪砖","b"),mark("meta",` 路 ${flags.length} ${flags.length===1?"讚讬讜讜讞":"讚讬讜讜讞讬诐"}`)); group.append(summary); box.append(group);
|
| 4487 |
for(const f of flags){
|
| 4488 |
const card=mark("card flag-review",""), title=mark("",f.he||f.phrase,"h2"), result=f.result||{}, issues=flagIssues(f);
|
|
@@ -4538,7 +4538,7 @@ function drawFlags(){
|
|
| 4538 |
}
|
| 4539 |
}
|
| 4540 |
}
|
| 4541 |
-
const flagGroupOpen={}; // reporter -> whether their group of reports is open;
|
| 4542 |
let systemActivityOpen=false; // the recent activity starts closed; a redraw keeps it as the teacher left it
|
| 4543 |
function drawSystemActivity(box){
|
| 4544 |
const outer=mark("card system-activity",""), card=document.createElement("details"), summary=document.createElement("summary");
|
|
|
|
| 4482 |
head.append(mark("meta",`${pending.length} ${pending.length===1?"讚讬讜讜讞":"讚讬讜讜讞讬诐"} 诪志${byUser.size} ${byUser.size===1?"诪讚讜讜讞/转":"诪讚讜讜讞讬诐"}, 诪拽讜讘爪讬诐 诇驻讬 讛诪讚讜讜讞/转.`,"p"));
|
| 4483 |
for(const [who,flags] of [...byUser].sort((a,b)=>b[1].length-a[1].length||a[0].localeCompare(b[0]))){ // the most reports first
|
| 4484 |
const group=document.createElement("details"), summary=document.createElement("summary");
|
| 4485 |
+
group.className="flag-group"; group.open=flagGroupOpen[who]===true; group.ontoggle=()=>{ flagGroupOpen[who]=group.open; };
|
| 4486 |
summary.append(mark("",who||"诇诇讗 诪砖转诪砖","b"),mark("meta",` 路 ${flags.length} ${flags.length===1?"讚讬讜讜讞":"讚讬讜讜讞讬诐"}`)); group.append(summary); box.append(group);
|
| 4487 |
for(const f of flags){
|
| 4488 |
const card=mark("card flag-review",""), title=mark("",f.he||f.phrase,"h2"), result=f.result||{}, issues=flagIssues(f);
|
|
|
|
| 4538 |
}
|
| 4539 |
}
|
| 4540 |
}
|
| 4541 |
+
const flagGroupOpen={}; // reporter -> whether their group of reports is open; closed until the teacher opens it
|
| 4542 |
let systemActivityOpen=false; // the recent activity starts closed; a redraw keeps it as the teacher left it
|
| 4543 |
function drawSystemActivity(box){
|
| 4544 |
const outer=mark("card system-activity",""), card=document.createElement("details"), summary=document.createElement("summary");
|