/* empty css                                    */
import { d as createAstro, c as createComponent, r as renderComponent, a as renderTemplate, m as maybeRenderHead } from '../chunks/astro/server_5mFihzcn.mjs';
import { $ as $$Card } from '../chunks/Card_CIZXu6HZ.mjs';
import { e as getAllUsers } from '../chunks/auths_D_cJY4N0.mjs';
import { $ as $$Layout } from '../chunks/Layout_v67TeP9G.mjs';
import { a as getAllMessages, b as getUnreadMessages } from '../chunks/message_DAReJ7u_.mjs';
export { renderers } from '../renderers.mjs';

let navigateOnServerWarned = false;
async function navigate(href, options) {
  {
    if (!navigateOnServerWarned) {
      const warning = new Error(
        "The view transitions client API was called during a server side render. This may be unintentional as the navigate() function is expected to be called in response to user interactions. Please make sure that your usage is correct."
      );
      warning.name = "Warning";
      console.warn(warning);
      navigateOnServerWarned = true;
    }
    return;
  }
}

const $$Astro = createAstro("https://new.sambekiel.com");
const $$Index = createComponent(async ($$result, $$props, $$slots) => {
  const Astro2 = $$result.createAstro($$Astro, $$props, $$slots);
  Astro2.self = $$Index;
  let user = Astro2.locals.user;
  const getData = (res) => {
    try {
      if (res === "a_stf") return getAllUsers();
      if (res === "a_msg") return getAllMessages();
      if (res === "u_msg") return getUnreadMessages();
    } catch (error) {
      console.error({ error });
    }
  };
  const unread = await getData("u_msg");
  const messages = await getData("a_msg");
  const staffs = await getData("a_stf");
  return renderTemplate`${renderComponent($$result, "Layout", $$Layout, { "title": "Dashboard" }, { "default": async ($$result2) => renderTemplate` ${maybeRenderHead()}<section class="summary-cards my-[2rem]"> ${renderComponent($$result2, "Card", $$Card, { "href": "/dashboard/messages?tab=unread", "title": "New Messages", "body": `${unread?.total ?? ""}`, "className": "bg-blue-700 hover:bg-opacity-80 transition-all duration-300 cursor-none text-white rounded-2xl" })} ${renderComponent($$result2, "Card", $$Card, { "href": "/dashboard/messages", "title": "Total Messages", "body": `${messages?.total ?? ""}`, "className": "bg-blue-950 hover:bg-opacity-80 transition-all duration-300 cursor-none text-white rounded-2xl" })} ${user?.isAdmin && renderTemplate`${renderComponent($$result2, "Card", $$Card, { "href": "/dashboard/staffs", "title": "Total Staffs", "body": `${staffs?.total ?? ""}`, "className": "bg-slate-950 hover:bg-opacity-80 transition-all duration-300 cursor-none text-white rounded-2xl" })}`} </section> <section> <h3 class="font-semibold text-2xl uppercase">Profile</h3> ${renderComponent($$result2, "ProfileForm", null, { ...user, "self": true, "client:only": "solid-js", "onSuccess": async () => {
    navigate();
  }, "client:component-hydration": "only", "client:component-path": "@/components/ProfileForm", "client:component-export": "ProfileForm" })} </section> ` })}`;
}, "C:/projects/sambekiel_front/src/pages/dashboard/index.astro", void 0);

const $$file = "C:/projects/sambekiel_front/src/pages/dashboard/index.astro";
const $$url = "/dashboard";

const _page = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
  __proto__: null,
  default: $$Index,
  file: $$file,
  url: $$url
}, Symbol.toStringTag, { value: 'Module' }));

const page = () => _page;

export { page };
