Skip to content
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

Merged
merged 52 commits into from
Dec 14, 2023
Merged
Show file tree
Hide file tree
Changes from 44 commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
ba96584
feat: init gift app functionality PE-5161
fedellen Dec 6, 2023
f314d33
style: add styling of gift app PE-5161
fedellen Dec 6, 2023
feb9145
feat: add GiB conversion PE-5161
fedellen Dec 6, 2023
c060653
style: design tweaks PE-5161
fedellen Dec 6, 2023
1310931
feat: init deployment action PE-5161
fedellen Dec 6, 2023
d3bdd3b
feat: init deployment action PE-5161
fedellen Dec 6, 2023
a1c4b8d
Merge pull request #4 from ardriveapp/PE-5161_deploy
fedellen Dec 6, 2023
9ed2628
style: design tweaks PE-5161
fedellen Dec 6, 2023
ddb12e5
feat: handle invalid email html state PE-5161
fedellen Dec 6, 2023
22279b0
style: one line button PE-5161
fedellen Dec 6, 2023
f195cad
feat: only update estimate when credits update PE-5161
fedellen Dec 6, 2023
72d5b9b
feat: mention char limit PE-5161
fedellen Dec 6, 2023
5e88682
style: capitialize Credits and dont resize textarea PE-5161
fedellen Dec 6, 2023
1a6e16a
feat: min/max and standard div sizing PE-5161
fedellen Dec 7, 2023
ef55749
feat: trim leading zero PE-5161
fedellen Dec 7, 2023
9f3af3b
feat: sugg amounts PE-5161
fedellen Dec 7, 2023
f54b86d
refactor: clean the code PE-5161
fedellen Dec 7, 2023
5110240
refactor: clean the code PE-5161
fedellen Dec 7, 2023
73ce0b4
feat(gift app): add router for extending app PE-5161
fedellen Dec 7, 2023
f3cab45
chore(gift app): use dev payment PE-5161
fedellen Dec 7, 2023
b65095a
refactor: simplify getTopUpQuote into forwardToCheckoutSession PE-5161
fedellen Dec 7, 2023
ae781d5
refactor: remove redundant var PE-5161
fedellen Dec 7, 2023
cbeb926
refactor: use shared const PE-5161
fedellen Dec 7, 2023
a1521d2
chore: deploy latest PE-5161
fedellen Dec 7, 2023
c68a69f
feat: add version footer and fix router PE-5161
fedellen Dec 7, 2023
3e90b1e
refactor: excise App, inlude Router PE-5161
fedellen Dec 7, 2023
f32c254
feat: forward gift message PE-5190
fedellen Dec 8, 2023
c6bd0a4
refactor: remove error logic from router PE-5161
fedellen Dec 8, 2023
c50121a
feat: handle 404 on gh pages PE-5161
fedellen Dec 8, 2023
1274b4b
feat: add plausible PE-5161
fedellen Dec 8, 2023
f40ddc5
refactor: clean up code PE-5161
fedellen Dec 8, 2023
0e4a1f1
feat: add a redeem page PE-5162
fedellen Dec 8, 2023
db64361
chore: add todo, remove branch from deploy PE-5161
fedellen Dec 8, 2023
3486930
feat: fill redeem from query params PE-5162
fedellen Dec 8, 2023
2e6dbe3
Merge pull request #5 from ardriveapp/PE-5162_redeem
fedellen Dec 11, 2023
7440377
feat: deploy at subdomain PE-5161
fedellen Dec 11, 2023
f8ba419
style: light mode input box fix PE-5161
fedellen Dec 11, 2023
1ffcac2
style: checkbox fix PE-5161
fedellen Dec 11, 2023
f8ab20a
style: button border radius update PE-5161
fedellen Dec 11, 2023
ac5f70b
feat: add FAQ PE-5161
fedellen Dec 12, 2023
ec02b7b
style: update expandable PE-5161
fedellen Dec 12, 2023
fda5143
style: fix safari media queries PE-5161
fedellen Dec 12, 2023
30b9b3e
fix: allow empty input PE-5161
fedellen Dec 12, 2023
13e5a6b
feat: add content PE-5161
fedellen Dec 12, 2023
5993e0b
feat: receieve query params in gift url PE-5161
fedellen Dec 12, 2023
68d7b57
Merge pull request #6 from ardriveapp/PE-5161_cancel_query_params
fedellen Dec 13, 2023
0dadc95
style: update spacing PE-5161
fedellen Dec 13, 2023
1e4a281
style: update spacing PE-5161
fedellen Dec 13, 2023
8f26c96
chore: remove feature branch from deploy PE-5161
fedellen Dec 13, 2023
1889063
feat: style and content updates PE-5161
fedellen Dec 13, 2023
6390ec9
Merge pull request #8 from ardriveapp/PE-5161_redemption_page_updates
fedellen Dec 14, 2023
8df7a2e
style: adjust checkbox PE-5161
fedellen Dec 14, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .github/workflows/build.yml
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 }}
34 changes: 34 additions & 0 deletions .github/workflows/deploy.yml
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
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: Remove before merge


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
Copy link
Collaborator Author

@fedellen fedellen Dec 8, 2023

Choose a reason for hiding this comment

The 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 github.io/turbo-app and they will show that but if someone goes to github.io/turbo-app/gift they show 404 by default.

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 🎉

Choose a reason for hiding this comment

The 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

Copy link
Collaborator Author

Choose a reason for hiding this comment

The 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
Copy link
Collaborator Author

@fedellen fedellen Dec 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fwiw I learned we can add dev dependency gh-pages and add a deploy command like yarn gh-pages (but this is working and fine)

uses: JamesIves/[email protected]
with:
branch: gh-pages
folder: dist
87 changes: 46 additions & 41 deletions index.html
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>
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"version": "1.0.0",
"type": "module",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

consider using nodenext in the tsconfig

"description": "ArDrive Turbo App",
"homepage": "./",
"license": "AGPL-3.0-or-later",
"author": {
"name": "Permanent Data Solutions Inc",
Expand All @@ -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",

Choose a reason for hiding this comment

The 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?

Copy link
Collaborator Author

@fedellen fedellen Dec 13, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#7 -- It did not seem to fix the problem there

Choose a reason for hiding this comment

The 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",
Expand Down
22 changes: 22 additions & 0 deletions src/Router.tsx
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>
);
}
192 changes: 192 additions & 0 deletions src/components/ArDriveLogo.tsx

Large diffs are not rendered by default.

80 changes: 80 additions & 0 deletions src/components/Expandable.css
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);
}
30 changes: 30 additions & 0 deletions src/components/Expandable.tsx
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>
);
}
Loading
Loading