@scalar/api-client
Version:
the open source API testing client
143 lines (142 loc) • 4.89 kB
JavaScript
import { defineComponent as b, computed as k, createElementBlock as m, openBlock as r, createVNode as x, createElementVNode as l, normalizeClass as d, createCommentVNode as _, unref as o, toDisplayString as v, Fragment as g, renderList as C, createBlock as N, withCtx as S } from "vue";
import { LibraryIcon as B } from "@scalar/icons/library";
import { useRouter as E, RouterLink as z } from "vue-router";
import { PathId as s } from "../../routes.js";
import I from "./CollectionInfoForm.vue.js";
import { useActiveEntities as L } from "../../store/active-entities.js";
const R = { class: "bg-b-1 sticky -top-[104px] z-10 mx-auto w-full" }, V = {
key: 0,
class: "flex max-w-40 items-center"
}, A = { class: "text-c-1 mr-[6.25px] hidden overflow-hidden px-2 font-medium text-ellipsis whitespace-nowrap md:block" }, G = /* @__PURE__ */ b({
__name: "CollectionNavigation",
props: {
isSticky: { type: Boolean }
},
setup(F) {
const { currentRoute: p } = E(), { activeCollection: e } = L(), h = k(() => {
var t, a, i, n;
return [
{
displayName: "Overview",
// icon: 'Collection',
to: {
name: "collection.overview",
params: {
[s.Collection]: (t = e.value) == null ? void 0 : t.uid
}
}
},
{
displayName: "Servers",
// icon: 'Server',
to: {
name: "collection.servers",
params: {
[s.Collection]: (a = e.value) == null ? void 0 : a.uid
}
}
},
{
displayName: "Authentication",
// icon: 'Lock',
to: {
name: "collection.authentication",
params: {
[s.Collection]: (i = e.value) == null ? void 0 : i.uid
}
}
},
{
displayName: "Environment",
// icon: 'Brackets',
to: {
name: "collection.environment",
params: {
[s.Collection]: (n = e.value) == null ? void 0 : n.uid
}
}
},
// {
// displayName: 'Cookies',
// // icon: 'Cookie',
// to: {
// name: 'collection.cookies',
// params: {
// [PathId.Collection]: activeCollection.value?.uid,
// },
// },
// },
// {
// displayName: 'Scripts',
// // icon: 'CodeFolder',
// to: {
// name: 'collection.scripts',
// params: {
// [PathId.Collection]: activeCollection.value?.uid,
// },
// },
// },
// {
// displayName: 'Sync',
// // icon: 'Download',
// to: {
// name: 'collection.sync',
// },
// },
{
displayName: "Settings",
// icon: 'Settings',
to: {
name: "collection.settings"
}
}
];
});
return (t, a) => {
var i, n, u;
return r(), m("div", R, [
x(I),
l("div", {
class: d([
"items-center text-sm font-medium",
t.isSticky ? "h-fit border-b md:grid md:grid-cols-[1fr_720px_1fr] md:px-4" : "flex md:mx-auto md:max-w-[720px]"
])
}, [
t.isSticky ? (r(), m("div", V, [
x(o(B), {
class: "text-c-2 hidden size-3.5 md:block",
src: ((i = o(e)) == null ? void 0 : i["x-scalar-icon"]) || "interface-content-folder",
"stroke-width": "2"
}, null, 8, ["src"]),
l("span", A, v((u = (n = o(e)) == null ? void 0 : n.info) == null ? void 0 : u.title), 1)
])) : _("", !0),
l("div", {
class: d(["flex w-full max-w-[720px] gap-2 pl-1.5 md:ml-1.5 md:pl-0", !t.isSticky && "border-b"])
}, [
(r(!0), m(g, null, C(h.value, ({ to: c, displayName: y }, w) => (r(), N(o(z), {
key: w,
class: "-ml-2 flex h-10 cursor-pointer items-center px-2 text-center text-sm font-medium whitespace-nowrap no-underline -outline-offset-1 has-[:focus-visible]:outline",
to: c
}, {
default: S(() => {
var f;
return [
l("span", {
class: d([
"flex-center h-full w-full border-b",
typeof c.name == "string" && typeof o(p).name == "string" && ((f = o(p).name) != null && f.startsWith(c.name)) ? "text-c-1 border-c-1" : "text-c-2 hover:text-c-1 border-transparent"
])
}, v(y), 3)
];
}),
_: 2
}, 1032, ["to"]))), 128))
], 2)
], 2)
]);
};
}
});
export {
G as default
};