Skip to content

Commit c953065

Browse files
committed
added few more page like bus club lost and found but it is not fixed at all need more time to fix all of this
1 parent a64e400 commit c953065

17 files changed

Lines changed: 726 additions & 54 deletions

File tree

next.config.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
const nextConfig = {
2-
reactStrictMode: true,
3-
eslint: {
4-
ignoreDuringBuilds: false,
5-
},
1+
import withPWA from 'next-pwa';
62

7-
};
3+
export default withPWA({
4+
dest: 'public',
5+
register: true,
6+
skipWaiting: true,
7+
disable: process.env.NODE_ENV === 'development', // Disable in development
8+
})();

src/app/[admin]/Lost/add/page.tsx

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
'use client';
2+
import { useState } from "react";
3+
import { useRouter } from "next/navigation";
4+
5+
export default function AddItemPage() {
6+
const router = useRouter();
7+
const [name, setName] = useState("");
8+
const [description, setDescription] = useState("");
9+
const [lastSeenPlace, setLastSeenPlace] = useState("");
10+
const [contactInfo, setContactInfo] = useState("");
11+
12+
const handleSave = () => {
13+
// Save the item to local storage or a backend API
14+
const newItem = {
15+
id: Date.now(), // Generate a unique ID
16+
name,
17+
description,
18+
lastSeenPlace,
19+
contactInfo,
20+
status: "lost", // Default status
21+
};
22+
23+
// Save to local storage (for demonstration purposes)
24+
const existingItems = JSON.parse(localStorage.getItem("lostFoundItems") || [];
25+
localStorage.setItem(
26+
"lostFoundItems",
27+
JSON.stringify([...existingItems, newItem])
28+
);
29+
30+
// Redirect back to the LostFound page
31+
router.push("/lost-found");
32+
};
33+
34+
return (
35+
<div className="p-4 max-w-md mx-auto">
36+
<h1 className="text-2xl font-bold mb-4">Add New Item</h1>
37+
<div className="space-y-4">
38+
<input
39+
type="text"
40+
placeholder="Item Name"
41+
className="w-full p-2 border rounded"
42+
value={name}
43+
onChange={(e) => setName(e.target.value)}
44+
/>
45+
<textarea
46+
placeholder="Description"
47+
className="w-full p-2 border rounded"
48+
value={description}
49+
onChange={(e) => setDescription(e.target.value)}
50+
/>
51+
<input
52+
type="text"
53+
placeholder="Last Seen Place"
54+
className="w-full p-2 border rounded"
55+
value={lastSeenPlace}
56+
onChange={(e) => setLastSeenPlace(e.target.value)}
57+
/>
58+
<input
59+
type="text"
60+
placeholder="Contact Info"
61+
className="w-full p-2 border rounded"
62+
value={contactInfo}
63+
onChange={(e) => setContactInfo(e.target.value)}
64+
/>
65+
<button
66+
className="w-full bg-blue-600 text-white py-2 rounded hover:bg-blue-700"
67+
onClick={handleSave}
68+
>
69+
Save
70+
</button>
71+
</div>
72+
</div>
73+
);
74+
}

src/app/[admin]/Lost/page.tsx

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
'use client';
2+
import { useState } from "react";
3+
import Link from "next/link";
4+
5+
// Define the type for an item
6+
type Item = {
7+
id: number;
8+
name: string;
9+
description: string;
10+
lastSeenPlace: string;
11+
contactInfo: string;
12+
status: "lost" | "found";
13+
};
14+
15+
export default function LostFound() {
16+
const [status, setStatus] = useState<"lost" | "found">("lost");
17+
const [items, setItems] = useState<Item[]>([
18+
{
19+
id: 1,
20+
name: "Watch",
21+
description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
22+
lastSeenPlace: "College Ground",
23+
contactInfo: "contact@example.com",
24+
status: "lost",
25+
},
26+
{
27+
id: 2,
28+
name: "Water Bottle",
29+
description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
30+
lastSeenPlace: "Library",
31+
contactInfo: "contact@example.com",
32+
status: "found",
33+
},
34+
]);
35+
36+
// Toggle item status between "lost" and "found"
37+
const toggleItemStatus = (id: number) => {
38+
setItems((prevItems) =>
39+
prevItems.map((item) =>
40+
item.id === id
41+
? { ...item, status: item.status === "lost" ? "found" : "lost" }
42+
: item
43+
)
44+
);
45+
};
46+
47+
// Filter items based on the selected status
48+
const filteredItems = items.filter((item) => item.status === status);
49+
50+
return (
51+
<div className="p-4 max-w-md mx-auto relative">
52+
<h1 className="text-2xl font-bold mb-4">Lost And Found</h1>
53+
54+
{/* Toggle Buttons */}
55+
<div className="flex mb-4">
56+
<button
57+
className={`flex-1 py-2 text-center ${
58+
status === "lost" ? "bg-gray-800 text-white" : "bg-gray-200"
59+
}`}
60+
onClick={() => setStatus("lost")}
61+
>
62+
Lost
63+
</button>
64+
<button
65+
className={`flex-1 py-2 text-center ${
66+
status === "found" ? "bg-gray-800 text-white" : "bg-gray-200"
67+
}`}
68+
onClick={() => setStatus("found")}
69+
>
70+
Found
71+
</button>
72+
</div>
73+
74+
{/* List of Items */}
75+
{filteredItems.map((item) => (
76+
<div key={item.id} className="mb-4 border p-4 rounded-lg shadow-md">
77+
<div className="flex flex-col items-center">
78+
<div className="w-20 h-20 bg-gray-300 mb-2"></div>
79+
<h2 className="text-lg font-semibold">{item.name}</h2>
80+
<p className="text-sm font-medium text-gray-600">
81+
Last Seen Place: {item.lastSeenPlace}
82+
</p>
83+
<p className="text-sm text-gray-500 mt-1">{item.description}</p>
84+
<p className="text-sm text-gray-500 mt-1">
85+
Contact: {item.contactInfo}
86+
</p>
87+
<div className="flex gap-2 mt-3">
88+
<button className="text-blue-600">Report</button>
89+
<button className="border px-3 py-1 rounded">Edit</button>
90+
<button
91+
className="border px-3 py-1 rounded bg-green-600 text-white"
92+
onClick={() => toggleItemStatus(item.id)}
93+
>
94+
{item.status === "lost" ? "Mark as Found" : "Mark as Lost"}
95+
</button>
96+
</div>
97+
</div>
98+
</div>
99+
))}
100+
101+
{/* Floating "+" Button */}
102+
<Link href="/lost-found/add">
103+
<button className="fixed bottom-6 right-6 bg-blue-600 text-white w-12 h-12 rounded-full flex items-center justify-center shadow-lg hover:bg-blue-700 transition-colors">
104+
+
105+
</button>
106+
</Link>
107+
</div>
108+
);
109+
}

src/app/bus/[busNumber]/page.tsx

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
import { notFound } from 'next/navigation';
2+
3+
// Mock data for bus timings (replace with actual data fetching logic)
4+
const busTimings = [
5+
{
6+
slug: 'bus-1',
7+
heading: 'Bus 1 Timings',
8+
locations: [
9+
{
10+
name: 'Location A',
11+
morning: '7:00 AM',
12+
afternoon: '1:00 PM',
13+
},
14+
{
15+
name: 'Location B',
16+
morning: '8:00 AM',
17+
afternoon: '2:00 PM',
18+
},
19+
],
20+
},
21+
{
22+
slug: 'bus-2',
23+
heading: 'Bus 2 Timings',
24+
locations: [
25+
{
26+
name: 'Location X',
27+
morning: '7:30 AM',
28+
afternoon: '1:30 PM',
29+
},
30+
{
31+
name: 'Location Y',
32+
morning: '8:30 AM',
33+
afternoon: '2:30 PM',
34+
},
35+
],
36+
},
37+
// Add more bus timings as needed
38+
];
39+
40+
export default function BusTimingPage({ params }: { params: { slug: string } }) {
41+
const { slug } = params;
42+
43+
// Find the bus timing data based on the slug
44+
const busTiming = busTimings.find((bus) => bus.slug === slug);
45+
46+
// If bus timing not found, return a 404 page
47+
if (!busTiming) {
48+
notFound();
49+
}
50+
51+
return (
52+
<div className="flex flex-col items-center justify-center min-h-screen p-4 bg-black text-white">
53+
{/* Heading */}
54+
<h1 className="text-4xl font-bold mb-6">{busTiming.heading}</h1>
55+
56+
{/* Timings Table */}
57+
<div className="w-full max-w-2xl overflow-x-auto">
58+
<table className="w-full border-collapse border border-gray-700">
59+
<thead>
60+
<tr className="bg-gray-800">
61+
<th className="p-3 text-left">Location</th>
62+
<th className="p-3 text-left">Morning Time</th>
63+
<th className="p-3 text-left">Afternoon Time</th>
64+
</tr>
65+
</thead>
66+
<tbody>
67+
{busTiming.locations.map((location, index) => (
68+
<tr key={index} className="border-b border-gray-700">
69+
<td className="p-3">{location.name}</td>
70+
<td className="p-3">{location.morning}</td>
71+
<td className="p-3">{location.afternoon}</td>
72+
</tr>
73+
))}
74+
</tbody>
75+
</table>
76+
</div>
77+
</div>
78+
);
79+
}

src/app/bus/page.tsx

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1-
export default function Home() {
2-
return <div></div>;
3-
}
1+
import { BusButtons } from "@/components/Bus/busButton";
2+
3+
const busData = [
4+
{ slug: 'bus-1', name: 'Bus 1' },
5+
{ slug: 'bus-2', name: 'Bus 2' },
6+
{ slug: 'bus-3', name: 'Bus 3' },
7+
{ slug: 'bus-4', name: 'Bus 4' },
8+
{ slug: 'bus-5', name: 'Bus 5' },
9+
{ slug: 'bus-6', name: 'Bus 6' },
10+
];
11+
12+
export default function BusPage() {
13+
return (
14+
<div>
15+
<BusButtons buses={busData} />
16+
</div>
17+
);
18+
}

src/app/club/[slug]/page.tsx

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
import { notFound } from 'next/navigation';
2+
3+
// Mock data for clubs (replace with actual data fetching logic)
4+
const clubsData = [
5+
{
6+
slug: 'coding',
7+
clubName: 'Coding Club',
8+
subheading: 'Innovate. Code. Build.',
9+
image: '/images/coding-club.jpg',
10+
description: 'Join us to learn and build amazing projects with the latest technologies.',
11+
socialMedia: {
12+
instagram: 'https://instagram.com/codingclub',
13+
linkedin: 'https://linkedin.com/company/codingclub',
14+
whatsapp: 'https://wa.me/1234567890',
15+
},
16+
},
17+
{
18+
slug: 'drama',
19+
clubName: 'Drama Club',
20+
subheading: 'Act. Perform. Inspire.',
21+
image: '/images/drama-club.jpg',
22+
description: 'Express yourself through the art of drama and theater.',
23+
socialMedia: {
24+
instagram: 'https://instagram.com/dramaclub',
25+
linkedin: 'https://linkedin.com/company/dramaclub',
26+
whatsapp: 'https://wa.me/1234567890',
27+
},
28+
},
29+
// Add more clubs as needed
30+
];
31+
32+
export default function ClubDetailPage({ params }: { params: { slug: string } }) {
33+
const { slug } = params;
34+
35+
// Find the club data based on the slug
36+
const club = clubsData.find((club) => club.slug === slug);
37+
38+
// If club not found, return a 404 page
39+
if (!club) {
40+
notFound();
41+
}
42+
43+
return (
44+
<div className="flex flex-col items-center justify-center min-h-screen p-4 bg-black text-white">
45+
{/* Heading */}
46+
<h1 className="text-4xl font-bold mb-2">{club.clubName}</h1>
47+
48+
{/* Subheading */}
49+
<h2 className="text-xl text-gray-400 mb-6">{club.subheading}</h2>
50+
51+
{/* Picture */}
52+
<img
53+
src={club.image}
54+
alt={club.clubName}
55+
className="w-full max-w-md rounded-lg mb-6"
56+
/>
57+
58+
{/* Description */}
59+
<p className="text-lg text-center max-w-2xl mb-8">{club.description}</p>
60+
61+
{/* Social Media Icons */}
62+
<div className="flex space-x-4">
63+
<a href={club.socialMedia.instagram} target="_blank" rel="noopener noreferrer">
64+
<img src="/icons/instagram.svg" alt="Instagram" className="w-8 h-8" />
65+
</a>
66+
<a href={club.socialMedia.linkedin} target="_blank" rel="noopener noreferrer">
67+
<img src="/icons/linkedin.svg" alt="LinkedIn" className="w-8 h-8" />
68+
</a>
69+
<a href={club.socialMedia.whatsapp} target="_blank" rel="noopener noreferrer">
70+
<img src="/icons/whatsapp.svg" alt="WhatsApp" className="w-8 h-8" />
71+
</a>
72+
</div>
73+
</div>
74+
);
75+
}

0 commit comments

Comments
 (0)