diff --git a/src/components/Card/CardEvent.tsx b/src/components/Card/CardEvent.tsx index 252c013f..2c1ada2a 100644 --- a/src/components/Card/CardEvent.tsx +++ b/src/components/Card/CardEvent.tsx @@ -31,6 +31,7 @@ const _CardEvent = ({ event }: CardEventProps) => { imageUrl, location, availabilities, + thumbnailMedia, } = event const [now, setNow] = useState(new Date()) const dateStartAt = useMemo(() => new Date(startsAt), [startsAt]) @@ -48,6 +49,7 @@ const _CardEvent = ({ event }: CardEventProps) => { ) }) }, [dateStartAt, event, id]) + const eventTimeStatus = useMemo<"upcoming" | "ongoing" | "past">(() => { const isLive = now > dateStartAt if (!isLive) return "upcoming" @@ -55,14 +57,18 @@ const _CardEvent = ({ event }: CardEventProps) => { if (isPast) return "past" return "ongoing" }, [dateStartAt, endsAt, now]) + const styleBackground = { - backgroundImage: `linear-gradient(rgba(0, 0, 0, 0.54), rgba(0, 0, 0, 0.54)), url(${imageUrl})`, + backgroundImage: `linear-gradient(rgba(0, 0, 0, 0.54), rgba(0, 0, 0, 0.54)), url(${ + thumbnailMedia?.url || imageUrl + })`, } const availabilitiesStr = useMemo(() => { return availabilities .map((availability) => availabilityLabels[availability]) .join(" and ") }, [availabilities]) + return (
diff --git a/src/containers/Homepage/HomeFeaturedEvent.module.scss b/src/containers/Homepage/HomeFeaturedEvent.module.scss new file mode 100644 index 00000000..ae01a18d --- /dev/null +++ b/src/containers/Homepage/HomeFeaturedEvent.module.scss @@ -0,0 +1,11 @@ +.root { + display: block; + width: 100%; + height: 30vh; + + img { + width: 100%; + height: 100%; + object-fit: cover; + } +} \ No newline at end of file diff --git a/src/containers/Homepage/HomeFeaturedEvent.tsx b/src/containers/Homepage/HomeFeaturedEvent.tsx new file mode 100644 index 00000000..85709f66 --- /dev/null +++ b/src/containers/Homepage/HomeFeaturedEvent.tsx @@ -0,0 +1,18 @@ +import { LiveMintingEvent } from "types/entities/LiveMinting" +import style from "./HomeFeaturedEvent.module.scss" +import cs from "classnames" +import Link from "next/link" + +interface Props { + event: LiveMintingEvent +} +export function HomeFeaturedEvent({ event }: Props) { + console.log(event) + return ( + + + {`${event.name} + + + ) +} diff --git a/src/containers/Homepage/Homepage.tsx b/src/containers/Homepage/Homepage.tsx index 98674622..6e26828a 100644 --- a/src/containers/Homepage/Homepage.tsx +++ b/src/containers/Homepage/Homepage.tsx @@ -9,6 +9,7 @@ import { NFTArticle } from "../../types/entities/Article" import { LiveMintingEvent } from "../../types/entities/LiveMinting" import { HomeEvents } from "./HomeEvents" import { HomeIncoming } from "./HomeIncoming" +import { HomeFeaturedEvent } from "./HomeFeaturedEvent" interface HomepageProps { generativeTokens: GenerativeToken[] @@ -16,6 +17,7 @@ interface HomepageProps { randomGenerativeToken: GenerativeToken | null articles: NFTArticle[] events: LiveMintingEvent[] + featuredEvent: LiveMintingEvent | null } const _Homepage = ({ @@ -24,6 +26,7 @@ const _Homepage = ({ randomGenerativeToken, articles, events, + featuredEvent, }: HomepageProps) => { return (
@@ -31,6 +34,7 @@ const _Homepage = ({ articles={articles} randomGenerativeToken={randomGenerativeToken} /> + {featuredEvent && } {events.length > 0 && } {incomingTokens.length > 0 && ( diff --git a/src/pages/events/[id]/onboarding.module.scss b/src/pages/events/[id]/onboarding.module.scss index ebcc93a8..cfc8baef 100644 --- a/src/pages/events/[id]/onboarding.module.scss +++ b/src/pages/events/[id]/onboarding.module.scss @@ -10,3 +10,23 @@ max-width: 800px; margin: auto; } + +.header { + display: block; + width: 1000px; + margin: 0 auto; + max-width: 100%; + + img { + width: 100%; + } +} + +.h1 { + font-family: "Source Serif Pro", serif; + font-size: 2.35rem; + width: 800px; + margin: 0 auto; + margin-top: 2.2em; + max-width: 100%; +} \ No newline at end of file diff --git a/src/pages/events/[id]/onboarding.tsx b/src/pages/events/[id]/onboarding.tsx index c84affc9..f33fc5d6 100644 --- a/src/pages/events/[id]/onboarding.tsx +++ b/src/pages/events/[id]/onboarding.tsx @@ -54,6 +54,15 @@ const EventsOnboardingPage: NextPage = ({ event, tokens }) => {
+ +
+ {event.headerMedia && ( + {`${event.name} + )} +
+ +

{event.name}

+ = ({ @@ -38,6 +42,7 @@ const Home: NextPage = ({ incomingTokens, articles, events, + featuredEvent, }) => { return ( <> @@ -65,8 +70,10 @@ const Home: NextPage = ({ content="https://www.fxhash.xyz/images/og/og1.jpg" /> + ({ query: gql` ${Frag_EventCard} @@ -98,6 +106,19 @@ export async function getServerSideProps() { id ...EventCard } + featured(where: { id: 1 }) { + id + event { + id + name + headerMedia { + ...MediaDetails + } + thumbnailMedia { + ...MediaDetails + } + } + } } `, variables: { @@ -173,6 +194,7 @@ export async function getServerSideProps() { incomingTokens: data.incomingTokens, articles: data.articles, events: dataEvent.events || [], + featuredEvent: dataEvent.featured?.event, }, } } diff --git a/src/queries/events/events.ts b/src/queries/events/events.ts index 05a78b1a..92925b2d 100644 --- a/src/queries/events/events.ts +++ b/src/queries/events/events.ts @@ -1,6 +1,9 @@ import { gql } from "@apollo/client" +import { Frag_EventMedia } from "queries/fragments/media" export const Qu_event = gql` + ${Frag_EventMedia} + query Event($where: EventWhereUniqueInput!) { event(where: $where) { id @@ -12,11 +15,19 @@ export const Qu_event = gql` endsAt projectIds freeLiveMinting + thumbnailMedia { + ...MediaDetails + } + headerMedia { + ...MediaDetails + } } } ` export const Qu_eventDetails = gql` + ${Frag_EventMedia} + query EventDetails($where: EventWhereUniqueInput!) { event(where: $where) { id @@ -27,6 +38,12 @@ export const Qu_eventDetails = gql` startsAt endsAt projectIds + thumbnailMedia { + ...MediaDetails + } + headerMedia { + ...MediaDetails + } onboarding { id enabled diff --git a/src/queries/events/featured.ts b/src/queries/events/featured.ts new file mode 100644 index 00000000..5065880f --- /dev/null +++ b/src/queries/events/featured.ts @@ -0,0 +1,22 @@ +import { gql } from "@apollo/client" +import { Frag_EventMedia } from "queries/fragments/media" + +export const getFeaturedQuery = gql` + ${Frag_EventMedia} + + query GetFeatured { + featured(where: { id: 1 }) { + id + event { + id + name + headerMedia { + ...MediaDetails + } + thumbnailMedia { + ...MediaDetails + } + } + } + } +` diff --git a/src/queries/events/redeemable.ts b/src/queries/events/redeemable.ts index 8518c7bd..828c2117 100644 --- a/src/queries/events/redeemable.ts +++ b/src/queries/events/redeemable.ts @@ -1,4 +1,5 @@ import { gql } from "@apollo/client" +import { Frag_EventMedia } from "queries/fragments/media" export const Frag_RedeemableBaseDetails = gql` fragment RedeemableBaseDetails on Consumable { @@ -19,6 +20,7 @@ export const Qu_redeemableBase = gql` export const Qu_redeemableDetails = gql` ${Frag_RedeemableBaseDetails} + ${Frag_EventMedia} query Consumables($where: ConsumableWhereInput) { consumables(where: $where) { @@ -37,9 +39,7 @@ export const Qu_redeemableDetails = gql` medias { index media { - s3key - name - url + ...MediaDetails } } } diff --git a/src/queries/fragments/event.ts b/src/queries/fragments/event.ts index 6610c5b4..aa3994bf 100644 --- a/src/queries/fragments/event.ts +++ b/src/queries/fragments/event.ts @@ -1,6 +1,9 @@ import { gql } from "@apollo/client" +import { Frag_EventMedia } from "./media" export const Frag_EventCard = gql` + ${Frag_EventMedia} + fragment EventCard on Event { id name @@ -11,5 +14,11 @@ export const Frag_EventCard = gql` imageUrl availabilities description + thumbnailMedia { + ...MediaDetails + } + headerMedia { + ...MediaDetails + } } ` diff --git a/src/queries/fragments/media.ts b/src/queries/fragments/media.ts index 46e27e20..9f98e6b9 100644 --- a/src/queries/fragments/media.ts +++ b/src/queries/fragments/media.ts @@ -11,3 +11,11 @@ export const Frag_MediaImage = gql` processed } ` + +export const Frag_EventMedia = gql` + fragment MediaDetails on Media { + s3key + url + name + } +` diff --git a/src/types/entities/LiveMinting.ts b/src/types/entities/LiveMinting.ts index 3a204995..166953cf 100644 --- a/src/types/entities/LiveMinting.ts +++ b/src/types/entities/LiveMinting.ts @@ -1,3 +1,4 @@ +import { EventMedia } from "./EventMedia" import { User } from "./User" export enum EventStatus { @@ -26,10 +27,16 @@ export interface LiveMintingEvent { availabilities: EventAvailability[] status: EventStatus freeLiveMinting: boolean + thumbnailMedia?: EventMedia | null + headerMedia?: EventMedia | null } export type LiveMintingEventWithArtists = LiveMintingEvent & { artists: User[] } +export interface DashboardFeatured { + event: LiveMintingEvent | null +} + export interface LiveMintingPassGroup { address: string label: string