-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Clicking on reply should scroll to the original message
- Loading branch information
Showing
99 changed files
with
6,959 additions
and
75 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
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
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
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
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,3 @@ | ||
# @holium/onboarding | ||
|
||
The onboarding flow at https://hosted.holium.com. |
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 @@ | ||
/// <reference types="next" /> | ||
/// <reference types="next/image-types/global" /> | ||
|
||
// NOTE: This file should not be edited | ||
// see https://nextjs.org/docs/basic-features/typescript for more information. |
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,18 @@ | ||
/** @type {import('next').NextConfig} */ | ||
const withPreconstruct = require('@preconstruct/next'); | ||
|
||
const nextConfig = { | ||
compiler: { | ||
styledComponents: true, | ||
}, | ||
reactStrictMode: true, | ||
publicRuntimeConfig: { | ||
API_URL: process.env.API_URL, | ||
API_HEADERS_VERSION: process.env.API_HEADERS_VERSION, | ||
API_HEADERS_CLIENT_ID: process.env.API_HEADERS_CLIENT_ID, | ||
STRIPE_KEY: process.env.STRIPE_KEY, | ||
AMPLITUDE_API_KEY: process.env.AMPLITUDE_API_KEY, | ||
}, | ||
}; | ||
|
||
module.exports = withPreconstruct(nextConfig); |
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,25 @@ | ||
{ | ||
"name": "@holium/onboarding", | ||
"version": "0.1.0", | ||
"private": true, | ||
"scripts": { | ||
"dev": "next dev", | ||
"build": "next build", | ||
"start": "next start", | ||
"lint": "next lint" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "^18.15.3", | ||
"@types/react": "^18.0.28", | ||
"@types/react-dom": "^18.0.11", | ||
"@preconstruct/next": "^4.0.0" | ||
}, | ||
"dependencies": { | ||
"@amplitude/analytics-browser": "^1.9.1", | ||
"@stripe/react-stripe-js": "^2.1.0", | ||
"@stripe/stripe-js": "^1.51.0", | ||
"next": "^13.2.4", | ||
"react": "^18.0.0", | ||
"react-dom": "^18.0.0" | ||
} | ||
} |
Binary file not shown.
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,67 @@ | ||
import { useEffect, ReactNode } from 'react'; | ||
import { track } from '@amplitude/analytics-browser'; | ||
import NextHead from 'next/head'; | ||
import { Rubik } from 'next/font/google'; | ||
import styled from 'styled-components'; | ||
import { useToggle } from '@holium/design-system'; | ||
import { api } from '../util/api'; | ||
import { useNavigation } from '../util/useNavigation'; | ||
|
||
const Main = styled.main` | ||
width: 100%; | ||
height: 100vh; | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
`; | ||
|
||
const rubik = Rubik({ subsets: ['latin'], weight: 'variable' }); | ||
|
||
type Props = { | ||
title: string; | ||
isProtected?: boolean; | ||
children: ReactNode; | ||
}; | ||
|
||
export const Page = ({ title, isProtected = false, children }: Props) => { | ||
const { goToPage, logout } = useNavigation(); | ||
const authenticated = useToggle(false); | ||
|
||
useEffect(() => { | ||
track(title); | ||
}); | ||
|
||
useEffect(() => { | ||
if (!isProtected) return; | ||
|
||
const refreshAndStoreToken = async (token: string) => { | ||
try { | ||
const response = await api.refreshToken(token); | ||
localStorage.setItem('token', response.token); | ||
authenticated.toggleOn(); | ||
} catch (error) { | ||
console.error(error); | ||
logout(); | ||
} | ||
}; | ||
|
||
const token = localStorage.getItem('token'); | ||
|
||
if (!token) goToPage('/'); | ||
else refreshAndStoreToken(token); | ||
}, [isProtected]); | ||
|
||
return ( | ||
<> | ||
<NextHead> | ||
<title>{title}</title> | ||
<meta name="description" content="Get on the Holium network." /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1" /> | ||
<link rel="icon" href="/favicon.ico" /> | ||
</NextHead> | ||
<Main className={rubik.className}> | ||
{isProtected ? (authenticated.isOn ? children : null) : children} | ||
</Main> | ||
</> | ||
); | ||
}; |
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 type { AppProps } from 'next/app'; | ||
import * as Amplitude from '@amplitude/analytics-browser'; | ||
import { constants } from '../util/constants'; | ||
import '../style/app.css'; | ||
|
||
Amplitude.init(constants.AMPLITUDE_API_KEY, undefined, { | ||
trackingOptions: { | ||
ipAddress: false, | ||
}, | ||
}); | ||
|
||
export default function App({ Component, pageProps }: AppProps) { | ||
return <Component {...pageProps} />; | ||
} |
Oops, something went wrong.