import { _ as __nuxt_component_0 } from "./nuxt-link-1NBbHb-h.js"; import { defineComponent, ref, unref, withCtx, createTextVNode, toDisplayString, openBlock, createBlock, createVNode, useSSRContext } from "vue"; import { ssrRenderAttrs, ssrInterpolate, ssrRenderAttr, ssrIncludeBooleanAttr, ssrLooseContain, ssrLooseEqual, ssrRenderList, ssrRenderClass, ssrRenderComponent } from "vue/server-renderer"; import "/app/node_modules/hookable/dist/index.mjs"; import { u as useFormatter } from "./useFormatter-hycy3urM.js"; 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 "./region-0mvXqaMM.js"; import "pinia"; 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 "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: "leaderboard", __ssrInlineRender: true, setup(__props) { const { t } = useI18n(); const { formatNumber, formatDateTime } = useFormatter(); const loading = ref(false); const error = ref(false); const entries = ref([]); const totalCount = ref(0); const offset = ref(0); const limit = ref(50); const sortBy = ref("total_xp"); const sortOrder = ref("desc"); const filters = ref({ search: "", level: "", min_xp: null }); function restrictionLabel(level) { switch (level) { case 1: return t("gamification.leaderboard.restriction_mild"); case 2: return t("gamification.leaderboard.restriction_moderate"); case 3: return t("gamification.leaderboard.restriction_severe"); default: return `${level}. ${t("gamification.leaderboard.restriction_level")}`; } } function getInitials(name) { return name.split(" ").map((part) => part.charAt(0).toUpperCase()).slice(0, 2).join(""); } function getRankBadgeClass(rank) { if (rank === 1) return "bg-amber-500/20 text-amber-400 border border-amber-500/30"; if (rank === 2) return "bg-slate-300/10 text-slate-300 border border-slate-400/20"; if (rank === 3) return "bg-amber-700/20 text-amber-600 border border-amber-700/30"; return "bg-slate-700/50 text-slate-400 border border-slate-600/30"; } function getRowClass(rank) { if (rank === 1) return "bg-amber-500/5"; if (rank === 2) return "bg-slate-300/5"; if (rank === 3) return "bg-amber-700/5"; return ""; } return (_ctx, _push, _parent, _attrs) => { const _component_NuxtLink = __nuxt_component_0; _push(`

${ssrInterpolate(unref(t)("gamification.leaderboard.title"))}

${ssrInterpolate(unref(t)("gamification.leaderboard.subtitle"))}

${ssrInterpolate(unref(totalCount))} ${ssrInterpolate(unref(t)("gamification.leaderboard.users_count"))}
`); if (unref(loading)) { _push(`
${ssrInterpolate(unref(t)("gamification.leaderboard.loading"))}
`); } else if (unref(error)) { _push(`

${ssrInterpolate(unref(t)("gamification.leaderboard.load_error"))}

`); } else if (unref(entries).length === 0) { _push(`

${ssrInterpolate(unref(t)("gamification.leaderboard.empty"))}

`); } else { _push(`
`); ssrRenderList(unref(entries), (entry) => { _push(``); }); _push(`
#${ssrInterpolate(unref(t)("gamification.leaderboard.col_user"))}${ssrInterpolate(unref(t)("gamification.leaderboard.col_email"))}${ssrInterpolate(unref(t)("gamification.leaderboard.col_xp"))}${ssrInterpolate(unref(t)("gamification.leaderboard.col_level"))}${ssrInterpolate(unref(t)("gamification.leaderboard.col_points"))}${ssrInterpolate(unref(t)("gamification.leaderboard.col_social"))}${ssrInterpolate(unref(t)("gamification.leaderboard.col_penalty"))}${ssrInterpolate(unref(t)("gamification.leaderboard.col_restriction"))}${ssrInterpolate(unref(t)("gamification.leaderboard.col_discoveries"))}${ssrInterpolate(unref(t)("gamification.leaderboard.col_services"))}${ssrInterpolate(unref(t)("gamification.leaderboard.col_updated"))}${ssrInterpolate(unref(t)("gamification.leaderboard.col_actions"))}
${ssrInterpolate(entry.rank)}
${ssrInterpolate(getInitials(entry.user_name))}
${ssrInterpolate(entry.user_name)}
${ssrInterpolate(entry.user_email || "—")}
${ssrInterpolate(unref(formatNumber)(entry.total_xp))}
${ssrInterpolate(entry.current_level)}${ssrInterpolate(unref(formatNumber)(entry.total_points))}${ssrInterpolate(unref(formatNumber)(entry.social_points))}`); if (entry.penalty_points > 0) { _push(` -${ssrInterpolate(entry.penalty_points)}`); } else { _push(``); } _push(``); if (entry.restriction_level > 0) { _push(`${ssrInterpolate(restrictionLabel(entry.restriction_level))}`); } else { _push(``); } _push(`${ssrInterpolate(entry.places_discovered)}${ssrInterpolate(entry.services_submitted)}${ssrInterpolate(entry.updated_at ? unref(formatDateTime)(entry.updated_at) : "—")}`); _push(ssrRenderComponent(_component_NuxtLink, { to: `/gamification/users/${entry.user_id}`, class: "inline-flex items-center gap-1.5 px-3 py-1.5 bg-indigo-600/10 hover:bg-indigo-600/20 text-indigo-400 text-xs font-medium rounded-lg transition" }, { default: withCtx((_, _push2, _parent2, _scopeId) => { if (_push2) { _push2(`${ssrInterpolate(unref(t)("gamification.leaderboard.details"))} `); } else { return [ createTextVNode(toDisplayString(unref(t)("gamification.leaderboard.details")) + " ", 1), (openBlock(), createBlock("svg", { class: "w-3.5 h-3.5", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24" }, [ createVNode("path", { "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2", d: "M9 5l7 7-7 7" }) ])) ]; } }), _: 2 }, _parent)); _push(`
${ssrInterpolate(unref(t)("gamification.leaderboard.prev"))}
${ssrInterpolate(unref(offset) + 1)}–${ssrInterpolate(Math.min(unref(offset) + unref(limit), unref(totalCount)))} / ${ssrInterpolate(unref(totalCount))}
= unref(totalCount)) ? " disabled" : ""} class="${ssrRenderClass([unref(offset) + unref(limit) >= unref(totalCount) ? "text-slate-600 cursor-not-allowed" : "text-slate-300 hover:bg-slate-700", "px-3 py-1.5 text-sm rounded-lg transition"])}">${ssrInterpolate(unref(t)("gamification.leaderboard.next"))}= unref(totalCount)) ? " disabled" : ""} class="${ssrRenderClass([unref(offset) + unref(limit) >= unref(totalCount) ? "text-slate-600 cursor-not-allowed" : "text-slate-300 hover:bg-slate-700", "px-2.5 py-1.5 text-sm rounded-lg transition"])}">
`); } _push(``); }; } }); const _sfc_setup = _sfc_main.setup; _sfc_main.setup = (props, ctx) => { const ssrContext = useSSRContext(); (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("pages/gamification/leaderboard.vue"); return _sfc_setup ? _sfc_setup(props, ctx) : void 0; }; export { _sfc_main as default }; //# sourceMappingURL=leaderboard-CqTgptys.js.map