Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

add additional info to feedback

Brendan Allan7c6a900f0c29
diff --git a/apps/desktop/src/routes/(window-chrome)/settings/feedback.tsx b/apps/desktop/src/routes/(window-chrome)/settings/feedback.tsx
index 775f70e85..70d390088 100644
--- a/apps/desktop/src/routes/(window-chrome)/settings/feedback.tsx
+++ b/apps/desktop/src/routes/(window-chrome)/settings/feedback.tsx
@@ -1,12 +1,14 @@
import { Button } from "@cap/ui-solid";
import { action, useAction, useSubmission } from "@solidjs/router";
import { createSignal } from "solid-js";
+import { type as ostype } from "@tauri-apps/plugin-os";
+import { getVersion } from "@tauri-apps/api/app";
import { apiClient, protectedHeaders } from "~/utils/web-api";
const sendFeedbackAction = action(async (feedback: string) => {
const response = await apiClient.desktop.submitFeedback({
- body: { feedback },
+ body: { feedback, os: ostype() as any, version: await getVersion() },
headers: await protectedHeaders(),
});
@@ -21,50 +23,56 @@ export default function FeedbackTab() {
const sendFeedback = useAction(sendFeedbackAction);
return (
- <div class="p-6 max-w-2xl">
- <h2 class="mb-2 text-lg font-medium text-primary">Send Feedback</h2>
- <p class="text-[--text-tertiary] mb-[1rem]">
- Help us improve Cap by submitting feedback or reporting bugs. We'll get
- right on it.
- </p>
- <form
- class="space-y-4"
- onSubmit={(e) => {
- e.preventDefault();
- sendFeedback(feedback());
- }}
- >
- <fieldset disabled={submission.pending}>
- <div>
- <textarea
- value={feedback()}
- onInput={(e) => setFeedback(e.currentTarget.value)}
- placeholder="Tell us what you think about Cap..."
- required
- minLength={10}
- class="p-2 w-full h-32 bg-gray-2 rounded-md border transition-shadow duration-200 resize-none placeholder:text-zinc-400 border-zinc-200 text-primary focus:outline-none focus:ring-2 focus:ring-blue-9"
- />
+ <div class="flex flex-col w-full h-full">
+ <div class="flex-1 custom-scroll">
+ <div class="p-4 space-y-2">
+ <div class="py-2 mb-4">
+ <h2 class="text-gray-12 text-lg font-medium">Send Feedback</h2>
+ <p class="text-gray-11 text-sm">
+ Help us improve Cap by submitting feedback or reporting bugs.
+ We'll get right on it.
+ </p>
</div>
+ <form
+ class="space-y-4"
+ onSubmit={(e) => {
+ e.preventDefault();
+ sendFeedback(feedback());
+ }}
+ >
+ <fieldset disabled={submission.pending}>
+ <div>
+ <textarea
+ value={feedback()}
+ onInput={(e) => setFeedback(e.currentTarget.value)}
+ placeholder="Tell us what you think about Cap..."
+ required
+ minLength={10}
+ class="p-2 w-full h-32 bg-gray-2 rounded-md border transition-shadow duration-200 resize-none placeholder:text-zinc-400 border-gray-6 text-primary focus:outline-none focus:ring-2 focus:ring-blue-9"
+ />
+ </div>
- {submission.error && (
- <p class="mt-2 text-sm text-red-400">
- {submission.error.toString()}
- </p>
- )}
+ {submission.error && (
+ <p class="mt-2 text-sm text-red-400">
+ {submission.error.toString()}
+ </p>
+ )}
- {submission.result?.success && (
- <p class="text-sm text-primary">Thank you for your feedback!</p>
- )}
+ {submission.result?.success && (
+ <p class="text-sm text-primary">Thank you for your feedback!</p>
+ )}
- <Button
- type="submit"
- disabled={!feedback().trim() || feedback().trim().length < 0}
- class="mt-2 w-full bg-primary text-primary"
- >
- {submission.pending ? "Submitting..." : "Submit Feedback"}
- </Button>
- </fieldset>
- </form>
+ <Button
+ type="submit"
+ disabled={!feedback().trim() || feedback().trim().length < 0}
+ class="mt-2 w-full bg-primary text-primary"
+ >
+ {submission.pending ? "Submitting..." : "Submit Feedback"}
+ </Button>
+ </fieldset>
+ </form>
+ </div>
+ </div>
</div>
);
}
diff --git a/apps/web/app/api/desktop/app.ts b/apps/web/app/api/desktop/app.ts
index cf06101c3..fcc1ad7c2 100644
--- a/apps/web/app/api/desktop/app.ts
+++ b/apps/web/app/api/desktop/app.ts
@@ -13,9 +13,16 @@ export const app = new Hono().use(withAuth);
app.post(
"/feedback",
- zValidator("form", z.object({ feedback: z.string() })),
+ zValidator(
+ "form",
+ z.object({
+ feedback: z.string(),
+ os: z.union([z.literal("macos"), z.literal("windows")]).optional(),
+ version: z.string().optional(),
+ })
+ ),
async (c) => {
- const { feedback } = c.req.valid("form");
+ const { feedback, os, version } = c.req.valid("form");
try {
// Send feedback to Discord channel
@@ -27,7 +34,13 @@ app.post(
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
- content: `New feedback from ${c.get("user").email}:\n${feedback}`,
+ content: [
+ `New feedback from ${c.get("user").email}:`,
+ feedback,
+ os && version && `${os} v${version}`,
+ ]
+ .filter(Boolean)
+ .join("\n"),
}),
});
diff --git a/packages/web-api-contract/src/desktop.ts b/packages/web-api-contract/src/desktop.ts
index 1d9204542..689dcee49 100644
--- a/packages/web-api-contract/src/desktop.ts
+++ b/packages/web-api-contract/src/desktop.ts
@@ -44,7 +44,11 @@ const protectedContract = c.router(
method: "POST",
path: "/desktop/feedback",
contentType: "application/x-www-form-urlencoded",
- body: z.object({ feedback: z.string() }),
+ body: z.object({
+ feedback: z.string(),
+ os: z.union([z.literal("macos"), z.literal("windows")]),
+ version: z.string(),
+ }),
responses: {
200: z.object({ success: z.boolean() }),
},