From f6a178257d81b5d139d9fcb95a6ea552200fabcf Mon Sep 17 00:00:00 2001 From: Ariel Weinberger Date: Sun, 28 Apr 2024 14:56:56 +0200 Subject: [PATCH 1/2] fix: trivial cleanup --- .vscode/settings.json | 15 +-------------- apps/console/src/components/common/Drawer.tsx | 7 +++++++ .../src/components/layout/OrgSubHeader.tsx | 7 +++++++ .../src/components/layout/SideNavigation.tsx | 1 + .../src/components/prompts/ConsumePromptModal.tsx | 2 -- .../src/pages/prompts/PromptNavigation.tsx | 7 +++++++ apps/server/src/app/identity/projects.resolver.ts | 2 +- apps/server/src/app/prompts/prompts.resolver.ts | 4 ++-- .../src/app/reporting/reporting.controller.ts | 2 +- 9 files changed, 27 insertions(+), 20 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index d626db8b..2f1ecf38 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,16 +1,3 @@ { - "sqltools.connections": [ - { - "server": "localhost", - "port": 8123, - "useHTTPS": false, - "database": "default", - "username": "default", - "password": "", - "tls": {}, - "previewLimit": 50, - "driver": "ClickHouse", - "name": "Local" - } - ] + "css.customData": [".vscode/tailwind.json"] } diff --git a/apps/console/src/components/common/Drawer.tsx b/apps/console/src/components/common/Drawer.tsx index 2dd621d9..f57093bc 100644 --- a/apps/console/src/components/common/Drawer.tsx +++ b/apps/console/src/components/common/Drawer.tsx @@ -26,6 +26,13 @@ export const Drawer = ({ children, className, onClose, open }: Props) => { !open && "hidden" )} onClick={onClose} + onKeyDown={(e) => { + if (e.key === "Enter") { + onClose(); + } + }} + role="button" + aria-label="Close" > { key={nav.href} onClick={() => navigate(nav.href)} className={getClassName(nav.href)} + onKeyDown={(e) => { + if (e.key === "Enter") { + navigate(nav.href); + } + }} + role="button" + aria-label={nav.name} > {nav.name} diff --git a/apps/console/src/components/layout/SideNavigation.tsx b/apps/console/src/components/layout/SideNavigation.tsx index 0bd276a7..f38d2387 100644 --- a/apps/console/src/components/layout/SideNavigation.tsx +++ b/apps/console/src/components/layout/SideNavigation.tsx @@ -49,6 +49,7 @@ export const SideNavigation = () => {
setCollapsed(false)} onMouseLeave={() => setCollapsed(true)} + onFocus={() => setCollapsed(false)} className={cn( "z-50 flex h-full grow flex-col gap-y-4 overflow-y-auto overflow-x-hidden border-r border-border bg-stone-900 px-3 pt-2" )} diff --git a/apps/console/src/components/prompts/ConsumePromptModal.tsx b/apps/console/src/components/prompts/ConsumePromptModal.tsx index 71b76c14..d6c4cd6e 100644 --- a/apps/console/src/components/prompts/ConsumePromptModal.tsx +++ b/apps/console/src/components/prompts/ConsumePromptModal.tsx @@ -21,8 +21,6 @@ interface Props { export const ConsumePromptModal = ({ open, onClose }: Props) => { const [integration, setIntegration] = useState("typescript"); - ; - const renderInsructions = () => { switch (integration) { case "typescript": diff --git a/apps/console/src/pages/prompts/PromptNavigation.tsx b/apps/console/src/pages/prompts/PromptNavigation.tsx index f467886b..46cd6e41 100644 --- a/apps/console/src/pages/prompts/PromptNavigation.tsx +++ b/apps/console/src/pages/prompts/PromptNavigation.tsx @@ -55,6 +55,13 @@ export const PromptNavigation = () => { key={nav.name} onClick={() => navigate(nav.href)} className={getClassName(nav)} + onKeyDown={(e) => { + if (e.key === "Enter") { + navigate(nav.href); + } + }} + role="button" + aria-label={nav.name} > {nav.name} diff --git a/apps/server/src/app/identity/projects.resolver.ts b/apps/server/src/app/identity/projects.resolver.ts index c802341b..5361d60e 100644 --- a/apps/server/src/app/identity/projects.resolver.ts +++ b/apps/server/src/app/identity/projects.resolver.ts @@ -61,7 +61,7 @@ export class ProjectsResolver { } @Query(() => [Project]) - async projects( + projects( @Args("data") data: GetProjectsInput, @CurrentUser() user: RequestUser ) { diff --git a/apps/server/src/app/prompts/prompts.resolver.ts b/apps/server/src/app/prompts/prompts.resolver.ts index 5169fe80..d7685193 100644 --- a/apps/server/src/app/prompts/prompts.resolver.ts +++ b/apps/server/src/app/prompts/prompts.resolver.ts @@ -266,7 +266,7 @@ export class PromptsResolver { } @ResolveField(() => [PromptVersion]) - async versions(@Parent() prompt: PrismaPrompt) { + versions(@Parent() prompt: PrismaPrompt) { this.logger.info("Resolving prompt versions"); try { @@ -278,7 +278,7 @@ export class PromptsResolver { } @ResolveField(() => PromptVersion, { nullable: true }) - async latestVersion(@Parent() prompt: PrismaPrompt) { + latestVersion(@Parent() prompt: PrismaPrompt) { this.logger.info("Resolving prompt latest version"); try { diff --git a/apps/server/src/app/reporting/reporting.controller.ts b/apps/server/src/app/reporting/reporting.controller.ts index e92ceb02..b11a3efb 100644 --- a/apps/server/src/app/reporting/reporting.controller.ts +++ b/apps/server/src/app/reporting/reporting.controller.ts @@ -31,7 +31,7 @@ export class ReportingController { description: "Report has been reported successfully", }) @ApiResponse({ status: 500, description: "Internal server error" }) - async reportRequest( + reportRequest( @Body() dto: CreateReportDto, @ApiKeyOrgId() organizationId: string, @ProjectId() projectId: string From 6012bccdfb932c0a0d51d813275238a475007660 Mon Sep 17 00:00:00 2001 From: Ariel Weinberger Date: Sun, 28 Apr 2024 15:04:25 +0200 Subject: [PATCH 2/2] fix: linting --- libs/common/src/utils/slugify.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/common/src/utils/slugify.ts b/libs/common/src/utils/slugify.ts index 3954900d..89ee850b 100644 --- a/libs/common/src/utils/slugify.ts +++ b/libs/common/src/utils/slugify.ts @@ -1,5 +1,5 @@ export function slugify(str: string) { - str = str.replace(/^\s+|\s+$/g, ""); // trim leading/trailing white space + str = str.replace(/(^\s+|\s+$)/g, ""); // trim leading/trailing white space str = str.toLowerCase(); // convert string to lowercase str = str .replace(/[^a-z0-9 -]/g, "") // remove any non-alphanumeric characters