Skip to content

Commit 79c0675

Browse files
committed
fix: adaptivecards
1 parent 689977d commit 79c0675

2 files changed

Lines changed: 76 additions & 37 deletions

File tree

src/components/HeaderFooter/VideoHeader.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import Image, { StaticImageData } from 'next/image'
66
import { HeaderDesktop } from './HeaderDesktop'
77
import { HeaderMobile } from './HeaderMobile'
88
import { type HeaderMenuProps } from './HeaderMenu'
9-
9+
import { cn } from '@/lib/utils/cn'
1010
export function VideoHeader({ logoVideo, logoLight, logoDark, menuItems } : { logoVideo: StaticImageData, logoLight: StaticImageData, logoDark: StaticImageData, menuItems?: HeaderMenuProps[] }) {
1111

1212
const [isScrolled, setIsScrolled] = useState(false)
@@ -77,7 +77,7 @@ export function VideoHeader({ logoVideo, logoLight, logoDark, menuItems } : { lo
7777
</button>
7878
)}
7979
<div className="fixed top-0 left-0 right-0 z-50" >
80-
<HeaderDesktop isMenuOpen={isScrolled} logoLight={logoLight} logoDark={logoDark} menuItems={menuItems}/>
80+
<HeaderDesktop isMenuOpen={isScrolled || isMenuOpen} logoLight={logoLight} logoDark={logoDark} menuItems={menuItems}/>
8181
<HeaderMobile isMenuOpen={true} logoLight={logoLight} logoDark={logoDark} menuItems={menuItems}/>
8282

8383
</div>
@@ -100,11 +100,11 @@ export function VideoHeader({ logoVideo, logoLight, logoDark, menuItems } : { lo
100100
alt="Cortex Reply Logo"
101101
width={720}
102102
height={320}
103-
className="h-auto w-auto mt-8 hidden lg:block"
103+
className={cn('h-auto w-auto mt-8 hidden lg:block', isMenuOpen && 'lg:hidden')}
104104
/>
105105
<div className='h-full flex flex-col items-center justify-center'>
106-
<h1 className="text-4xl font-bold pt-auto mb-4">We are Cortex Reply.</h1>
107-
<p className="text-2xl mb-8 max-w-2xl">Efficiency through technology.</p>
106+
<h1 className="text-6xl font-bold pt-auto mb-12">We are Cortex Reply.</h1>
107+
<p className="text-3xl mb-8 max-w-2xl">Efficiency through technology.</p>
108108
</div>
109109
<div className="flex justify-center items-center w-full mb-8">
110110
<div

src/sections/form/server/contact-us-form-submit.ts

Lines changed: 71 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -10,65 +10,104 @@ export async function contactUsFormSubmit(
1010
const { name, email, subject, message } = values
1111

1212

13-
// const webhookUrl = process.env.TEAMS_WEBHOOK_URL
14-
15-
const webhookUrl = "https://reply.webhook.office.com/webhookb2/bd96f013-d306-4244-8611-743f6bf96fb9@b00367e2-193a-4f48-94de-7245d45c0947/IncomingWebhook/03eafcb222a24d38aa7af5b5c09af0f0/a03e7d9d-7fba-4893-8c70-fcfcf540483d/V2TvPmNJLZgvGfNKyLJP51BEpKG04B-XU3o8hEp0vLFcU1"
13+
const webhookUrl = process.env.TEAMS_WEBHOOK_URL
1614

1715
if (!webhookUrl) {
1816
throw new Error('TEAMS_WEBHOOK_URL is not defined')
1917
}
2018

19+
2120
const adaptiveCard = {
22-
type: 'message',
21+
type: "message",
2322
attachments: [
2423
{
25-
contentType: 'application/vnd.microsoft.card.adaptive',
24+
contentType: "application/vnd.microsoft.card.adaptive",
2625
content: {
27-
type: 'AdaptiveCard',
28-
version: '1.2',
26+
$schema: "http://adaptivecards.io/schemas/adaptive-card.json",
27+
type: "AdaptiveCard",
28+
version: "1.2",
2929
body: [
3030
{
31-
type: 'TextBlock',
32-
text: 'New Contact Us Form Submission',
33-
weight: 'Bolder',
34-
size: 'Medium',
35-
},
36-
{
37-
type: 'TextBlock',
38-
text: `**Name:** ${name}`,
31+
type: "TextBlock",
32+
text: "Contact Us Form",
3933
wrap: true,
34+
style: "heading",
35+
weight: "Bolder"
4036
},
4137
{
42-
type: 'TextBlock',
43-
text: `**Email:** ${email}`,
44-
wrap: true,
38+
type: "ColumnSet",
39+
columns: [
40+
{
41+
type: "Column",
42+
width: "stretch",
43+
items: [
44+
{
45+
type: "TextBlock",
46+
text: "Name",
47+
wrap: true,
48+
weight: "Bolder"
49+
},
50+
{
51+
type: "TextBlock",
52+
text: "Email",
53+
wrap: true,
54+
weight: "Bolder"
55+
},
56+
{
57+
type: "TextBlock",
58+
text: "Subject",
59+
wrap: true,
60+
weight: "Bolder"
61+
}
62+
]
63+
},
64+
{
65+
type: "Column",
66+
width: "stretch",
67+
items: [
68+
{
69+
type: "TextBlock",
70+
text: `${name}`,
71+
wrap: true
72+
},
73+
{
74+
type: "TextBlock",
75+
text: `${email}`,
76+
wrap: true
77+
},
78+
{
79+
type: "TextBlock",
80+
text: `${subject}`,
81+
wrap: true
82+
}
83+
]
84+
}
85+
]
4586
},
4687
{
47-
type: 'TextBlock',
48-
text: `**Subject:** ${subject}`,
49-
wrap: true,
50-
},
51-
{
52-
type: 'TextBlock',
53-
text: `**Message:** ${message}`,
54-
wrap: true,
55-
},
56-
],
57-
},
58-
},
59-
],
88+
type: "TextBlock",
89+
text: `${message}`,
90+
wrap: true
91+
}
92+
]
93+
}
94+
}
95+
]
6096
}
61-
97+
98+
console.log(JSON.stringify(adaptiveCard))
6299
try {
63100
const response = await fetch(webhookUrl, {
64101
method: 'POST',
102+
mode: "no-cors",
65103
headers: {
66104
'Content-Type': 'application/json',
67105
},
68106
body: JSON.stringify(adaptiveCard),
69107
})
70108

71109
if (!response.ok) {
110+
console.error(response)
72111
throw new Error('Network response was not ok')
73112
}
74113

0 commit comments

Comments
 (0)