History

Add support icons to error fallback

Rhys Sullivan committed 6 months ago

Commit 07ea2e61 parent 64aa2ae1 file · +105 −6Browse files

Unified · Split

apps/cloud/src/routes/__root.tsx+105−6
@@ -6,6 +6,17 @@ import posthog from "posthog-js"; · 5 unmodified lines
6import { PostHogProvider } from "posthog-js/react";6import { PostHogProvider } from "posthog-js/react";
7import type { FrontendErrorReporter } from "@executor-js/react/api/error-reporting";7import type { FrontendErrorReporter } from "@executor-js/react/api/error-reporting";
8import { ExecutorProvider } from "@executor-js/react/api/provider";8import { ExecutorProvider } from "@executor-js/react/api/provider";
9import { Button } from "@executor-js/react/components/button";
10import {
11 Dialog,
12 DialogClose,
13 DialogContent,
14 DialogDescription,
15 DialogFooter,
16 DialogHeader,
17 DialogTitle,
18 DialogTrigger,
19} from "@executor-js/react/components/dialog";
9import { Skeleton } from "@executor-js/react/components/skeleton";20import { Skeleton } from "@executor-js/react/components/skeleton";
10import { Toaster } from "@executor-js/react/components/sonner";21import { Toaster } from "@executor-js/react/components/sonner";
11import { ExecutorPluginsProvider } from "@executor-js/sdk/client";22import { ExecutorPluginsProvider } from "@executor-js/sdk/client";
@@ -168,11 +179,15 @@ function ShellSkeleton() { · 156 unmodified lines
168}179}
169 180
170function ShellErrorFallback() {181function ShellErrorFallback() {
182 const [slackOpen, setSlackOpen] = React.useState(false);
171 const supportLinks = [183 const supportLinks = [
172 { label: "Discord", href: "https://discord.gg/eF29HBHwM6" },184 { label: "Discord", href: "https://discord.gg/eF29HBHwM6", icon: DiscordMark },
173 { label: "GitHub Issues", href: "https://github.com/RhysSullivan/executor/issues" },185 {
174 { label: "Slack", href: "mailto:rhys@executor.sh?subject=Executor%20Slack%20invite" },186 label: "GitHub Issues",
175 { label: "Email", href: "mailto:rhys@executor.sh?subject=Executor%20support" },187 href: "https://github.com/RhysSullivan/executor/issues",
188 icon: GitHubMark,
189 },
190 { label: "Email", href: "mailto:rhys@executor.sh?subject=Executor%20support", icon: MailMark },
176 ] as const;191 ] as const;
177 192
178 return (193 return (
@@ -185,13 +200,39 @@ function ShellErrorFallback() { · 6 unmodified lines
185 <p className="mt-2 text-sm leading-6 text-muted-foreground">200 <p className="mt-2 text-sm leading-6 text-muted-foreground">
186 We&apos;ve tracked it. Give refreshing a try, and get in touch if support is needed.201 We&apos;ve tracked it. Give refreshing a try, and get in touch if support is needed.
187 </p>202 </p>
188 <div className="mt-6 flex flex-wrap items-center justify-center gap-x-4 gap-y-2 text-sm">203 <div className="mt-6 flex flex-wrap items-center justify-center gap-2 text-sm">
204 <Dialog open={slackOpen} onOpenChange={setSlackOpen}>
205 <DialogTrigger asChild>
206 <Button type="button" variant="outline" size="sm" className="gap-2">
207 <SlackMark className="size-4" />
208 Slack
209 </Button>
210 </DialogTrigger>
211 <DialogContent>
212 <DialogHeader>
213 <DialogTitle>Slack Connect</DialogTitle>
214 <DialogDescription>
215 Add <span className="font-medium text-foreground">rhys@executor.sh</span> to your
216 Slack Connect channel and mention that you need Executor support.
217 </DialogDescription>
218 </DialogHeader>
219 <DialogFooter>
220 <DialogClose asChild>
221 <Button type="button" variant="outline">
222 Done
223 </Button>
224 </DialogClose>
225 </DialogFooter>
226 </DialogContent>
227 </Dialog>
189 {supportLinks.map((link) => (228 {supportLinks.map((link) => (
229 // oxlint-disable-next-line react/jsx-no-new-function-as-prop -- static support link component choice
190 <a230 <a
191 key={link.label}231 key={link.label}
192 href={link.href}232 href={link.href}
193 className="font-medium text-foreground underline-offset-4 hover:underline"233 className="inline-flex h-9 items-center gap-2 rounded-md border border-border bg-background px-3 font-medium text-foreground transition-colors hover:bg-muted"
194 >234 >
235 <link.icon className="size-4" />
195 {link.label}236 {link.label}
196 </a>237 </a>
197 ))}238 ))}
@@ -201,6 +242,64 @@ function ShellErrorFallback() { · 3 unmodified lines
201 );242 );
202}243}
203 244
245function DiscordMark({ className }: { className?: string }) {
246 return (
247 <svg viewBox="0 0 24 24" fill="currentColor" className={className} aria-hidden>
248 <path d="M20.32 4.37A19.8 19.8 0 0 0 15.36 2.8a13.8 13.8 0 0 0-.64 1.32 18.4 18.4 0 0 0-5.44 0 13.8 13.8 0 0 0-.64-1.32 19.7 19.7 0 0 0-4.97 1.57C.53 9.09-.32 13.69.1 18.22a19.9 19.9 0 0 0 6.08 3.03 14.7 14.7 0 0 0 1.3-2.09 12.8 12.8 0 0 1-2.04-.97l.5-.38a14.2 14.2 0 0 0 12.12 0l.5.38c-.65.38-1.33.7-2.04.97.37.74.8 1.44 1.3 2.09a19.9 19.9 0 0 0 6.08-3.03c.5-5.25-.84-9.8-3.58-13.85ZM8.02 15.43c-1.18 0-2.15-1.08-2.15-2.4 0-1.33.95-2.41 2.15-2.41 1.2 0 2.17 1.09 2.15 2.4 0 1.33-.95 2.41-2.15 2.41Zm7.96 0c-1.18 0-2.15-1.08-2.15-2.4 0-1.33.95-2.41 2.15-2.41 1.2 0 2.17 1.09 2.15 2.4 0 1.33-.95 2.41-2.15 2.41Z" />
249 </svg>
250 );
251}
252
253function GitHubMark({ className }: { className?: string }) {
254 return (
255 <svg viewBox="0 0 24 24" fill="currentColor" className={className} aria-hidden>
256 <path d="M12 .5C5.65.5.5 5.65.5 12c0 5.08 3.29 9.39 7.86 10.91.58.1.79-.25.79-.56v-2.15c-3.2.7-3.88-1.36-3.88-1.36-.52-1.33-1.28-1.68-1.28-1.68-1.05-.72.08-.7.08-.7 1.16.08 1.77 1.19 1.77 1.19 1.03 1.77 2.71 1.26 3.37.96.1-.75.4-1.26.73-1.55-2.55-.29-5.24-1.28-5.24-5.68 0-1.25.45-2.28 1.19-3.08-.12-.29-.52-1.46.11-3.04 0 0 .98-.31 3.17 1.18a10.9 10.9 0 0 1 5.78 0c2.2-1.49 3.17-1.18 3.17-1.18.63 1.58.23 2.75.11 3.04.74.8 1.19 1.83 1.19 3.08 0 4.42-2.69 5.39-5.25 5.68.41.36.78 1.06.78 2.14v3.16c0 .31.21.67.79.56A11.5 11.5 0 0 0 23.5 12C23.5 5.65 18.35.5 12 .5Z" />
257 </svg>
258 );
259}
260
261function MailMark({ className }: { className?: string }) {
262 return (
263 <svg
264 viewBox="0 0 24 24"
265 fill="none"
266 stroke="currentColor"
267 strokeWidth="1.8"
268 className={className}
269 aria-hidden
270 >
271 <path
272 strokeLinecap="round"
273 strokeLinejoin="round"
274 d="M3 7l9 6 9-6M5 19h14a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2Z"
275 />
276 </svg>
277 );
278}
279
280function SlackMark({ className }: { className?: string }) {
281 return (
282 <svg viewBox="0 0 24 24" fill="none" className={className} aria-hidden>
283 <path
284 d="M5.042 15.165a2.528 2.528 0 0 1-2.52 2.523A2.528 2.528 0 0 1 0 15.165a2.527 2.527 0 0 1 2.522-2.52h2.52v2.52zm1.271 0a2.527 2.527 0 0 1 2.521-2.52 2.527 2.527 0 0 1 2.521 2.52v6.313A2.528 2.528 0 0 1 8.834 24a2.528 2.528 0 0 1-2.521-2.522v-6.313z"
285 fill="#E01E5A"
286 />
287 <path
288 d="M8.834 5.042a2.528 2.528 0 0 1-2.521-2.52A2.528 2.528 0 0 1 8.834 0a2.528 2.528 0 0 1 2.521 2.522v2.52H8.834zm0 1.271a2.527 2.527 0 0 1 2.521 2.521 2.527 2.527 0 0 1-2.521 2.521H2.522A2.527 2.527 0 0 1 0 8.834a2.528 2.528 0 0 1 2.522-2.521h6.312z"
289 fill="#36C5F0"
290 />
291 <path
292 d="M18.956 8.834a2.528 2.528 0 0 1 2.522-2.521A2.528 2.528 0 0 1 24 8.834a2.528 2.528 0 0 1-2.522 2.521h-2.522V8.834zm-1.272 0a2.528 2.528 0 0 1-2.521 2.521 2.527 2.527 0 0 1-2.521-2.521V2.522A2.527 2.527 0 0 1 15.163 0a2.528 2.528 0 0 1 2.521 2.522v6.312z"
293 fill="#2EB67D"
294 />
295 <path
296 d="M15.163 18.956a2.528 2.528 0 0 1 2.521 2.522A2.528 2.528 0 0 1 15.163 24a2.527 2.527 0 0 1-2.521-2.522v-2.522h2.521zm0-1.272a2.527 2.527 0 0 1-2.521-2.521 2.527 2.527 0 0 1 2.521-2.521h6.315A2.527 2.527 0 0 1 24 15.163a2.528 2.528 0 0 1-2.522 2.521h-6.315z"
297 fill="#ECB22E"
298 />
299 </svg>
300 );
301}
302
204function AuthGate() {303function AuthGate() {
205 const auth = useAuth();304 const auth = useAuth();
206 305