-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from aufacicenta/hellheadz
feat: batch 44 - 66
- Loading branch information
Showing
34 changed files
with
1,277 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { createContext } from "react"; | ||
|
||
import { AnalyticsContextType } from "./AnalyticsContext.types"; | ||
|
||
export const AnalyticsContext = createContext<AnalyticsContextType | undefined>(undefined); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { ReactNode } from "react"; | ||
|
||
export type AnalyticsContextControllerProps = { | ||
children: ReactNode; | ||
}; | ||
|
||
export type AnalyticsEvent = { | ||
name: string; | ||
meta?: Record<string, string | number | undefined>; | ||
}; | ||
|
||
export type AnalyticsContextType = { | ||
onClick: (event: AnalyticsEvent) => void; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* eslint-disable @typescript-eslint/no-explicit-any */ | ||
import React from "react"; | ||
|
||
import { AnalyticsContext } from "./AnalyticsContext"; | ||
import { AnalyticsContextControllerProps, AnalyticsContextType, AnalyticsEvent } from "./AnalyticsContext.types"; | ||
|
||
const onClick = (event: AnalyticsEvent) => { | ||
(window as any) | ||
.pirsch(event.name, { | ||
meta: event.meta, | ||
}) | ||
.then(() => { | ||
console.log(`AnalyticsContextController.onClick: ${event.name}, ${JSON.stringify(event.meta)}`); | ||
}) | ||
.catch((error: Error) => { | ||
console.error(error); | ||
}); | ||
}; | ||
|
||
export const AnalyticsContextController = ({ children }: AnalyticsContextControllerProps) => { | ||
const props: AnalyticsContextType = { | ||
onClick, | ||
}; | ||
|
||
return <AnalyticsContext.Provider value={props}>{children}</AnalyticsContext.Provider>; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { useContext } from "react"; | ||
|
||
import { AnalyticsContext } from "./AnalyticsContext"; | ||
|
||
export const useAnalyticsContext = () => { | ||
const context = useContext(AnalyticsContext); | ||
|
||
if (context === undefined) { | ||
throw new Error("useAnalyticsContext must be used within a AnalyticsContext"); | ||
} | ||
|
||
return context; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { NextApiRequest, NextApiResponse } from "next"; | ||
|
||
import logger from "providers/logger"; | ||
import discord from "providers/discord"; | ||
import metadataBatch0_21 from "providers/svpervnder/hellheadz/metadata-batch-0-21.json"; | ||
|
||
export default async function Fn(_request: NextApiRequest, response: NextApiResponse) { | ||
try { | ||
logger.info(`api.discord.create-forum-channel-message`); | ||
|
||
const discordClient = new discord.DiscordBotClient(); | ||
|
||
// const getChannel = await discordClient.getChannel({ | ||
// channelId: "1242289603906502686", | ||
// }); | ||
|
||
// logger.info(`api.discord.create-forum-channel-message: getChannel: ${getChannel}`); | ||
|
||
metadataBatch0_21.map(async (token) => { | ||
const createForumThread = await discordClient.createForumThread({ | ||
channelId: "1242289603906502686", | ||
name: `${token.name}`, | ||
content: `Decide on the future of ${token.name}`, | ||
applied_tags: ["1242290625106415646"], | ||
}); | ||
|
||
logger.info(`api.discord.create-forum-channel-message: createForumThread: ${JSON.stringify(createForumThread)}`); | ||
}); | ||
|
||
response.json({ success: true }); | ||
} catch (error) { | ||
logger.error(error); | ||
|
||
response.status(500).json({ | ||
error: (error as Error).message, | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +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`, | ||
}, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { EventTracking } from "./events"; | ||
|
||
export default { | ||
EventTracking, | ||
}; |
File renamed without changes.
Oops, something went wrong.