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
This commit is contained in:
+3
-10
@@ -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 = () => {
|
||||
<TableRow
|
||||
key={item.key}
|
||||
gridTemplateColumns={USAGE_TABLE_GRID_TEMPLATE_COLUMNS}
|
||||
onClick={() =>
|
||||
navigate(
|
||||
getSettingsPath(
|
||||
SettingsPath.AdminPanelWorkspaceDetail,
|
||||
{ workspaceId: item.key },
|
||||
),
|
||||
)
|
||||
}
|
||||
to={getSettingsPath(SettingsPath.AdminPanelWorkspaceDetail, {
|
||||
workspaceId: item.key,
|
||||
})}
|
||||
>
|
||||
<TableCell color={themeCssVariables.font.color.primary}>
|
||||
{item.label ?? item.key}
|
||||
|
||||
+4
-2
@@ -111,7 +111,7 @@ export const SettingsAdminGeneral = () => {
|
||||
<TableRow gridTemplateColumns="1fr 2fr 1fr">
|
||||
<TableHeader>{t`Name`}</TableHeader>
|
||||
<TableHeader>{t`Email`}</TableHeader>
|
||||
<TableHeader>{t`Workspace`}</TableHeader>
|
||||
<TableHeader align="right">{t`Workspace`}</TableHeader>
|
||||
</TableRow>
|
||||
{recentUsers.map((user) => (
|
||||
<TableRow
|
||||
@@ -126,7 +126,9 @@ export const SettingsAdminGeneral = () => {
|
||||
'\u2014'}
|
||||
</TableCell>
|
||||
<TableCell>{user.email}</TableCell>
|
||||
<TableCell>{user.workspaceName || '\u2014'}</TableCell>
|
||||
<TableCell align="right">
|
||||
{user.workspaceName || '\u2014'}
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
))}
|
||||
</TableBody>
|
||||
|
||||
+2
-8
@@ -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
|
||||
|
||||
+3
-9
@@ -132,10 +132,7 @@ export const SettingsAdminWorkspaceChatThread = () => {
|
||||
>
|
||||
<SettingsPageContainer>
|
||||
<Section>
|
||||
<H2Title
|
||||
title={threadTitle}
|
||||
description={t`Chat conversation`}
|
||||
/>
|
||||
<H2Title title={threadTitle} description={t`Chat conversation`} />
|
||||
|
||||
{messages.length === 0 ? (
|
||||
<Card rounded>
|
||||
@@ -151,16 +148,13 @@ export const SettingsAdminWorkspaceChatThread = () => {
|
||||
) : (
|
||||
<StyledMessagesContainer>
|
||||
{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');
|
||||
|
||||
+10
-8
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user