Skip to content

Commit 6b98763

Browse files
Implement tab content components for TeamAnalysisResultPage (#276)
* Implement tab content components for TeamAnalysisResultPage Co-Authored-By: Hal Seki <[email protected]> * Fix TypeScript type issues in TabContent components Co-Authored-By: Hal Seki <[email protected]> * Update tab components to use workspaceUuid prop Co-Authored-By: Hal Seki <[email protected]> --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
1 parent 1b97d31 commit 6b98763

File tree

9 files changed

+415
-258
lines changed

9 files changed

+415
-258
lines changed
Lines changed: 41 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,49 @@
11
import React from 'react'
2-
import { Box } from '@chakra-ui/react'
2+
import { Card, CardBody } from '@chakra-ui/react'
3+
import { renderPlainText } from '../../../utils/textRenderer'
4+
import { TabContentProps } from './types'
5+
import { ChannelAnalysisList } from '../../common'
36

47
/**
58
* Tab content for contributors analysis
69
*/
7-
const ContributorsTab: React.FC = () => {
8-
return <Box>{/* Contributors content will go here */}</Box>
10+
const ContributorsTab: React.FC<TabContentProps> = ({
11+
analysis,
12+
processedAnalysis,
13+
reportResult,
14+
isTeamAnalysis,
15+
workspaceUuid,
16+
}) => {
17+
return (
18+
<>
19+
<Card variant="outline">
20+
<CardBody>
21+
{processedAnalysis?.fixedContributorInsights
22+
? renderPlainText(
23+
processedAnalysis.fixedContributorInsights,
24+
String(workspaceUuid || '')
25+
)
26+
: renderPlainText(
27+
analysis?.contributor_insights ||
28+
'No contributor insights available',
29+
String(workspaceUuid || '')
30+
)}
31+
</CardBody>
32+
</Card>
33+
34+
{/* For team analysis, show individual channel contributor insights */}
35+
{isTeamAnalysis && reportResult && (
36+
<ChannelAnalysisList
37+
title="Channel Contributor Insights"
38+
reportResult={reportResult}
39+
currentResources={[]}
40+
integrationId=""
41+
contentField="contributor_insights"
42+
emptyMessage="No contributor insights available for individual channels."
43+
/>
44+
)}
45+
</>
46+
)
947
}
1048

1149
export default ContributorsTab
Lines changed: 40 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,48 @@
11
import React from 'react'
2-
import { Box } from '@chakra-ui/react'
2+
import { Card, CardBody } from '@chakra-ui/react'
3+
import { renderPlainText } from '../../../utils/textRenderer'
4+
import { TabContentProps } from './types'
5+
import { ChannelAnalysisList } from '../../common'
36

47
/**
58
* Tab content for highlights analysis
69
*/
7-
const HighlightsTab: React.FC = () => {
8-
return <Box>{/* Highlights content will go here */}</Box>
10+
const HighlightsTab: React.FC<TabContentProps> = ({
11+
analysis,
12+
processedAnalysis,
13+
reportResult,
14+
isTeamAnalysis,
15+
workspaceUuid,
16+
}) => {
17+
return (
18+
<>
19+
<Card variant="outline">
20+
<CardBody>
21+
{processedAnalysis?.fixedKeyHighlights
22+
? renderPlainText(
23+
processedAnalysis.fixedKeyHighlights,
24+
String(workspaceUuid || '')
25+
)
26+
: renderPlainText(
27+
analysis?.key_highlights || 'No highlights available',
28+
String(workspaceUuid || '')
29+
)}
30+
</CardBody>
31+
</Card>
32+
33+
{/* For team analysis, show individual channel highlights */}
34+
{isTeamAnalysis && reportResult && (
35+
<ChannelAnalysisList
36+
title="Channel Highlights"
37+
reportResult={reportResult}
38+
currentResources={[]}
39+
integrationId=""
40+
contentField="key_highlights"
41+
emptyMessage="No highlights available for individual channels."
42+
/>
43+
)}
44+
</>
45+
)
946
}
1047

1148
export default HighlightsTab
Lines changed: 40 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,48 @@
11
import React from 'react'
2-
import { Box } from '@chakra-ui/react'
2+
import { Card, CardBody } from '@chakra-ui/react'
3+
import { renderPlainText } from '../../../utils/textRenderer'
4+
import { TabContentProps } from './types'
5+
import { ChannelAnalysisList } from '../../common'
36

47
/**
58
* Tab content for summary information
69
*/
7-
const SummaryTab: React.FC = () => {
8-
return <Box>{/* Summary content will go here */}</Box>
10+
const SummaryTab: React.FC<TabContentProps> = ({
11+
analysis,
12+
processedAnalysis,
13+
reportResult,
14+
isTeamAnalysis,
15+
workspaceUuid,
16+
}) => {
17+
return (
18+
<>
19+
<Card variant="outline">
20+
<CardBody>
21+
{processedAnalysis?.fixedChannelSummary
22+
? renderPlainText(
23+
processedAnalysis.fixedChannelSummary,
24+
String(workspaceUuid || '')
25+
)
26+
: renderPlainText(
27+
analysis?.channel_summary || 'No summary available',
28+
String(workspaceUuid || '')
29+
)}
30+
</CardBody>
31+
</Card>
32+
33+
{/* For team analysis, show individual channel summaries */}
34+
{isTeamAnalysis && reportResult && (
35+
<ChannelAnalysisList
36+
title="Channel Summaries"
37+
reportResult={reportResult}
38+
currentResources={[]}
39+
integrationId=""
40+
contentField="resource_summary"
41+
emptyMessage="No channel summaries available."
42+
/>
43+
)}
44+
</>
45+
)
946
}
1047

1148
export default SummaryTab
Lines changed: 40 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,48 @@
11
import React from 'react'
2-
import { Box } from '@chakra-ui/react'
2+
import { Card, CardBody } from '@chakra-ui/react'
3+
import { renderPlainText } from '../../../utils/textRenderer'
4+
import { TabContentProps } from './types'
5+
import { ChannelAnalysisList } from '../../common'
36

47
/**
58
* Tab content for topics analysis
69
*/
7-
const TopicsTab: React.FC = () => {
8-
return <Box>{/* Topics content will go here */}</Box>
10+
const TopicsTab: React.FC<TabContentProps> = ({
11+
analysis,
12+
processedAnalysis,
13+
reportResult,
14+
isTeamAnalysis,
15+
workspaceUuid,
16+
}) => {
17+
return (
18+
<>
19+
<Card variant="outline">
20+
<CardBody>
21+
{processedAnalysis?.fixedTopicAnalysis
22+
? renderPlainText(
23+
processedAnalysis.fixedTopicAnalysis,
24+
String(workspaceUuid || '')
25+
)
26+
: renderPlainText(
27+
analysis?.topic_analysis || 'No topic analysis available',
28+
String(workspaceUuid || '')
29+
)}
30+
</CardBody>
31+
</Card>
32+
33+
{/* For team analysis, show individual channel topic analyses */}
34+
{isTeamAnalysis && reportResult && (
35+
<ChannelAnalysisList
36+
title="Channel Topic Analyses"
37+
reportResult={reportResult}
38+
currentResources={[]}
39+
integrationId=""
40+
contentField="topic_analysis"
41+
emptyMessage="No topic analyses available for individual channels."
42+
/>
43+
)}
44+
</>
45+
)
946
}
1047

1148
export default TopicsTab

frontend/src/components/analysis/TabContent/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ export { default as SummaryTab } from './SummaryTab'
22
export { default as TopicsTab } from './TopicsTab'
33
export { default as ContributorsTab } from './ContributorsTab'
44
export { default as HighlightsTab } from './HighlightsTab'
5+
export type { TabContentProps } from './types'
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
import { FC } from 'react'
2+
3+
export interface AnalysisResponse {
4+
id: string
5+
channel_id: string
6+
channel_name: string
7+
start_date: string
8+
end_date: string
9+
message_count: number
10+
participant_count: number
11+
thread_count: number
12+
reaction_count: number
13+
channel_summary: string
14+
topic_analysis: string
15+
contributor_insights: string
16+
key_highlights: string
17+
model_used: string
18+
generated_at: string
19+
team_id?: string
20+
report_id?: string
21+
is_unified_report?: boolean
22+
23+
fixedChannelSummary?: string
24+
fixedTopicAnalysis?: string
25+
fixedContributorInsights?: string
26+
fixedKeyHighlights?: string
27+
}
28+
29+
export interface Channel {
30+
id: string
31+
integration_id: string
32+
resource_type: string
33+
external_id: string
34+
name: string
35+
metadata?: Record<string, unknown>
36+
last_synced_at?: string
37+
created_at: string
38+
updated_at: string
39+
is_selected_for_analysis?: boolean
40+
type: string
41+
topic?: string
42+
purpose?: string
43+
}
44+
45+
export interface TabContentProps {
46+
analysis: AnalysisResponse | null
47+
channel: Channel | null
48+
processedAnalysis: Record<string, unknown> | null
49+
reportResult: Record<string, unknown> | null
50+
isTeamAnalysis: boolean | string | undefined
51+
customStyles: Record<string, unknown>
52+
workspaceUuid?: string
53+
}
54+
55+
export type TabContentComponent = FC<TabContentProps>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
export { default as ErrorBoundary } from './ErrorBoundary'
2+
export { default as ChannelAnalysisList } from '../integration/ChannelAnalysisList'

0 commit comments

Comments
 (0)