Skip to content

Commit 604b14d

Browse files
author
jean-philippe
committed
working out
1 parent 779f5cf commit 604b14d

8 files changed

Lines changed: 88 additions & 139 deletions

File tree

src/components/profile/CreateEventCTA.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { component$ } from "@builder.io/qwik";
22
import { Link } from "@builder.io/qwik-city";
3-
import { CalendarIcon as Calendar, MapPinIcon as MapPin } from "lucide-qwik";
43

54
export const CreateEventCTA = component$(() => {
65
return (
@@ -36,14 +35,14 @@ export const CreateEventCTA = component$(() => {
3635
// Larger padding
3736
class="inline-flex items-center justify-center rounded-lg bg-[#D98E73] px-6 py-3 text-base font-medium text-white shadow-sm transition-colors hover:bg-[#C27B62] focus:outline-none focus:ring-2 focus:ring-[#D98E73] focus:ring-offset-2"
3837
>
39-
<Calendar class="-ml-1 mr-2 h-5 w-5" /> Create an Event
38+
Create an Event
4039
</Link>
4140
<Link
4241
href="/spaces"
4342
// Larger padding
4443
class="inline-flex items-center justify-center rounded-lg border border-[#D98E73]/80 px-6 py-3 text-base font-medium text-[#D98E73] transition-colors hover:bg-[#FFF1E6] focus:outline-none focus:ring-2 focus:ring-[#D98E73] focus:ring-offset-2"
4544
>
46-
<MapPin class="-ml-1 mr-2 h-5 w-5" /> Browse Spaces
45+
Browse Spaces
4746
</Link>
4847
</div>
4948
</div>

src/components/profile/EventCard.tsx

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,6 @@
11
import { component$ } from "@builder.io/qwik";
22
import { Link } from "@builder.io/qwik-city";
33
import JustRnD from "../../assets/just-rnd.png?url";
4-
import {
5-
CalendarIcon as Calendar,
6-
MapPinIcon as MapPin,
7-
UsersIcon as Users,
8-
UserPlusIcon as UserPlus,
9-
CheckCircleIcon as CheckCircle,
10-
Clock3Icon as Clock3,
11-
InfoIcon,
12-
} from "lucide-qwik";
134
import type { DetailedEventType } from "~/routes/profile/types";
145

156
interface EventCardProps {
@@ -73,7 +64,6 @@ export const EventCard = component$<EventCardProps>(
7364
{/* Location Badge - Adjusted padding, position, max-width */}
7465
{event.location && (
7566
<div class="absolute left-3 top-3 flex max-w-[calc(100%-6rem)] items-center rounded-full bg-white/90 px-3 py-1.5 text-xs font-medium text-[#5B3E29] shadow-sm backdrop-blur-sm sm:left-4 sm:top-4">
76-
<MapPin class="mr-1.5 h-3.5 w-3.5 flex-shrink-0 text-[#D98E73]" />
7767
<span class="truncate">{event.location}</span>
7868
</div>
7969
)}
@@ -83,15 +73,6 @@ export const EventCard = component$<EventCardProps>(
8373
<span
8474
class={`inline-flex items-center rounded-full px-3 py-1.5 text-xs font-semibold ${currentStatusStyle}`} // Adjusted padding slightly
8575
>
86-
{/* Increased icon margin */}
87-
{status === "Host" && <UserPlus class="mr-1.5 h-3.5 w-3.5" />}
88-
{status === "Confirmed" && (
89-
<CheckCircle class="mr-1.5 h-3.5 w-3.5" />
90-
)}
91-
{status === "Pending" && <Clock3 class="mr-1.5 h-3.5 w-3.5" />}
92-
{status !== "Host" &&
93-
status !== "Confirmed" &&
94-
status !== "Pending" && <InfoIcon class="mr-1.5 h-3.5 w-3.5" />}
9576
{status}
9677
</span>
9778
</div>
@@ -104,16 +85,12 @@ export const EventCard = component$<EventCardProps>(
10485
{/* Stack date/attendees vertically on small screens */}
10586
<div class="flex flex-col gap-1 text-xs opacity-95 sm:flex-row sm:items-center sm:justify-between sm:gap-2 sm:text-sm">
10687
<div class="flex items-center gap-1.5">
107-
<Calendar class="h-4 w-4 flex-shrink-0" />{" "}
108-
{/* Prevent icon shrinking */}
10988
<span>
11089
{displayDate} {displayTime ? `at ${displayTime}` : ""}
11190
</span>
11291
</div>
11392
{typeof event.attendees === "number" && event.attendees > 0 && (
11493
<div class="flex items-center gap-1">
115-
<Users class="h-4 w-4 flex-shrink-0" />{" "}
116-
{/* Prevent icon shrinking */}
11794
{/* Added context "Attendees" */}
11895
<span>
11996
{event.attendees} Attendee{event.attendees !== 1 ? "s" : ""}

src/components/profile/ProfileHeader.tsx

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { component$, type Signal } from "@builder.io/qwik";
2-
import { EditIcon as Edit, XIcon } from "lucide-qwik";
32
import type { UserProfileType } from "~/routes/profile/types";
43
import { BetaBadge } from "./BetaBadge";
54

@@ -41,12 +40,6 @@ export const ProfileHeader = component$<ProfileHeaderProps>(
4140
aria-label={showEdit.value ? "Cancel edit" : "Edit profile"}
4241
title={showEdit.value ? "Cancel edit" : "Edit profile"}
4342
>
44-
{showEdit.value ? (
45-
// Smaller icon for smaller button on mobile
46-
<XIcon class="h-3 w-3 md:h-5 md:w-5" />
47-
) : (
48-
<Edit class="h-3 w-3 md:h-5 md:w-5" />
49-
)}
5043
</button>
5144
</div>
5245
<div class="flex-1 text-left md:pt-2">

src/routes/(app)/home/create-event-card.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
import { component$ } from "@builder.io/qwik";
2-
import { CalendarIcon as Calendar } from "lucide-qwik";
32

43
export const CreateEventCard = component$(() => {
54
return (
65
<div class="overflow-hidden rounded-xl border-2 border-dashed border-[#E6D7C3] bg-white/50">
76
<div class="flex h-full flex-col items-center justify-center p-8 text-center">
87
<div class="mb-4 rounded-full bg-[#F8D7BD] p-6">
9-
<Calendar class="h-8 w-8 text-[#D98E73]" />
108
</div>
119
<h3 class="mb-2 text-xl font-semibold text-[#5B3E29]">
1210
Host Your Own Session

src/routes/(app)/home/event-card.tsx

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,4 @@
11
import { component$ } from "@builder.io/qwik";
2-
import {
3-
CalendarIcon as Calendar,
4-
ClockIcon as Clock,
5-
MapPinIcon as MapPin,
6-
UsersIcon as Users,
7-
} from "lucide-qwik";
82

93
export const EventCard = component$(
104
(props: {
@@ -43,9 +37,6 @@ export const EventCard = component$(
4337
<div class="flex flex-col justify-between bg-white p-5 md:w-3/5">
4438
<div>
4539
<div class="mb-2 flex items-center gap-2">
46-
<div class="flex h-5 w-5 items-center justify-center rounded-full bg-[#F8D7BD]">
47-
<Users class="h-3 w-3 text-[#8B5A2B]" />
48-
</div>
4940
<span class="text-sm text-[#8B5A2B]">
5041
By {props.event.creator}
5142
</span>
@@ -57,20 +48,16 @@ export const EventCard = component$(
5748
{props.event.title}
5849
</h3>
5950
<div class="grid grid-cols-2 gap-2 text-sm text-[#6D5D4E]">
60-
<div class="flex items-center gap-2">
61-
<Calendar class="h-4 w-4 text-[#D98E73]" />
51+
<div>
6252
<span>{props.event.date}</span>
6353
</div>
64-
<div class="flex items-center gap-2">
65-
<Clock class="h-4 w-4 text-[#D98E73]" />
54+
<div>
6655
<span>{props.event.time}</span>
6756
</div>
68-
<div class="flex items-center gap-2">
69-
<MapPin class="h-4 w-4 text-[#D98E73]" />
57+
<div>
7058
<span>{props.event.location}</span>
7159
</div>
72-
<div class="flex items-center gap-2">
73-
<Users class="h-4 w-4 text-[#D98E73]" />
60+
<div>
7461
<span>{props.event.spotsLeft} spots left</span>
7562
</div>
7663
</div>

src/routes/(app)/home/index.tsx

Lines changed: 75 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
import { component$, useSignal } from "@builder.io/qwik";
1+
import { component$, useSignal, useTask$ } from "@builder.io/qwik";
22
import { routeLoader$ } from "@builder.io/qwik-city";
3-
import { MapPinIcon as MapPin } from "lucide-qwik"; // Keep MapPin for the modal button
43

54
import { MapWrapper as Leaflet } from "@/components/leaflet-map";
65
import { getEvents } from "~/api/EndPoint";
@@ -39,82 +38,92 @@ export const usePlaces = routeLoader$(async (event) => {
3938
return { data: data.data, success: data.success };
4039
});
4140

41+
4242
export default component$(() => {
4343
const events = useEvents();
4444
const places = usePlaces();
4545
const showMap = useSignal(false);
46-
const combinedMapData = useSignal<unknown>();
47-
// --- Data Transformation (Remains the same) ---
48-
const placesDataForMap =
49-
places.value.data?.map((place) => ({
50-
id: place.Places?.PlaceID,
51-
name: place.Places?.Name,
52-
image: (place.Places?.ImageURL as string) || "/placeholder.svg",
53-
badge: "Place",
54-
location: place.Places?.Address,
55-
description: place.Places?.Description,
56-
tags: ["Quiet", "WiFi", "Coffee"], // Example tags, ideally fetch from DB
57-
creator: place.Users?.Username, // Placeholder
58-
rating: 4.8, // Placeholder, fetch actual rating if available
59-
coords: [place.Places?.Lat, place.Places?.Lng] as [number, number],
60-
})) || [];
61-
62-
// Add events to the map data as well
63-
const eventsDataForMap =
64-
events.value.data?.map((event) => ({
65-
id: event.eventID,
66-
name: event.name,
67-
image: event.image || "/placeholder.svg",
68-
badge: "Event",
69-
location: event.place?.Places?.Name || "Location TBD",
70-
description: event.description,
71-
tags: ["Study", "Meetup"],
72-
creator: event.creator || "Anonymous",
73-
rating: 4.7, // Placeholder for events
74-
coords: [
75-
event.place?.Places?.Lat ?? 0,
76-
event.place?.Places?.Lng ?? 0,
77-
] as [number, number],
78-
})) || [];
79-
combinedMapData.value = [...placesDataForMap, ...eventsDataForMap];
80-
81-
const eventsDataForCards =
82-
events.value.data?.map((event) => ({
83-
id: event.eventID,
84-
title: event.name,
85-
image: event.image || "/placeholder.svg",
86-
badge: "Event", // Or derive from event type/tags
87-
type: "Study Group", // Or derive from event type
88-
date: event.date,
89-
time: event.date,
90-
location: event.location || "Location TBD",
91-
creator: event.creator || "Anonymous",
92-
attendees: event.attendees ?? 8, // Fetch real attendee count if available
93-
spotsLeft: 5, // Fetch real spots left if available
94-
})) || [];
95-
96-
const placesApiDataForCards =
97-
places.value.data?.map((place) => {
98-
return {
46+
const combinedMapData = useSignal([]);
47+
const eventsDataForCards = useSignal<any[]>([]);
48+
const placesApiDataForCards = useSignal<any[]>([]);
49+
50+
useTask$(({ track }) => {
51+
track(() => places.value.data);
52+
track(() => events.value.data);
53+
54+
const placesDataForMap =
55+
places.value.data?.map((place) => ({
9956
id: place.Places?.PlaceID,
10057
name: place.Places?.Name,
101-
image: place.Places?.ImageURL as string,
102-
badge: "Popular", // Or derive dynamically
58+
image: (place.Places?.ImageURL as string) || "/placeholder.svg",
59+
badge: "Place",
10360
location: place.Places?.Address,
10461
description: place.Places?.Description,
105-
tags: ["Quiet", "WiFi", "Coffee"], // Fetch real tags if available
62+
tags: ["Quiet", "WiFi", "Coffee"], // Example tags, ideally fetch from DB
10663
creator: place.Users?.Username, // Placeholder
107-
rating: 4.8, // Fetch real rating if available
108-
coords: [place.Places?.Lat, place.Places?.Lng] as [number, number], // Keep coords if needed by card, though maybe not displayed
109-
};
110-
}) || [];
64+
rating: 4.8, // Placeholder, fetch actual rating if available
65+
coords: [place.Places?.Lat, place.Places?.Lng] as [number, number],
66+
})) || [];
67+
68+
// Add events to the map data as well
69+
const eventsDataForMap =
70+
events.value.data?.map((event) => ({
71+
id: event.eventID,
72+
name: event.name,
73+
image: event.image || "/placeholder.svg",
74+
badge: "Event",
75+
location: event.place?.Places?.Name || "Location TBD",
76+
description: event.description,
77+
tags: ["Study", "Meetup"],
78+
creator: event.creator || "Anonymous",
79+
rating: 4.7, // Placeholder for events
80+
coords: [
81+
event.place?.Places?.Lat ?? 0,
82+
event.place?.Places?.Lng ?? 0,
83+
] as [number, number],
84+
})) || [];
85+
// @ts-ignore
86+
combinedMapData.value = [...placesDataForMap, ...eventsDataForMap];
87+
88+
eventsDataForCards.value =
89+
events.value.data?.map((event) => ({
90+
id: event.eventID,
91+
title: event.name,
92+
image: event.image || "/placeholder.svg",
93+
badge: "Event", // Or derive from event type/tags
94+
type: "Study Group", // Or derive from event type
95+
date: event.date,
96+
time: event.date,
97+
location: event.location || "Location TBD",
98+
creator: event.creator || "Anonymous",
99+
attendees: event.attendees ?? 8, // Fetch real attendee count if available
100+
spotsLeft: 5, // Fetch real spots left if available
101+
})) || [];
102+
103+
placesApiDataForCards.value =
104+
places.value.data?.map((place) => {
105+
return {
106+
id: place.Places?.PlaceID,
107+
name: place.Places?.Name,
108+
image: place.Places?.ImageURL as string,
109+
badge: "Popular", // Or derive dynamically
110+
location: place.Places?.Address,
111+
description: place.Places?.Description,
112+
tags: ["Quiet", "WiFi", "Coffee"], // Fetch real tags if available
113+
creator: place.Users?.Username, // Placeholder
114+
rating: 4.8, // Fetch real rating if available
115+
coords: [place.Places?.Lat, place.Places?.Lng] as [number, number], // Keep coords if needed by card, though maybe not displayed
116+
};
117+
}) || [];
118+
});
119+
111120
return (
112121
<div class="min-h-screen bg-[#FFF8F0]">
113122
<HeroSection />
114123

115124
<TabsSection
116-
placesApiData={placesApiDataForCards}
117-
eventsData={eventsDataForCards}
125+
placesApiData={placesApiDataForCards.value}
126+
eventsData={eventsDataForCards.value}
118127
/>
119128

120129
<CommunitySection />
@@ -150,7 +159,7 @@ export default component$(() => {
150159
<div class="h-[calc(90vh-6rem)] w-full overflow-hidden rounded-md border border-[#E6D7C3]">
151160
<Leaflet
152161
// Pass combined places and events data for markers
153-
places={combinedMapData as any}
162+
places={combinedMapData.value as any}
154163
// TODO: Get user's actual location or a default center
155164
location={[51.505, -0.09] as any} // Default location
156165
/>
@@ -166,9 +175,9 @@ export default component$(() => {
166175
onClick$={() => (showMap.value = true)}
167176
class="fixed bottom-24 right-6 z-40 inline-flex h-12 items-center justify-center rounded-full bg-[#D98E73] px-5 py-2 text-sm font-medium text-white shadow-lg ring-offset-background transition-colors hover:bg-[#C27B62] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50"
168177
>
169-
<MapPin class="mr-2 h-5 w-5" />
170178
View Map
171179
</button>
180+
172181
</div>
173182
);
174183
});

src/routes/(app)/home/place-card.tsx

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,4 @@
11
import { component$ } from "@builder.io/qwik";
2-
import {
3-
MapPinIcon as MapPin,
4-
UsersIcon as Users,
5-
HeartIcon as Heart,
6-
StarIcon as Star,
7-
} from "lucide-qwik";
8-
92
export const PlaceCard = component$(
103
(props: {
114
place: {
@@ -40,12 +33,10 @@ export const PlaceCard = component$(
4033
type="button"
4134
class="absolute right-3 top-3 flex h-10 items-center justify-center rounded-full bg-black/20 px-4 py-2 text-white ring-offset-background transition-colors hover:bg-white/90 hover:text-[#D98E73] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50"
4235
>
43-
<Heart class="h-5 w-5" />
4436
</button>
4537
</div>
4638
<div class="bg-white p-5">
4739
<div class="mb-2 flex items-center gap-2 text-sm text-muted-foreground">
48-
<MapPin class="h-4 w-4 text-[#D98E73]" />
4940
<span class="truncate">{props.place.location}</span>
5041
</div>
5142
<h3 class="mb-1 text-lg font-semibold text-[#5B3E29]">
@@ -67,12 +58,10 @@ export const PlaceCard = component$(
6758
<div class="flex items-center justify-between">
6859
<div class="flex items-center gap-1 text-sm">
6960
<div class="flex h-5 w-5 items-center justify-center rounded-full bg-[#F8D7BD]">
70-
<Users class="h-3 w-3 text-[#8B5A2B]" />
7161
</div>
7262
<span class="text-[#8B5A2B]">By {props.place.creator}</span>
7363
</div>
7464
<div class="flex items-center gap-1">
75-
<Star class="h-4 w-4 fill-[#D98E73] text-[#D98E73]" />
7665
<span class="font-medium text-[#5B3E29]">
7766
{props.place.rating}
7867
</span>

0 commit comments

Comments
 (0)