Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2,452 changes: 2,269 additions & 183 deletions package-lock.json

Large diffs are not rendered by default.

27 changes: 24 additions & 3 deletions pages/_document.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React from 'react';
import Document, { DocumentContext, Head, Html, Main, NextScript } from 'next/document';


class MyDocument extends Document {

static async getInitialProps(ctx: DocumentContext) {
Expand All @@ -26,16 +25,38 @@ class MyDocument extends Document {
href="https://cdn.staticaly.com/gh/hung1001/font-awesome-pro/8af0edd/css/all.css"
rel="stylesheet"
/>

{/* Google Tag Manager */}
<script
dangerouslySetInnerHTML={{
__html: `
(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-N7TQWNCN');
`,
}}
/>
</Head>
<body>
{/* Google Tag Manager (noscript) - Must be right after opening <body> tag */}
<noscript>
<iframe
src="https://www.googletagmanager.com/ns.html?id=GTM-N7TQWNCN"
height="0"
width="0"
style={{display: 'none', visibility: 'hidden'}}
/>
</noscript>

<Main />
<NextScript />
<script src="https://play.inctf.in/sdk.js" />
</body>
</Html>
);
}

}

export default MyDocument;
export default MyDocument;
20 changes: 15 additions & 5 deletions pages/faq.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,12 @@ const FAQPage = () => {
}, [router.isReady]);

useEffect(() => {
setOpen(0);
const items = filteredFAQ(search, tags);
if (items.length > 0) {
setOpen(0); // Open first question if results exist
} else {
setOpen(null); // No questions to open if no results
}
}, [search, tags]);

const updateTotalVisible = (value) =>
Expand All @@ -63,7 +68,7 @@ const FAQPage = () => {
answer={q.answer}
search={search}
isOpen={i === openQ}
onClick={() => setOpen(i !== openQ ? i : null)}
onClick={() => setOpen(i === openQ ? null : i)}
key={i}
/>
),
Expand All @@ -76,9 +81,9 @@ const FAQPage = () => {
You could try rephrasing the question in a different way, or
can join our
{' '}
<a href="/discord" target="_blank" className="hover:text-blue-600">
<a href="/discord" target="_blank" className="text-blue-600 hover:text-blue-800 hover:underline">
discord community
<i className="fa fa-external-link mr-1" />
<i className="fa fa-external-link ml-1" />
{' '}
</a>
{' '}
Expand Down Expand Up @@ -108,7 +113,12 @@ const FAQPage = () => {
<div style={{ color: '#222' }}>
Write to us at
{' '}
<a href="mailto:inctfj@am.amrita.edu">inctfj@am.amrita.edu</a>
<a
href="mailto:inctfj@am.amrita.edu"
className="text-blue-600 hover:text-blue-800 hover:underline"
>
inctfj@am.amrita.edu
</a>
</div>
</div>
</Waypoint>
Expand Down
16 changes: 11 additions & 5 deletions pages/rules.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,13 @@ const RulePage = () => {
<div style={{ width: '100%', maxWidth: '900px' }}>
{rules.rule.map((rule, index) => {
if (rule.tag === 'p') {
return <p key={index}>{rule.text}</p>;
return (
<p key={index}>
{rule.text.map((text, textIndex) => (
<span key={textIndex} dangerouslySetInnerHTML={{ __html: text }} />
))}
</p>
);
} else if (rule.tag === 'h1') {
return <h1 key={index}>{rule.text}</h1>;
} else if (rule.tag === 'h2') {
Expand All @@ -78,14 +84,14 @@ const RulePage = () => {
return <h3 key={index}>{rule.text}</h3>;
} else if (rule.tag === 'ul') {
return (<ul key={index}>
{rule.text.map((text, index) => {
return <li key={index}>{text}</li>;
{rule.text.map((text, textIndex) => {
return <li key={textIndex} dangerouslySetInnerHTML={{ __html: text }} />;
})}
</ul>);
} else if (rule.tag === 'ol') {
return (<ol key={index}>
{rule.text.map((text, index) => {
return <li key={index}>{text}</li>;
{rule.text.map((text, textIndex) => {
return <li key={textIndex} dangerouslySetInnerHTML={{ __html: text }} />;
})}
</ol>);
}
Expand Down
17 changes: 15 additions & 2 deletions src/components/faq/Filter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,30 @@ import Dropdown from '../landing/search/Dropdown';
const FAQFilter = ({ search, setSearch, tags, setTags, totalTags }) => {
const [searchFocus, setSearchFocus] = useState(false);

const handleSubmit = (e) => {
e.preventDefault();
setSearchFocus(false);
// The search is already handled by the input onChange, so just blur the input
if (e.target.querySelector('input')) {
e.target.querySelector('input').blur();
}
};

return (
<div className="mx-4 mb-8">
<form className="w-full transition relative" style={{ height: 'fit-content' }}>
<form
className="w-full transition relative"
style={{ height: 'fit-content' }}
onSubmit={handleSubmit}
>
<input
type="text"
value={search}
onChange={e => setSearch(e.target.value)}
placeholder="Enter your question here..."
className={`outline-none pl-4 pr-12 py-2 border rounded-t-lg shadow-inner focus:border-yellow-600 w-full ${searchFocus ? '' : 'rounded-b-lg'}`}
onFocus={() => setSearchFocus(true)}
onBlur={() => setTimeout(() => setSearchFocus(false), 100)}
onBlur={() => setTimeout(() => setSearchFocus(false), 200)}
/>
<div
className="absolute right-0 mr-4"
Expand Down
2 changes: 1 addition & 1 deletion src/components/faq/QuestionCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ const QuestionCard = ({ question, answer, isOpen, onClick = () => {}, search })
const copy = event => {
event.preventDefault();
event.stopPropagation();
navigator.clipboard.writeText(encodeURI(`${location.origin}/faq?q=${question}`));
navigator.clipboard.writeText(`${location.origin}/faq?q=${encodeURIComponent(question)}`);
setIsCopied(true);
setTimeout(() => setIsCopied(false), 1000);
};
Expand Down
4 changes: 2 additions & 2 deletions src/components/landing/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,9 @@ const LandingHeader = () => (
</p>
<p>
<div className="font-semibold text-xl">
<span className="font-bold mb-4 text-xl block">
{/* <span className="font-bold mb-4 text-xl block">
Registration Opening Soon
</span>
</span> */}
{/* <span className="block">
Date:
{' '}
Expand Down
2 changes: 1 addition & 1 deletion src/components/landing/search/Dropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const Dropdown = ({ search, setSearch = (_: string) => {} }) => {
{faq().length ? (
<div>
{faq().map((f, i) => (
<Link key={i} href={`/faq?q=${encodeURI(f.question)}`} passHref legacyBehavior>
<Link key={i} href={`/faq?q=${encodeURIComponent(f.question)}`} passHref legacyBehavior>
<a className="px-6 py-2 hover:bg-gray-100 flex" onClick={() => setSearch(f.question)}>
<div>
{reactStringReplace(f.question, search, match => (
Expand Down
29 changes: 26 additions & 3 deletions src/components/shared/Base.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const seoTags = {
const Base = ({ children, meta }) => {

const title = `${meta && meta.title ? `${meta.title} |` : '' } ${seoTags.siteName} - ${seoTags.tagLine}`;
const GoogleAnalyticsID = 'G-XYWG82LV7L';
// const GoogleAnalyticsID = 'G-XYWG82LV7L';

useEffect(() => {
navigator.serviceWorker.getRegistrations().then((registrations) => {
Expand All @@ -22,6 +22,18 @@ const Base = ({ children, meta }) => {

return (<React.Fragment>
<Head>
{/* Google Tag Manager */}
<script
dangerouslySetInnerHTML={{
__html: `(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-N7TQWNCN');`,
}}
/>
{/* End Google Tag Manager */}

<title>{title}</title>
<meta charSet="utf-8" />
<meta name="theme-color" content="#E65100" />
Expand All @@ -41,16 +53,27 @@ const Base = ({ children, meta }) => {
<link href="/images/icons/icon-384x384.png" rel="icon" type="image/png" sizes="384x384" />
<link rel="apple-touch-icon" href="/images/icons/icon-512x512.png" />
<link rel="shortcut icon" href="/images/icons/icon-72x72.png" />
{ GoogleAnalyticsID && <React.Fragment>
{/* { GoogleAnalyticsID && <React.Fragment>
<script rel="preconnect" async src={`https://www.googletagmanager.com/gtag/js?id=${GoogleAnalyticsID}`} />
<script
dangerouslySetInnerHTML={{
__html: `window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', '${GoogleAnalyticsID}');`,
}}
/>
</React.Fragment>}
</React.Fragment>} */}
</Head>
<div className="app">
{/* Google Tag Manager (noscript) */}
<noscript>
<iframe
src="https://www.googletagmanager.com/ns.html?id=GTM-N7TQWNCN"
height="0"
width="0"
style={{display:'none',visibility:'hidden'}}
/>
</noscript>
{/* End Google Tag Manager (noscript) */}

{children}
{/*<SupportDesk />*/}
</div>
Expand Down
17 changes: 14 additions & 3 deletions src/components/shared/TopBar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -245,16 +245,27 @@ const TopBar = ({ UTMSource = null }) => {
<div className="font-semibold text-primary">
InCTF Jr 2025
</div>
<div>Coming Soon</div>
{topbarConfig?.CTA?.type === 'link' && (
<a
href={topbarConfig?.CTA?.link}
target="_blank"
rel="noopener noreferrer"
>
<button className="px-4 py-2 mt-2 rounded-lg font-semibold bg-primary hover:bg-blue-800 text-white text-sm whitespace-nowrap">
{topbarConfig?.CTA?.buttonText}
{' '}
<i className="fa fa-chevron-right" />
</button>
</a> )}
</div>
{/*<TopbarInfoCard className="mr-3">*/}
{/* <TopbarInfoCard className="mr-3">*/}
{/* <button*/}
{/* onClick={() => setShowRegCard(true)}*/}
{/* className="w-full px-5 py-4 font-semibold rounded-lg bg-primary text-white hover:bg-blue-800 shadow hover:shadow-xl ml-3"*/}
{/* >*/}
{/* Register <i className="fa fa-chevron-right"/>*/}
{/* </button>*/}
{/*</TopbarInfoCard>*/}
{/*</TopbarInfoCard> */}
<button onClick={onOpen} className="transition">
<img src={`/assets/icons/${showMenu ? 'times' : 'menu'}.svg`} alt="Sidebar" className="w-[46px] h-[46px]" />
</button>
Expand Down
Loading