diff --git a/.github/workflows/azure-static-web-apps-witty-grass-02cc39100.yml b/.github/workflows/azure-static-web-apps-witty-grass-02cc39100.yml index 9eb2ac1..ff279eb 100644 --- a/.github/workflows/azure-static-web-apps-witty-grass-02cc39100.yml +++ b/.github/workflows/azure-static-web-apps-witty-grass-02cc39100.yml @@ -12,7 +12,6 @@ on: jobs: build_and_deploy_job: - if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed') runs-on: ubuntu-latest name: Build and Deploy Job steps: diff --git a/components/Cards/FavoritePeople.tsx b/components/Cards/FavoritePeople.tsx index 50cd792..2557d96 100644 --- a/components/Cards/FavoritePeople.tsx +++ b/components/Cards/FavoritePeople.tsx @@ -13,19 +13,24 @@ interface Props { const FavoritePeople: React.FC = ({ className, favPeople }) => { return (
-

Some of your twitter favorites are...

+

+ Some of our favorite beta testers are... +

{favPeople.map((item) => (
-
- user image -
+ {item.profile_image_url ? ( +
+ user image +
+ ) : null} +

{item.name}

@{item.username}

diff --git a/components/DataLayer.tsx b/components/DataLayer.tsx index 4ee9090..375a9db 100644 --- a/components/DataLayer.tsx +++ b/components/DataLayer.tsx @@ -37,27 +37,27 @@ export const DataLayerProvider: React.FC = ({ const router = useRouter(); const [data, setData] = useState(undefined); - useEffect(() => { - const localStorageData = localStorage.getItem("wrapped_data"); + // useEffect(() => { + // const localStorageData = localStorage.getItem("wrapped_data"); - try { - if (localStorageData) { - setData(JSON.parse(localStorageData)); - } - } catch (err) { - // failed to parse data - } - }, []); + // try { + // if (localStorageData) { + // setData(JSON.parse(localStorageData)); + // } + // } catch (err) { + // // failed to parse data + // } + // }, []); - useEffect(() => { - if (data && data.twitterReport && doItOnce.current) { - localStorage.setItem("wrapped_data", JSON.stringify(data)); - router.push("/wrapped"); - doItOnce.current = false; - } else if (data?.error) { - router.push("/error"); - } - }, [data, router]); + // useEffect(() => { + // if (data && data.twitterReport && doItOnce.current) { + // localStorage.setItem("wrapped_data", JSON.stringify(data)); + // router.push("/wrapped"); + // doItOnce.current = false; + // } else if (data?.error) { + // router.push("/error"); + // } + // }, [data, router]); return ( diff --git a/components/TwitterWrappedWrapped.tsx b/components/TwitterWrappedWrapped.tsx new file mode 100644 index 0000000..f898599 --- /dev/null +++ b/components/TwitterWrappedWrapped.tsx @@ -0,0 +1,261 @@ +import { FC, useMemo, useRef } from "react"; +import { UserV2 } from "twitter-api-v2"; +import styles from "../styles/Wrapper.module.scss"; +import BigNumberCard from "./Cards/BigNumberCard"; +import FavoritePeople from "./Cards/FavoritePeople"; +import TextCard from "./Cards/TextCard"; +import Twemoji from "./Twemoji"; + +const ParaTextWithEmoji = ({ + text, + emoji, +}: { + text: string; + emoji: string; +}) => { + return ( +

+ {text} + + + +

+ ); +}; + +const favPeople: UserV2[] = [ + { + id: "nitro", + name: "Nirupama Singh", + username: "nitropumaa", + }, + { + id: "adi", + name: "Aditya Oberai", + username: "adityaoberai1", + }, + { + id: "raghav", + name: "Raghav Agarwal", + username: "raghav1687", + }, + { + id: "ranjit", + name: "Ranjit", + username: "ranjitzade", + }, + { + id: "harsh", + name: "Harsh Suryan", + username: "hksuryan", + }, + { + id: "mitra", + name: "Haimantika Mitra", + username: "HaimantikaM", + }, + { + id: "Shlokzz", + name: "Shloka", + username: "shlokasspam", + }, +]; + +const favPeople2: UserV2[] = [ + { + id: "darshan", + name: "Darshan", + username: "SirusTweets", + }, + { + id: "Shrankhla", + name: "Shrankhla Srivastava", + username: "shrankhla3", + }, + { + id: "sree", + name: "Sreekaran", + username: "skxrxn", + }, + { + id: "otc", + name: "Our Tech Community", + username: "OurTechComm", + }, +]; + +const TwitterWrappedWrapped: FC = () => { + // TODO: remove swipe gesture, make it tap gesture instead + // TODO: add instagram story sort of indicator + + const array = useMemo( + () => [ + , + ]} + />, + , + ]} + />, + + ), + }, + ]} + />, + + ), + }, + ]} + />, + + ), + }, + ]} + />, + 150K", + text: ( + + ), + }, + ]} + />, + + ), + }, + ]} + />, + 10,000,000", + text: ( + + ), + }, + ]} + />, + , + ]} + />, + , + , + , + ]} + />, + ], + [] + ); + + return ( + <> +
+
{array}
+
+
+

keep swiping to continue...

+
+
+ crafted with ❤️ by{" "} + @0xSaurabh +
+ + ); +}; + +export default TwitterWrappedWrapped; diff --git a/pages/error.tsx b/pages/error.tsx index ab95015..fa9f883 100644 --- a/pages/error.tsx +++ b/pages/error.tsx @@ -1,3 +1,4 @@ +import { GetServerSideProps } from "next"; import Head from "next/head"; import ErrorScreen from "../components/ErrorScreen"; @@ -12,4 +13,8 @@ const ErrorView = () => { ); }; +export const getServerSideProps: GetServerSideProps = async () => { + return { redirect: { destination: "/", permanent: true } }; +}; + export default ErrorView; diff --git a/pages/index.tsx b/pages/index.tsx index 359e1ce..00e7ccd 100644 --- a/pages/index.tsx +++ b/pages/index.tsx @@ -1,50 +1,73 @@ -import type { NextPage } from "next"; +// import type { NextPage } from "next"; +// import Head from "next/head"; +// import Image from "next/image"; +// import Link from "next/link"; + +// import styles from "../styles/Home.module.scss"; +// import logoStyles from "../styles/Logo.module.scss"; +// import TwitterLogo from "../assets/svg/twitter_white.svg"; +// import TwitterWrappedWrapped from "../components/TwitterWrappedWrapped"; + +// const Home: NextPage = () => { +// return ( +//
+// +// Twitter Wrapped +// +// + +//
+//
+//

Twitter

+//

Wrapped

+//
+ +// +// +// +//
+// crafted with ❤️ by{" "} +// +// @0xSaurabh +// +//
+//
+//
+// ); +// }; + +// export default Home; + import Head from "next/head"; -import Image from "next/image"; -import Link from "next/link"; +import { NextPage } from "next"; -import styles from "../styles/Home.module.scss"; -import logoStyles from "../styles/Logo.module.scss"; -import TwitterLogo from "../assets/svg/twitter_white.svg"; +import styles from "../styles/Wrapped.module.scss"; +import useDataLayer from "../components/DataLayer"; +import TwitterWrappedWrapped from "../components/TwitterWrappedWrapped"; const Home: NextPage = () => { return (
- Twitter Wrapped - + Your Wrapped -
-
-

Twitter

-

Wrapped

-
- - - - -
- crafted with ❤️ by{" "} - - @0xSaurabh - -
+
); diff --git a/pages/loading.tsx b/pages/loading.tsx index 5b2c616..0c117ff 100644 --- a/pages/loading.tsx +++ b/pages/loading.tsx @@ -13,30 +13,30 @@ interface PropType { authCode?: string; } -async function getWrapped(authCode: string) { - const res = await fetch(url + "/api/wrapped", { - method: "POST", - body: JSON.stringify({ authCode }), - }); - const data = await res.json(); - - return data; -} +// async function getWrapped(authCode: string) { +// const res = await fetch(url + "/api/wrapped", { +// method: "POST", +// body: JSON.stringify({ authCode }), +// }); +// const data = await res.json(); + +// return data; +// } const Wrapped: NextPage = (props: PropType) => { const [_, setData] = useDataLayer(); - useEffect(() => { - if (props.authCode) { - getWrapped(props.authCode) - .then((data) => { - setData({ twitterReport: data }); - }) - .catch((err) => setData({ error: err })); - } else { - window.location.href = createTwitterOAuthLink(); - } - }, [props.authCode, setData]); + // useEffect(() => { + // if (props.authCode) { + // getWrapped(props.authCode) + // .then((data) => { + // setData({ twitterReport: data }); + // }) + // .catch((err) => setData({ error: err })); + // } else { + // window.location.href = createTwitterOAuthLink(); + // } + // }, [props.authCode, setData]); return (
@@ -51,11 +51,13 @@ const Wrapped: NextPage = (props: PropType) => { export const getServerSideProps: GetServerSideProps = async ( ctx: GetServerSidePropsContext ) => { - if (typeof ctx.query.code === "string") { - return { props: { authCode: ctx.query.code } }; - } + return { redirect: { destination: "/", permanent: true } }; + + // if (typeof ctx.query.code === "string") { + // return { props: { authCode: ctx.query.code } }; + // } - return { props: {} }; + // return { props: {} }; }; export default Wrapped; diff --git a/pages/wrapped.tsx b/pages/wrapped.tsx index df85836..b9d54dc 100644 --- a/pages/wrapped.tsx +++ b/pages/wrapped.tsx @@ -5,6 +5,7 @@ import Wrapper from "../components/Wrapper"; import styles from "../styles/Wrapped.module.scss"; import useDataLayer from "../components/DataLayer"; import ErrorScreen from "../components/ErrorScreen"; +import TwitterWrappedWrapped from "../components/TwitterWrappedWrapped"; const Wrapped: NextPage = () => { const [data] = useDataLayer(); @@ -20,9 +21,14 @@ const Wrapped: NextPage = () => { ) : ( )} +
); }; +export const getServerSideProps: GetServerSideProps = async () => { + return { redirect: { destination: "/", permanent: true } }; +}; + export default Wrapped; diff --git a/styles/Cards/FavoritePeople.module.scss b/styles/Cards/FavoritePeople.module.scss index afc3705..a62a483 100644 --- a/styles/Cards/FavoritePeople.module.scss +++ b/styles/Cards/FavoritePeople.module.scss @@ -5,7 +5,8 @@ h1 { font-size: 1.25rem !important; - text-align: center !important; + // text-align: center !important; + margin: 0 1rem; padding-bottom: 2rem; }