From 91b0937315e471c205f07bb6849eda19c2acf283 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 12 Apr 2026 06:27:48 +0000 Subject: [PATCH] Fix CI lint/typecheck failures and admin panel UI issues - Remove undefined useNavigate reference in SettingsAdminWorkspaceDetail (was crashing at runtime since useNavigate was not imported) - Replace onCompleted callback with useEffect for Apollo useQuery compatibility, fix DeepPartialObject type mismatch - Replace onClick+navigate with to prop on TableRow in SettingsAdminAI for accessible link behavior (cmd+click to open in new tab) - Right-align Workspace column in Recent Users table - Fix prettier formatting across changed files https://claude.ai/code/session_01SdHcodsLnF7R6Zg8fUtKj8 --- .../ai/components/SettingsAdminAI.tsx | 13 +++---------- .../components/SettingsAdminGeneral.tsx | 6 ++++-- .../queries/getAdminChatThreadMessages.ts | 10 ++-------- .../SettingsAdminWorkspaceChatThread.tsx | 12 +++--------- .../SettingsAdminWorkspaceDetail.tsx | 18 ++++++++++-------- 5 files changed, 22 insertions(+), 37 deletions(-) diff --git a/packages/twenty-front/src/modules/settings/admin-panel/ai/components/SettingsAdminAI.tsx b/packages/twenty-front/src/modules/settings/admin-panel/ai/components/SettingsAdminAI.tsx index c8e57fba0a9..7be739943b2 100644 --- a/packages/twenty-front/src/modules/settings/admin-panel/ai/components/SettingsAdminAI.tsx +++ b/packages/twenty-front/src/modules/settings/admin-panel/ai/components/SettingsAdminAI.tsx @@ -1,5 +1,4 @@ import { useMemo, useState } from 'react'; -import { useNavigate } from 'react-router-dom'; import { useMutation, useQuery } from '@apollo/client/react'; import { t } from '@lingui/core/macro'; @@ -54,7 +53,6 @@ type UsageBreakdownItem = { }; export const SettingsAdminAI = () => { - const navigate = useNavigate(); const { enqueueErrorSnackBar } = useSnackBar(); const { refetch: refetchClientConfig } = useClientConfig(); const { formatUsageValue } = useUsageValueFormatter(); @@ -323,14 +321,9 @@ export const SettingsAdminAI = () => { - navigate( - getSettingsPath( - SettingsPath.AdminPanelWorkspaceDetail, - { workspaceId: item.key }, - ), - ) - } + to={getSettingsPath(SettingsPath.AdminPanelWorkspaceDetail, { + workspaceId: item.key, + })} > {item.label ?? item.key} diff --git a/packages/twenty-front/src/modules/settings/admin-panel/components/SettingsAdminGeneral.tsx b/packages/twenty-front/src/modules/settings/admin-panel/components/SettingsAdminGeneral.tsx index dfd8292fb4e..74a86e9846c 100644 --- a/packages/twenty-front/src/modules/settings/admin-panel/components/SettingsAdminGeneral.tsx +++ b/packages/twenty-front/src/modules/settings/admin-panel/components/SettingsAdminGeneral.tsx @@ -111,7 +111,7 @@ export const SettingsAdminGeneral = () => { {t`Name`} {t`Email`} - {t`Workspace`} + {t`Workspace`} {recentUsers.map((user) => ( { '\u2014'} {user.email} - {user.workspaceName || '\u2014'} + + {user.workspaceName || '\u2014'} + ))} diff --git a/packages/twenty-front/src/modules/settings/admin-panel/graphql/queries/getAdminChatThreadMessages.ts b/packages/twenty-front/src/modules/settings/admin-panel/graphql/queries/getAdminChatThreadMessages.ts index b7d2918edb3..9433c747b5d 100644 --- a/packages/twenty-front/src/modules/settings/admin-panel/graphql/queries/getAdminChatThreadMessages.ts +++ b/packages/twenty-front/src/modules/settings/admin-panel/graphql/queries/getAdminChatThreadMessages.ts @@ -1,14 +1,8 @@ import { gql } from '@apollo/client'; export const GET_ADMIN_CHAT_THREAD_MESSAGES = gql` - query GetAdminChatThreadMessages( - $workspaceId: String! - $threadId: String! - ) { - getAdminChatThreadMessages( - workspaceId: $workspaceId - threadId: $threadId - ) { + query GetAdminChatThreadMessages($workspaceId: String!, $threadId: String!) { + getAdminChatThreadMessages(workspaceId: $workspaceId, threadId: $threadId) { thread { id title diff --git a/packages/twenty-front/src/pages/settings/admin-panel/SettingsAdminWorkspaceChatThread.tsx b/packages/twenty-front/src/pages/settings/admin-panel/SettingsAdminWorkspaceChatThread.tsx index 0a5318d3c29..58d130ab405 100644 --- a/packages/twenty-front/src/pages/settings/admin-panel/SettingsAdminWorkspaceChatThread.tsx +++ b/packages/twenty-front/src/pages/settings/admin-panel/SettingsAdminWorkspaceChatThread.tsx @@ -132,10 +132,7 @@ export const SettingsAdminWorkspaceChatThread = () => { >
- + {messages.length === 0 ? ( @@ -151,16 +148,13 @@ export const SettingsAdminWorkspaceChatThread = () => { ) : ( {messages - .filter( - (message) => message.role !== AgentMessageRole.SYSTEM, - ) + .filter((message) => message.role !== AgentMessageRole.SYSTEM) .map((message) => { const isUser = message.role === AgentMessageRole.USER; const textParts = message.parts .filter( (part) => - part.type === 'text' && - part.textContent !== null, + part.type === 'text' && part.textContent !== null, ) .map((part) => part.textContent) .join('\n'); diff --git a/packages/twenty-front/src/pages/settings/admin-panel/SettingsAdminWorkspaceDetail.tsx b/packages/twenty-front/src/pages/settings/admin-panel/SettingsAdminWorkspaceDetail.tsx index d163661ce4d..f1d772348d8 100644 --- a/packages/twenty-front/src/pages/settings/admin-panel/SettingsAdminWorkspaceDetail.tsx +++ b/packages/twenty-front/src/pages/settings/admin-panel/SettingsAdminWorkspaceDetail.tsx @@ -1,4 +1,4 @@ -import { useMemo, useState } from 'react'; +import { useEffect, useMemo, useState } from 'react'; import { useParams } from 'react-router-dom'; import { useMutation, useQuery } from '@apollo/client/react'; @@ -19,6 +19,7 @@ import { useImpersonationRedirect } from '@/settings/admin-panel/hooks/useImpers import { userLookupResultState } from '@/settings/admin-panel/states/userLookupResultState'; import { type AdminChatThread } from '@/settings/admin-panel/types/AdminChatThread'; import { type UserLookup } from '@/settings/admin-panel/types/UserLookup'; +import { type WorkspaceInfo } from '@/settings/admin-panel/types/WorkspaceInfo'; import { SettingsPageContainer } from '@/settings/components/SettingsPageContainer'; import { SettingsSkeletonLoader } from '@/settings/components/SettingsSkeletonLoader'; import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar'; @@ -61,7 +62,6 @@ const WORKSPACE_DETAIL_TAB_IDS = { export const SettingsAdminWorkspaceDetail = () => { const { workspaceId } = useParams<{ workspaceId: string }>(); - const navigate = useNavigate(); const [activeTabId] = useAtomComponentState( activeTabIdComponentState, @@ -89,14 +89,16 @@ export const SettingsAdminWorkspaceDetail = () => { }>(WORKSPACE_LOOKUP_ADMIN_PANEL, { variables: { workspaceId }, skip: !workspaceId, - onCompleted: (data) => { - if (isDefined(data?.workspaceLookupAdminPanel)) { - setUserLookupResult(data.workspaceLookupAdminPanel); - } - }, }); - const workspace = workspaceData?.workspaceLookupAdminPanel?.workspaces?.[0]; + useEffect(() => { + if (isDefined(workspaceData?.workspaceLookupAdminPanel)) { + setUserLookupResult(workspaceData.workspaceLookupAdminPanel); + } + }, [workspaceData, setUserLookupResult]); + + const workspace = workspaceData?.workspaceLookupAdminPanel + ?.workspaces?.[0] as WorkspaceInfo | undefined; const effectiveTabId = activeTabId || WORKSPACE_DETAIL_TAB_IDS.INFO;