feat(web): cache dashboard aggregations with version invalidation
This commit is contained in:
1 parent
91aa3e1f95
commit
9fd277c05f
15 files changed
+399
-30
No files matched your search
@@ -62,7 +62,7 @@ function icon(name) {
|
||||
}
|
||||
|
||||
function renderNav() {
|
||||
const nav = document.querySelector("#bottom-nav");
|
||||
const nav = document.querySelector("#nav-items");
|
||||
const items = NAV_ITEMS.filter(
|
||||
(item) => !item.protected || canAccessProtected(),
|
||||
);
|
||||
@@ -86,8 +86,9 @@ function activeNav(path) {
|
||||
function setTitle(route, path) {
|
||||
const title = route?.title || "看板";
|
||||
document.title = `${title} · 咻咻满 Reaction`;
|
||||
const element = document.querySelector("#topbar-title");
|
||||
if (element) element.textContent = title;
|
||||
document.querySelectorAll(".brand-subtitle").forEach((element) => {
|
||||
element.textContent = title;
|
||||
});
|
||||
activeNav(path);
|
||||
}
|
||||
|
||||
@@ -113,8 +114,6 @@ window.addEventListener("error", (event) => {
|
||||
|
||||
async function boot() {
|
||||
const banner = document.querySelector("#preview-banner");
|
||||
const hint = document.querySelector("#topbar-hint");
|
||||
const authLink = document.querySelector("#topbar-auth");
|
||||
try {
|
||||
const data = await session();
|
||||
authState = {
|
||||
@@ -123,10 +122,14 @@ async function boot() {
|
||||
};
|
||||
if (data?.preview) {
|
||||
banner.hidden = false;
|
||||
if (hint) hint.hidden = false;
|
||||
document.querySelectorAll(".topbar-preview").forEach((element) => {
|
||||
element.hidden = false;
|
||||
});
|
||||
}
|
||||
if (authLink && authState.authEnabled && !authState.authenticated) {
|
||||
authLink.hidden = false;
|
||||
if (authState.authEnabled && !authState.authenticated) {
|
||||
document.querySelectorAll(".topbar-auth").forEach((element) => {
|
||||
element.hidden = false;
|
||||
});
|
||||
}
|
||||
} catch {
|
||||
toast("无法连接看板服务", "error");
|
||||
|
||||
Reference in new issue
Block a user