Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 4 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ jobs:
uses: astral-sh/setup-uv@v6

- name: Build frontend
env:
VITE_COGNITO_USER_POOL_ID: ${{ vars.VITE_COGNITO_USER_POOL_ID }}
VITE_COGNITO_USER_POOL_CLIENT_ID: ${{ vars.VITE_COGNITO_USER_POOL_CLIENT_ID }}
VITE_API_URL: ${{ vars.VITE_API_URL }}
run: ./build.sh
- name: Deploy frontend
run: ./deploy.sh
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
.DS_Store
.claude

# React
frontend/node_modules/
frontend/.react-router/
frontend/build/
frontend/.env*.local
**/*.tsbuildinfo

# Python
Expand Down
221 changes: 221 additions & 0 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"@react-router/node": "^7.5.3",
"@react-router/serve": "^7.5.3",
"@vitejs/plugin-react": "^5.1.1",
"amazon-cognito-identity-js": "^6.3.15",
"isbot": "^5.1.27",
"react": "^19.1.0",
"react-dom": "^19.1.0",
Expand Down
35 changes: 35 additions & 0 deletions frontend/src/auth/AuthContext.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { createContext, useContext, useState, ReactNode } from "react";

interface AuthState {
username: string | null;
idToken: string | null;
setAuth: (username: string, idToken: string) => void;
clearAuth: () => void;
}

const AuthContext = createContext<AuthState | null>(null);

export function AuthProvider({ children }: { children: ReactNode }) {
const [username, setUsername] = useState<string | null>(null);
const [idToken, setIdToken] = useState<string | null>(null);

const setAuth = (newUsername: string, newIdToken: string) => {
setUsername(newUsername);
setIdToken(newIdToken);
};

const clearAuth = () => {
setUsername(null);
setIdToken(null);
};

return <AuthContext.Provider value={{ username, idToken, setAuth, clearAuth }}>{children}</AuthContext.Provider>;
}

export function useAuth(): AuthState {
const ctx = useContext(AuthContext);
if (!ctx) {
throw new Error("useAuth must be used within an AuthProvider");
}
return ctx;
}
Loading
Loading