@parallelworks/tandem-web 0.189.1 → 0.189.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +0,0 @@
1
- import { createFileRoute as e, lazyRouteComponent as t } from "@tanstack/react-router";
2
- var n = e("/request/$token")({ component: t(() => import("./request2._token.js"), "component") });
3
- export { n as Route };
@@ -1,132 +0,0 @@
1
- import { api as e, unwrap as t } from "../api/client.js";
2
- import { Logo as n } from "../components/Logo.js";
3
- import { usePageTitle as r } from "../lib/pageTitle.js";
4
- import { Route as i } from "./request._token.js";
5
- import { Button as a, Card as o, ErrorText as s, Input as c, Textarea as l } from "@parallelworks/ui";
6
- import { useState as u } from "react";
7
- import { useErrorMessage as d } from "@parallelworks/problem/react";
8
- import { useTranslations as f } from "use-intl";
9
- import { jsx as p, jsxs as m } from "react/jsx-runtime";
10
- import { useMutation as h, useQuery as g } from "@tanstack/react-query";
11
- // src/routes/request.$token.tsx?tsr-split=component
12
- function _() {
13
- let _ = f("intakeForm"), v = d(), { token: y } = i.useParams(), { data: b, error: x } = g({
14
- queryKey: ["intake", y],
15
- queryFn: async ({ signal: n }) => t(await e.GET("/api/v1/intake/{token}", {
16
- params: { path: { token: y } },
17
- signal: n
18
- })),
19
- retry: !1
20
- });
21
- r(b ? _("title", { team: b.team }) : _("heading"));
22
- let [S, C] = u(""), [w, T] = u(""), [E, D] = u(""), [O, k] = u(""), A = h({ mutationFn: async () => t(await e.POST("/api/v1/intake/{token}/requests", {
23
- params: { path: { token: y } },
24
- body: {
25
- email: S,
26
- title: E,
27
- ...w && { name: w },
28
- ...O && { body: O }
29
- }
30
- })) }), j = "block text-xs font-medium text-muted-foreground";
31
- return /* @__PURE__ */ p("main", {
32
- className: "min-h-full bg-background px-4 py-10",
33
- children: /* @__PURE__ */ m("div", {
34
- className: "mx-auto max-w-lg",
35
- children: [/* @__PURE__ */ p(n, { className: "mb-8 h-6" }), /* @__PURE__ */ p(o, {
36
- padding: "lg",
37
- children: x || b && !b.form ? /* @__PURE__ */ p("p", {
38
- className: "text-sm",
39
- children: _("closed")
40
- }) : A.isSuccess ? /* @__PURE__ */ m("div", {
41
- className: "space-y-2",
42
- children: [
43
- /* @__PURE__ */ p("h1", {
44
- className: "text-lg font-semibold",
45
- children: _("sentTitle")
46
- }),
47
- /* @__PURE__ */ p("p", {
48
- className: "text-sm text-muted-foreground",
49
- children: _("sent", { team: b?.team ?? "" })
50
- }),
51
- /* @__PURE__ */ p(a, {
52
- size: "sm",
53
- onClick: () => {
54
- A.reset(), D(""), k("");
55
- },
56
- children: _("another")
57
- })
58
- ]
59
- }) : /* @__PURE__ */ m("form", {
60
- className: "space-y-4",
61
- onSubmit: (e) => {
62
- e.preventDefault(), A.mutate();
63
- },
64
- children: [
65
- /* @__PURE__ */ m("div", { children: [/* @__PURE__ */ p("h1", {
66
- className: "text-lg font-semibold text-balance",
67
- children: b ? _("title", { team: b.team }) : _("heading")
68
- }), b && /* @__PURE__ */ p("p", {
69
- className: "mt-1 text-sm text-muted-foreground",
70
- children: _("intro", {
71
- team: b.team,
72
- workspace: b.workspace
73
- })
74
- })] }),
75
- /* @__PURE__ */ m("label", {
76
- className: j,
77
- children: [_("what"), /* @__PURE__ */ p(c, {
78
- value: E,
79
- onChange: (e) => D(e.target.value),
80
- required: !0,
81
- maxLength: 200,
82
- className: "mt-1"
83
- })]
84
- }),
85
- /* @__PURE__ */ m("label", {
86
- className: j,
87
- children: [_("details"), /* @__PURE__ */ p(l, {
88
- value: O,
89
- onChange: (e) => k(e.target.value),
90
- rows: 6,
91
- maxLength: 2e4,
92
- className: "mt-1"
93
- })]
94
- }),
95
- /* @__PURE__ */ m("div", {
96
- className: "grid gap-4 sm:grid-cols-2",
97
- children: [/* @__PURE__ */ m("label", {
98
- className: j,
99
- children: [_("email"), /* @__PURE__ */ p(c, {
100
- type: "email",
101
- value: S,
102
- onChange: (e) => C(e.target.value),
103
- required: !0,
104
- autoComplete: "email",
105
- className: "mt-1"
106
- })]
107
- }), /* @__PURE__ */ m("label", {
108
- className: j,
109
- children: [_("name"), /* @__PURE__ */ p(c, {
110
- value: w,
111
- onChange: (e) => T(e.target.value),
112
- maxLength: 100,
113
- autoComplete: "name",
114
- className: "mt-1"
115
- })]
116
- })]
117
- }),
118
- A.error && /* @__PURE__ */ p(s, { children: v(A.error) }),
119
- /* @__PURE__ */ p(a, {
120
- type: "submit",
121
- variant: "primary",
122
- loading: A.isPending,
123
- disabled: !b,
124
- children: _("send")
125
- })
126
- ]
127
- })
128
- })]
129
- })
130
- });
131
- }
132
- export { _ as component };