180 lines
15 KiB
JavaScript
180 lines
15 KiB
JavaScript
import { _ as __nuxt_component_0 } from "./nuxt-link-Ci8vU-Yt.js";
|
|
import { defineComponent, ref, unref, withCtx, openBlock, createBlock, createVNode, createTextVNode, toDisplayString, useSSRContext } from "vue";
|
|
import { ssrRenderAttrs, ssrInterpolate, ssrRenderComponent, ssrRenderList, ssrRenderClass } from "vue/server-renderer";
|
|
import "/app/node_modules/hookable/dist/index.mjs";
|
|
import "/app/node_modules/klona/dist/index.mjs";
|
|
import { a as useI18n } from "../server.mjs";
|
|
import "/app/node_modules/ufo/dist/index.mjs";
|
|
import "/app/node_modules/defu/dist/defu.mjs";
|
|
import "/app/node_modules/ofetch/dist/node.mjs";
|
|
import "#internal/nuxt/paths";
|
|
import "/app/node_modules/unctx/dist/index.mjs";
|
|
import "/app/node_modules/h3/dist/index.mjs";
|
|
import "pinia";
|
|
import "vue-router";
|
|
import "/app/node_modules/cookie-es/dist/index.mjs";
|
|
import "/app/node_modules/destr/dist/index.mjs";
|
|
import "/app/node_modules/ohash/dist/index.mjs";
|
|
import "/app/node_modules/@unhead/vue/dist/index.mjs";
|
|
import "@vue/devtools-api";
|
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
__name: "index",
|
|
__ssrInlineRender: true,
|
|
setup(__props) {
|
|
const { t } = useI18n();
|
|
const loading = ref(true);
|
|
const error = ref(false);
|
|
const stats = ref({
|
|
total_users: 0,
|
|
active_season: null,
|
|
pending_contributions: 0,
|
|
today_xp: 0
|
|
});
|
|
const recentLedger = ref([]);
|
|
const topLeaderboard = ref([]);
|
|
return (_ctx, _push, _parent, _attrs) => {
|
|
const _component_NuxtLink = __nuxt_component_0;
|
|
_push(`<div${ssrRenderAttrs(_attrs)}><div class="mb-8"><h1 class="text-2xl font-bold text-white">${ssrInterpolate(unref(t)("gamification.dashboard.title"))}</h1><p class="text-slate-400 mt-1">${ssrInterpolate(unref(t)("gamification.dashboard.subtitle"))}</p></div>`);
|
|
if (unref(loading)) {
|
|
_push(`<div class="flex items-center justify-center py-20"><div class="text-slate-400 flex items-center gap-3"><svg class="w-5 h-5 animate-spin" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"></path></svg><span>${ssrInterpolate(unref(t)("gamification.dashboard.loading"))}</span></div></div>`);
|
|
} else if (unref(error)) {
|
|
_push(`<div class="bg-rose-500/10 border border-rose-500/30 rounded-xl p-6 mb-8"><p class="text-rose-400">${ssrInterpolate(unref(t)("gamification.dashboard.load_error"))}</p></div>`);
|
|
} else {
|
|
_push(`<!--[--><div class="grid grid-cols-1 sm:grid-cols-2 xl:grid-cols-4 gap-6 mb-8"><div class="bg-slate-800 rounded-xl border border-slate-700 p-6 hover:border-amber-500/50 transition group"><div class="flex items-center justify-between mb-4"><div class="p-2 rounded-lg bg-amber-500/10 text-amber-400 group-hover:bg-amber-500/20 transition"><svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"></path></svg></div></div><h3 class="text-sm font-medium text-slate-400 uppercase tracking-wider">${ssrInterpolate(unref(t)("gamification.dashboard.total_users"))}</h3><p class="text-3xl font-bold text-white mt-2">${ssrInterpolate(unref(stats).total_users)}</p></div><div class="bg-slate-800 rounded-xl border border-slate-700 p-6 hover:border-emerald-500/50 transition group"><div class="flex items-center justify-between mb-4"><div class="p-2 rounded-lg bg-emerald-500/10 text-emerald-400 group-hover:bg-emerald-500/20 transition"><svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 7h8m0 0v8m0-8l-8 8-4-4-6 6"></path></svg></div></div><h3 class="text-sm font-medium text-slate-400 uppercase tracking-wider">${ssrInterpolate(unref(t)("gamification.dashboard.active_season"))}</h3><p class="text-3xl font-bold text-white mt-2">${ssrInterpolate(unref(stats).active_season || unref(t)("gamification.dashboard.none"))}</p></div><div class="bg-slate-800 rounded-xl border border-slate-700 p-6 hover:border-violet-500/50 transition group"><div class="flex items-center justify-between mb-4"><div class="p-2 rounded-lg bg-violet-500/10 text-violet-400 group-hover:bg-violet-500/20 transition"><svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"></path></svg></div></div><h3 class="text-sm font-medium text-slate-400 uppercase tracking-wider">${ssrInterpolate(unref(t)("gamification.dashboard.pending_contributions"))}</h3><p class="text-3xl font-bold text-white mt-2">${ssrInterpolate(unref(stats).pending_contributions)}</p></div><div class="bg-slate-800 rounded-xl border border-slate-700 p-6 hover:border-cyan-500/50 transition group"><div class="flex items-center justify-between mb-4"><div class="p-2 rounded-lg bg-cyan-500/10 text-cyan-400 group-hover:bg-cyan-500/20 transition"><svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M11.049 2.927c.3-.921 1.603-.921 1.902 0l1.519 4.674a1 1 0 00.95.69h4.915c.969 0 1.371 1.24.588 1.81l-3.976 2.888a1 1 0 00-.363 1.118l1.518 4.674c.3.922-.755 1.688-1.538 1.118l-3.976-2.888a1 1 0 00-1.176 0l-3.976 2.888c-.783.57-1.838-.197-1.538-1.118l1.518-4.674a1 1 0 00-.363-1.118l-3.976-2.888c-.784-.57-.38-1.81.588-1.81h4.914a1 1 0 00.951-.69l1.519-4.674z"></path></svg></div></div><h3 class="text-sm font-medium text-slate-400 uppercase tracking-wider">${ssrInterpolate(unref(t)("gamification.dashboard.today_xp"))}</h3><p class="text-3xl font-bold text-white mt-2">${ssrInterpolate(unref(stats).today_xp)}</p></div></div><div class="grid grid-cols-1 lg:grid-cols-2 gap-6 mb-8"><div class="bg-slate-800 rounded-xl border border-slate-700 p-6"><h2 class="text-lg font-semibold text-white mb-4">${ssrInterpolate(unref(t)("gamification.dashboard.quick_actions"))}</h2><div class="space-y-3">`);
|
|
_push(ssrRenderComponent(_component_NuxtLink, {
|
|
to: "/gamification/point-rules",
|
|
class: "flex items-center gap-3 px-4 py-3 bg-slate-700/50 hover:bg-slate-700 rounded-lg text-sm text-slate-300 hover:text-white transition"
|
|
}, {
|
|
default: withCtx((_, _push2, _parent2, _scopeId) => {
|
|
if (_push2) {
|
|
_push2(`<svg class="w-5 h-5 text-amber-400 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24"${_scopeId}><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"${_scopeId}></path></svg> ${ssrInterpolate(unref(t)("gamification.dashboard.manage_point_rules"))}`);
|
|
} else {
|
|
return [
|
|
(openBlock(), createBlock("svg", {
|
|
class: "w-5 h-5 text-amber-400 flex-shrink-0",
|
|
fill: "none",
|
|
stroke: "currentColor",
|
|
viewBox: "0 0 24 24"
|
|
}, [
|
|
createVNode("path", {
|
|
"stroke-linecap": "round",
|
|
"stroke-linejoin": "round",
|
|
"stroke-width": "2",
|
|
d: "M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"
|
|
})
|
|
])),
|
|
createTextVNode(" " + toDisplayString(unref(t)("gamification.dashboard.manage_point_rules")), 1)
|
|
];
|
|
}
|
|
}),
|
|
_: 1
|
|
}, _parent));
|
|
_push(ssrRenderComponent(_component_NuxtLink, {
|
|
to: "/gamification/badges",
|
|
class: "flex items-center gap-3 px-4 py-3 bg-slate-700/50 hover:bg-slate-700 rounded-lg text-sm text-slate-300 hover:text-white transition"
|
|
}, {
|
|
default: withCtx((_, _push2, _parent2, _scopeId) => {
|
|
if (_push2) {
|
|
_push2(`<svg class="w-5 h-5 text-violet-400 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24"${_scopeId}><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4M7.835 4.697a3.42 3.42 0 001.946-.806 3.42 3.42 0 014.438 0 3.42 3.42 0 001.946.806 3.42 3.42 0 013.138 3.138 3.42 3.42 0 00.806 1.946 3.42 3.42 0 010 4.438 3.42 3.42 0 00-.806 1.946 3.42 3.42 0 01-3.138 3.138 3.42 3.42 0 00-1.946.806 3.42 3.42 0 01-4.438 0 3.42 3.42 0 00-1.946-.806 3.42 3.42 0 01-3.138-3.138 3.42 3.42 0 00-.806-1.946 3.42 3.42 0 010-4.438 3.42 3.42 0 00.806-1.946 3.42 3.42 0 013.138-3.138z"${_scopeId}></path></svg> ${ssrInterpolate(unref(t)("gamification.dashboard.manage_badges"))}`);
|
|
} else {
|
|
return [
|
|
(openBlock(), createBlock("svg", {
|
|
class: "w-5 h-5 text-violet-400 flex-shrink-0",
|
|
fill: "none",
|
|
stroke: "currentColor",
|
|
viewBox: "0 0 24 24"
|
|
}, [
|
|
createVNode("path", {
|
|
"stroke-linecap": "round",
|
|
"stroke-linejoin": "round",
|
|
"stroke-width": "2",
|
|
d: "M9 12l2 2 4-4M7.835 4.697a3.42 3.42 0 001.946-.806 3.42 3.42 0 014.438 0 3.42 3.42 0 001.946.806 3.42 3.42 0 013.138 3.138 3.42 3.42 0 00.806 1.946 3.42 3.42 0 010 4.438 3.42 3.42 0 00-.806 1.946 3.42 3.42 0 01-3.138 3.138 3.42 3.42 0 00-1.946.806 3.42 3.42 0 01-4.438 0 3.42 3.42 0 00-1.946-.806 3.42 3.42 0 01-3.138-3.138 3.42 3.42 0 00-.806-1.946 3.42 3.42 0 010-4.438 3.42 3.42 0 00.806-1.946 3.42 3.42 0 013.138-3.138z"
|
|
})
|
|
])),
|
|
createTextVNode(" " + toDisplayString(unref(t)("gamification.dashboard.manage_badges")), 1)
|
|
];
|
|
}
|
|
}),
|
|
_: 1
|
|
}, _parent));
|
|
_push(ssrRenderComponent(_component_NuxtLink, {
|
|
to: "/gamification/seasons",
|
|
class: "flex items-center gap-3 px-4 py-3 bg-slate-700/50 hover:bg-slate-700 rounded-lg text-sm text-slate-300 hover:text-white transition"
|
|
}, {
|
|
default: withCtx((_, _push2, _parent2, _scopeId) => {
|
|
if (_push2) {
|
|
_push2(`<svg class="w-5 h-5 text-emerald-400 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24"${_scopeId}><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"${_scopeId}></path></svg> ${ssrInterpolate(unref(t)("gamification.dashboard.manage_seasons"))}`);
|
|
} else {
|
|
return [
|
|
(openBlock(), createBlock("svg", {
|
|
class: "w-5 h-5 text-emerald-400 flex-shrink-0",
|
|
fill: "none",
|
|
stroke: "currentColor",
|
|
viewBox: "0 0 24 24"
|
|
}, [
|
|
createVNode("path", {
|
|
"stroke-linecap": "round",
|
|
"stroke-linejoin": "round",
|
|
"stroke-width": "2",
|
|
d: "M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"
|
|
})
|
|
])),
|
|
createTextVNode(" " + toDisplayString(unref(t)("gamification.dashboard.manage_seasons")), 1)
|
|
];
|
|
}
|
|
}),
|
|
_: 1
|
|
}, _parent));
|
|
_push(`</div></div><div class="bg-slate-800 rounded-xl border border-slate-700 p-6"><h2 class="text-lg font-semibold text-white mb-4">${ssrInterpolate(unref(t)("gamification.dashboard.recent_ledger"))}</h2>`);
|
|
if (unref(recentLedger).length === 0) {
|
|
_push(`<div class="text-sm text-slate-500 text-center py-8">${ssrInterpolate(unref(t)("gamification.dashboard.no_ledger_entries"))}</div>`);
|
|
} else {
|
|
_push(`<div class="space-y-3"><!--[-->`);
|
|
ssrRenderList(unref(recentLedger), (entry) => {
|
|
_push(`<div class="flex items-center justify-between py-2 border-b border-slate-700/50 last:border-0"><div><p class="text-sm text-slate-300">${ssrInterpolate(entry.reason)}</p><p class="text-xs text-slate-500">${ssrInterpolate(entry.created_at)}</p></div><span class="${ssrRenderClass([entry.points >= 0 ? "text-emerald-400" : "text-rose-400", "text-sm font-semibold"])}">${ssrInterpolate(entry.points >= 0 ? "+" : "")}${ssrInterpolate(entry.points)}</span></div>`);
|
|
});
|
|
_push(`<!--]--></div>`);
|
|
}
|
|
_push(`</div></div><div class="bg-slate-800 rounded-xl border border-slate-700 p-6"><div class="flex items-center justify-between mb-4"><h2 class="text-lg font-semibold text-white">${ssrInterpolate(unref(t)("gamification.dashboard.top_5_leaderboard"))}</h2>`);
|
|
_push(ssrRenderComponent(_component_NuxtLink, {
|
|
to: "/gamification/leaderboard",
|
|
class: "text-sm text-indigo-400 hover:text-indigo-300 transition"
|
|
}, {
|
|
default: withCtx((_, _push2, _parent2, _scopeId) => {
|
|
if (_push2) {
|
|
_push2(`${ssrInterpolate(unref(t)("gamification.dashboard.full_leaderboard"))} → `);
|
|
} else {
|
|
return [
|
|
createTextVNode(toDisplayString(unref(t)("gamification.dashboard.full_leaderboard")) + " → ", 1)
|
|
];
|
|
}
|
|
}),
|
|
_: 1
|
|
}, _parent));
|
|
_push(`</div>`);
|
|
if (unref(topLeaderboard).length === 0) {
|
|
_push(`<div class="text-sm text-slate-500 text-center py-8">${ssrInterpolate(unref(t)("gamification.dashboard.no_leaderboard_data"))}</div>`);
|
|
} else {
|
|
_push(`<div class="space-y-2"><!--[-->`);
|
|
ssrRenderList(unref(topLeaderboard), (entry, idx) => {
|
|
_push(`<div class="${ssrRenderClass([idx < 3 ? "bg-slate-700/50" : "", "flex items-center gap-4 px-4 py-3 rounded-lg"])}"><span class="${ssrRenderClass([idx === 0 ? "text-amber-400" : idx === 1 ? "text-slate-300" : idx === 2 ? "text-amber-700" : "text-slate-500", "w-8 text-center text-lg font-bold"])}"> #${ssrInterpolate(idx + 1)}</span><div class="flex-1"><p class="text-sm font-medium text-white">${ssrInterpolate(entry.user_name)}</p><p class="text-xs text-slate-500">${ssrInterpolate(unref(t)("gamification.dashboard.level"))} ${ssrInterpolate(entry.level)} · ${ssrInterpolate(entry.xp)} ${ssrInterpolate(unref(t)("gamification.dashboard.xp_abbr"))}</p></div><span class="text-sm font-semibold text-emerald-400">${ssrInterpolate(entry.total_points)} ${ssrInterpolate(unref(t)("gamification.dashboard.points"))}</span></div>`);
|
|
});
|
|
_push(`<!--]--></div>`);
|
|
}
|
|
_push(`</div><!--]-->`);
|
|
}
|
|
_push(`</div>`);
|
|
};
|
|
}
|
|
});
|
|
const _sfc_setup = _sfc_main.setup;
|
|
_sfc_main.setup = (props, ctx) => {
|
|
const ssrContext = useSSRContext();
|
|
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("pages/gamification/index.vue");
|
|
return _sfc_setup ? _sfc_setup(props, ctx) : void 0;
|
|
};
|
|
export {
|
|
_sfc_main as default
|
|
};
|
|
//# sourceMappingURL=index-Bf37iyk4.js.map
|