Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
HUSAM-07 committed Aug 27, 2024
1 parent acbfc26 commit 0efe6a6
Show file tree
Hide file tree
Showing 5 changed files with 91 additions and 111 deletions.
82 changes: 27 additions & 55 deletions src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,69 +2,41 @@

import { useState } from 'react';
import HomePage from '@/components/HomePage';
import Dashboard from '@/components/Dashboard';
import { Button } from "@/components/ui/button";
import { Card, CardContent, CardHeader } from "@/components/ui/card";
import Link from 'next/link';
import AttendanceTracker from '@/components/AttendanceTracker'; // Import the existing component

export default function Home() {
const [showDashboard, setShowDashboard] = useState(false);
const [activeTab, setActiveTab] = useState("home");
const [showAttendanceTracker, setShowAttendanceTracker] = useState(false);

const webPages = [
{ name: "Uni-Notes", url: "https://uni-notes.netlify.app/" },
{ name: "ERP", url: "https://erp.bits-pilani.ac.in" },
{ name: "Google DSC Resources", url: "https://gdscbpdc.github.io/"},
{ name: "ACM Resources", url: "https://openlib-cs.acmbpdc.org/"}
// Add other web pages as needed
];
const renderNavigation = () => (
<nav className="flex items-center justify-between p-4">
<div className="font-bold text-xl">UniDash</div>
<div className="flex items-center space-x-4">
<a href="[email protected]" className="hover:underline">Contact</a>
<Link href="/about" className="hover:underline">About</Link>
<button onClick={() => setShowAttendanceTracker(true)} className="hover:underline">Attendance Tracker</button>
<Link href="/code" className="text-gray-500 hover:underline">Code</Link>
<Button variant="default" className="bg-black text-white px-4 py-2 rounded-md">Join Up</Button>
</div>
</nav>
);

if (showAttendanceTracker) {
return <AttendanceTracker onBack={() => setShowAttendanceTracker(false)} />;
}

if (!showDashboard) {
return <HomePage onEnter={() => setShowDashboard(true)} />;
return (
<HomePage
onEnter={() => setShowDashboard(true)}
navigation={renderNavigation()}
/>
);
}

return (
<div className="min-h-screen w-full bg-gray-100 p-2 sm:p-4 md:p-6">
<Card className="overflow-hidden rounded-xl border border-gray-200 bg-white shadow-lg mb-6">
<CardHeader className="border-b border-gray-200 bg-gray-50 p-4">
<div className="flex items-center justify-between">
<h2 className="text-xl font-bold">University Dashboard</h2>
<div className="flex space-x-2">
<Button
variant={activeTab === "home" ? "default" : "outline"}
onClick={() => setActiveTab("home")}
>
Home
</Button>
<Button
variant={activeTab === "features" ? "default" : "outline"}
onClick={() => setActiveTab("features")}
>
Features
</Button>
</div>
</div>
</CardHeader>
<CardContent className="p-2 sm:p-4">
{activeTab === "home" && (
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
{webPages.map((page, index) => (
<div key={index} className="border rounded-lg p-4">
<h3 className="font-semibold mb-2">{page.name}</h3>
<div className="h-[400px] sm:h-[500px] md:h-[600px]">
<iframe
src={page.url}
title={page.name}
width="100%"
height="100%"
className="border-0"
/>
</div>
</div>
))}
</div>
)}
{activeTab === "features" && <div>Features content here</div>}
</CardContent>
</Card>
</div>
);
return <Dashboard />;
}
8 changes: 7 additions & 1 deletion src/components/AttendanceTracker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@ interface Subject {
missed: number
}

export default function AttendanceTracker() {
interface AttendanceTrackerProps {
onBack: () => void;
}

function AttendanceTracker({ onBack }: AttendanceTrackerProps) {
const [subjects, setSubjects] = useState<Record<string, Subject>>({})
const [newSubject, setNewSubject] = useState("")
const [totalClasses, setTotalClasses] = useState(30)
Expand Down Expand Up @@ -101,3 +105,5 @@ export default function AttendanceTracker() {
</div>
)
}

export default AttendanceTracker;
35 changes: 35 additions & 0 deletions src/components/Dashboard.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import React from 'react';

const webPages = [
{ title: 'BITS ERP', url: 'https://erp.bits-pilani.ac.in/', description: 'The main website for registration, academic progress, and grading' },
{ title: 'LMS', url: 'https://lms.bitspilanidubai.ae/', description: 'A website for coursework management, assessments, and coursework resources' },
{ title: 'Uni Notes', url: 'https://uni-notes.netlify.app/', description: 'Find information across courses and their respective notes, contributed by individual students' },
{ title: 'Google DSC Resources', url: 'https://gdscbpdc.github.io/', description: 'Find information of technical workshops and events conducted by Google DSC BPDC' },
{ title: 'ACM lib Resources', url: 'https://openlib-cs.acmbpdc.org/', description: 'A library of resources provided by ACM BPDC' },
];

function Dashboard() {
return (
<div className="container mx-auto p-4">
<h1 className="text-2xl font-bold mb-4">All Web Pages</h1>
<div className="space-y-6">
{webPages.map((page, index) => (
<div key={index} className="border rounded-lg p-4 shadow-sm">
<h2 className="font-semibold mb-2">{page.title}</h2>
<p className="text-sm mb-2">{page.description}</p>
<div className="w-full h-[600px]">
<iframe
src={page.url}
className="w-full h-full border rounded"
title={page.title}
loading="lazy"
/>
</div>
</div>
))}
</div>
</div>
);
}

export default Dashboard;
42 changes: 0 additions & 42 deletions src/components/Features.tsx

This file was deleted.

35 changes: 22 additions & 13 deletions src/components/HomePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import React from 'react';
import { Button } from "@/components/ui/button";
import Link from 'next/link';
import DotPattern from "@/components/magicui/dot-pattern"; // Adjust the import path as needed

interface HomePageProps {
onEnter: () => void;
Expand All @@ -12,19 +11,29 @@ interface HomePageProps {

function HomePage({ onEnter, navigation }: HomePageProps) {
return (
<div className="relative min-h-screen">
<div className="absolute inset-0 z-0">
<DotPattern />
</div>

<div className="relative z-10 p-6">
<div className="mb-6">
{navigation}
<div className="min-h-screen flex flex-col">
{navigation}
<main className="flex-grow flex flex-col items-center justify-center px-4 max-w-4xl mx-auto text-center">
<div className="text-sm mb-4 flex items-center justify-center">
<img src="/bits.png" alt="Student Council Logo" className="w-6 h-6 mr-2 rounded-full" />
<span className="text-xs sm:text-sm">Backed by Student Council BITS Pilani Dubai Campus</span>
</div>
<h1 className="text-4xl font-bold mb-4">Welcome to the University Dashboard</h1>
<p className="mb-4">This is your central hub for all university-related information and tools.</p>
<Button onClick={onEnter}>Enter Dashboard</Button>
</div>
<h1 className="text-3xl sm:text-4xl md:text-5xl font-bold mb-4">
Access all your university tools and resources in one place.
</h1>
<p className="text-base sm:text-lg md:text-xl mb-8">
Quickly find info about course requirements, simplify resources navigation, be organized. Save four hours on your academic planning.
</p>
<div className="flex flex-col sm:flex-row items-center space-y-4 sm:space-y-0 sm:space-x-4">
<Button
onClick={onEnter}
className="bg-black text-white px-6 py-3 rounded-full w-full sm:w-auto"
>
Go to Dashboard
</Button>
<span className="text-sm sm:text-base">Join 1000+ faculty and students</span>
</div>
</main>
</div>
);
}
Expand Down

0 comments on commit 0efe6a6

Please sign in to comment.