Skip to content

Commit fe8ef37

Browse files
committed
update 2 files and create 2 files
1 parent 10a32d5 commit fe8ef37

File tree

4 files changed

+238
-2
lines changed

4 files changed

+238
-2
lines changed

ToDo.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
- [ ] Add backend to the hackathon hosting form.
33
- [x] implement search functionality on the hackathons page
44
- [ ] Add a code editor and problem statement page for a hackathon.
5-
- [ ] implement a file uploading mechanism for hackathon participants
5+
- [x] implement a file uploading mechanism for hackathon participants
66
- [ ] implement join a team and create a team functionality for hackathon participants
77
- [ ] implement a notification function
88
- [ ] implement a chat functionality for hackathon participants
99

10-
10+
1111
register now -> join as team/individual -> create team/join team -> enter team details -> File upload page
1212

1313
-> code editor -> problem statement -> submit -> notification -> chat -> leaderboard -> results

app/public/javascripts/code.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Initialize CodeMirror instance
2+
var solutionEditor = CodeMirror.fromTextArea(document.getElementById("solution"), {
3+
lineNumbers: true,
4+
mode: "javascript",
5+
lint: true,
6+
gutters: ["CodeMirror-lint-markers"]
7+
});
8+
9+
// Language Dropdown Change Event
10+
document.getElementById("language").addEventListener("change", function() {
11+
var selectedLanguage = this.value;
12+
solutionEditor.setOption("mode", selectedLanguage);
13+
solutionEditor.setOption("lint", selectedLanguage === "javascript");
14+
});
15+
16+
17+
document.getElementById("submitBtn").addEventListener("click", function() {
18+
var solutionCode = solutionEditor.getValue();
19+
20+
console.log("Submitting solution code:", solutionCode);
21+
});

app/routes/index.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,9 @@ router.get('/register', function(req, res, next) {
4444
router.get('/file-upload', function(req, res, next) {
4545
res.render('file-upload');
4646
});
47+
48+
//file-upload page
49+
router.get('/code', function(req, res, next) {
50+
res.render('code');
51+
});
4752
module.exports = router;

app/views/code.ejs

Lines changed: 210 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,210 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<title>Code Forge</title>
7+
<link rel="shortcut icon" href="images/assets/logo-favicon-color.svg" type="image/x-icon">
8+
<link href="https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300..700&display=swap" rel="stylesheet">
9+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
10+
<link href="https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@600&display=swap" rel="stylesheet">
11+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.2/css/all.min.css" integrity="sha512-SnH5WK+bZxgPHs44uWIX+LLJAJ9/2PkPKZ5QiAj6Ta86w+fsb2TkcmfRyVX3pBnMFcV7oQPJkl9QevSCWr3W6A==" crossorigin="anonymous" referrerpolicy="no-referrer" />
12+
13+
<link rel="stylesheet" href="stylesheets/style.css">
14+
<script src="https://cdn.tailwindcss.com"></script>
15+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">
16+
<link href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css" rel="stylesheet">
17+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.63.1/codemirror.min.css">
18+
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.63.1/codemirror.min.js"></script>
19+
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.63.1/addon/lint/lint.min.js"></script>
20+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.63.1/addon/lint/lint.min.css">
21+
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.63.1/addon/lint/javascript-lint.min.js"></script>
22+
<script src="javascripts/code.js"></script>
23+
</head>
24+
<body class="bg-purple-100">
25+
26+
27+
<header class="text-gray-600 body-font" id="header">
28+
<div class="container mx-auto flex flex-wrap p-5 flex-col md:flex-row items-center">
29+
<a class="flex title-font font-medium items-center text-gray-900 mb-4 md:mb-0">
30+
<a href="/"><img src="images/assets/logo.svg" height="150" width="150"></a>
31+
<!-- <span class="ml-0 text-xl">ZenDevs</span> -->
32+
</a>
33+
<nav class="md:ml-auto md:mr-auto flex flex-wrap items-center text-base justify-center">
34+
<a href="/hackathon" class="mr-5 hover:text-gray-900" >Hackathons</a>
35+
<a href="/organisation" class="mr-5 hover:text-gray-900">Organizations</a>
36+
<a href="/winner" class="mr-5 hover:text-gray-900">Winners</a>
37+
</nav>
38+
<a href="/login"><button class="inline-flex items-center bg-gray-100 border-0 py-1 px-3 focus:outline-none hover:bg-gray-200 rounded text-base mt-4 md:mt-0">Log In
39+
<svg fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" class="w-4 h-4 ml-1" viewBox="0 0 24 24">
40+
<path d="M5 12h14M12 5l7 7-7 7"></path>
41+
</svg>
42+
</button></a>
43+
</div>
44+
</header>
45+
46+
47+
48+
49+
<div class="container mx-auto flex flex-col md:flex-row gap-4 py-24 mt-8 px-4">
50+
<div class="w-full md:w-1/2 overflow-auto">
51+
<div class="flex items-start justify-between mb-4 ml-2 mr-2">
52+
<div class="text-lg font-semibold text-purple-600 truncate cursor-text whitespace-normal">
53+
<a href="#" class="hover:underline">1980. Find Unique Binary String</a>
54+
</div>
55+
56+
<div class="flex items-center gap-2">
57+
<div class="text-xs px-2 py-1 rounded-full bg-purple-200 text-purple-700">Medium</div>
58+
<div class="text-xs px-2 py-1 rounded-full bg-gray-200 text-gray-700">Topics</div>
59+
<div class="text-xs px-2 py-1 rounded-full bg-gray-200 text-gray-700">Companies</div>
60+
<div class="text-xs px-2 py-1 rounded-full bg-gray-200 text-gray-700">Hint</div>
61+
</div>
62+
</div>
63+
<div class="text-gray-700">
64+
<div class="mb-4">Given an array of strings nums containing n unique binary strings each of length n, return a binary string of length n that does not appear in nums. If there are multiple answers, you may return any of them.</div>
65+
66+
<div class="mb-4">
67+
<strong class="text-purple-600">Example 1:</strong>
68+
<pre class="bg-purple-200 p-2 rounded-md"><code>Input: nums = ["01","10"]
69+
Output: "11"
70+
Explanation: "11" does not appear in nums. "00" would also be correct.</code></pre>
71+
</div>
72+
73+
<div class="mb-4">
74+
<strong class="text-purple-600">Example 2:</strong>
75+
<pre class="bg-purple-200 p-2 rounded-md"><code>Input: nums = ["00","01"]
76+
Output: "11"
77+
Explanation: "11" does not appear in nums. "10" would also be correct.</code></pre>
78+
</div>
79+
80+
<div class="mb-4">
81+
<strong class="text-purple-600">Example 3:</strong>
82+
<pre class="bg-purple-200 p-2 rounded-md"><code>Input: nums = ["111","011","001"]
83+
Output: "101"
84+
Explanation: "101" does not appear in nums. "000", "010", "100", and "110" would also be correct.</code></pre>
85+
</div>
86+
<!-- add other examples here -->
87+
</div>
88+
</div>
89+
90+
<!-- Code Editor -->
91+
<div class="w-full md:w-1/2 flex flex-col justify-between mr-2">
92+
<div>
93+
<h2 class="text-lg font-semibold mb-4">Solution Code</h2>
94+
<!-- Language Dropdown -->
95+
<div class="mb-4">
96+
<select id="language" class="px-2 py-1 border rounded-md">
97+
<option value="java">Java</option>
98+
<option value="javascript">JavaScript</option>
99+
<option value="python">Python</option>
100+
<option value="c++">C++</option>
101+
<option value="c">C</option>
102+
<option value="c#">C#</option>
103+
<option value="golang">Go</option>
104+
<option value="pearl">Pearl</option>
105+
<option value="Ruby">Ruby</option>
106+
<option value="rust">Rust</option>
107+
<option value="R">R</option>
108+
</select>
109+
</div>
110+
<!-- Code Editor -->
111+
<textarea id="solution" class="border rounded-md p-2 w-full h-96">Enter your solution code here</textarea>
112+
</div>
113+
<!-- Submit Button -->
114+
<button id="submitBtn" class="bg-purple-500 hover:bg-purple-600 text-white font-bold py-2 px-4 rounded mt-4 self-end">Submit</button>
115+
</div>
116+
</div>
117+
118+
119+
<footer class="text-gray-600 body-font" id="footer">
120+
<div class="container px-5 py-24 mx-auto flex md:items-center lg:items-start md:flex-row md:flex-nowrap flex-wrap flex-col">
121+
<div class="w-64 flex-shrink-0 md:mx-0 mx-auto text-center md:text-left">
122+
<a class="flex title-font font-medium items-center md:justify-start justify-center text-gray-900">
123+
<img src="images/assets/logo.svg">
124+
<!-- <span class="ml-3 text-xl">ZenDevs</span> -->
125+
</a>
126+
<p class="mt-2 text-sm text-gray-500">The platform to Launch and Join Hackathons</p>
127+
</div>
128+
<div class="flex-grow flex flex-wrap md:pl-20 -mb-10 md:mt-0 mt-10 md:text-left text-center">
129+
<div class="lg:w-1/4 md:w-1/2 w-full px-4">
130+
<h2 class="title-font font-medium text-gray-900 tracking-widest text-sm mb-3">Products</h2>
131+
<nav class="list-none mb-10">
132+
<li>
133+
<a class="text-gray-600 hover:text-gray-800">Hackathons</a>
134+
</li>
135+
<li>
136+
<a class="text-gray-600 hover:text-gray-800">Host a Hackathon</a>
137+
</li>
138+
</nav>
139+
</div>
140+
141+
<div class="lg:w-1/4 md:w-1/2 w-full px-4">
142+
<h2 class="title-font font-medium text-gray-900 tracking-widest text-sm mb-3">Community</h2>
143+
<nav class="list-none mb-10">
144+
<li>
145+
<a class="text-gray-600 hover:text-gray-800">Organizations</a>
146+
</li>
147+
<li>
148+
<a class="text-gray-600 hover:text-gray-800">Discord</a>
149+
</li>
150+
</li>
151+
<li>
152+
<a class="text-gray-600 hover:text-gray-800">Past Winners</a>
153+
</li>
154+
</nav>
155+
</div>
156+
157+
<div class="lg:w-1/4 md:w-1/2 w-full px-4">
158+
<h2 class="title-font font-medium text-gray-900 tracking-widest text-sm mb-3">Company</h2>
159+
<nav class="list-none mb-10">
160+
<li>
161+
<a class="text-gray-600 hover:text-gray-800">About Us</a>
162+
</li>
163+
<li>
164+
<a class="text-gray-600 hover:text-gray-800">Careers</a>
165+
</li>
166+
</nav>
167+
</div>
168+
<div class="lg:w-1/4 md:w-1/2 w-full px-4">
169+
<h2 class="title-font font-medium text-gray-900 tracking-widest text-sm mb-3">Help</h2>
170+
<nav class="list-none mb-10">
171+
<li>
172+
<a class="text-gray-600 hover:text-gray-800">FAQs</a>
173+
</li>
174+
<li>
175+
<a class="text-gray-600 hover:text-gray-800">Support</a>
176+
</li>
177+
<li>
178+
<a class="text-gray-600 hover:text-gray-800">Terms & Conditions</a>
179+
</li>
180+
<li>
181+
<a class="text-gray-600 hover:text-gray-800">Privacy Policy</a>
182+
</li>
183+
</nav>
184+
</div>
185+
</div>
186+
</div>
187+
<div class="bg-gray-100">
188+
<div class="container mx-auto py-4 px-5 flex flex-wrap flex-col sm:flex-row">
189+
<p class="text-gray-500 text-sm text-center sm:text-left">Copyright © 2024 — ZenDevs All rights reserved.
190+
</p>
191+
<span class="inline-flex sm:ml-auto sm:mt-0 mt-2 justify-center sm:justify-start">
192+
<a class="text-gray-500">
193+
<i class="fa-brands fa-github"></i>
194+
</a>
195+
<a class="ml-3 text-gray-500">
196+
<i class="fa-brands fa-linkedin"></i>
197+
</a>
198+
<a class="ml-3 text-gray-500">
199+
<i class="fa-brands fa-discord"></i>
200+
</a>
201+
<a class="ml-3 text-gray-500">
202+
<i class="fa-brands fa-instagram"></i>
203+
</a>
204+
</span>
205+
</div>
206+
</div>
207+
</footer>
208+
209+
</body>
210+
</html>

0 commit comments

Comments
 (0)