-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: create the gift app PE-5161 #3
Changes from 46 commits
ba96584
f314d33
feb9145
c060653
1310931
d3bdd3b
a1c4b8d
9ed2628
ddb12e5
22279b0
f195cad
72d5b9b
5e88682
1a6e16a
ef55749
9f3af3b
f54b86d
5110240
73ce0b4
f3cab45
b65095a
ae781d5
cbeb926
a1521d2
c68a69f
3e90b1e
f32c254
c6bd0a4
c50121a
1274b4b
f40ddc5
0e4a1f1
db64361
3486930
2e6dbe3
7440377
f8ba419
1ffcac2
f8ab20a
ac5f70b
ec02b7b
fda5143
30b9b3e
13e5a6b
5993e0b
68d7b57
0dadc95
1e4a281
8f26c96
1889063
6390ec9
8df7a2e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
name: Build and Test | ||
|
||
on: [push] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
node_version: [18.x, 20.x] | ||
command: ["lint", "format", "build", "test"] | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Set Up node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ matrix.node_version }} | ||
cache: "yarn" | ||
|
||
- name: Install dependencies | ||
run: yarn --immutable --immutable-cache | ||
|
||
- run: yarn ${{ matrix.command }} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: Deploy to GitHub Pages | ||
|
||
on: | ||
push: | ||
branches: | ||
- prod | ||
- PE-5161_gift_app_init | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Set Up node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 20.x | ||
cache: "yarn" | ||
|
||
- name: Install dependencies | ||
run: yarn --immutable --immutable-cache | ||
|
||
- name: Build | ||
run: yarn build | ||
|
||
- name: Copy index.html to 404.html | ||
run: cp ./dist/index.html ./dist/404.html | ||
Comment on lines
+26
to
+27
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. for the reviewer -- when GH pages serves static files, if they don't find anything at the target url they will serve 404.html. they will only serve static file if there is a repo named that with gh pages. like we are at By adding this dup 404.html we basically create the app there as well as at index. So GH pages serves our 404.html at subpaths which is actually our app 🎉 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we have a workaround for this in the arns-react app - https://github.com/ar-io/arns-react/blob/develop/404.html There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was testing a similar script last night but this seems to solve the problem in a simpler way |
||
|
||
- name: Deploy gh-pages if on prod | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fwiw I learned we can add dev dependency |
||
uses: JamesIves/[email protected] | ||
with: | ||
branch: gh-pages | ||
folder: dist |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,48 @@ | ||
<!DOCTYPE html> | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<link rel="icon" href="/favicon.ico" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1" /> | ||
<meta name="description" content="The ArDrive Turbo Web App" /> | ||
<link rel="stylesheet" href="/font.css" /> | ||
<link | ||
rel="preload" | ||
href="/fonts/Wavehaus/Wavehaus-66Book.woff" | ||
as="font" | ||
type="font/woff" | ||
crossorigin | ||
/> | ||
<link | ||
rel="preload" | ||
href="/fonts/Wavehaus/Wavehaus-95SemiBold.woff" | ||
as="font" | ||
type="font/woff" | ||
crossorigin | ||
/> | ||
<link | ||
rel="preload" | ||
href="/fonts/Wavehaus/Wavehaus-128Bold.woff" | ||
as="font" | ||
type="font/woff" | ||
crossorigin | ||
/> | ||
<link | ||
rel="preload" | ||
href="/fonts/Wavehaus/Wavehaus-158ExtraBold.woff" | ||
as="font" | ||
type="font/woff" | ||
crossorigin | ||
/> | ||
<title>ArDrive Turbo App</title> | ||
</head> | ||
<body> | ||
<div id="root"></div> | ||
<script type="module" src="/src/main.tsx"></script> | ||
</body> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<link rel="icon" href="/favicon.ico" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1" /> | ||
<meta name="description" content="The ArDrive Gift App" /> | ||
<link rel="stylesheet" href="/font.css" /> | ||
<link | ||
rel="preload" | ||
href="/fonts/Wavehaus/Wavehaus-66Book.woff" | ||
as="font" | ||
type="font/woff" | ||
crossorigin | ||
/> | ||
<link | ||
rel="preload" | ||
href="/fonts/Wavehaus/Wavehaus-95SemiBold.woff" | ||
as="font" | ||
type="font/woff" | ||
crossorigin | ||
/> | ||
<link | ||
rel="preload" | ||
href="/fonts/Wavehaus/Wavehaus-128Bold.woff" | ||
as="font" | ||
type="font/woff" | ||
crossorigin | ||
/> | ||
<link | ||
rel="preload" | ||
href="/fonts/Wavehaus/Wavehaus-158ExtraBold.woff" | ||
as="font" | ||
type="font/woff" | ||
crossorigin | ||
/> | ||
<script | ||
defer | ||
data-domain="gift.ardrive.io" | ||
src="https://plausible.io/js/plausible.js" | ||
></script> | ||
<title>ArDrive Gift App</title> | ||
</head> | ||
<body> | ||
<div id="root"></div> | ||
<script type="module" src="src/main.tsx"></script> | ||
</body> | ||
</html> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
"version": "1.0.0", | ||
"type": "module", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. consider using |
||
"description": "ArDrive Turbo App", | ||
"homepage": "./", | ||
"license": "AGPL-3.0-or-later", | ||
"author": { | ||
"name": "Permanent Data Solutions Inc", | ||
|
@@ -14,12 +15,14 @@ | |
"build": "tsc && vite build", | ||
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0", | ||
"format": "prettier --write \"src/**/*.{js,jsx,ts,tsx}\"", | ||
"preview": "vite preview" | ||
"preview": "vite preview", | ||
"test": "echo \"TODO: add tests\" && exit 0" | ||
}, | ||
"dependencies": { | ||
"@ardrive/turbo-sdk": "^1.1.0", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can you test v1.1.1-alpha-1 and see if it removes the need for vite polyfill plugin below? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. #7 -- It did not seem to fix the problem there There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. all good - will continue validating on that branch |
||
"react": "^18.2.0", | ||
"react-dom": "^18.2.0" | ||
"react-dom": "^18.2.0", | ||
"react-router-dom": "^6.20.1" | ||
}, | ||
"devDependencies": { | ||
"@types/react": "^18.2.37", | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { BrowserRouter, Route, Routes } from "react-router-dom"; | ||
import { GiftPage } from "./pages/GiftPage"; | ||
import { RedeemPage } from "./pages/RedeemPage"; | ||
|
||
export function Router() { | ||
return ( | ||
<BrowserRouter basename={`${import.meta.env.BASE_URL}`}> | ||
<Routes> | ||
<Route path="/gift" element={<GiftPage />} /> | ||
<Route path="/redeem" element={<RedeemPage />} /> | ||
<Route | ||
path="/" | ||
element={ | ||
/* Put gift element at baseUrl for now */ | ||
<GiftPage /> | ||
} | ||
/> | ||
<Route path="*" element={<p>404</p>} /> | ||
</Routes> | ||
</BrowserRouter> | ||
); | ||
} |
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
.expandable { | ||
padding: 1.5rem 0; | ||
font-family: "Wavehaus-Book"; | ||
} | ||
|
||
@media (min-width: 640px) { | ||
.expandable { | ||
font-size: 18px; | ||
} | ||
} | ||
|
||
@media (min-width: 800px) { | ||
.expandable { | ||
font-size: 20px; | ||
} | ||
} | ||
|
||
@media (min-width: 1200px) { | ||
.expandable { | ||
font-size: 24px; | ||
} | ||
} | ||
.expandable h3 { | ||
font-size: inherit; | ||
} | ||
|
||
.expandable:not(:last-of-type) { | ||
border-bottom: 0.25px; | ||
border-color: var(--off-gray); | ||
border-bottom-style: solid; | ||
} | ||
|
||
.expandable button { | ||
background-color: inherit; | ||
border: none; | ||
cursor: pointer; | ||
display: flex; | ||
width: 100%; | ||
font-size: inherit; | ||
|
||
color: var(--text-white); | ||
|
||
padding: 0; | ||
justify-content: space-between; | ||
width: 100%; | ||
align-items: center; | ||
text-align: left; | ||
letter-spacing: 1.09px; | ||
font-family: Wavehaus-Book; | ||
} | ||
|
||
@media (prefers-color-scheme: light) { | ||
.expandable button { | ||
color: var(--black); | ||
} | ||
} | ||
|
||
.expandable div { | ||
padding-left: 1rem; | ||
height: 1rem; | ||
width: 1rem; | ||
display: flex; | ||
justify-content: center; | ||
} | ||
|
||
.expandable p { | ||
padding-top: 1rem; | ||
} | ||
|
||
.expandable strong { | ||
font-family: "Wavehaus-Bold"; | ||
} | ||
|
||
.expandable.expanded button { | ||
font-family: Wavehaus-Semi; | ||
} | ||
|
||
.expandable.expanded div { | ||
transform: rotate(180deg); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { JSX } from "react"; | ||
import * as React from "react"; | ||
import UpArrowIcon from "./icons/UpArrowIcon"; | ||
import "./Expandable.css"; | ||
|
||
interface ExpandableProps { | ||
question: string; | ||
answer: React.ReactNode; | ||
expanded: boolean; | ||
setExpanded: () => void; | ||
} | ||
|
||
export default function Expandable({ | ||
question, | ||
answer, | ||
expanded, | ||
setExpanded, | ||
}: ExpandableProps): JSX.Element { | ||
return ( | ||
<div className={`expandable ${expanded ? "expanded" : ""}`}> | ||
<button aria-label={question} onClick={() => setExpanded()}> | ||
<h3>{question}</h3> | ||
<div className="expandable-icon-container"> | ||
<UpArrowIcon /> | ||
</div> | ||
</button> | ||
{expanded && <>{answer}</>} | ||
</div> | ||
); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO: Remove before merge