Skip to content

Commit 3b32403

Browse files
committed
basic tab system
1 parent 732479c commit 3b32403

12 files changed

Lines changed: 586 additions & 72 deletions

File tree

devconnect-app/src/app/dashboard-sections.tsx

Lines changed: 51 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,37 +4,67 @@ import { useFavorites } from './store.hooks';
44
import NoEventsImage from 'lib/components/event-schedule-new/images/404.png';
55
import moment from 'moment';
66
import Image from 'next/image';
7+
import Button from 'lib/components/voxel-button/button';
8+
import { useUnifiedConnection } from '@/hooks/useUnifiedConnection';
9+
import { useNow } from 'lib/hooks/useNow';
10+
import { useState } from 'react';
711

812
export function WelcomeSection() {
13+
// const { email } = useUnifiedConnection();
14+
const now = useNow();
15+
const dummyEmail = 'example.eth';
16+
const buenosAiresTime = moment(now).utc().subtract(3, 'hours');
17+
const formattedDate = buenosAiresTime.format('h:mm A');
18+
919
return (
10-
<div className="flex flex-col items-start justify-start gap-2">
11-
<div className="text-2xl font-semibold bg-clip-text text-transparent bg-[linear-gradient(90.78deg,#F6B40E_2.23%,#FF85A6_25.74%,#74ACDF_86.85%)]">
12-
¡Buen dia!
20+
<div className="flex flex-col items-start justify-start gap-2 mb-4">
21+
<div className="flex justify-between w-full gap-2">
22+
<div className="text-2xl font-semibold bg-clip-text text-transparent bg-[linear-gradient(90.78deg,#F6B40E_2.23%,#FF85A6_25.74%,#74ACDF_86.85%)]">
23+
¡Buen dia!
24+
</div>
25+
<div className="font-semibold text-sm">
26+
{formattedDate} Buenos Aires (GMT-3)
27+
</div>
1328
</div>
14-
<div className="text-2xl font-bold">John Nethereum</div>
15-
<div>Welcome to the Ethereum World's Fair!</div>
29+
<div className="text-xl font-bold">{dummyEmail}</div>
30+
<div>Welcome to the Ethereum World's Fair! </div>
1631
</div>
1732
);
1833
}
1934

2035
export function TodaysSchedule({ atprotoEvents }: { atprotoEvents: any[] }) {
2136
const [favorites] = useFavorites();
37+
const [selectedEvent, setSelectedEvent] = useState<any>(null);
2238
const events = atprotoEvents.filter((event) =>
2339
favorites.includes(event.id.toString())
2440
);
2541

2642
const hasEventsToShow = events.length > 0;
2743

2844
return (
29-
<div className="flex flex-col items-start justify-start gap-2 p-4 bg-white border border-[rgba(234,234,234,1)]">
30-
<div className="flex w-full items-start justify-between gap-2">
45+
<div className="flex flex-col items-start justify-start gap-2 p-4 pt-3 bg-white border border-[rgba(234,234,234,1)]">
46+
<div className="flex w-full items-center justify-between gap-2">
3147
<p className="font-semibold">Today's Schedule</p>
32-
<p className="text-xs">{moment().format('dddd, D MMMM')}</p>
48+
{/* <p className="text-xs">{moment().format('dddd, D MMMM')}</p> */}
3349
</div>
34-
<p className="text-xs">
50+
<p className="text-xs mb-2">
3551
These are your recommended events for today. Build your own schedule by
3652
adding events to your favorites.
3753
</p>
54+
55+
{selectedEvent && (
56+
<div className="flex flex-col items-center justify-center gap-2 w-full">
57+
<Event
58+
event={selectedEvent}
59+
selectedEvent={selectedEvent}
60+
setSelectedEvent={setSelectedEvent}
61+
setExports={() => {}}
62+
className="w-full"
63+
isDialog
64+
/>
65+
</div>
66+
)}
67+
3868
{hasEventsToShow && (
3969
<div className="flex flex-col items-stretch gap-2 w-full">
4070
{events.map((event) => (
@@ -43,18 +73,26 @@ export function TodaysSchedule({ atprotoEvents }: { atprotoEvents: any[] }) {
4373
key={event.id}
4474
event={event}
4575
className="w-full"
46-
selectedEvent={null}
47-
setSelectedEvent={() => {}}
76+
selectedEvent={selectedEvent}
77+
setSelectedEvent={setSelectedEvent}
4878
setExports={() => {}}
4979
/>
5080
))}
5181
</div>
5282
)}
5383
{!hasEventsToShow && (
54-
<div className="flex flex-col items-center justify-center gap-2 w-full">
55-
<Image src={NoEventsImage} alt="No events" className="w-full" />
84+
<div className="flex flex-col items-center justify-center gap-2 w-full ">
85+
<Image
86+
src={NoEventsImage}
87+
alt="No events"
88+
className="w-full max-w-[400px]"
89+
/>
5690
</div>
5791
)}
92+
93+
<Button size="sm" className="w-full md:w-auto self-start mt-2">
94+
View full Schedule
95+
</Button>
5896
</div>
5997
);
6098
}

devconnect-app/src/app/layout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ export default async function RootLayout({
9898
// const image = `${process.env.NEXT_PUBLIC_APP_URL}/social.jpg`;
9999

100100
// Check if Supabase is configured
101-
const hasSupabase = !!process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY;
101+
// const hasSupabase = !!process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY;
102102

103103
return (
104104
<html lang="en">

devconnect-app/src/app/page-content.tsx

Lines changed: 29 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,29 @@ import { useRouter } from 'next/navigation';
44
import PageLayout from '@/components/PageLayout';
55
import { useUnifiedConnection } from '@/hooks/useUnifiedConnection';
66
import { WelcomeSection, TodaysSchedule } from './dashboard-sections';
7+
import { HomeIcon, CalendarIcon, TicketIcon } from 'lucide-react';
78

8-
const tabs = (atprotoEvents: any[]) => [
9+
export const homeTabs = () => [
910
{
10-
label: 'Dashboard',
11-
component: () => (
12-
<div className="bg-[rgba(246,250,254,1)] p-4">
13-
<WelcomeSection />
14-
<TodaysSchedule atprotoEvents={atprotoEvents} />
15-
</div>
16-
),
11+
label: 'Home',
12+
labelIcon: HomeIcon,
13+
href: '/',
14+
component: () => null,
15+
isActive: (pathname: string) => pathname === '/',
16+
},
17+
{
18+
label: 'Schedule',
19+
labelIcon: CalendarIcon,
20+
href: '/schedule',
21+
component: () => null,
22+
isActive: (pathname: string) => pathname === '/schedule',
23+
},
24+
{
25+
label: 'Tickets',
26+
labelIcon: TicketIcon,
27+
href: '/tickets',
28+
component: () => null,
29+
isActive: (pathname: string) => pathname === '/tickets',
1730
},
1831
];
1932

@@ -25,7 +38,6 @@ export default function HomePageContent({
2538
const router = useRouter();
2639
const { address } = useUnifiedConnection();
2740

28-
console.log('🔄 [HOME] atprotoEvents', atprotoEvents);
2941
useEffect(() => {
3042
const isSkipped = localStorage.getItem('loginIsSkipped');
3143

@@ -35,5 +47,12 @@ export default function HomePageContent({
3547
}
3648
}, [router, address]);
3749

38-
return <PageLayout title="Home 😎" tabs={tabs(atprotoEvents)} />;
50+
return (
51+
<PageLayout title="Ethereum World's Fair" tabs={homeTabs()}>
52+
<div className="bg-[rgba(246,250,254,1)] p-4 grow">
53+
<WelcomeSection />
54+
<TodaysSchedule atprotoEvents={atprotoEvents} />
55+
</div>
56+
</PageLayout>
57+
);
3958
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
'use client';
2+
import PageLayout from '@/components/PageLayout';
3+
// import { CalendarRangeIcon } from 'lucide-react';
4+
// import ProgrammeTab from './ScheduleTab';
5+
// import { useUnifiedConnection } from '@/hooks/useUnifiedConnection';
6+
import { homeTabs } from '../page-content';
7+
import cn from 'classnames';
8+
import css from './schedule.module.scss';
9+
import { useFavorites } from '@/app/store.hooks';
10+
import { default as ScheduleLayout } from 'lib/components/event-schedule-new/layout-app';
11+
12+
// const tabs = (atprotoEvents: any[]) => [
13+
// {
14+
// label: 'Event Schedule',
15+
// labelIcon: CalendarRangeIcon,
16+
// component: () => <ProgrammeTab atprotoEvents={atprotoEvents} />,
17+
// },
18+
19+
// // {
20+
// // label: 'Favorites',
21+
// // component: () => <FavoritesTab />,
22+
// // },
23+
// ];
24+
25+
export default function ProgrammePageContent({
26+
atprotoEvents,
27+
}: {
28+
atprotoEvents: any;
29+
}) {
30+
// useUnifiedConnection();
31+
const [favoriteEvents, toggleFavoriteEvent] = useFavorites();
32+
33+
return (
34+
<PageLayout title="Schedule" tabs={homeTabs()}>
35+
<div className={cn('text-left touch-only:px-0 p-4', css['schedule-tab'])}>
36+
<ScheduleLayout
37+
isCommunityCalendar={false}
38+
events={atprotoEvents}
39+
favoriteEvents={favoriteEvents}
40+
toggleFavoriteEvent={toggleFavoriteEvent}
41+
// events={atprotoEvents.filter((event: any) => event.isCoreEvent)}
42+
/>
43+
</div>
44+
</PageLayout>
45+
);
46+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import ProgrammePageContent from './page-content';
2+
import { apiResultToCalendarFormat } from 'lib/components/event-schedule-new/atproto-to-calendar-format';
3+
4+
export async function getAtprotoEvents() {
5+
try {
6+
const atprotoEvents = await fetch(
7+
process.env.NODE_ENV === 'development' && !process.env.FORCE_PROD_ENV
8+
? 'http://localhost:4000/calendar-events'
9+
: 'https://at-slurper.onrender.com/calendar-events',
10+
{
11+
next: { revalidate: 300 }, // Cache for 5 minutes
12+
}
13+
);
14+
15+
const atprotoEventsData = await atprotoEvents.json();
16+
17+
const formattedAtprotoEvents = apiResultToCalendarFormat(atprotoEventsData);
18+
19+
return formattedAtprotoEvents;
20+
} catch (error) {
21+
console.error(error);
22+
return [];
23+
}
24+
}
25+
26+
export default async function ProgrammePage() {
27+
const atprotoEvents = await getAtprotoEvents();
28+
return <ProgrammePageContent atprotoEvents={atprotoEvents} />;
29+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
.schedule-tab {
2+
[data-type="action-bar"] {
3+
@media (pointer: coarse) {
4+
padding-left: 16px;
5+
padding-right: 16px;
6+
}
7+
}
8+
}

devconnect-app/src/app/store.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ export interface AppState {
1313
logout: (state: AppState) => void;
1414
}
1515

16+
export const useNow = () => {
17+
return new Date();
18+
};
19+
1620
// Lets keep global state for simplicity - useShallow for performance as needed
1721
export const useGlobalStore = create<AppState>()((set) => ({
1822
// Initial state

0 commit comments

Comments
 (0)