Skip to content

Commit a5ec364

Browse files
author
Deepak Pandey
committed
πŸ”§ Fix code review issues and add protected jobs page
✨ New Features: - Add /protected/jobs page with real internship data - Integrate full internship application system for authenticated users πŸ”§ Code Review Fixes: - Replace DOMPurify with isomorphic-dompurify (prevents client bundle issues) - Add type guard for non-string inputs in validation - Remove duplicate favicon tags from layout.tsx - Add /projects β†’ /zenith-hall redirect in next.config.js - Update Apple touch icon to PNG format for iOS compatibility β™Ώ Accessibility Improvements: - Add SheetTitle components to StudentSidebar and AdminSidebar - Fix console accessibility errors for screen readers πŸ“¦ Dependencies: - Add isomorphic-dompurify package - Create apple-touch-icon.png for better iOS support πŸ§ͺ Testing: - Build passes with no warnings or errors - All accessibility issues resolved - Real internship data properly integrated
1 parent 8f267f5 commit a5ec364

File tree

11 files changed

+925
-28
lines changed

11 files changed

+925
-28
lines changed

β€Žapp/layout.tsxβ€Ž

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,6 @@ export default function RootLayout({
6868

6969
{/* Viewport for mobile optimization */}
7070
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
71-
72-
{/* Favicon configuration */}
73-
<link rel="icon" type="image/x-icon" href="/favicon.ico" />
74-
<link rel="icon" type="image/svg+xml" href="/codeunia-favicon-light.svg" media="(prefers-color-scheme: light)" />
75-
<link rel="icon" type="image/svg+xml" href="/codeunia-favicon-dark.svg" media="(prefers-color-scheme: dark)" />
76-
<link rel="icon" type="image/svg+xml" href="/codeunia-favicon-light.svg" />
77-
<link rel="apple-touch-icon" href="/codeunia-favicon-light.svg" />
78-
<link rel="shortcut icon" href="/favicon.ico" />
7971
</head>
8072
<body className={`${geistSans.className} antialiased`} suppressHydrationWarning>
8173
<ErrorBoundary>

β€Žapp/protected/jobs/page.tsxβ€Ž

Lines changed: 511 additions & 0 deletions
Large diffs are not rendered by default.

β€Žapp/protected/layout.tsxβ€Ž

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,11 @@ const sidebarItems: SidebarGroupType[] = [
8888
url: "/protected/projects",
8989
icon: Briefcase,
9090
},
91+
{
92+
title: "Jobs",
93+
url: "/protected/jobs",
94+
icon: Briefcase,
95+
},
9196
{
9297
title: "Achievements",
9398
url: "/protected/achievements",

β€Žcomponents/admin/Sidebar.tsxβ€Ž

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import {
3131
SidebarProvider,
3232
} from "@/components/ui/sidebar"
3333
import { Button } from "@/components/ui/button"
34-
import { Sheet, SheetContent, SheetTrigger } from "@/components/ui/sheet"
34+
import { Sheet, SheetContent, SheetTrigger, SheetTitle } from "@/components/ui/sheet"
3535
import AdminHeader from "./AdminHeader";
3636
import CodeuniaLogo from "../codeunia-logo";
3737

@@ -71,6 +71,7 @@ export function Sidebar({ avatar, name, email, role, sidebarItems, children }: S
7171
</Button>
7272
</SheetTrigger>
7373
<SheetContent side="left" className="w-80 p-0 bg-black border-r border-zinc-800">
74+
<SheetTitle className="sr-only">Admin Navigation Menu</SheetTitle>
7475
<div className="flex flex-col h-full">
7576
{/* mobile header */}
7677
<div className="p-4 border-b border-zinc-800">

β€Žcomponents/users/StudentSidebar.tsxβ€Ž

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ import {
3333
SidebarProvider,
3434
} from "@/components/ui/sidebar"
3535
import { Button } from "@/components/ui/button"
36-
import { Sheet, SheetContent, SheetTrigger } from "@/components/ui/sheet"
36+
import { Sheet, SheetContent, SheetTrigger, SheetTitle } from "@/components/ui/sheet"
3737
import CodeuniaLogo from "../codeunia-logo";
3838

3939

@@ -86,6 +86,7 @@ export function StudentSidebar({ avatar, name, email, sidebarItems, children }:
8686
</Button>
8787
</SheetTrigger>
8888
<SheetContent side="left" className="w-80 p-0 bg-black border-r border-zinc-800">
89+
<SheetTitle className="sr-only">Student Navigation Menu</SheetTitle>
8990
<div className="flex flex-col h-full">
9091
{/* mobile header */}
9192
<div className="p-4 border-b border-zinc-800">

β€Žlib/security/input-validation.tsβ€Ž

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
1-
import DOMPurify from 'dompurify';
2-
import { JSDOM } from 'jsdom';
3-
4-
// Create a DOMPurify instance for server-side use
5-
const window = new JSDOM('').window;
6-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
7-
const purify = DOMPurify(window as any);
1+
import DOMPurify from 'isomorphic-dompurify';
2+
// Works in both server and client without jsdom
3+
const purify = DOMPurify;
84

95
export interface ValidationResult {
106
isValid: boolean;
@@ -468,6 +464,10 @@ export function withInputValidation<T extends Record<string, unknown>>(
468464

469465
for (const [key, options] of Object.entries(schema)) {
470466
const value = body[key];
467+
if (typeof value !== 'string') {
468+
errors.push(`${key}: must be a string`);
469+
continue;
470+
}
471471
const result = InputValidator.validateText(value, options);
472472

473473
if (!result.isValid) {

β€Žlib/seo/metadata.tsβ€Ž

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,9 @@ export function generateMetadata(config: SEOConfig): Metadata {
6363
{ url: '/codeunia-favicon-dark.svg', media: '(prefers-color-scheme: dark)' },
6464
{ url: '/codeunia-favicon-light.svg' }
6565
],
66-
apple: '/codeunia-favicon-light.svg',
66+
apple: [
67+
{ url: '/apple-touch-icon.png', sizes: '180x180', type: 'image/png' }
68+
],
6769
shortcut: '/favicon.ico'
6870
},
6971

β€Žnext.config.tsβ€Ž

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,13 @@ const nextConfig: NextConfig = {
6060
compress: true,
6161
poweredByHeader: false,
6262

63+
async redirects() {
64+
return [
65+
{ source: '/projects', destination: '/zenith-hall', permanent: true },
66+
{ source: '/projects/:path*', destination: '/zenith-hall', permanent: true },
67+
];
68+
},
69+
6370
async headers() {
6471
const isDev = process.env.NODE_ENV === 'development'
6572
const isProd = process.env.NODE_ENV === 'production'

0 commit comments

Comments
Β (0)