From b0476ee0c62a6a3843dc3966328ee8b366c2ad1e Mon Sep 17 00:00:00 2001 From: Stef Lewandowski Date: Tue, 26 Nov 2024 16:36:35 +0000 Subject: [PATCH] fix: minor sonar issues --- .../AppComponents/Chat/ui/codeblock.tsx | 6 +- .../AppComponents/Chat/user-or-login.tsx | 22 +++---- .../FeedbackForms/ModerationFeedbackForm.tsx | 62 +++++++++---------- .../GenerationInputAndText.tsx | 4 +- .../ContextProviders/AnalyticsProvider.tsx | 11 ++-- 5 files changed, 51 insertions(+), 54 deletions(-) diff --git a/apps/nextjs/src/components/AppComponents/Chat/ui/codeblock.tsx b/apps/nextjs/src/components/AppComponents/Chat/ui/codeblock.tsx index 1633f7d0c..fc4fcfa01 100644 --- a/apps/nextjs/src/components/AppComponents/Chat/ui/codeblock.tsx +++ b/apps/nextjs/src/components/AppComponents/Chat/ui/codeblock.tsx @@ -18,11 +18,11 @@ interface Props { value: string; } -interface languageMap { +interface LanguageMap { [key: string]: string | undefined; } -const programmingLanguages: languageMap = { +const programmingLanguages: LanguageMap = { javascript: ".js", python: ".py", java: ".java", @@ -65,7 +65,7 @@ const CodeBlock: FC = memo(({ language, value }) => { if (typeof window === "undefined") { return; } - const fileExtension = programmingLanguages[language] || ".file"; + const fileExtension = programmingLanguages[language] ?? ".file"; const suggestedFileName = `file-${generateRandomString( 3, true, diff --git a/apps/nextjs/src/components/AppComponents/Chat/user-or-login.tsx b/apps/nextjs/src/components/AppComponents/Chat/user-or-login.tsx index 940a8f76d..f1cd37291 100644 --- a/apps/nextjs/src/components/AppComponents/Chat/user-or-login.tsx +++ b/apps/nextjs/src/components/AppComponents/Chat/user-or-login.tsx @@ -10,17 +10,15 @@ export function UserOrLogin() { return <>; } return ( - <> -
- - - - - - -
- +
+ + + + + + +
); } diff --git a/apps/nextjs/src/components/AppComponents/FeedbackForms/ModerationFeedbackForm.tsx b/apps/nextjs/src/components/AppComponents/FeedbackForms/ModerationFeedbackForm.tsx index 22366e46a..e5a072be0 100644 --- a/apps/nextjs/src/components/AppComponents/FeedbackForms/ModerationFeedbackForm.tsx +++ b/apps/nextjs/src/components/AppComponents/FeedbackForms/ModerationFeedbackForm.tsx @@ -46,39 +46,35 @@ export const ModerationFeedbackForm = ({ /> - <> -
- - Guidance required - - - - Contains{" "} - {moderation.categories - .map(moderationSlugToDescription) - .join(", ")} - . Check content carefully. If you have feedback on this guidance, - please provide details below. - - -
-
-