UNPKG

@scalar/api-client

Version:

the open source API testing client

104 lines (103 loc) 3.9 kB
import { defineComponent as w, onMounted as q, onBeforeUnmount as R, createElementBlock as l, openBlock as i, createElementVNode as s, createCommentVNode as m, normalizeClass as y, unref as t, createVNode as u, createTextVNode as c, toDisplayString as h, nextTick as S } from "vue"; import { ScalarHotkey as p } from "@scalar/components"; import { useRoute as C, useRouter as N } from "vue-router"; import B from "../../../assets/computer.ascii.js"; import V from "../../../components/EmptyState.vue.js"; import E from "../../../components/ScalarAsciiArt.vue.js"; import { useWorkspace as K } from "../../../store/store.js"; import { useLayout as A } from "../../../hooks/useLayout.js"; const W = { class: "flex-center relative flex flex-1 flex-col gap-6 p-2 capitalize" }, $ = { key: 0, class: "scalar-version-number" }, j = { class: "text-c-3 right-4 mt-auto flex w-full flex-col items-end gap-2 text-sm" }, U = /* @__PURE__ */ w({ __name: "ResponseEmpty", props: { collection: {}, operation: {}, workspace: {}, numWorkspaceRequests: {} }, setup(r) { const { events: a, requestMutators: x } = K(), g = C(), b = N(), { layout: n } = A(), d = () => { const o = r.operation.tags?.length ? { tags: r.operation.tags[0] ? [r.operation.tags[0]] : [] } : {}, e = x.add(o, r.collection.uid); e && (b.push({ name: "request", params: { workspace: r.workspace.uid, request: e.uid } }), S(() => { a.hotKeys.emit({ focusAddressBar: new KeyboardEvent("keydown", { key: "l" }) }); })); }, f = (o) => { o?.createNew && g.name === "request" && d(); }, v = "2.12.0"; return q(() => a.hotKeys.on(f)), R(() => a.hotKeys.off(f)), (o, e) => (i(), l("div", W, [ s("div", { class: y(["flex h-[calc(100%_-_50px)] flex-col items-center justify-center", { "hidden opacity-0": o.numWorkspaceRequests <= 1 && t(n) !== "modal" }]) }, [ t(n) !== "modal" ? (i(), l("div", $, [ c(" Scalar App V" + h(t(v)) + " Beta ", 1), e[3] || (e[3] = s("div", { class: "mt-2" }, [ s("a", { href: "https://github.com/scalar/scalar/issues/2669", target: "_blank" }, " Roadmap ") ], -1)) ])) : m("", !0), e[4] || (e[4] = s("a", { class: "gitbook-show scalar-version-number", href: "https://www.scalar.com", target: "_blank" }, " Powered By Scalar.com ", -1)), u(E, { art: t(B), class: "text-c-3" }, null, 8, ["art"]) ], 2), t(n) !== "modal" ? (i(), l("div", { key: 0, class: y(["hidden h-[calc(100%_-_50px)] items-center justify-center pb-5", { "!flex opacity-100": o.numWorkspaceRequests == 1 }]) }, [ u(V) ], 2)) : m("", !0), s("div", j, [ t(n) !== "modal" ? (i(), l("button", { key: 0, class: "flex items-center gap-1.5", type: "button", onClick: e[0] || (e[0] = (k) => t(a).commandPalette.emit()) }, [ e[5] || (e[5] = c(" Get Started ", -1)), u(t(p), { hotkey: "k" }) ])) : m("", !0), t(n) === "desktop" ? (i(), l("button", { key: 1, class: "flex items-center gap-1.5", type: "button", onClick: e[1] || (e[1] = (k) => d()) }, [ e[6] || (e[6] = c(" New Request ", -1)), u(t(p), { hotkey: "N" }) ])) : m("", !0), s("button", { class: "flex items-center gap-1.5", type: "button", onClick: e[2] || (e[2] = (k) => t(a).executeRequest.emit()) }, [ e[7] || (e[7] = c(" Send Request ", -1)), u(t(p), { hotkey: "↵" }) ]) ]) ])); } }); export { U as default };