Skip to content

Commit 8611468

Browse files
feat: add utility functions for status and difficulty colors, HR utilities, and internship document generation
- Created `getStatusColor` function for mapping application statuses to color classes. - Introduced `DIFF_COLOR` record for difficulty levels with corresponding text colors. - Added HR utility functions: `labelize`, `formatLabel`, and `initials` for string manipulation. - Implemented a script to generate and send internship certificates and letters of recommendation via email.
1 parent 08214d7 commit 8611468

69 files changed

Lines changed: 565 additions & 500 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,5 +70,5 @@ jobs:
7070
working-directory: client
7171

7272
- name: Run ESLint
73-
run: npx eslint . --ext .ts,.tsx || true
73+
run: npx eslint . --ext .ts,.tsx
7474
working-directory: client

client/package-lock.json

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@
1111
"preview": "vite preview"
1212
},
1313
"dependencies": {
14-
"@codemirror/view": "^6.39.16",
1514
"@codemirror/lang-cpp": "^6.0.3",
1615
"@codemirror/lang-css": "^6.3.1",
1716
"@codemirror/lang-html": "^6.4.11",
1817
"@codemirror/lang-java": "^6.0.2",
1918
"@codemirror/lang-javascript": "^6.2.5",
2019
"@codemirror/lang-python": "^6.2.1",
2120
"@codemirror/lang-sql": "^6.10.0",
21+
"@codemirror/view": "^6.39.16",
2222
"@hookform/resolvers": "^5.2.2",
2323
"@mediapipe/tasks-vision": "^0.10.32",
2424
"@number-flow/react": "^0.6.0",
@@ -50,7 +50,7 @@
5050
"react-hot-toast": "^2.6.0",
5151
"react-markdown": "^10.1.0",
5252
"react-router": "^7.13.0",
53-
"react-to-print": "^3.0.1",
53+
"react-to-print": "^3.3.0",
5454
"reactflow": "^11.11.4",
5555
"recharts": "^3.8.0",
5656
"rehype-highlight": "^7.0.2",

client/src/components/Footer.tsx

Lines changed: 4 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -200,59 +200,12 @@ export function Footer() {
200200
© {new Date().getFullYear()} InternHack. built in india.
201201
</p>
202202
<div className="flex flex-wrap items-center gap-x-4 gap-y-1">
203-
fix/harshita-contact-button
204-
<Link to="/terms" className="hover:text-stone-400 transition-colors no-underline" onClick={handleNavigation}>Terms</Link>
203+
<Link to="/terms" className="hover:text-stone-400 transition-colors no-underline" onClick={handleNavigation}>Terms</Link>
205204
<Link to="/privacy" className="hover:text-stone-400 transition-colors no-underline" onClick={handleNavigation}>Privacy</Link>
206205
<Link to="/refund" className="hover:text-stone-400 transition-colors no-underline" onClick={handleNavigation}>Refunds</Link>
207-
<Link to="/shipping" className="hover:text-stone-400 transition-colors no-underline">Shipping</Link>
208-
<Link
209-
to="/contact"
210-
className="hover:text-stone-400 transition-colors no-underline"
211-
onClick={handleNavigation}
212-
>
213-
Contact
214-
</Link>
215-
216-
<Link
217-
to="/terms"
218-
onClick={() => window.scrollTo({ top: 0, behavior: "smooth" })}
219-
className="hover:text-stone-400 transition-colors no-underline"
220-
>
221-
Terms
222-
</Link>
223-
224-
<Link
225-
to="/privacy"
226-
onClick={() => window.scrollTo({ top: 0, behavior: "smooth" })}
227-
className="hover:text-stone-400 transition-colors no-underline"
228-
>
229-
Privacy
230-
</Link>
231-
232-
<Link
233-
to="/refund"
234-
onClick={() => window.scrollTo({ top: 0, behavior: "smooth" })}
235-
className="hover:text-stone-400 transition-colors no-underline"
236-
>
237-
Refunds
238-
</Link>
239-
240-
<Link
241-
to="/shipping"
242-
onClick={() => window.scrollTo({ top: 0, behavior: "smooth" })}
243-
className="hover:text-stone-400 transition-colors no-underline"
244-
>
245-
Shipping
246-
</Link>
247-
248-
<Link
249-
to="/contact"
250-
onClick={() => window.scrollTo({ top: 0, behavior: "smooth" })}
251-
className="hover:text-stone-400 transition-colors no-underline"
252-
>
253-
Contact
254-
</Link>
255-
</div>
206+
<Link to="/shipping" className="hover:text-stone-400 transition-colors no-underline" onClick={handleNavigation}>Shipping</Link>
207+
<Link to="/contact" className="hover:text-stone-400 transition-colors no-underline" onClick={handleNavigation}>Contact</Link>
208+
</div>
256209
</div>
257210
</div>
258211
</footer>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
export function getStatusColor(status: string): string {
2+
switch (status) {
3+
case "APPLIED": return "bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-400";
4+
case "IN_PROGRESS": return "bg-yellow-100 text-yellow-700 dark:bg-yellow-900/30 dark:text-yellow-400";
5+
case "SHORTLISTED": return "bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400";
6+
case "REJECTED": return "bg-red-100 text-red-700 dark:bg-red-900/30 dark:text-red-400";
7+
case "HIRED": return "bg-emerald-100 text-emerald-700 dark:bg-emerald-900/30 dark:text-emerald-400";
8+
case "WITHDRAWN": return "bg-stone-100 text-stone-700 dark:bg-stone-800 dark:text-stone-300";
9+
default: return "bg-stone-100 text-stone-700 dark:bg-stone-800 dark:text-stone-300";
10+
}
11+
}

client/src/lib/auth.store.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ export const useAuthStore = create<AuthState>((set) => {
2020
const storedUser = localStorage.getItem("user");
2121

2222
return {
23-
user: storedUser ? JSON.parse(storedUser) : null,
24-
isAuthenticated: !!storedUser,
23+
user: storedUser ? (() => { try { return JSON.parse(storedUser) as User; } catch { localStorage.removeItem("user"); return null; } })() : null,
24+
isAuthenticated: !!storedUser && (() => { try { return !!JSON.parse(storedUser); } catch { return false; } })(),
2525

2626
login: (user) => {
2727
localStorage.setItem("user", JSON.stringify(user));
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
export const DIFF_COLOR: Record<string, string> = {
2+
Beginner: "text-emerald-600 dark:text-emerald-400",
3+
Intermediate: "text-amber-600 dark:text-amber-400",
4+
Advanced: "text-rose-600 dark:text-rose-400",
5+
Easy: "text-emerald-600 dark:text-emerald-400",
6+
Medium: "text-amber-600 dark:text-amber-400",
7+
Hard: "text-rose-600 dark:text-rose-400",
8+
};

client/src/module/auth/LoginPage.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ import { GoogleAuthButton } from "../../components/GoogleAuthButton";
1010
export default function LoginPage() {
1111
const navigate = useNavigate();
1212
const [searchParams] = useSearchParams();
13-
const returnTo = searchParams.get("from");
13+
const rawReturnTo = searchParams.get("from");
14+
const returnTo = rawReturnTo && /^\/(?!\/)/.test(rawReturnTo) ? rawReturnTo : null;
1415
const initialRole = searchParams.get("role") === "RECRUITER" ? "RECRUITER" : "STUDENT";
1516
const [role, setRole] = useState<"STUDENT" | "RECRUITER">(initialRole);
1617
const login = useAuthStore((s) => s.login);

client/src/module/auth/RegisterPage.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ export default function RegisterPage() {
2222
const navigate = useNavigate();
2323
const [searchParams] = useSearchParams();
2424
const login = useAuthStore((s) => s.login);
25-
const returnTo = searchParams.get("from");
25+
const rawReturnTo = searchParams.get("from");
26+
const returnTo = rawReturnTo && /^\/(?!\/)/.test(rawReturnTo) ? rawReturnTo : null;
2627
const initialRole = searchParams.get("role") === "RECRUITER" ? "RECRUITER" : "STUDENT";
2728
const [role, setRole] = useState<"STUDENT" | "RECRUITER">(initialRole);
2829
const [form, setForm] = useState({

client/src/module/recruiter/applications/ApplicationDetail.tsx

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { useEffect, useState } from "react";
2+
import { getStatusColor } from "../../../lib/application-colors";
23
import { useParams, useNavigate } from "react-router";
34
import { ArrowLeft, Download, CheckCircle, XCircle, Clock, FileText, ShieldCheck } from "lucide-react";
45
import { motion } from "framer-motion";
@@ -220,17 +221,6 @@ function getStatusIcon(status: string) {
220221
}
221222
}
222223

223-
function getStatusColor(status: string) {
224-
switch (status) {
225-
case "APPLIED": return "bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-400";
226-
case "IN_PROGRESS": return "bg-yellow-100 text-yellow-700 dark:bg-yellow-900/30 dark:text-yellow-400";
227-
case "SHORTLISTED": return "bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400";
228-
case "REJECTED": return "bg-red-100 text-red-700 dark:bg-red-900/30 dark:text-red-400";
229-
case "HIRED": return "bg-emerald-100 text-emerald-700 dark:bg-emerald-900/30 dark:text-emerald-400";
230-
default: return "bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-300";
231-
}
232-
}
233-
234224
function getRoundStatusColor(status: string) {
235225
switch (status) {
236226
case "COMPLETED": return "bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400";

0 commit comments

Comments
 (0)