-
Notifications
You must be signed in to change notification settings - Fork 334
/
WholeMeetingSummaryResult.tsx
110 lines (98 loc) · 2.96 KB
/
WholeMeetingSummaryResult.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
import graphql from 'babel-plugin-relay/macro'
import {marked} from 'marked'
import React, {useEffect} from 'react'
import {useFragment} from 'react-relay'
import {WholeMeetingSummaryResult_meeting$key} from '../../../../../__generated__/WholeMeetingSummaryResult_meeting.graphql'
import useAtmosphere from '../../../../../hooks/useAtmosphere'
import {PALETTE} from '../../../../../styles/paletteV3'
import {FONT_FAMILY} from '../../../../../styles/typographyV2'
import {AIExplainer} from '../../../../../types/constEnums'
import SendClientSideEvent from '../../../../../utils/SendClientSideEvent'
import EmailBorderBottom from './EmailBorderBottom'
const topicTitleStyle = {
color: PALETTE.SLATE_700,
fontFamily: FONT_FAMILY.SANS_SERIF,
fontWeight: 600,
lineHeight: '22px',
fontSize: 14,
padding: '8px 48px'
}
const explainerStyle = {
color: PALETTE.SLATE_700,
fontFamily: FONT_FAMILY.SANS_SERIF,
fontStyle: 'italic',
padding: '8px 48px',
fontSize: 14
}
const textStyle = {
color: PALETTE.SLATE_700,
fontFamily: FONT_FAMILY.SANS_SERIF,
padding: '0px 48px 8px 48px',
fontSize: 14,
whiteSpace: 'pre-line',
textAlign: 'left'
} as const
interface Props {
meetingRef: WholeMeetingSummaryResult_meeting$key
}
const WholeMeetingSummaryResult = ({meetingRef}: Props) => {
const atmosphere = useAtmosphere()
const meeting = useFragment(
graphql`
fragment WholeMeetingSummaryResult_meeting on NewMeeting {
__typename
id
summary
team {
tier
billingTier
}
}
`,
meetingRef
)
useEffect(() => {
SendClientSideEvent(atmosphere, 'AI Summary Viewed', {
source: 'Meeting Summary',
tier: meeting.team.billingTier,
meetingId: meeting.id
})
}, [atmosphere, meeting.id, meeting.team.billingTier])
const {summary: wholeMeetingSummary, team} = meeting
if (!wholeMeetingSummary) return null
const renderedSummary = marked(wholeMeetingSummary, {
gfm: true,
breaks: true
}) as string
// replace links with styled links
const formattedSummary = renderedSummary?.replace(
/<a href="(.*?)">(.*?)<\/a>/g,
`<a href="$1" style="color: ${PALETTE.SKY_500}; text-decoration: underline;">$2</a>`
)
const explainerText = team?.tier === 'starter' ? AIExplainer.STARTER : AIExplainer.PREMIUM_MEETING
return (
<>
<tr>
<td align='center' style={{paddingTop: 20}}>
<table>
<tbody>
<tr>
<td style={explainerStyle}>{explainerText}</td>
</tr>
<tr>
<td align='center' style={topicTitleStyle}>
{'🤖 Meeting Summary'}
</td>
</tr>
<tr>
<td style={textStyle} dangerouslySetInnerHTML={{__html: formattedSummary}} />
</tr>
</tbody>
</table>
</td>
</tr>
<EmailBorderBottom />
</>
)
}
export default WholeMeetingSummaryResult