Files
service-finder/frontend_admin/.nuxt/dist/server/_nuxt/leaderboard-CqTgptys.js
2026-07-01 02:27:38 +00:00

149 lines
20 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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(`<div${ssrRenderAttrs(_attrs)}><div class="mb-8"><h1 class="text-2xl font-bold text-white">${ssrInterpolate(unref(t)("gamification.leaderboard.title"))}</h1><p class="text-slate-400 mt-1">${ssrInterpolate(unref(t)("gamification.leaderboard.subtitle"))}</p></div><div class="bg-slate-800 rounded-xl border border-slate-700 p-4 mb-6"><div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4"><div><label class="block text-xs font-medium text-slate-400 mb-1.5 uppercase tracking-wider">${ssrInterpolate(unref(t)("gamification.leaderboard.search"))}</label><div class="relative"><input${ssrRenderAttr("value", unref(filters).search)} type="text"${ssrRenderAttr("placeholder", unref(t)("gamification.leaderboard.search_placeholder"))} class="w-full bg-slate-700 border border-slate-600 rounded-lg pl-9 pr-3 py-2 text-sm text-white placeholder-slate-500 focus:ring-2 focus:ring-indigo-500 focus:border-transparent"><svg class="absolute left-2.5 top-2.5 w-4 h-4 text-slate-500" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"></path></svg></div></div><div><label class="block text-xs font-medium text-slate-400 mb-1.5 uppercase tracking-wider">${ssrInterpolate(unref(t)("gamification.leaderboard.level"))}</label><select class="w-full bg-slate-700 border border-slate-600 rounded-lg px-3 py-2 text-sm text-white focus:ring-2 focus:ring-indigo-500 focus:border-transparent"><option value=""${ssrIncludeBooleanAttr(Array.isArray(unref(filters).level) ? ssrLooseContain(unref(filters).level, "") : ssrLooseEqual(unref(filters).level, "")) ? " selected" : ""}>${ssrInterpolate(unref(t)("gamification.leaderboard.all_levels"))}</option><!--[-->`);
ssrRenderList(20, (lvl) => {
_push(`<option${ssrRenderAttr("value", lvl)}${ssrIncludeBooleanAttr(Array.isArray(unref(filters).level) ? ssrLooseContain(unref(filters).level, lvl) : ssrLooseEqual(unref(filters).level, lvl)) ? " selected" : ""}>${ssrInterpolate(lvl)}. ${ssrInterpolate(unref(t)("gamification.leaderboard.level_suffix"))}</option>`);
});
_push(`<!--]--></select></div><div><label class="block text-xs font-medium text-slate-400 mb-1.5 uppercase tracking-wider">${ssrInterpolate(unref(t)("gamification.leaderboard.min_xp"))}</label><input${ssrRenderAttr("value", unref(filters).min_xp)} type="number" min="0" placeholder="0" class="w-full bg-slate-700 border border-slate-600 rounded-lg px-3 py-2 text-sm text-white focus:ring-2 focus:ring-indigo-500 focus:border-transparent"></div><div><label class="block text-xs font-medium text-slate-400 mb-1.5 uppercase tracking-wider">${ssrInterpolate(unref(t)("gamification.leaderboard.sort_by"))}</label><select class="w-full bg-slate-700 border border-slate-600 rounded-lg px-3 py-2 text-sm text-white focus:ring-2 focus:ring-indigo-500 focus:border-transparent"><option value="total_xp"${ssrIncludeBooleanAttr(Array.isArray(unref(sortBy)) ? ssrLooseContain(unref(sortBy), "total_xp") : ssrLooseEqual(unref(sortBy), "total_xp")) ? " selected" : ""}>${ssrInterpolate(unref(t)("gamification.leaderboard.sort_xp"))}</option><option value="total_points"${ssrIncludeBooleanAttr(Array.isArray(unref(sortBy)) ? ssrLooseContain(unref(sortBy), "total_points") : ssrLooseEqual(unref(sortBy), "total_points")) ? " selected" : ""}>${ssrInterpolate(unref(t)("gamification.leaderboard.sort_points"))}</option><option value="social_points"${ssrIncludeBooleanAttr(Array.isArray(unref(sortBy)) ? ssrLooseContain(unref(sortBy), "social_points") : ssrLooseEqual(unref(sortBy), "social_points")) ? " selected" : ""}>${ssrInterpolate(unref(t)("gamification.leaderboard.sort_social"))}</option><option value="current_level"${ssrIncludeBooleanAttr(Array.isArray(unref(sortBy)) ? ssrLooseContain(unref(sortBy), "current_level") : ssrLooseEqual(unref(sortBy), "current_level")) ? " selected" : ""}>${ssrInterpolate(unref(t)("gamification.leaderboard.sort_level"))}</option></select></div></div><div class="flex items-center gap-3 mt-4 pt-4 border-t border-slate-700/50"><button class="px-4 py-2 bg-indigo-600 hover:bg-indigo-500 text-white text-sm font-medium rounded-lg transition">${ssrInterpolate(unref(t)("gamification.leaderboard.filter"))}</button><button class="px-4 py-2 bg-slate-700 hover:bg-slate-600 text-slate-300 text-sm font-medium rounded-lg transition">${ssrInterpolate(unref(t)("gamification.leaderboard.reset"))}</button><button class="px-3 py-2 bg-slate-700 hover:bg-slate-600 text-slate-300 text-sm font-medium rounded-lg transition flex items-center gap-1.5"><svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">`);
if (unref(sortOrder) === "desc") {
_push(`<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 4h13M3 8h9m-9 4h6m4 0l4-4m0 0l4 4m-4-4v12"></path>`);
} else {
_push(`<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 4h13M3 8h9m-9 4h9m5-4v12m0 0l-4-4m4 4l4-4"></path>`);
}
_push(`</svg> ${ssrInterpolate(unref(sortOrder) === "desc" ? unref(t)("gamification.leaderboard.desc") : unref(t)("gamification.leaderboard.asc"))}</button><span class="text-xs text-slate-500 ml-auto">${ssrInterpolate(unref(totalCount))} ${ssrInterpolate(unref(t)("gamification.leaderboard.users_count"))}</span></div></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.leaderboard.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.leaderboard.load_error"))}</p><button class="mt-3 text-sm text-rose-300 hover:text-rose-200 underline">${ssrInterpolate(unref(t)("gamification.leaderboard.retry"))}</button></div>`);
} else if (unref(entries).length === 0) {
_push(`<div class="bg-slate-800 rounded-xl border border-slate-700 p-6"><p class="text-slate-400 text-center py-12">${ssrInterpolate(unref(t)("gamification.leaderboard.empty"))}</p></div>`);
} else {
_push(`<div class="bg-slate-800 rounded-xl border border-slate-700 overflow-hidden"><div class="overflow-x-auto"><table class="w-full"><thead><tr class="border-b border-slate-700"><th class="text-left px-4 py-3 text-xs font-medium text-slate-400 uppercase tracking-wider w-16">#</th><th class="text-left px-4 py-3 text-xs font-medium text-slate-400 uppercase tracking-wider">${ssrInterpolate(unref(t)("gamification.leaderboard.col_user"))}</th><th class="text-left px-4 py-3 text-xs font-medium text-slate-400 uppercase tracking-wider">${ssrInterpolate(unref(t)("gamification.leaderboard.col_email"))}</th><th class="text-left px-4 py-3 text-xs font-medium text-slate-400 uppercase tracking-wider">${ssrInterpolate(unref(t)("gamification.leaderboard.col_xp"))}</th><th class="text-left px-4 py-3 text-xs font-medium text-slate-400 uppercase tracking-wider">${ssrInterpolate(unref(t)("gamification.leaderboard.col_level"))}</th><th class="text-left px-4 py-3 text-xs font-medium text-slate-400 uppercase tracking-wider">${ssrInterpolate(unref(t)("gamification.leaderboard.col_points"))}</th><th class="text-left px-4 py-3 text-xs font-medium text-slate-400 uppercase tracking-wider">${ssrInterpolate(unref(t)("gamification.leaderboard.col_social"))}</th><th class="text-left px-4 py-3 text-xs font-medium text-slate-400 uppercase tracking-wider">${ssrInterpolate(unref(t)("gamification.leaderboard.col_penalty"))}</th><th class="text-left px-4 py-3 text-xs font-medium text-slate-400 uppercase tracking-wider">${ssrInterpolate(unref(t)("gamification.leaderboard.col_restriction"))}</th><th class="text-left px-4 py-3 text-xs font-medium text-slate-400 uppercase tracking-wider">${ssrInterpolate(unref(t)("gamification.leaderboard.col_discoveries"))}</th><th class="text-left px-4 py-3 text-xs font-medium text-slate-400 uppercase tracking-wider">${ssrInterpolate(unref(t)("gamification.leaderboard.col_services"))}</th><th class="text-left px-4 py-3 text-xs font-medium text-slate-400 uppercase tracking-wider">${ssrInterpolate(unref(t)("gamification.leaderboard.col_updated"))}</th><th class="text-right px-4 py-3 text-xs font-medium text-slate-400 uppercase tracking-wider">${ssrInterpolate(unref(t)("gamification.leaderboard.col_actions"))}</th></tr></thead><tbody class="divide-y divide-slate-700/50"><!--[-->`);
ssrRenderList(unref(entries), (entry) => {
_push(`<tr class="${ssrRenderClass([getRowClass(entry.rank), "hover:bg-slate-700/30 transition"])}"><td class="px-4 py-3"><span class="${ssrRenderClass([getRankBadgeClass(entry.rank), "inline-flex items-center justify-center w-8 h-8 rounded-full text-sm font-bold"])}">${ssrInterpolate(entry.rank)}</span></td><td class="px-4 py-3"><div class="flex items-center gap-2"><div class="w-8 h-8 rounded-full bg-gradient-to-br from-indigo-500 to-purple-600 flex items-center justify-center text-xs font-bold text-white flex-shrink-0">${ssrInterpolate(getInitials(entry.user_name))}</div><span class="text-sm font-medium text-white">${ssrInterpolate(entry.user_name)}</span></div></td><td class="px-4 py-3 text-sm text-slate-400 font-mono">${ssrInterpolate(entry.user_email || "—")}</td><td class="px-4 py-3"><div class="flex items-center gap-1.5"><svg class="w-4 h-4 text-amber-400" fill="currentColor" viewBox="0 0 20 20"><path 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><span class="text-sm font-semibold text-white">${ssrInterpolate(unref(formatNumber)(entry.total_xp))}</span></div></td><td class="px-4 py-3"><span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-indigo-500/10 text-indigo-400 border border-indigo-500/20">${ssrInterpolate(entry.current_level)}</span></td><td class="px-4 py-3 text-sm text-slate-300">${ssrInterpolate(unref(formatNumber)(entry.total_points))}</td><td class="px-4 py-3 text-sm text-slate-300">${ssrInterpolate(unref(formatNumber)(entry.social_points))}</td><td class="px-4 py-3">`);
if (entry.penalty_points > 0) {
_push(`<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-rose-500/10 text-rose-400 border border-rose-500/20"> -${ssrInterpolate(entry.penalty_points)}</span>`);
} else {
_push(`<span class="text-sm text-slate-500">—</span>`);
}
_push(`</td><td class="px-4 py-3">`);
if (entry.restriction_level > 0) {
_push(`<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-amber-500/10 text-amber-400 border border-amber-500/20">${ssrInterpolate(restrictionLabel(entry.restriction_level))}</span>`);
} else {
_push(`<span class="text-sm text-slate-500">—</span>`);
}
_push(`</td><td class="px-4 py-3 text-sm text-slate-300">${ssrInterpolate(entry.places_discovered)}</td><td class="px-4 py-3 text-sm text-slate-300">${ssrInterpolate(entry.services_submitted)}</td><td class="px-4 py-3 text-sm text-slate-500">${ssrInterpolate(entry.updated_at ? unref(formatDateTime)(entry.updated_at) : "—")}</td><td class="px-4 py-3 text-right">`);
_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"))} <svg class="w-3.5 h-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24"${_scopeId}><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7"${_scopeId}></path></svg>`);
} 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(`</td></tr>`);
});
_push(`<!--]--></tbody></table></div><div class="flex items-center justify-between px-4 py-3 border-t border-slate-700"><div class="flex items-center gap-2"><button${ssrIncludeBooleanAttr(unref(offset) === 0) ? " disabled" : ""} class="${ssrRenderClass([unref(offset) === 0 ? "text-slate-600 cursor-not-allowed" : "text-slate-300 hover:bg-slate-700", "px-2.5 py-1.5 text-sm rounded-lg transition"])}"><svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M11 19l-7-7 7-7m8 14l-7-7 7-7"></path></svg></button><button${ssrIncludeBooleanAttr(unref(offset) === 0) ? " disabled" : ""} class="${ssrRenderClass([unref(offset) === 0 ? "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.prev"))}</button></div><div class="flex items-center gap-3"><span class="text-sm text-slate-500">${ssrInterpolate(unref(offset) + 1)}${ssrInterpolate(Math.min(unref(offset) + unref(limit), unref(totalCount)))} / ${ssrInterpolate(unref(totalCount))}</span><select class="bg-slate-700 border border-slate-600 rounded-lg px-2 py-1.5 text-xs text-slate-300 focus:ring-2 focus:ring-indigo-500 focus:border-transparent"><option${ssrRenderAttr("value", 25)}${ssrIncludeBooleanAttr(Array.isArray(unref(limit)) ? ssrLooseContain(unref(limit), 25) : ssrLooseEqual(unref(limit), 25)) ? " selected" : ""}>25 / ${ssrInterpolate(unref(t)("gamification.leaderboard.page"))}</option><option${ssrRenderAttr("value", 50)}${ssrIncludeBooleanAttr(Array.isArray(unref(limit)) ? ssrLooseContain(unref(limit), 50) : ssrLooseEqual(unref(limit), 50)) ? " selected" : ""}>50 / ${ssrInterpolate(unref(t)("gamification.leaderboard.page"))}</option><option${ssrRenderAttr("value", 100)}${ssrIncludeBooleanAttr(Array.isArray(unref(limit)) ? ssrLooseContain(unref(limit), 100) : ssrLooseEqual(unref(limit), 100)) ? " selected" : ""}>100 / ${ssrInterpolate(unref(t)("gamification.leaderboard.page"))}</option><option${ssrRenderAttr("value", 250)}${ssrIncludeBooleanAttr(Array.isArray(unref(limit)) ? ssrLooseContain(unref(limit), 250) : ssrLooseEqual(unref(limit), 250)) ? " selected" : ""}>250 / ${ssrInterpolate(unref(t)("gamification.leaderboard.page"))}</option></select></div><div class="flex items-center gap-2"><button${ssrIncludeBooleanAttr(unref(offset) + unref(limit) >= 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"))}</button><button${ssrIncludeBooleanAttr(unref(offset) + unref(limit) >= 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"])}"><svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 5l7 7-7 7M5 5l7 7-7 7"></path></svg></button></div></div></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/leaderboard.vue");
return _sfc_setup ? _sfc_setup(props, ctx) : void 0;
};
export {
_sfc_main as default
};
//# sourceMappingURL=leaderboard-CqTgptys.js.map