Skip to content

Commit 2c729b2

Browse files
authored
📷🥯 ↝ [SSG-281 SSF-9]: Viewport extensions - Merge pull request #205 from Signal-K/SSG-281
🍓📷 ↝ [SSG-281 SSF-9]: Viewport extensions
2 parents ebbdb9e + eb640b3 commit 2c729b2

File tree

68 files changed

+9736
-5449
lines changed

Some content is hidden

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

68 files changed

+9736
-5449
lines changed

.DS_Store

0 Bytes
Binary file not shown.
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Delete Push Anomaly Log
2+
3+
on:
4+
schedule:
5+
# Run at 00:00 AEST every Sunday (AEST is UTC+10, so 14:00 UTC Saturday)
6+
- cron: '0 14 * * 6'
7+
workflow_dispatch:
8+
9+
jobs:
10+
delete-push-anomaly-log:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v4
15+
- name: Setup Go
16+
uses: actions/setup-go@v4
17+
with:
18+
go-version: '1.21'
19+
- name: Install dependencies
20+
run: go mod tidy
21+
- name: Delete push anomaly log
22+
env:
23+
SUPABASE_URL: ${{ secrets.NEXT_PUBLIC_SUPABASE_URL }}
24+
SUPABASE_SERVICE_ROLE_KEY: ${{ secrets.SUPABASE_SERVICE_ROLE_KEY }}
25+
run: go run scripts/delete_push_anomaly_log.go
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Unlock SolarHealth Anomalies
2+
3+
on:
4+
schedule:
5+
# Run every 24 hours
6+
- cron: '0 0 * * *'
7+
push:
8+
branches: [ '*' ]
9+
workflow_dispatch:
10+
11+
jobs:
12+
unlock-solarhealth-anomalies:
13+
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || (github.event_name == 'push' && contains(github.event.head_commit.message, 'SSM-257'))
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v4
18+
- name: Setup Node.js
19+
uses: actions/setup-node@v4
20+
with:
21+
node-version: '20'
22+
cache: 'yarn'
23+
- name: Install dependencies
24+
run: yarn install --frozen-lockfile
25+
- name: Unlock SolarHealth anomalies
26+
env:
27+
SUPABASE_URL: ${{ secrets.NEXT_PUBLIC_SUPABASE_URL }}
28+
SUPABASE_SERVICE_ROLE_KEY: ${{ secrets.SUPABASE_SERVICE_ROLE_KEY }}
29+
run: node scripts/unlock-solarhealth-anomalies.js

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@ venv
2424
/.next/
2525
/out/
2626

27+
storage_downloads/
28+
.storage_downloads/
29+
/storage_downloads/
30+
/.storage_downloads/
31+
2732
# production
2833
/build
2934

WARP.md

Lines changed: 207 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,207 @@
1+
# WARP.md
2+
3+
This file provides guidance to WARP (warp.dev) when working with code in this repository.
4+
5+
## Project Overview
6+
7+
**Star Sailors** is a Next.js 14 application for space exploration, citizen science, and data classification. It features a complex user-centric architecture with components organized around user mechanics (classification, deployment, discovery, research, social, profile) rather than technical implementation.
8+
9+
## Common Development Commands
10+
11+
### Local Development
12+
```bash
13+
# Start development server (recommended)
14+
yarn dev
15+
# or using Makefile
16+
make dev
17+
18+
# Install dependencies
19+
yarn install
20+
# or
21+
make install
22+
23+
# Build application
24+
yarn build
25+
# or
26+
make build-app
27+
```
28+
29+
### Database Operations (Drizzle ORM + Supabase)
30+
```bash
31+
# Generate database schema
32+
yarn db:generate
33+
34+
# Push schema changes to database
35+
yarn db:push
36+
37+
# Open Drizzle Studio (database UI)
38+
yarn db:studio
39+
# or via Docker
40+
make db-studio
41+
42+
# Database migrations
43+
yarn db:migrate
44+
```
45+
46+
### Testing
47+
48+
#### Unit Testing (Vitest)
49+
```bash
50+
# Run unit tests
51+
yarn test:unit
52+
53+
# Run unit tests in watch mode
54+
yarn test:unit:watch
55+
56+
# Run unit tests in Docker (isolated)
57+
yarn docker:test:unit
58+
```
59+
60+
#### E2E Testing (Cypress)
61+
```bash
62+
# Run E2E tests headless
63+
yarn test:e2e
64+
65+
# Run E2E tests with Cypress UI
66+
yarn test:e2e:open
67+
68+
# Run E2E tests with user creation (local)
69+
yarn test:e2e:local
70+
71+
# Run E2E tests in Docker
72+
yarn docker:test:e2e
73+
yarn docker:test:e2e:local
74+
```
75+
76+
#### Comprehensive Testing
77+
```bash
78+
# Run all tests (unit + E2E)
79+
yarn test:all
80+
yarn docker:test:all
81+
82+
# Clean Docker test resources
83+
yarn docker:test:clean
84+
```
85+
86+
### Docker Operations
87+
```bash
88+
# Development with Docker
89+
docker-compose up
90+
# or
91+
make up
92+
93+
# Production deployment
94+
docker-compose -f docker-compose.prod.yml up -d
95+
# or
96+
make prod-up
97+
98+
# Test environment
99+
docker-compose -f docker-compose.test.yml --profile unit up
100+
docker-compose -f docker-compose.test.yml --profile e2e up
101+
```
102+
103+
### Linting and Code Quality
104+
```bash
105+
# Next.js linting
106+
yarn lint
107+
108+
# Detect unused dependencies
109+
yarn knip
110+
```
111+
112+
### Single Test Execution
113+
```bash
114+
# Run specific Cypress test
115+
npx cypress run --spec "cypress/e2e/specific-test.cy.ts"
116+
117+
# Run specific unit test
118+
npx vitest run path/to/test.test.ts
119+
120+
# Run tests matching pattern
121+
npx vitest run --reporter=verbose --grep "test pattern"
122+
```
123+
124+
## Architecture Overview
125+
126+
### File Organization
127+
The codebase uses a **user-centric component architecture** rather than technical grouping:
128+
129+
- **`src/components/classification/`** - Image/data classification mechanics (viewports, telescopes, AI tools)
130+
- **`src/components/deployment/`** - Structure & mission deployment (buildings, equipment, missions)
131+
- **`src/components/discovery/`** - Exploration & data discovery (planets, anomalies, weather)
132+
- **`src/components/research/`** - Scientific progression (projects, skill trees)
133+
- **`src/components/social/`** - Community features (comments, posts, activity)
134+
- **`src/components/profile/`** - User management (auth, dashboard, inventory)
135+
- **`src/components/ui/`** - Reusable UI components
136+
- **`src/components/layout/`** - Application layout components
137+
138+
### Core Architecture
139+
- **`app/`** - Next.js 14 App Router with file-based routing
140+
- **`src/core/`** - Core application logic and context providers
141+
- **`src/shared/`** - Shared utilities and helper functions
142+
- **`lib/`** - External library configurations
143+
- **`hooks/`** - Custom React hooks
144+
- **`types/`** - TypeScript type definitions
145+
146+
### Key Technologies
147+
- **Frontend**: Next.js 14, React 18, TypeScript, Tailwind CSS
148+
- **Database**: Supabase with Drizzle ORM (PostgreSQL)
149+
- **3D Graphics**: Three.js with React Three Fiber
150+
- **Testing**: Vitest (unit), Cypress (E2E)
151+
- **Styling**: Tailwind CSS, Radix UI, Framer Motion
152+
- **Auth**: Supabase Auth with NextAuth helpers
153+
154+
### Import Patterns
155+
```typescript
156+
// Absolute imports using @ alias
157+
import { Component } from '@/src/components/classification/...'
158+
import { utility } from '@/src/shared/utils'
159+
import { type } from '@/types/...'
160+
161+
// UI components
162+
import { Button } from '@/src/components/ui/button'
163+
```
164+
165+
### Environment Configuration
166+
- **`.env`** - Production environment variables
167+
- **`.env.local`** - Local development overrides
168+
- **`.env.example`** - Template with required variables
169+
- **`.env.test`** - Testing environment configuration
170+
171+
### Docker Architecture
172+
173+
#### Container Services
174+
- **nextapp**: Main Next.js application container
175+
- **nextapp-test**: Test application server
176+
- **unit-tests**: Isolated unit testing service
177+
- **e2e-tests-headless**: Headless E2E testing
178+
- **e2e-tests-local**: Local E2E testing with user creation
179+
- **db**: PostgreSQL database
180+
- **redis**: Redis cache
181+
- **drizzle-studio**: Database UI tool
182+
183+
#### Testing Profiles
184+
- **`unit`**: Fast, isolated unit testing
185+
- **`e2e`**: Full application integration testing
186+
- **`local-test`**: Comprehensive testing with user creation
187+
- **`all`**: Complete test suite validation
188+
189+
### Flask API Integration
190+
The application integrates with a Flask backend for citizen science features:
191+
- Flask routes are proxied through Next.js using `/citizen/*` paths
192+
- Development uses `http://flask:5001` container communication
193+
- API routes remain at `/api/*` for Next.js server functions
194+
195+
### Key Development Notes
196+
- Components are organized by **user mechanics** not technical implementation
197+
- Database schema is managed through Drizzle ORM in `src/core/database/schema.ts`
198+
- All routes have been validated for the user-centric reorganization
199+
- Docker testing environment provides consistent CI/CD integration
200+
- Three.js components use React Three Fiber patterns
201+
- Supabase handles authentication, real-time subscriptions, and data storage
202+
203+
### Testing Strategy
204+
- **Unit tests** focus on individual component logic and utilities
205+
- **E2E tests** cover complete user workflows and integration scenarios
206+
- **Docker profiles** enable different testing scopes (unit, e2e, combined)
207+
- Tests can skip user creation with `SKIP_USER_CREATION_TESTS=true`

app/activity/deploy/page.tsx

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { useRouter } from "next/navigation"
55
import { AvatarGenerator } from "@/src/components/profile/setup/Avatar"
66
import DeployTelescopeViewport from "@/src/components/ui/scenes/deploy/TelescopeViewportRange"
77
import { Button } from "@/src/components/ui/button"
8-
import { useSession } from "@supabase/auth-helpers-react"
8+
import { useSession, useSupabaseClient } from "@supabase/auth-helpers-react"
99
import { ArrowLeft, User, Sun, Moon } from "lucide-react"
1010
import { useEffect, useState } from "react"
1111
import { Switch } from "@/src/components/ui/switch"
@@ -14,7 +14,36 @@ import UseDarkMode from "@/src/shared/hooks/useDarkMode"
1414
export default function NewDeployPage() {
1515
const router = useRouter()
1616
const session = useSession()
17+
const supabase = useSupabaseClient()
1718
const { isDark, toggleDarkMode } = UseDarkMode()
19+
const [profileChecked, setProfileChecked] = useState(false)
20+
21+
useEffect(() => {
22+
async function ensureProfile() {
23+
if (!session?.user?.id) return;
24+
// Check if profile exists in Supabase
25+
const { data, error } = await supabase
26+
.from("profiles")
27+
.select("id")
28+
.eq("id", session.user.id)
29+
.single();
30+
if (!data) {
31+
// Create profile if not exists
32+
const { error: insertError } = await supabase
33+
.from("profiles")
34+
.insert({ id: session.user.id });
35+
if (insertError) {
36+
console.error("Error creating profile:", insertError.message);
37+
}
38+
}
39+
setProfileChecked(true);
40+
}
41+
ensureProfile();
42+
}, [session, supabase]);
43+
44+
if (!profileChecked) {
45+
return <div className="h-screen w-full flex items-center justify-center bg-gradient-to-b from-[#002439] to-[#001a2a] text-white text-lg">Preparing your profile...</div>;
46+
}
1847

1948
return (
2049
<div className="h-screen w-full flex flex-col bg-gradient-to-b from-[#002439] to-[#001a2a] overflow-hidden">

0 commit comments

Comments
 (0)