Skip to content

Commit

Permalink
featured events fix
Browse files Browse the repository at this point in the history
  • Loading branch information
pblvrt committed Aug 12, 2024
1 parent 424ecd6 commit 6289c52
Show file tree
Hide file tree
Showing 6 changed files with 76 additions and 67 deletions.
2 changes: 1 addition & 1 deletion packages/app/app/explore/components/ExploreTabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ const ExploreTabs = () => {
};

return (
<div className=" w-full sticky top-[57px] z-[99999] bg-white pt-2 border-b">
<div className=" w-full sticky top-[57px] z-[5] bg-white pt-2 border-b">
{showLeftArrow && (
<button
onClick={() => scroll('left')}
Expand Down
45 changes: 14 additions & 31 deletions packages/app/app/explore/components/FeaturedEvents.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,24 @@ import {
CardTitle,
} from '@/components/ui/card';
import Image from 'next/image';
import { IExtendedEvent, IExtendedOrganization } from '@/lib/types';

interface FeaturedEventsProps {
events: IExtendedEvent[];
organizations: { [key: string]: IExtendedOrganization };
}

const FeaturedEvents: React.FC<FeaturedEventsProps> = ({
const FeaturedEvents = ({
events,
organizations,
}: {
events: {
name: string;
url: string;
cover: string;
organization: string;
}[];
}) => {
return (
<div className="grid grid-cols-1 gap-8 sm:grid-cols-2 lg:grid-cols-3">
{events.map((event, index) => {
const org = organizations[event.organizationId];
const eventUrl = `https://streameth.org/${org.slug}`;

return (
<Link
href={eventUrl}
key={event._id}
href={event.url}
key={index}
target="_blank"
rel="noopener noreferrer"
>
Expand All @@ -37,37 +34,23 @@ const FeaturedEvents: React.FC<FeaturedEventsProps> = ({
>
<CardHeader className="flex-shrink-0 p-0 md:p-0 lg:p-0">
<Image
src={
event.eventCover || 'https://via.placeholder.com/300x200'
}
src={event.cover}
className="aspect-video w-full"
alt={event.name}
width={300}
height={200}
/>
</CardHeader>
<div className="absolute bottom-0">
{/* <div className="absolute bottom-0 bg-black bg-opacity-80 w-full text-white">
<CardContent className="flex flex-grow flex-col p-5">
<CardTitle className="mb-2 line-clamp-2 text-xl font-bold">
{event.name}
</CardTitle>
<CardDescription className="mb-2">
{new Date(event.start).toLocaleDateString()} -{' '}
{new Date(event.end).toLocaleDateString()}
</CardDescription>
<CardDescription className="mb-2">
{event.location}
</CardDescription>
{org && (
<CardDescription className="mb-2">
Organized by: {org.name}
Organized by: {event.organization}
</CardDescription>
)}
<CardDescription className="mt-auto line-clamp-3">
{event.description}
</CardDescription>
</CardContent>
</div>
</div> */}
</Card>
</Link>
);
Expand Down
33 changes: 28 additions & 5 deletions packages/app/app/explore/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,35 @@ import HomePageNavbar from '@/components/Layout/HomePageNavbar';
import { Suspense } from 'react';

const Home = async ({ searchParams }: HomePageProps) => {
const { events, organizations } = await getFeaturedEventsData();
const featuredEvents = [
{
name: 'EthCC [7]',
url: '/ethcc',
cover:
'https://ethcc.io/_next/image?url=%2Farchive%2Fethcc7.jpg&w=640&q=75',
organization: 'Ethereum France',
},
{
name: 'Zuzalu',
url: '/zuzalu',
cover:
'https://streamethapp.ams3.cdn.digitaloceanspaces.com/sessions/zuzalu_montenegro_2023/zuzalu_thumbnail.jpg',
organization: 'Zuzau',
},
{
name: 'Protocol Berg',
url: '/ethberlin',
cover:
'https://pbs.twimg.com/media/Fxn7DwyWAAQwXzx?format=jpg&name=large',
organization: 'Department of Decentralization',
},
];

const pages = [
{
name: 'Home',
href: `/`,
bgColor: 'bg-muted',
name: 'Create event',
href: `https://info.streameth.org/`,
bgColor: 'primary',
},
];
return (
Expand All @@ -28,7 +51,7 @@ const Home = async ({ searchParams }: HomePageProps) => {
<h2 className="text-xl font-medium text-foreground">
Featured events
</h2>
<FeaturedEvents events={events} organizations={organizations} />
<FeaturedEvents events={featuredEvents} />
</section>
<section className="relative">
<h2 className="text-xl font-medium text-foreground">Past sessions</h2>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ const TableCells = async ({
return <ProcessingSkeleton item={item} />;
}

console.log(item);
return (
<>
<TableCell className="relative max-w-[500px] font-medium">
Expand Down
14 changes: 7 additions & 7 deletions packages/app/components/Layout/HomePageNavbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import SwitchOrganization from '@/app/studio/[organization]/components/SwitchOrg
import { IExtendedOrganization } from '@/lib/types';
import { cn } from '@/lib/utils/utils';
import { Button } from '@/components/ui/button';
import { ConnectWalletButton } from '../misc/ConnectWalletButton';
import { usePathname } from 'next/navigation';
import { useAccount } from 'wagmi';

Expand Down Expand Up @@ -132,7 +131,7 @@ const MobileNavBar = ({
)}
</button>
)}
{pages.length > 0 && (
{pages.length > 1 && (
<button onClick={toggleMenu} className="z-50">
{!menuVisible ? (
<Menu size={30} strokeWidth={2} className="" />
Expand All @@ -142,9 +141,10 @@ const MobileNavBar = ({
</button>
)}
</div>
{menuVisible && (
<Navbar organization={currentOrganization} pages={pages} />
)}
{menuVisible ||
(pages.length < 2 && (
<Navbar organization={currentOrganization} pages={pages} />
))}
</div>
</NavigationMenu>
);
Expand Down Expand Up @@ -206,11 +206,11 @@ const PCNavBar = ({
/>
)}
<Navbar organization={currentOrganization} pages={pages} />
{isConnected && (
{/* {isConnected && (
<div className="mr-2">
<ConnectWalletButton />
</div>
)}
)} */}
{isStudio && <SignInUserButton />}
</div>
</NavigationMenu>
Expand Down
48 changes: 25 additions & 23 deletions packages/app/components/Layout/Navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { SignInUserButton } from '../misc/SignInUserButton';
import { Dialog, DialogContent, DialogTrigger } from '../ui/dialog';
import { ConnectWalletButton } from '../misc/ConnectWalletButton';
import { usePathname } from 'next/navigation';
import { Button } from '../ui/button';

export default function Navbar({
setIsNavVisible,
Expand All @@ -28,6 +29,28 @@ export default function Navbar({
return null;
}

if (pages.length < 2) {
return (
<div className="">
<ul
onClick={() => isMobile && setIsNavVisible?.(false)}
className="flex w-full flex-col lg:flex-row lg:space-x-2 lg:px-2"
>
{pages.map((item) => (
<NavigationMenuItem key={item.name}>
<Link href={item.href} legacyBehavior passHref>
<Button variant={item.bgColor} className="">
{item.name}
{/* <div className="ml-2 text-black">{item.icon}</div> */}
</Button>
</Link>
</NavigationMenuItem>
))}
</ul>
</div>
);
}

return (
<div className="absolute right-0 top-[56px] z-50 flex w-screen items-center text-center lg:relative lg:top-[unset] lg:h-full lg:w-[unset] lg:items-center">
<ul
Expand All @@ -37,34 +60,13 @@ export default function Navbar({
{pages.map((item) => (
<NavigationMenuItem key={item.name}>
<Link href={item.href} legacyBehavior passHref>
<NavigationMenuLink
className={navigationMenuTriggerStyle() + ' ' + item.bgColor}
>
<Button variant={item.bgColor} className="">
{item.name}
{/* <div className="ml-2 text-black">{item.icon}</div> */}
</NavigationMenuLink>
</Button>
</Link>
</NavigationMenuItem>
))}
{organization === 'ethprague' && (
<Dialog>
<DialogTrigger>
<NavigationMenuItem
className={`${navigationMenuTriggerStyle()} bg-muted`}
>
Schedule
</NavigationMenuItem>
</DialogTrigger>
<DialogContent className="h-[calc(100vh-54px)] w-[calc(100vw-54px)] p-2 md:h-[800px] md:p-0 lg:min-w-[1000px] xl:min-w-[1250px] 2xl:min-w-[1400px]">
<iframe
src="https://ethprague.com/schedule"
width="100%"
height="100%"
name="myiFrame"
></iframe>
</DialogContent>
</Dialog>
)}
<NavigationMenuItem key={'connect'} className="lg:hidden">
{isStudio && <SignInUserButton className="w-full rounded-none" />}
</NavigationMenuItem>
Expand Down

0 comments on commit 6289c52

Please sign in to comment.