Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 72bb1ac

Browse filesBrowse files
authored
update contact form, label form submissions (cpinitiative#3364)
* update contact form, label form submissions * update contact form
1 parent 730c5e2 commit 72bb1ac
Copy full SHA for 72bb1ac

File tree

Expand file treeCollapse file tree

2 files changed

+61
-20
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+61
-20
lines changed

‎src/components/ContactUsSlideover/ContactUsSlideover.tsx

Copy file name to clipboardExpand all lines: src/components/ContactUsSlideover/ContactUsSlideover.tsx
+43-18Lines changed: 43 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ export default function ContactUsSlideover({
200200
}
201201
onSubmit={handleSubmit}
202202
>
203-
<div className="bg-gray-50 dark:bg-gray-900 mb-4">
203+
{/* <div className="bg-gray-50 dark:bg-gray-900 mb-4">
204204
<div className="px-4 py-5 sm:p-6">
205205
<h3 className="text-lg leading-6 font-medium text-gray-900 dark:text-gray-200">
206206
Ask on the USACO Forum!
@@ -223,8 +223,8 @@ export default function ContactUsSlideover({
223223
</span>
224224
</div>
225225
</div>
226-
</div>
227-
<div className="px-4 sm:px-6">
226+
</div> */}
227+
<div className="px-4 sm:px-6 mt-4">
228228
{showSuccess && (
229229
<div className="rounded-md bg-green-50 dark:bg-green-800 p-4">
230230
<div className="flex">
@@ -309,6 +309,18 @@ export default function ContactUsSlideover({
309309
<legend className="text-sm leading-5 font-medium text-gray-900 dark:text-dark-high-emphasis">
310310
Topic
311311
</legend>
312+
<div className="text-sm">
313+
If you're having issues registering on usaco.org, see{' '}
314+
<a
315+
className="hover:underline text-blue-600 dark:text-blue-300"
316+
target="_blank"
317+
rel="noreferrer"
318+
href="https://github.com/cpinitiative/usaco-guide/issues/2854#issuecomment-1162802123"
319+
>
320+
this comment
321+
</a>
322+
.
323+
</div>
312324
<div className="space-y-3">
313325
{topics.map((t, idx) => (
314326
<div key={idx}>
@@ -329,22 +341,35 @@ export default function ContactUsSlideover({
329341
className="font-medium text-gray-900 dark:text-dark-high-emphasis"
330342
>
331343
{t}
332-
{t === 'Other' && (
333-
<span>
334-
&nbsp;- If you're having issues registering on
335-
usaco.org, see
336-
<a
337-
className="text-blue-300"
338-
target="_blank"
339-
rel="noreferrer"
340-
href="https://github.com/cpinitiative/usaco-guide/issues/2854#issuecomment-1162802123"
341-
>
342-
{' '}
343-
this link.
344-
</a>
345-
</span>
346-
)}
347344
</label>
345+
{t === 'Typo / Broken Link' && topic === t && (
346+
<div>
347+
Submitting a pull request{' '}
348+
<a
349+
className="hover:underline text-blue-600 dark:text-blue-300"
350+
target="_blank"
351+
rel="noreferrer"
352+
href="https://github.com/cpinitiative/usaco-guide/pulls"
353+
>
354+
here
355+
</a>{' '}
356+
is the preferred way to fix a typo.
357+
</div>
358+
)}
359+
{t === 'Unclear Explanation' && topic === t && (
360+
<div>
361+
You may get a faster response by reaching out on the{' '}
362+
<a
363+
className="hover:underline text-blue-600 dark:text-blue-300"
364+
href="https://forum.usaco.guide/"
365+
target="_blank"
366+
rel="noreferrer"
367+
>
368+
USACO Guide forum
369+
</a>{' '}
370+
instead.
371+
</div>
372+
)}
348373
</div>
349374
</div>
350375
</div>

‎src/functions/src/submitContactForm.ts

Copy file name to clipboardExpand all lines: src/functions/src/submitContactForm.ts
+18-2Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,30 @@ const submitContactForm = functions.https.onCall(async data => {
2929
password: key,
3030
},
3131
});
32-
32+
const labels = [];
33+
if (
34+
topic.includes('Typo') ||
35+
topic.includes('Missing Section') ||
36+
topic.includes('Unclear Explanation')
37+
)
38+
labels.push('content');
39+
if (topic.includes('Bug')) labels.push('bug');
40+
if (topic.includes('Website')) labels.push('website');
41+
if (topic.includes('Suggestion')) labels.push('enhancement');
42+
if (topic.includes('Missing Section')) labels.push('good first issue');
43+
let title = `Contact Form Submission - ${topic}`;
44+
if (moduleName) {
45+
title += ` (${moduleName})`;
46+
}
3347
const createdIssue = await githubAPI.post(
3448
'/repos/cpinitiative/usaco-guide/issues',
3549
{
36-
title: `Contact Form Submission - ${topic}`,
50+
title: title,
3751
body: body,
52+
labels: labels,
3853
}
3954
);
55+
4056
await admin.firestore().collection('contactFormSubmissions').add({
4157
name: name,
4258
email: email,

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.