Skip to content

Commit e175f71

Browse files
committed
Initial static site for Code Alert hackathon
Based on thinkinginmath/ra-hackathon frontend, configured for GitHub Pages deployment with custom domain hackathon.mofa.ai
0 parents  commit e175f71

90 files changed

Lines changed: 7173 additions & 0 deletions

Some content is hidden

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

.dockerignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
node_modules
2+
.next
3+
out
4+
Dockerfile.*

.eslintrc.json

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"extends": ["next/core-web-vitals", "next/typescript"],
3+
"rules": {
4+
"no-restricted-globals": ["error", {
5+
"name": "localStorage",
6+
"message": "Use safeLocalStorage from '@/lib/utils/hydration-safe' instead"
7+
}, {
8+
"name": "sessionStorage",
9+
"message": "Use safeSessionStorage from '@/lib/utils/hydration-safe' instead"
10+
}],
11+
"no-restricted-properties": ["warn", {
12+
"object": "window",
13+
"property": "localStorage",
14+
"message": "Use safeLocalStorage from '@/lib/utils/hydration-safe' instead"
15+
}, {
16+
"object": "Date",
17+
"property": "toLocaleString",
18+
"message": "Use ClientDate component or formatDate utility for hydration safety"
19+
}, {
20+
"object": "Date",
21+
"property": "toLocaleDateString",
22+
"message": "Use ClientDate component or formatDate utility for hydration safety"
23+
}, {
24+
"object": "Date",
25+
"property": "toLocaleTimeString",
26+
"message": "Use ClientDate component or formatDate utility for hydration safety"
27+
}]
28+
}
29+
}

.github/workflows/deploy-pages.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Deploy to GitHub Pages
2+
3+
on:
4+
push:
5+
branches: [main]
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: read
10+
pages: write
11+
id-token: write
12+
13+
concurrency:
14+
group: "pages"
15+
cancel-in-progress: true
16+
17+
jobs:
18+
build:
19+
runs-on: ubuntu-latest
20+
steps:
21+
- uses: actions/checkout@v4
22+
23+
- uses: actions/setup-node@v4
24+
with:
25+
node-version: '20'
26+
cache: 'npm'
27+
cache-dependency-path: frontend/package-lock.json
28+
29+
- name: Install dependencies
30+
working-directory: frontend
31+
run: npm ci
32+
33+
- name: Build static site
34+
working-directory: frontend
35+
env:
36+
NEXT_PUBLIC_API_URL: ""
37+
NEXT_PUBLIC_REGION_MODE: "GLOBAL"
38+
run: npm run build
39+
40+
- name: Upload artifact
41+
uses: actions/upload-pages-artifact@v3
42+
with:
43+
path: frontend/out
44+
45+
deploy:
46+
environment:
47+
name: github-pages
48+
url: ${{ steps.deployment.outputs.page_url }}
49+
runs-on: ubuntu-latest
50+
needs: build
51+
steps:
52+
- name: Deploy to GitHub Pages
53+
id: deployment
54+
uses: actions/deploy-pages@v4

.gitignore

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
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+
36+
# vercel
37+
.vercel
38+
39+
# typescript
40+
*.tsbuildinfo
41+
next-env.d.ts
42+
43+
# fonts
44+
public/fonts/*
45+
!public/fonts/.gitkeep

.nvmrc

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

Dockerfile.dev

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
FROM node:20-slim
2+
3+
# Set working directory
4+
WORKDIR /app
5+
6+
# Install dependencies based on lock file
7+
COPY package.json ./
8+
RUN npm install
9+
10+
# Copy application code
11+
COPY . .
12+
13+
# Expose development port
14+
EXPOSE 3000
15+
16+
# Start development server
17+
CMD ["npm", "run", "dev"]

Dockerfile.prod

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
###
2+
# Temporary production build image to test static export outside host-mount environment
3+
###
4+
FROM node:20-slim AS builder
5+
WORKDIR /app
6+
7+
# Install dependencies
8+
COPY package.json package-lock.json* ./
9+
RUN npm install
10+
11+
# Copy application source
12+
COPY . .
13+
14+
# Build and export static site
15+
RUN npm run build && npm run export
16+
17+
# The 'out' directory should now exist at /app/out
18+
# Use this image to extract the static output if needed:
19+
# docker build -f Dockerfile.prod -t frontend-export .
20+
# docker create --name tmp frontend-export
21+
# docker cp tmp:/app/out ./out
22+
# docker rm tmp

README.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
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 self-hosts the [Geist](https://vercel.com/font) font using [`next/font/local`](https://nextjs.org/docs/app/building-your-application/optimizing/fonts#local-fonts) to avoid external font CDNs.
22+
23+
Download the font files before building:
24+
- [Geist Sans Variable](https://raw.githubusercontent.com/vercel/geist-font/main/packages/next/dist/fonts/geist-sans/Geist-Variable.woff2)
25+
- [Geist Mono Variable](https://raw.githubusercontent.com/vercel/geist-font/main/packages/next/dist/fonts/geist-mono/GeistMono-Variable.woff2)
26+
27+
Place them in `public/fonts/` as `Geist-Variable.woff2` and `GeistMono-Variable.woff2`.
28+
29+
Set `NEXT_PUBLIC_REGION_MODE=CN` at build time to enable China-optimized behavior.
30+
31+
## Learn More
32+
33+
To learn more about Next.js, take a look at the following resources:
34+
35+
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
36+
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
37+
38+
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js) - your feedback and contributions are welcome!
39+
40+
## Deploy on Vercel
41+
42+
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.
43+
44+
Check out our [Next.js deployment documentation](https://nextjs.org/docs/app/building-your-application/deploying) for more details.

app/(auth)/login/page.tsx

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
'use client'
2+
3+
import dynamic from 'next/dynamic'
4+
5+
const LoginForm = dynamic(
6+
() => import('@/components/auth/LoginForm'),
7+
{
8+
ssr: false,
9+
loading: () => (
10+
<div className="flex min-h-screen items-center justify-center p-4">
11+
<div className="w-full max-w-md">
12+
<div className="text-center">
13+
<div className="animate-spin rounded-full h-8 w-8 border-b-2 border-primary mx-auto"></div>
14+
<p className="mt-2 text-sm text-muted-foreground">加载中...</p>
15+
</div>
16+
</div>
17+
</div>
18+
)
19+
}
20+
)
21+
22+
export default function LoginPage() {
23+
return (
24+
<div className="flex min-h-screen items-center justify-center p-4">
25+
<LoginForm />
26+
</div>
27+
)
28+
}

0 commit comments

Comments
 (0)