1 2!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="af903869-16bf-5ec5-b1c8-fa33d9d88338")}catch(e){}}(); 3import { r as reactExports, f as useQuery, j as jsxRuntimeExports, B as Button, n as navigate, d as namedRoutes, g as gql } from "./index-BjFgPdnU.js"; 4import { C as Card, a as CardHeader, b as CardTitle, d as CardContent } from "./Card-DLMBlvAV.js"; 5import { I as Input } from "./Input-Bw7aOmsY.js"; 6import { T as Table, a as TableHeader, b as TableRow, c as TableHead, d as TableBody, e as TableCell } from "./Table-Co2NjOTz.js"; 7const SEARCH_USER_BY_EMAIL = gql` 8 query SearchUserByEmail($email: String!) { 9 userByEmail(email: $email) { 10 id 11 email 12 createdAt 13 } 14 } 15`; 16const UsersPage = () => { 17 const [email, setEmail] = reactExports.useState(""); 18 const [searchEmail, setSearchEmail] = reactExports.useState(""); 19 const { 20 loading, 21 data, 22 error 23 } = useQuery(SEARCH_USER_BY_EMAIL, { 24 variables: { 25 email: searchEmail 26 }, 27 skip: !searchEmail 28 }); 29 const handleSearch = async (e) => { 30 e.preventDefault(); 31 setSearchEmail(email); 32 }; 33 return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "container mx-auto py-10", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Card, { children: [ 34 /* @__PURE__ */ jsxRuntimeExports.jsx(CardHeader, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(CardTitle, { children: "Search Users" }) }), 35 /* @__PURE__ */ jsxRuntimeExports.jsxs(CardContent, { children: [
36 /* @__PURE__ */ jsxRuntimeExports.jsxs("form", { onSubmit: handleSearch, className: "space-y-4", children: [ 37 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "space-y-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Input, { id: "email", name: "email", value: email, onChange: (e) => setEmail(e.target.value), placeholder: "Enter email address", className: "w-full" }) }), 38 /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { type: "submit", disabled: loading, children: loading ? "Searching..." : "Search" }) 39 ] }), 40 error && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-6 rounded-md bg-destructive/10 p-4 text-destructive", children: "No user found with that email address" }), 41 (data == null ? void 0 : data.userByEmail) && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-6", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Table, { children: [ 42 /* @__PURE__ */ jsxRuntimeExports.jsx(TableHeader, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(TableRow, { children: [
43 /* @__PURE__ */ jsxRuntimeExports.jsx(TableHead, { children: "Email" }), 44 /* @__PURE__ */ jsxRuntimeExports.jsx(TableHead, { children: "Created" }), 45 /* @__PURE__ */ jsxRuntimeExports.jsx(TableHead, { children: "Actions" }) 46 ] }) }), 47 /* @__PURE__ */ jsxRuntimeExports.jsx(TableBody, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(TableRow, { children: [ 48 /* @__PURE__ */ jsxRuntimeExports.jsx(TableCell, { children: data.userByEmail.email }), 49 /* @__PURE__ */ jsxRuntimeExports.jsx(TableCell, { children: new Date(data.userByEmail.createdAt).toLocaleString() }), 50 /* @__PURE__ */ jsxRuntimeExports.jsx(TableCell, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { variant: "outline", onClick: () => navigate(namedRoutes.adminUser({ 51 id: data.userByEmail.id 52 })), children: "View Details" }) }) 53 ] }) }) 54 ] }) }) 55 ] }) 56 ] }) }); 57}; 58export { 59 UsersPage as default 60}; 61//# sourceMappingURL=UsersPage-CEIg0HYw.js.map 62 63//# debugId=af903869-16bf-5ec5-b1c8-fa33d9d88338
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.