import { jsxs as n, jsx as i } from "react/jsx-runtime";
import { useState as d, useEffect as u } from "react";
import { useSearchParams as b } from "react-router-dom";
import { useTranslation as p } from "react-i18next";
import { B as y, _ as o } from "./index-Dh9kUeDn.js";
const c = ["submitted", "assigned"];
function v() {
  const { t: e } = p("support"), [r, a] = b(), m = () => {
    const t = r.get("tab");
    return t && c.includes(t) ? t : "submitted";
  }, [s, l] = d(m);
  return u(() => {
    const t = r.get("tab");
    s === "submitted" ? t && (r.delete("tab"), a(r, { replace: !0 })) : t !== s && a({ tab: s }, { replace: !0 });
  }, [s, r, a]), /* @__PURE__ */ n("div", { className: "space-y-4", children: [
    /* @__PURE__ */ i(
      y,
      {
        items: [
          { label: e("title", "Support"), href: "/support" },
          { label: e("list.myTicketsTitle", "My Tickets") }
        ]
      }
    ),
    /* @__PURE__ */ i("div", { className: "flex gap-1 border-b border-[var(--border-color)]", children: c.map((t) => /* @__PURE__ */ i(
      "button",
      {
        onClick: () => l(t),
        className: `px-4 py-2 text-sm font-medium border-b-2 transition-colors ${s === t ? "border-[var(--color-primary-600)] text-[var(--color-primary-600)]" : "border-transparent text-[var(--text-secondary)] hover:text-[var(--text-primary)] hover:border-[var(--border-color)]"}`,
        children: t === "assigned" ? e("list.tabs.assigned", "Assigned to me") : e("list.tabs.submitted", "My tickets")
      },
      t
    )) }),
    s === "assigned" && /* @__PURE__ */ i(
      o,
      {
        mode: "assigned",
        showDrafts: !0,
        basePath: "/support/my-tickets",
        title: e("list.assignedTitle", "Assigned Tickets"),
        subtitle: e("list.assignedSubtitle", "Tickets assigned to you"),
        createPath: "/support/my-tickets/create"
      }
    ),
    s === "submitted" && /* @__PURE__ */ i(
      o,
      {
        mode: "user",
        showDrafts: !0,
        basePath: "/support/my-tickets",
        title: e("list.myTitle", "Submitted Tickets"),
        subtitle: e("list.mySubtitle", "Tickets you have created"),
        createPath: "/support/my-tickets/create"
      }
    )
  ] });
}
export {
  v as MyTicketsPage
};
//# sourceMappingURL=MyTicketsPage-BWd90VHs.js.map
