Skip to content

Commit 588a58f

Browse files
authored
Merge branch 'dev' into feat-auth-frontend
2 parents 22fb573 + 2fcae20 commit 588a58f

File tree

26 files changed

+2860
-1653
lines changed

26 files changed

+2860
-1653
lines changed

.env.development

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
# TDO
1313

14-
NEXT_PUBLIC_API_URL=http://localhost:3001
14+
NEXT_PUBLIC_API_URL=https://node-api-qi6ms4rtoa-ue.a.run.app
1515
NEXT_PUBLIC_FRONTEND_URL=http://localhost:3000
1616
NEXT_PUBLIC_APP_API_KEY=AIzaSyAHz1s-UuNhlZ6aKvqwzmzzidzWxBKw9hw
1717
NEXT_PUBLIC_APP_AUTH_DOMAIN=ctfguide-dev.firebaseapp.com

.vscode/settings.json

Whitespace-only changes.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
"react-loading-skeleton": "^3.2.0",
5454
"react-markdown": "^8.0.7",
5555
"react-router-dom": "^6.9.0",
56+
"react-select-country-list": "^2.2.3",
5657
"react-simplemde-editor": "^5.2.0",
5758
"react-text-loop": "^2.3.0",
5859
"react-text-transition": "^3.1.0",

public/icons8-leaderboard.svg

Lines changed: 1 addition & 0 deletions
Loading

src/components/Header.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,4 +112,4 @@ export function Header() {
112112
</Container>
113113
</header>
114114
);
115-
}
115+
}

src/components/Logo.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
export function Logo(props) {
22
return (
33
<div className="mx-auto my-auto flex">
4-
<img className="mx-auto w-12 text-center" src="../../../../darkLogo.png" />
4+
<img className="mx-auto w-12 text-center spin-on-hover" src="../../../../darkLogo.png" />
55
<h1
66
className="my-auto text-xl font-semibold text-white"
77
style={{ fontFamily: 'Poppins, sans-serif' }}

src/components/StandardNav.jsx

Lines changed: 63 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import { Fragment, useEffect, useState } from 'react';
22
import { Disclosure, Menu, Popover, Transition } from '@headlessui/react';
3+
import { Dialog } from '@headlessui/react'
4+
35
import {
46
Bars3Icon,
57
XMarkIcon,
@@ -18,11 +20,13 @@ import { faEllipsis, faSearch } from '@fortawesome/free-solid-svg-icons';
1820
import { faBug, faLock, faUserSecret, faNetworkWired, faBrain, faTerminal } from '@fortawesome/free-solid-svg-icons';
1921

2022
import 'reactjs-popup/dist/index.css';
23+
import Upgrade from './nav/Upgrade';
24+
2125
import { useRouter } from 'next/router';
2226
import { LogoAdmin } from './LogoAdmin';
2327
import { CSSTransition } from 'react-transition-group';
24-
25-
28+
import SearchModal from './nav/SearchModal';
29+
import SpawnTerminal from './nav/SpawnTerminal';
2630
function classNames(...classes) {
2731
return classes.filter(Boolean).join(' ');
2832
}
@@ -39,13 +43,20 @@ const DEFAULT_NOTIFICATION = {
3943
};
4044

4145
export function StandardNav({ guestAllowed, alignCenter = true }) {
46+
const [terminaIsOpen, setTerminalIsOpen] = useState(false);
47+
const [upgradeModalOpen, setUpgradeModalOpen] = useState(false);
48+
49+
4250
const [isAdmin, setIsAdmin] = useState(false);
4351
const [points, setPoints] = useState('0');
4452
const [notifications, setNotifications] = useState([]);
4553
const [showBanner, setShowBanner] = useState(false);
4654
const [showSearchModal, setShowSearchModal] = useState(false);
4755
const [isPopoverOpen, setIsPopoverOpen] = useState(false);
4856

57+
const [open, setOpen] = useState(true)
58+
59+
4960
const router = useRouter();
5061

5162
function logout() {
@@ -213,7 +224,11 @@ export function StandardNav({ guestAllowed, alignCenter = true }) {
213224
<br></br>
214225
</div>
215226
)}
216-
<Disclosure as="nav" className=" shadow border-b border-white/10">
227+
228+
229+
230+
231+
<Disclosure as="nav" className=" shadow border-b border-neutral-800">
217232
{({ open }) => (
218233
<>
219234
<div className={`px-2 ${alignCenter ? 'mx-auto' : ''}`}>
@@ -257,12 +272,26 @@ export function StandardNav({ guestAllowed, alignCenter = true }) {
257272
</Link>
258273
<Link
259274
href='/leaderboards'
260-
className={linkClass('/leaderboards')}
275+
className={linkClass('/leaderboards') + " hidden lg:inline-flex"}
261276
>
262277
Leaderboards
263278
</Link>
279+
<Link
280+
href='/create'
281+
className={linkClass('/create') + " hidden md:hidden lg:hidden xl:hidden 2xl:inline-flex"}
282+
>
283+
Create
284+
</Link>
285+
286+
<Link
287+
href='/groups'
288+
className={linkClass('/groups') + " hidden md:hidden lg:hidden xl:hidden 2xl:inline-flex"}
289+
>
290+
Classrooms
291+
</Link>
292+
264293
{/* Ellipsis dropdown */}
265-
<Popover className="relative">
294+
<Popover className="relative md:block lg:block xl:block 2xl:hidden">
266295
{({ open }) => (
267296
<>
268297
<Popover.Button className="inline-flex items-center p-2 text-gray-400 hover:text-white ring-none outline-none " >
@@ -305,17 +334,16 @@ export function StandardNav({ guestAllowed, alignCenter = true }) {
305334
</Popover>
306335

307336
{/*search bar*/}
308-
<div className="mt-3 ml-4 flex-grow ">
309-
310-
<div
311-
type="text"
312-
className="w-full px-16 vertical-align flex py-2 text-sm font-semibold text-neutral-500 hover:text-neutral-50 placeholder-gray-300 bg-neutral-800 hover:cursor-pointer border border-transparent rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent"
313-
onClick={() => setShowSearchModal(true)}
314-
>
315-
<FontAwesomeIcon icon={faSearch} className="w-3 h-3 mt-1.5 mr-1" /> Search for anything
316-
</div>
317-
318-
</div>
337+
<div className="mt-3 ml-4 flex-grow">
338+
<div
339+
type="text"
340+
className="w-full px-16 py-2 text-sm font-semibold text-neutral-500 hover:text-neutral-50 placeholder-gray-300 bg-neutral-800 hover:cursor-pointer border border-transparent rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent flex items-center"
341+
onClick={() => setShowSearchModal(true)}
342+
>
343+
<FontAwesomeIcon icon={faSearch} className="w-3 h-3 md:mt-1.5 mr-1" />
344+
<span className="hidden md:inline">Search for anything</span>
345+
</div>
346+
</div>
319347
{/* <Link */}
320348
{/* href={`${baseUrl}/live`} */}
321349
{/* className="inline-flex items-center border-b-2 border-transparent px-4 pt-1 text-sm font-semibold text-gray-300 hover:text-gray-50 transition-all" */}
@@ -341,8 +369,18 @@ export function StandardNav({ guestAllowed, alignCenter = true }) {
341369
</div>
342370
{!guestAllowed &&
343371
<div className="flex items-center ">
344-
345-
<div className="mb-0 flex items-center space-x-2 rounded-lg px-4 py-1"
372+
<button className='bg-blue-600 hover:bg-blue-500 text-white px-2 py-1 text-sm rounded-md'
373+
onClick={() => setTerminalIsOpen(true)}
374+
><i className="fas fa-terminal"></i> Launch a machine</button>
375+
376+
<button
377+
className='ml-4 bg-orange-600 hover:bg-orange-500 text-white px-2 py-1 text-sm rounded-md'
378+
onClick={() => setUpgradeModalOpen(true)}
379+
>
380+
<i className="fas fa-crown"></i> Upgrade to Pro
381+
</button>
382+
383+
<div className="ml-2 mb-0 flex items-center space-x-2 rounded-lg px-4 py-1"
346384
style={{ backgroundColor: '#212121', borderWidth: '0px' }}
347385
>
348386
<h1 className="mx-auto mb-0 mt-0 text-center font-semibold text-blue-500">
@@ -524,61 +562,11 @@ export function StandardNav({ guestAllowed, alignCenter = true }) {
524562
)}
525563
</Disclosure >
526564

527-
{showSearchModal && (
528-
<div
529-
onEnter={() => setShowSearchModal(true)}
530-
531-
>
532-
<div
533-
className="fastanimate fixed inset-0 z-50 flex items-center justify-center bg-black bg-opacity-70 animate__animated animate__faster animate__fadeIn"
534-
style={{
535-
backdropFilter: 'blur(2px)',
536-
}}
537-
onClick={() => setShowSearchModal(false)}
538-
>
539-
<div
540-
className="relative transform overflow-hidden rounded-lg bg-neutral-800 px-4 pb-4 pt-5 text-left shadow-xl transition-all sm:my-8 sm:w-full sm:p-6 sm:max-w-3xl sm:mx-auto sm:rounded-xl sm:shadow-2xl sm:ring-1 sm:ring-white/10"
541-
onClick={(e) => e.stopPropagation()}
542-
>
543-
<div className="px-4 py-5 sm:px-6 mx-auto">
544-
<div className='flex items-center mx-auto'>
545-
<FontAwesomeIcon icon={faSearch} className="w-5 h-5 mr-1 text-white" />
546-
<input placeholder="Search for challenges, users, or competitions" className='w-full border-0 text-xl focus:ring-0 bg-transparent text-white' autoFocus></input>
547-
</div>
548-
<h1 className='mt-10 text-xl text-white font-semibold mb-4'>Search by Category</h1>
549-
<div className="flex flex-wrap gap-2">
550-
<button className="px-4 py-2 rounded bg-blue-500 bg-opacity-50 border border-blue-800 hover:brightness-110 text-white flex items-center gap-2">
551-
<FontAwesomeIcon icon={faBug} className='w-4 h-4' />
552-
<span>Web Exploitation</span>
553-
</button>
554-
<button className="px-4 py-2 rounded bg-green-500 bg-opacity-50 border border-green-800 hover:brightness-110 text-white flex items-center gap-2">
555-
<FontAwesomeIcon icon={faLock} className='w-4 h-4' />
556-
<span>Cryptography</span>
557-
</button>
558-
<button className="px-4 py-2 rounded bg-red-500 bg-opacity-50 border border-red-800 hover:brightness-110 text-white flex items-center gap-2">
559-
<FontAwesomeIcon icon={faUserSecret} className='w-4 h-4' />
560-
<span>Reverse Engineering</span>
561-
</button>
562-
<button className="px-4 py-2 rounded bg-yellow-500 bg-opacity-50 border border-yellow-800 hover:brightness-110 text-white flex items-center gap-2">
563-
<FontAwesomeIcon icon={faNetworkWired} className='w-4 h-4' />
564-
<span>Networking</span>
565-
</button>
566-
<button className="px-4 py-2 rounded bg-purple-500 bg-opacity-50 border border-purple-800 hover:brightness-110 text-white flex items-center gap-2">
567-
<FontAwesomeIcon icon={faBrain} className='w-4 h-4' />
568-
<span>Forensics</span>
569-
</button>
570-
<button className="px-4 py-2 rounded bg-pink-500 bg-opacity-50 border border-pink-800 hover:brightness-110 text-white flex items-center gap-2">
571-
<FontAwesomeIcon icon={faTerminal} className='w-4 h-4' />
572-
<span>Binary Exploitation</span>
573-
</button>
574-
</div>
575-
</div>
576-
<div className="px-4 py-5 sm:p-6">{/* Content goes here */}</div>
577-
</div>
578-
</div>
579-
</div>
580-
)}
581565

566+
<SearchModal showSearchModal={showSearchModal} setShowSearchModal={setShowSearchModal} />
567+
<Upgrade open={upgradeModalOpen} setOpen={setUpgradeModalOpen} />
568+
569+
582570
{isAdmin && (
583571
<div className="bg-neutral-800 py-1 text-center text-sm text-white ">
584572
<h1>CTFGuide is running in development mode. </h1>
@@ -593,6 +581,9 @@ export function StandardNav({ guestAllowed, alignCenter = true }) {
593581
</div>
594582
)
595583
}
584+
585+
586+
<SpawnTerminal open={terminaIsOpen} setOpen={setTerminalIsOpen} />
596587
</>
597588
);
598589
}

src/components/nav/SearchModal.jsx

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
import React from 'react';
2+
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
3+
import { faSearch, faBug, faLock, faUserSecret, faNetworkWired, faBrain, faTerminal } from '@fortawesome/free-solid-svg-icons';
4+
5+
const SearchModal = ({ showSearchModal, setShowSearchModal }) => {
6+
return (
7+
<>
8+
{showSearchModal && (
9+
<div onEnter={() => setShowSearchModal(true)}>
10+
<div
11+
className="fastanimate fixed inset-0 z-50 flex items-center justify-center bg-black bg-opacity-70 animate__animated animate__faster animate__fadeIn"
12+
style={{ backdropFilter: 'blur(2px)' }}
13+
onClick={() => setShowSearchModal(false)}
14+
>
15+
<div
16+
className="relative transform overflow-hidden rounded-lg bg-neutral-800 px-4 pb-4 pt-5 text-left shadow-xl transition-all sm:my-8 sm:w-full sm:p-6 sm:max-w-3xl sm:mx-auto sm:rounded-xl sm:shadow-2xl sm:ring-1 sm:ring-white/10"
17+
onClick={(e) => e.stopPropagation()}
18+
>
19+
<div className="px-4 py-5 sm:px-6 mx-auto">
20+
<div className='flex items-center mx-auto'>
21+
<FontAwesomeIcon icon={faSearch} className="w-5 h-5 mr-1 text-white" />
22+
<input placeholder="Search for challenges, users, or competitions" className='w-full border-0 text-xl focus:ring-0 bg-transparent text-white' autoFocus />
23+
</div>
24+
<h1 className='mt-10 text-xl text-white font-semibold mb-4'>Search by Category</h1>
25+
<div className="flex flex-wrap gap-2">
26+
<button className="px-4 py-2 rounded bg-blue-500 bg-opacity-50 border border-blue-800 hover:brightness-110 text-white flex items-center gap-2">
27+
<FontAwesomeIcon icon={faBug} className='w-4 h-4' />
28+
<span>Web Exploitation</span>
29+
</button>
30+
<button className="px-4 py-2 rounded bg-green-500 bg-opacity-50 border border-green-800 hover:brightness-110 text-white flex items-center gap-2">
31+
<FontAwesomeIcon icon={faLock} className='w-4 h-4' />
32+
<span>Cryptography</span>
33+
</button>
34+
<button className="px-4 py-2 rounded bg-red-500 bg-opacity-50 border border-red-800 hover:brightness-110 text-white flex items-center gap-2">
35+
<FontAwesomeIcon icon={faUserSecret} className='w-4 h-4' />
36+
<span>Reverse Engineering</span>
37+
</button>
38+
<button className="px-4 py-2 rounded bg-yellow-500 bg-opacity-50 border border-yellow-800 hover:brightness-110 text-white flex items-center gap-2">
39+
<FontAwesomeIcon icon={faNetworkWired} className='w-4 h-4' />
40+
<span>Networking</span>
41+
</button>
42+
<button className="px-4 py-2 rounded bg-purple-500 bg-opacity-50 border border-purple-800 hover:brightness-110 text-white flex items-center gap-2">
43+
<FontAwesomeIcon icon={faBrain} className='w-4 h-4' />
44+
<span>Forensics</span>
45+
</button>
46+
<button className="px-4 py-2 rounded bg-pink-500 bg-opacity-50 border border-pink-800 hover:brightness-110 text-white flex items-center gap-2">
47+
<FontAwesomeIcon icon={faTerminal} className='w-4 h-4' />
48+
<span>Binary Exploitation</span>
49+
</button>
50+
</div>
51+
</div>
52+
<div className="px-4 py-5 sm:p-6">{/* Content goes here */}</div>
53+
</div>
54+
</div>
55+
</div>
56+
)}
57+
</>
58+
);
59+
};
60+
61+
export default SearchModal;

0 commit comments

Comments
 (0)