Skip to content

Commit

Permalink
Initial version 1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jm42 committed May 8, 2023
1 parent 79e9092 commit 496cd19
Show file tree
Hide file tree
Showing 148 changed files with 17,752 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .env.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Configure CRA
PORT=3033

# Infura is used as ENS provider to resolve domains and reverse addresses
REACT_APP_INFURA_API_KEY=

# Request API access and include POAP API key
# https://documentation.poap.tech/docs/api-access
REACT_APP_POAP_API_KEY=
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/build/
/node_modules/
/.env
1 change: 1 addition & 0 deletions CONTRIBUTORS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Juan <[email protected]>
57 changes: 57 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{
"name": "@poap-xyz/poap-family",
"version": "1.0.0",
"author": {
"name": "POAP",
"url": "https://poap.xyz"
},
"license": "MIT",
"homepage": "https://poap.family",
"bugs": {
"url": "https://github.com/poap-xyz/poap-family/issues"
},
"repository": {
"type": "git",
"url": "[email protected]:poap-xyz/poap-family.git"
},
"dependencies": {
"@datapunt/matomo-tracker-react": "^0.5.1",
"@ethersproject/address": "^5.7.0",
"@ethersproject/contracts": "^5.7.0",
"@ethersproject/providers": "^5.7.2",
"@mapbox/to-color": "^2.0.0",
"axios": "^1.4.0",
"dayjs": "^1.11.7",
"downloadjs": "^1.4.7",
"iconoir-react": "^6.8.0",
"numbro": "^2.3.6",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-lazy-images": "^1.1.0",
"react-modal": "^3.16.1",
"react-router-dom": "^6.11.1",
"react-scripts": "5.0.1"
},
"main": "src/index.js",
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build"
},
"eslintConfig": {
"extends": [
"react-app"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}
2 changes: 2 additions & 0 deletions public/_redirects
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/faq https://poap.notion.site/POAP-Family-FAQ-cef29bc0bb8c4f8f936164d988a944cc 301
/* /index.html 200
Binary file added public/favicon.ico
Binary file not shown.
21 changes: 21 additions & 0 deletions public/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>POAP Family</title>
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico">
<meta name="theme-color" content="#B5AEFF">
<meta name="description" content="Discover the POAPs that different collectors have in common">
<meta property="og:site_name" content="POAP Family">
<meta property="og:title" content="POAP Family">
<meta property="og:description" content="Explore POAPs collections have in common">
<meta property="og:image" content="%PUBLIC_URL%/poap-family.png">
<link rel="apple-touch-icon" href="%PUBLIC_URL%/poap-family.png">
<link rel="manifest" href="%PUBLIC_URL%/manifest.json">
</head>
<body>
<noscript>Enable JavaScript to explore POAPs collections have in common.</noscript>
<div id="root"></div>
</body>
</html>
20 changes: 20 additions & 0 deletions public/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"short_name": "POAP.Family",
"name": "POAP Family",
"icons": [
{
"src": "/poap-family-192x192.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "/poap-family.png",
"sizes": "512x512",
"type": "image/png"
}
],
"start_url": ".",
"display": "standalone",
"theme_color": "#000000",
"background_color": "#B5AEFF"
}
Binary file added public/poap-family-192x192.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/poap-family.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
57 changes: 57 additions & 0 deletions src/app/Admin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import { useContext } from 'react'
import { Outlet } from 'react-router-dom'
import { AdminContext } from '../stores/admin'
import CenterPage from '../components/CenterPage'
import Card from '../components/Card'
import InputPassphraseForm from '../components/InputPassphraseForm'
import ErrorMessage from '../components/ErrorMessage'
import Loading from '../components/Loading'
import ButtonLink from '../components/ButtonLink'

function Admin() {
const { authenticate, authenticated, passphrase, error, loading, reset } = useContext(AdminContext)

if (!passphrase) {
return (
<CenterPage>
<Card style={{ padding: '4.5rem' }}>
<InputPassphraseForm
onSubmit={(passphrase) => authenticate(passphrase)}
/>
</Card>
</CenterPage>
)
}

if (loading) {
return (
<CenterPage>
<Card>
<Loading />
</Card>
</CenterPage>
)
}

if (!authenticated || error) {
return (
<CenterPage>
<Card>
<ErrorMessage>
{error && error.message && <p>{error.message}</p>}
{!authenticated && !error && <p>Access denied</p>}
</ErrorMessage>
<div className="footer">
<ButtonLink onClick={() => reset()}>retry</ButtonLink>
</div>
</Card>
</CenterPage>
)
}

return (
<Outlet />
)
}

export default Admin
30 changes: 30 additions & 0 deletions src/app/Analytics.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { createInstance, MatomoProvider } from '@datapunt/matomo-tracker-react'

const matomoHost = process.env.REACT_APP_MATOMO_HOST
const matomoSiteId = parseInt(process.env.REACT_APP_MATOMO_SITE_ID)

const matomo = matomoHost
? createInstance({
siteId: matomoSiteId,
urlBase: `https://${matomoHost}`,
srcUrl: `https://cdn.matomo.cloud/${matomoHost}/matomo.js`,
disabled: false,
linkTracking: true,
configurations: {
disableCookies: true,
},
})
: undefined

function Analytics({ children }) {
if (!matomo) {
return children
}
return (
<MatomoProvider value={matomo}>
{children}
</MatomoProvider>
)
}

export default Analytics
100 changes: 100 additions & 0 deletions src/app/App.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
import { createBrowserRouter, RouterProvider } from 'react-router-dom'
import Root from './Root'
import CenterPage from '../components/CenterPage'
import Loading from '../components/Loading'
import Home from '../pages/Home'
import Event from '../pages/Event'
import Events from '../pages/Events'
import PageError from '../components/PageError'
import EventsPageError from '../components/EventsPageError'
import { eventLoader, eventRedirect, eventsLoader, eventsRedirect } from '../loaders/event'
import Last from '../pages/Last'
import Settings from '../pages/Settings'
import FeedbackList from '../pages/FeedbackList'
import Analytics from './Analytics'
import Admin from './Admin'
import Addresses from '../pages/Addresses'
import { AdminProvider } from '../stores/admin'
import { SettingsProvider } from '../stores/cache'
import { EnsProvider, ReverseEnsProvider } from '../stores/ethereum'
import { HTMLProvider } from '../stores/html'
import '../styles/fonts.css'
import '../styles/app.css'

function App() {
return (
<main className="app">
<HTMLProvider>
<Analytics>
<AdminProvider>
<SettingsProvider>
<ReverseEnsProvider>
<EnsProvider>
<RouterProvider
router={createBrowserRouter([
{
path: '/',
element: <Root />,
errorElement: <PageError />,
children: [
{
index: true,
element: <Home />,
},
{
path: '/r/event/:eventId',
loader: eventRedirect,
},
{
path: '/event/:eventId',
loader: eventLoader,
element: <Event />,
errorElement: <PageError />,
},
{
path: '/r/events/:eventIds',
loader: eventsRedirect,
},
{
path: '/events/:eventIds',
loader: eventsLoader,
element: <Events />,
errorElement: <EventsPageError />,
},
{
path: '/addresses',
element: <Addresses />,
},
{
path: '/last',
element: <Last />,
},
{
path: '/settings',
element: <Settings />,
},
{
element: <Admin />,
children: [
{
path: '/feedback',
element: <FeedbackList />,
},
],
},
],
},
])}
fallbackElement={<CenterPage><Loading /></CenterPage>}
/>
</EnsProvider>
</ReverseEnsProvider>
</SettingsProvider>
</AdminProvider>
</Analytics>
</HTMLProvider>
</main>
)
}

export default App
43 changes: 43 additions & 0 deletions src/app/Root.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import { useContext, useEffect } from 'react'
import { useFetcher, useNavigation, Outlet } from 'react-router-dom'
import { useMatomo } from '@datapunt/matomo-tracker-react'
import { HTMLContext } from '../stores/html'
import Loading from '../components/Loading'
import CenterPage from '../components/CenterPage'

function Root() {
const fetcher = useFetcher()
const navigation = useNavigation()
const { trackPageView } = useMatomo()
const { title } = useContext(HTMLContext)

useEffect(
() => {
document.title = title
},
[title]
)

useEffect(
() => {
trackPageView({
href: window.location.href,
documentTitle: title,
})
},
[title, trackPageView]
)

if (fetcher.state === 'loading' || navigation.state === 'loading') {
return (
<CenterPage>
<Loading />
</CenterPage>
)
}
return (
<Outlet />
)
}

export default Root
Loading

0 comments on commit 496cd19

Please sign in to comment.