diff --git a/src/components/CTFDescription.tsx b/src/components/CTFDescription.tsx index 4cb17a2..3dbb052 100644 --- a/src/components/CTFDescription.tsx +++ b/src/components/CTFDescription.tsx @@ -29,11 +29,11 @@ const CTFDescription = ({ {author || 'Author'} -
+
{tags.map((tag) => ( {tag} diff --git a/src/components/Speaker.jsx b/src/components/Speaker.jsx index 6760fad..05b05a3 100644 --- a/src/components/Speaker.jsx +++ b/src/components/Speaker.jsx @@ -49,42 +49,45 @@ function Speaker({ }, []) return ( -
-
+
+
{/* Left section - Speaker Info */} -
+
Speaker
{/* Right section - Values Table (Hidden on Small Screens) */} -
+
{Object.entries(values).map(([key, value], index) => (
-
+
{/* Key */} -
+
(rowRefs.current[index] = el)}>
@@ -96,14 +99,14 @@ function Speaker({
{/* Line */} -
+
(lineRefs.current[index] = el)} className="h-[1px] w-full bg-white" diff --git a/src/components/content.jsx b/src/components/content.jsx index 0b278be..9566f0e 100644 --- a/src/components/content.jsx +++ b/src/components/content.jsx @@ -46,9 +46,17 @@ function Content() { ref={wrapperRef} className="z-30 flex h-screen flex-row items-center gap-x-20 bg-enigma-green px-10 font-neuebit text-black" > - participants for c0day3 + participants for c0day3

Participants

- participants for c0day3 + participants for c0day3

Placeholder

Placeholder

Placeholder

diff --git a/src/components/team/TeamCreation.tsx b/src/components/team/TeamCreation.tsx index 5cf71a2..cd9f7d8 100644 --- a/src/components/team/TeamCreation.tsx +++ b/src/components/team/TeamCreation.tsx @@ -1,59 +1,62 @@ -import React, { useState, FormEvent } from 'react'; -import AnimatedText from '../text'; -import axios from 'axios'; -import api from '../../utils/api'; +import React, { useState, FormEvent } from 'react' +import AnimatedText from '../text' +import axios from 'axios' +import api from '../../utils/api' const TeamCreation = () => { - const [teamName, setTeamName] = useState(''); - const [teamCode, setTeamCode] = useState(''); - const [showCode, setShowCode] = useState(false); - const [joinCode, setJoinCode] = useState(''); - const [error, setError] = useState(""); - const [mode, setMode] = useState<'create' | 'join'>('create'); + const [teamName, setTeamName] = useState('') + const [teamCode, setTeamCode] = useState('') + const [showCode, setShowCode] = useState(false) + const [joinCode, setJoinCode] = useState('') + const [error, setError] = useState('') + const [mode, setMode] = useState<'create' | 'join'>('create') const handleSubmit = (e: FormEvent) => { - e.preventDefault(); + e.preventDefault() if (teamName.trim()) { - console.log('Team name submitted:', teamName); - const generatedCode = Math.random().toString(36).substring(2, 8).toUpperCase(); - setTeamCode(generatedCode); - setShowCode(true); + console.log('Team name submitted:', teamName) + const generatedCode = Math.random() + .toString(36) + .substring(2, 8) + .toUpperCase() + setTeamCode(generatedCode) + setShowCode(true) } - }; + } const handleJoinSubmit = async (e: FormEvent) => { - e.preventDefault(); + e.preventDefault() if (joinCode.trim()) { - console.log('Joining team with code:', joinCode); + console.log('Joining team with code:', joinCode) } try { - const response = await api.post('/auth/login',{ - "name":"NIGGESH123", - "password": "NIGGA!@#" + const response = await api.post('/auth/login', { + name: 'NIGGESH123', + password: 'NIGGA!@#' }) console.log(response) if (response.status === 200) { - if (typeof window !== "undefined") { - localStorage.setItem("token", response.data.access_token); - window.location.href = `${window.location.origin}/team-login`; + if (typeof window !== 'undefined') { + localStorage.setItem('token', response.data.access_token) + window.location.href = `${window.location.origin}/team-login` } } } catch (err: unknown) { if (axios.isAxiosError(err)) { if (err.response) { - setError(err.response.data.msg_code.toString()); + setError(err.response.data.msg_code.toString()) } } } - }; + } const switchMode = () => { - setMode(mode === 'create' ? 'join' : 'create'); - setShowCode(false); - }; + setMode(mode === 'create' ? 'join' : 'create') + setShowCode(false) + } return (
@@ -63,8 +66,8 @@ const TeamCreation = () => {
- {!showCode && ( - mode === 'create' ? ( + {!showCode && + (mode === 'create' ? ( <>
{ type="submit" className="rounded-none bg-white px-8 py-3 text-2xl font-semibold text-black transition-colors hover:bg-enigma-green" > - +
@@ -116,20 +122,19 @@ const TeamCreation = () => {
- ) - )} + ))} {showCode && (
@@ -142,7 +147,7 @@ const TeamCreation = () => {
)}
- ); -}; + ) +} -export default TeamCreation; \ No newline at end of file +export default TeamCreation diff --git a/src/questions/page.tsx b/src/questions/page.tsx index ab50aaa..ffaad2c 100644 --- a/src/questions/page.tsx +++ b/src/questions/page.tsx @@ -23,8 +23,8 @@ const CTFs = () => { const [selectedQuestionType, setSelectedQuestionType] = React.useState('') - const [error, setError] = useState(""); - const [questions, setQuestions] = useState([]); + const [error, setError] = useState('') + const [questions, setQuestions] = useState([]) // So this selected question ID contains whatever you click, I will create a function below that logs the current selected question ID in the console so that during backend integration, it will be easy for you. Everything else happens on its own in the individual components. const [selectedQuestionId, setSelectedQuestionId] = React.useState('') @@ -42,20 +42,20 @@ const CTFs = () => { try { const response = await api.get('/ctf/list') if (response.status === 200) { - setQuestions(response.data); + setQuestions(response.data) } } catch (err: unknown) { if (axios.isAxiosError(err)) { if (err.response) { - setError(err.response.data.msg_code.toString()); + setError(err.response.data.msg_code.toString()) } } } - }; - - getData(); - }, []); - + } + + getData() + }, []) + return (
{ selectedQuestionType - ? getTypesFromMask(question.tags).includes( - selectedQuestionType - ) + ? getTypesFromMask(question.tags).includes(selectedQuestionType) : true )} onHover={setHoveredQuestionId} @@ -107,25 +105,21 @@ const CTFs = () => { /> question.id === hoveredQuestionId - )?.description || '' + questions.find((question) => question.id === hoveredQuestionId) + ?.description || '' } points={ - questions.find( - (question) => question.id === hoveredQuestionId - )?.points || 0 + questions.find((question) => question.id === hoveredQuestionId) + ?.points || 0 } author={ - questions.find( - (question) => question.id === hoveredQuestionId - )?.author || '' + questions.find((question) => question.id === hoveredQuestionId) + ?.author || '' } tags={ getTypesFromMask( - questions.find( - (question) => question.id === hoveredQuestionId - )?.tags || 0 + questions.find((question) => question.id === hoveredQuestionId) + ?.tags || 0 ) || [] } /> diff --git a/src/utils/api.ts b/src/utils/api.ts index 97a0535..5fb00f8 100644 --- a/src/utils/api.ts +++ b/src/utils/api.ts @@ -1,43 +1,48 @@ -import axios, { AxiosError, AxiosInstance, AxiosResponse, InternalAxiosRequestConfig } from "axios"; +import axios, { + AxiosError, + AxiosInstance, + AxiosResponse, + InternalAxiosRequestConfig +} from 'axios' interface ApiConfig { - baseURL: string; - headers: { - "Content-Type": string; - Authorization?: string; - } + baseURL: string + headers: { + 'Content-Type': string + Authorization?: string + } } const config: ApiConfig = { - baseURL: "https://pwncore.udk.me/api", - headers: { - "Content-Type": "application/json" - } + baseURL: 'https://pwncore.udk.me/api', + headers: { + 'Content-Type': 'application/json' + } } -const api: AxiosInstance = axios.create(config); +const api: AxiosInstance = axios.create(config) api.interceptors.request.use( - (config: InternalAxiosRequestConfig): InternalAxiosRequestConfig => { - if (typeof window !== "undefined") { - const token = localStorage.getItem("token"); - if (token) { - config.headers.Authorization = `Bearer ${token}`; - } - } - return config; - }, (error: AxiosError): Promise => { - return Promise.reject(error); + (config: InternalAxiosRequestConfig): InternalAxiosRequestConfig => { + if (typeof window !== 'undefined') { + const token = localStorage.getItem('token') + if (token) { + config.headers.Authorization = `Bearer ${token}` + } } + return config + }, + (error: AxiosError): Promise => { + return Promise.reject(error) + } ) api.interceptors.response.use( - (response: AxiosResponse): AxiosResponse => response, - (error: AxiosError): Promise => { - if (error.response?.status === 401) localStorage.removeItem("token"); - return Promise.reject(error); - } + (response: AxiosResponse): AxiosResponse => response, + (error: AxiosError): Promise => { + if (error.response?.status === 401) localStorage.removeItem('token') + return Promise.reject(error) + } ) -export default api; - +export default api