Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

feat: Submit feedback to Linear

Rene Wangab683abf1856
diff --git a/src/app/[variants]/(main)/home/_layout/Footer/index.tsx b/src/app/[variants]/(main)/home/_layout/Footer/index.tsx
index 5a708cd06a4..e526708cdfa 100644
--- a/src/app/[variants]/(main)/home/_layout/Footer/index.tsx
+++ b/src/app/[variants]/(main)/home/_layout/Footer/index.tsx
@@ -5,12 +5,13 @@ import { ActionIcon, Dropdown, Icon, type MenuProps } from '@lobehub/ui';
import { Flexbox } from '@lobehub/ui';
import { DiscordIcon } from '@lobehub/ui/icons';
import { Book, CircleHelp, Feather, FileClockIcon, FlaskConical, Github, Mail } from 'lucide-react';
-import { memo, useMemo, useState } from 'react';
+import { lazy, memo, Suspense, useMemo, useState } from 'react';
import { useTranslation } from 'react-i18next';
import ChangelogModal from '@/components/ChangelogModal';
-import FeedbackModal from '@/components/FeedbackModal';
import LabsModal from '@/components/LabsModal';
+
+const FeedbackModal = lazy(() => import('@/components/FeedbackModal'));
import { DOCUMENTS_REFER_URL, GITHUB, mailTo } from '@/const/url';
import ThemeButton from '@/features/User/UserPanel/ThemeButton';
import { featureFlagsSelectors, useServerConfigStore } from '@/store/serverConfig';
@@ -21,6 +22,7 @@ const Footer = memo(() => {
const [isLabsModalOpen, setIsLabsModalOpen] = useState(false);
const [shouldLoadChangelog, setShouldLoadChangelog] = useState(false);
const [isChangelogModalOpen, setIsChangelogModalOpen] = useState(false);
+ const [shouldLoadFeedback, setShouldLoadFeedback] = useState(false);
const [isFeedbackModalOpen, setIsFeedbackModalOpen] = useState(false);
const handleOpenLabsModal = () => {
@@ -41,6 +43,7 @@ const Footer = memo(() => {
};
const handleOpenFeedbackModal = () => {
+ setShouldLoadFeedback(true);
setIsFeedbackModalOpen(true);
};
@@ -129,7 +132,11 @@ const Footer = memo(() => {
open={isChangelogModalOpen}
shouldLoad={shouldLoadChangelog}
/>
- <FeedbackModal onClose={handleCloseFeedbackModal} open={isFeedbackModalOpen} />
+ {shouldLoadFeedback && (
+ <Suspense fallback={null}>
+ <FeedbackModal onClose={handleCloseFeedbackModal} open={isFeedbackModalOpen} />
+ </Suspense>
+ )}
</>
);
});
diff --git a/src/components/FeedbackModal/index.tsx b/src/components/FeedbackModal/index.tsx
index 5185a6432ef..a5136146074 100644
--- a/src/components/FeedbackModal/index.tsx
+++ b/src/components/FeedbackModal/index.tsx
@@ -65,7 +65,18 @@ const FeedbackModal = memo<FeedbackModalProps>(({ onClose, open }) => {
const values = await form.validateFields();
setLoading(true);
+ // Collect client information
+ const clientInfo = {
+ language: navigator.language,
+ screenResolution: `${window.screen.width}x${window.screen.height}`,
+ timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
+ url: window.location.href,
+ userAgent: navigator.userAgent,
+ viewport: `${window.innerWidth}x${window.innerHeight}`,
+ };
+
await lambdaClient.feedback.submitFeedback.mutate({
+ clientInfo,
message: values.message,
screenshotUrl: screenshotUrl || undefined,
title: values.title,
diff --git a/src/server/routers/lambda/feedback.ts b/src/server/routers/lambda/feedback.ts
index ac9ad3d769b..d22450b66b6 100644
--- a/src/server/routers/lambda/feedback.ts
+++ b/src/server/routers/lambda/feedback.ts
@@ -6,6 +6,16 @@ import { authedProcedure, router } from '@/libs/trpc/lambda';
import { serverDatabase } from '@/libs/trpc/lambda/middleware';
const submitFeedbackSchema = z.object({
+ clientInfo: z
+ .object({
+ language: z.string().optional(),
+ screenResolution: z.string().optional(),
+ timezone: z.string().optional(),
+ url: z.string().optional(),
+ userAgent: z.string().optional(),
+ viewport: z.string().optional(),
+ })
+ .optional(),
message: z.string().min(1).max(5000),
screenshotUrl: z.string().url().optional(),
title: z.string().min(1).max(200),
@@ -112,15 +122,37 @@ export const feedbackRouter = router({
// 1. Get user email
const userState = await ctx.userModel.getUserState(async () => ({}));
- // 2. Build description with email and screenshot
+ // 2. Build description with email, screenshot, and client info
let description = input.message;
+
+ // Add user email
if (userState.email) {
description += `\n\n---\n**Submitted by**: ${userState.email}`;
}
+
+ // Add screenshot
if (input.screenshotUrl) {
description += `\n\n**Screenshot**: ${input.screenshotUrl}`;
}
+ // Add client information as a table
+ if (input.clientInfo) {
+ description += '\n\n## System Information\n\n';
+ description += '| Property | Value |\n';
+ description += '|----------|-------|\n';
+ if (input.clientInfo.url) description += `| URL | ${input.clientInfo.url} |\n`;
+ if (input.clientInfo.userAgent)
+ description += `| User Agent | ${input.clientInfo.userAgent} |\n`;
+ if (input.clientInfo.language)
+ description += `| Language | ${input.clientInfo.language} |\n`;
+ if (input.clientInfo.timezone)
+ description += `| Timezone | ${input.clientInfo.timezone} |\n`;
+ if (input.clientInfo.screenResolution)
+ description += `| Screen | ${input.clientInfo.screenResolution} |\n`;
+ if (input.clientInfo.viewport)
+ description += `| Viewport | ${input.clientInfo.viewport} |\n`;
+ }
+
// 3. Get label ID if configured
const LINEAR_FEEDBACK_LABEL_ID = process.env.LINEAR_FEEDBACK_LABEL_ID;
const labelIds = LINEAR_FEEDBACK_LABEL_ID ? [LINEAR_FEEDBACK_LABEL_ID] : undefined;