Skip to content

Commit

Permalink
feat: Events page + analytics events
Browse files Browse the repository at this point in the history
  • Loading branch information
netpoe committed Jun 14, 2024
1 parent fd5e420 commit fd617aa
Show file tree
Hide file tree
Showing 17 changed files with 319 additions and 16 deletions.
6 changes: 6 additions & 0 deletions app/src/hooks/useRoutes/useRoutes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ export const routes = {
x2y2: () => `https://x2y2.io/collection/larskristo-hellheadz/items`,
looksrare: () => `https://looksrare.org/collections/0x853bdaa30Cfd5A2Ec1E1d75935eBca7A0E52626D`,
},
socials: {
discord: `https://discord.gg/y3GWNkRh`,
},
oauth: {
discord: {
lkhh: () => `${origin}/oauth/discord/lkhh`,
Expand All @@ -20,6 +23,9 @@ export const routes = {
index: () => `/artists`,
larskristo: () => `/artists/larskristo`,
},
events: {
index: () => `/events`,
},
api: {
discord: {
verifyOwnership: () => `/api/discord/verify-ownership`,
Expand Down
36 changes: 36 additions & 0 deletions app/src/pages/events/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import { GetServerSidePropsContext, NextPage } from "next";
import { i18n, useTranslation } from "next-i18next";
import { serverSideTranslations } from "next-i18next/serverSideTranslations";
import Head from "next/head";

import { HomeLayout } from "layouts/home-layout/HomeLayout";
import { Events } from "ui/svpervnder/events/Events";

const Index: NextPage = () => {
const { t } = useTranslation("head");

return (
<HomeLayout>
<Head>
<title>{t("head.og.title")}</title>
<meta name="description" content={t("head.og.description")} />
<meta property="og:title" content={t("head.og.title")} />
<meta property="og:description" content={t("head.og.description")} />
</Head>

<Events />
</HomeLayout>
);
};

export const getServerSideProps = async ({ locale }: GetServerSidePropsContext) => {
await i18n?.reloadResources();

return {
props: {
...(await serverSideTranslations(locale!, ["common", "head", "chat", "prompt-wars"])),
},
};
};

export default Index;
14 changes: 14 additions & 0 deletions app/src/providers/analytics/events.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,21 @@
export const EventTracking = {
click: {
events: {
discord_button: `click.events.discord_button`,
},
navbar: {
wallet_selector: `click.navbar.wallet_selector`,
},
footer: {
navigation: `click.footer.navigation`,
socials: `click.footer.socials`,
},
homepage: {
collection_item: `click.homepage.collection_item`,
collection_discord_card_button: `click.homepage.collection_discord_card_button`,
faqs_discord_button: `click.homepage.faqs_discord_button`,
faqs_accordion_trigger: `click.homepage.faqs_accordion_trigger`,
marketplaces_button: `click.homepage.marketplaces_button`,
},
},
};
9 changes: 8 additions & 1 deletion app/src/ui/accordion/Accordion.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,29 @@ import clsx from "clsx";
import { useEffect, useState } from "react";

import { Icon } from "ui/icon/Icon";
import { useAnalyticsContext } from "context/analytics/useAnalyticsContext";

import { AccordionContentProps, AccordionHeaderProps, AccordionProps } from "./Accordion.types";
import styles from "./Accordion.module.scss";

export const Accordion: React.FC<AccordionProps> & {
Header: React.FC<AccordionHeaderProps>;
Content: React.FC<AccordionContentProps>;
} = ({ className, accordionHeader, accordionContent, isDefaultExpanded }) => {
} = ({ className, accordionHeader, accordionContent, isDefaultExpanded, analyticsEvent }) => {
const [isExpanded, setIsExpanded] = useState(false);

const AnalyticsContext = useAnalyticsContext();

useEffect(() => {
setIsExpanded(!!isDefaultExpanded);
}, [isDefaultExpanded]);

const onClickHeaderTrigger = () => {
setIsExpanded(!isExpanded);

if (analyticsEvent?.name) {
AnalyticsContext.onClick(analyticsEvent);
}
};

return (
Expand Down
3 changes: 3 additions & 0 deletions app/src/ui/accordion/Accordion.types.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import { HTMLAttributes, ReactNode } from "react";

import { AnalyticsEvent } from "context/analytics/AnalyticsContext.types";

export type AccordionProps = HTMLAttributes<HTMLDivElement> & {
accordionHeader: ReactNode;
accordionContent: ReactNode;
analyticsEvent?: AnalyticsEvent;
isDefaultExpanded?: boolean;
className?: string;
};
Expand Down
17 changes: 9 additions & 8 deletions app/src/ui/button/Button.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ $HALF_LOADER_SIZE: 15px;
.button {
@extend .button-primary;
display: inline-block;
width: fit-content;
min-width: auto;
line-height: 0;
white-space: nowrap;
Expand Down Expand Up @@ -159,7 +160,7 @@ $HALF_LOADER_SIZE: 15px;
&:hover,
&:active,
&:focus {
background: rgba(var(--color-status-success), 0.9);
background: rgb(var(--color-status-success) 0.9);
}
}

Expand All @@ -174,7 +175,7 @@ $HALF_LOADER_SIZE: 15px;
&:hover,
&:active,
&:focus {
background: rgba(var(--color-status-info), 0.9);
background: rgb(var(--color-status-info) 0.9);
}
}

Expand All @@ -185,7 +186,7 @@ $HALF_LOADER_SIZE: 15px;
&:hover,
&:active,
&:focus {
background: rgba(var(--color-status-critical), 0.9);
background: rgb(var(--color-status-critical) 0.9);
}
}

Expand All @@ -208,7 +209,7 @@ $HALF_LOADER_SIZE: 15px;
&:hover,
&:active,
&:focus {
background: rgba(var(--color-dark-5), 0.9);
background: rgb(var(--color-dark-5) 0.9);
}
}

Expand Down Expand Up @@ -493,12 +494,12 @@ $HALF_LOADER_SIZE: 15px;
}

&--glass {
border: 1px solid rgba(48, 66, 213, 0.3);
border: 1px solid rgb(48 66 213 / 30%);
border-radius: 16px;

/* From https://css.glass */
background: rgba(83, 86, 252, 0.2);
box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
-webkit-backdrop-filter: blur(5px);
background: rgb(83 86 252 / 20%);
box-shadow: 0 4px 30px rgb(0 0 0 / 10%);
backdrop-filter: blur(5px);
}

Expand Down
7 changes: 6 additions & 1 deletion app/src/ui/footer/Footer.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
border-top: 1px solid var(--color-background-contrast);
background-color: var(--color-background);

&__bottom {
margin-top: $space-default;
}

&__socials {
display: flex;

Expand Down Expand Up @@ -48,6 +52,7 @@
&__right,
&__center {
display: flex;
flex-wrap: wrap;

&--item {
@include atLargeTablet {
Expand All @@ -57,7 +62,7 @@
display: flex;
flex-direction: column;
justify-content: center;
min-height: $footer-height-mobile;
min-height: auto;
padding: $space-default 0;

&-flat {
Expand Down
1 change: 1 addition & 0 deletions app/src/ui/footer/Footer.module.scss.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export type Styles = {
footer: string;
footer__bottom: string;
footer__center: string;
"footer__center--item": string;
"footer__center--item-flat": string;
Expand Down
70 changes: 64 additions & 6 deletions app/src/ui/footer/Footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,20 @@ import { Icon } from "ui/icon/Icon";
import { Button } from "ui/button/Button";
import evm from "providers/evm";
import { ERC721Instance } from "providers/evm/ERC721Instance";
import { useAnalyticsContext } from "context/analytics/useAnalyticsContext";
import analytics from "providers/analytics";
import { AnalyticsEvent } from "context/analytics/AnalyticsContext.types";

import { FooterProps } from "./Footer.types";
import styles from "./Footer.module.scss";

export const Footer: React.FC<FooterProps> = ({ className }) => {
const routes = useRoutes();
const AnalyticsContext = useAnalyticsContext();

const onClick = (event: AnalyticsEvent) => {
AnalyticsContext.onClick(event);
};

return (
<footer className={clsx(styles.footer, className)}>
Expand All @@ -23,22 +31,66 @@ export const Footer: React.FC<FooterProps> = ({ className }) => {
<Grid.Col lg={6} sm={6} xs={6}>
<div className={styles.footer__left}>
<div className={styles["footer__left--item"]}>
<Typography.Link flat href={`${routes.home()}#collection`}>
<Typography.Link
flat
href={`${routes.home()}#collection`}
onClick={() =>
onClick({
name: analytics.EventTracking.click.footer.navigation,
meta: {
item: "collection",
},
})
}
>
Collection
</Typography.Link>
</div>
<div className={styles["footer__left--item"]}>
<Typography.Link flat href={`${routes.home()}#faqs`}>
<Typography.Link
flat
href={`${routes.home()}#faqs`}
onClick={() =>
onClick({
name: analytics.EventTracking.click.footer.navigation,
meta: {
item: "faqs",
},
})
}
>
FAQs
</Typography.Link>
</div>
<div className={styles["footer__left--item"]}>
<Typography.Link flat href="#">
<Typography.Link
flat
href={routes.events.index()}
onClick={() =>
onClick({
name: analytics.EventTracking.click.footer.navigation,
meta: {
item: "events",
},
})
}
>
Events
</Typography.Link>
</div>
<div className={styles["footer__left--item"]}>
<Typography.Link flat href={routes.artists.larskristo()}>
<Typography.Link
flat
href={routes.artists.larskristo()}
onClick={() =>
onClick({
name: analytics.EventTracking.click.footer.navigation,
meta: {
item: "about",
},
})
}
>
About
</Typography.Link>
</div>
Expand All @@ -55,15 +107,18 @@ export const Footer: React.FC<FooterProps> = ({ className }) => {
</Grid.Col>
</Grid.Row>
</Grid.Container>
<Grid.Container>
<Grid.Container className={clsx(styles.footer__bottom)}>
<Grid.Row>
<Grid.Col lg={6} sm={6} xs={6}>
<div className={clsx(styles.footer__left, styles.footer__socials)}>
<div className={styles["footer__socials--links"]}>
<Typography.Link
className={clsx(styles["footer__socials--link"])}
href="https://discord.gg/xZuhTDTef3"
href={routes.socials.discord}
target="_blank"
onClick={() =>
onClick({ name: analytics.EventTracking.click.footer.socials, meta: { item: "discord" } })
}
>
<Icon name="icon-discord" />
</Typography.Link>
Expand All @@ -75,6 +130,9 @@ export const Footer: React.FC<FooterProps> = ({ className }) => {
href={`${evm.getBlockExplorerUrl()}/token/${ERC721Instance.defaultContractAddress}`}
target="_blank"
leftIcon={<EtherscanIcon className={styles["footer__socials--etherscan-icon"]} />}
onClick={() =>
onClick({ name: analytics.EventTracking.click.footer.socials, meta: { item: "etherscan" } })
}
>
LK💀💀
</Button>
Expand Down
Loading

0 comments on commit fd617aa

Please sign in to comment.