Skip to content

Commit 2989401

Browse files
authored
Merge pull request #1 from sanctuarycomputer/www
Add the `www` folder
2 parents 3c78bdf + 5423b41 commit 2989401

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+9439
-6
lines changed

.github/workflows/deploy.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Deploys & Previews
2+
on:
3+
push:
4+
jobs:
5+
deploy-www:
6+
runs-on: ubuntu-latest
7+
permissions:
8+
pull-requests: write
9+
issues: write
10+
repository-projects: write
11+
contents: write
12+
steps:
13+
- uses: actions/checkout@v2
14+
- name: Setup Node.js
15+
uses: actions/setup-node@v4
16+
with:
17+
node-version: '20'
18+
cache: 'npm'
19+
cache-dependency-path: './www/package-lock.json'
20+
- name: Install dependencies
21+
run: |
22+
cd www
23+
npm ci
24+
# - name: Run Prettier check
25+
# run: |
26+
# cd www
27+
# npm run format:check
28+
# - name: Run ESLint
29+
# run: |
30+
# cd www
31+
# npm run lint
32+
# - name: Run Lighthouse CI
33+
# run: |
34+
# cd www
35+
# npm run lighthouse
36+
- name: Deploy to Vercel
37+
uses: amondnet/vercel-action@v20
38+
with:
39+
vercel-token: ${{ secrets.VERCEL_TOKEN }}
40+
github-token: ${{ secrets.GITHUB_TOKEN }}
41+
vercel-org-id: ${{ secrets.VERCEL_ORG_ID}}
42+
vercel-project-id: prj_5wJWsrSkl9yTZ3rY1DgEV7UpAtly
43+
scope: ${{ secrets.VERCEL_ORG_ID }}
44+
working-directory: ./www
45+
github-comment: ${{ github.ref != 'refs/heads/production' }}
46+
vercel-args: ${{ github.ref == 'refs/heads/production' && '--prod' || '' }}

.gitignore

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
11
venv/
22
.env
3-
.DS_Store
4-
5-
models/*
6-
!models/.gitkeep
7-
__pycache__
8-
benchmark/__pycache__
3+
.DS_Store

www/.env.example

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
STACKS_API_KEY=[ask_hugh]

www/.gitignore

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# dependencies
4+
/node_modules
5+
/.pnp
6+
.pnp.*
7+
.yarn/*
8+
!.yarn/patches
9+
!.yarn/plugins
10+
!.yarn/releases
11+
!.yarn/versions
12+
13+
# testing
14+
/coverage
15+
16+
# next.js
17+
/.next/
18+
/out/
19+
20+
# production
21+
/build
22+
23+
# misc
24+
.DS_Store
25+
*.pem
26+
27+
# debug
28+
npm-debug.log*
29+
yarn-debug.log*
30+
yarn-error.log*
31+
.pnpm-debug.log*
32+
33+
# env files (can opt-in for committing if needed)
34+
.env*
35+
!.env.example
36+
37+
# vercel
38+
.vercel
39+
40+
# typescript
41+
*.tsbuildinfo
42+
next-env.d.ts
43+
.lighthouseci

www/.prettierignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
node_modules/
2+
.next/
3+
out/
4+
build/
5+
dist/
6+
*.log
7+
.env*
8+
.DS_Store
9+
coverage/
10+
.nyc_output/

www/.prettierrc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"semi": true,
3+
"trailingComma": "es5",
4+
"singleQuote": true,
5+
"printWidth": 80,
6+
"tabWidth": 2,
7+
"useTabs": false,
8+
"bracketSpacing": true,
9+
"arrowParens": "avoid",
10+
"endOfLine": "lf"
11+
}

www/.tool-versions

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
nodejs 20.19.6

www/README.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
This is a [Next.js](https://nextjs.org) project bootstrapped with [`create-next-app`](https://nextjs.org/docs/app/api-reference/cli/create-next-app).
2+
3+
## Getting Started
4+
5+
First, run the development server:
6+
7+
```bash
8+
npm run dev
9+
# or
10+
yarn dev
11+
# or
12+
pnpm dev
13+
# or
14+
bun dev
15+
```
16+
17+
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
18+
19+
You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.
20+
21+
This project uses [`next/font`](https://nextjs.org/docs/app/building-your-application/optimizing/fonts) to automatically optimize and load [Geist](https://vercel.com/font), a new font family for Vercel.
22+
23+
## Learn More
24+
25+
To learn more about Next.js, take a look at the following resources:
26+
27+
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
28+
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
29+
30+
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js) - your feedback and contributions are welcome!
31+
32+
## Deploy on Vercel
33+
34+
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
35+
36+
Check out our [Next.js deployment documentation](https://nextjs.org/docs/app/building-your-application/deploying) for more details.

www/app/api/subscribe/route.ts

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
import { NextRequest, NextResponse } from 'next/server';
2+
3+
// Example in-memory store for demonstration
4+
// In production, you'd use a real database or email service like Mailchimp, ConvertKit, etc.
5+
const subscribedEmails = new Set<string>([
6+
'already@subscribed.com', // Example of already subscribed email for testing
7+
]);
8+
9+
interface SubscribeResponse {
10+
success: boolean;
11+
message: string;
12+
status: 'subscribed' | 'already_subscribed' | 'error';
13+
}
14+
15+
export async function POST(request: NextRequest): Promise<NextResponse<SubscribeResponse>> {
16+
try {
17+
const body = await request.json();
18+
const { email } = body;
19+
20+
// Validate email
21+
if (!email || typeof email !== 'string') {
22+
return NextResponse.json(
23+
{
24+
success: false,
25+
message: 'Email address is required.',
26+
status: 'error',
27+
},
28+
{ status: 400 }
29+
);
30+
}
31+
32+
// Basic email validation
33+
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
34+
if (!emailRegex.test(email)) {
35+
return NextResponse.json(
36+
{
37+
success: false,
38+
message: 'Please enter a valid email address.',
39+
status: 'error',
40+
},
41+
{ status: 400 }
42+
);
43+
}
44+
45+
const normalizedEmail = email.toLowerCase().trim();
46+
47+
const response = await fetch('https://stacks.garden3d.net/api/contacts', {
48+
method: 'POST',
49+
headers: {
50+
'Content-Type': 'application/json',
51+
'X-Api-Key': process.env.STACKS_API_KEY!,
52+
},
53+
body: JSON.stringify({
54+
email: normalizedEmail,
55+
sources: ['g3d:family_intelligence']
56+
}),
57+
});
58+
59+
if (response.ok) {
60+
return NextResponse.json(
61+
{
62+
success: true,
63+
message: 'Thank you for subscribing! We\'ll keep you updated.',
64+
status: 'subscribed',
65+
},
66+
{ status: 201 }
67+
);
68+
} else {
69+
console.error('Subscription error:', response.statusText);
70+
return NextResponse.json(
71+
{
72+
success: false,
73+
message: 'Something went wrong. Please try again later.',
74+
status: 'error',
75+
},
76+
{ status: 500 }
77+
);
78+
}
79+
80+
} catch (error) {
81+
console.error('Subscription error:', error);
82+
83+
return NextResponse.json(
84+
{
85+
success: false,
86+
message: 'Something went wrong. Please try again later.',
87+
status: 'error',
88+
},
89+
{ status: 500 }
90+
);
91+
}
92+
}

www/app/favicon.ico

25.3 KB
Binary file not shown.

0 commit comments

Comments
 (0)