Skip to content
Open
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
8 changes: 4 additions & 4 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
- **Name:** UFOund it
- **What it is:** UFOund it, is a webapp that displays UFO sightings.
- **Dataset:** [NUFORC](https://nuforc.org/) UFO sightings, CSV in `backend/data/ufo_sightings_scrubbed.csv` (the Kaggle page is gone), approx 80,000 reports, approx 15mb.
- **Current state:** The backend is an Apollo Server with `sightings`, `sighting` and `createSighting`, backed by MySQL on the VM. The search and detail pages fetch sightings through Apollo Client, with search, sort and "load more" pagination done in the database. A temporary footer shows whether the backend is reachable.
- **Current state:** The backend is an Apollo Server with `sightings`, `sighting` and `createSighting`, backed by MySQL on the VM. The search and detail pages fetch sightings through Apollo Client, with search, sort and "load more" pagination done in the database. Each page shows its own loading and error states.
- **Course context:** NTNU IT2810 project. Must be reproducible, accessible and sustainable.

## Tech stack
Expand Down Expand Up @@ -43,8 +43,8 @@ python3 backend/data/cleanAndInsertDatatoDb.py insert
npm run dev:backend

# If port 3001 is taken, move both to another port. The frontend's
# BACKEND_PORT must match the backend's PORT, or the footer shows
# "Backend: unavailable".
# BACKEND_PORT must match the backend's PORT so Vite proxies GraphQL
# requests to the correct port.
PORT=3002 npm run dev:backend
BACKEND_PORT=3002 npm run dev

Expand Down Expand Up @@ -80,7 +80,7 @@ npm run test:watch
```
frontend/
src/
components/ Reusable UI (Banner, SearchBar, SightingList, SightingMap, LocationPicker, BackendStatus)
components/ Reusable UI (Banner, SearchBar, SightingList, SightingMap, LocationPicker)
pages/ Route-level components (SearchPage, SightingDetailPage, SubmitSightingPage)
hooks/ Custom hooks (debounce, sighting search, single sighting)
utils/ Pure helpers (formatting)
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,10 @@ npm run dev
```

Open the address Vite prints, usually http://localhost:5173/project2/. Vite
forwards `/project2/graphql` to the backend, so no CORS setup is needed. The
footer shows "Backend: unavailable" if the backend is not running or is on
another port. If port 3001 is taken, run `PORT=3002 npm run dev:backend` and
`BACKEND_PORT=3002 npm run dev`.
forwards `/project2/graphql` to the backend, so no CORS setup is needed.
Pages show their own error states if requests fail. If port 3001 is taken,
run `PORT=3002 npm run dev:backend` and `BACKEND_PORT=3002 npm run dev`
so Vite forwards requests to the correct backend port.

### Other commands

Expand Down
4 changes: 0 additions & 4 deletions frontend/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { lazy, Suspense } from 'react'
import { Route, Routes } from 'react-router'
import BackendStatus from './components/BackendStatus'
import Banner from './components/Banner'
import SearchPage from './pages/SearchPage'
import './App.css'
Expand All @@ -23,9 +22,6 @@ function App() {
</Routes>
</Suspense>
</main>
<footer>
<BackendStatus />
</footer>
</>
)
}
Expand Down
10 changes: 0 additions & 10 deletions frontend/src/components/BackendStatus.css

This file was deleted.

25 changes: 0 additions & 25 deletions frontend/src/components/BackendStatus.tsx

This file was deleted.

14 changes: 0 additions & 14 deletions frontend/src/graphql/queries.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,6 @@
import { gql, type TypedDocumentNode } from '@apollo/client'
import type { SightingSortEnum, UfoSighting } from '../types/ufo-sighting'

interface HealthQueryData {
health: string
}

/**
* Asks the backend's placeholder health field, to check that the frontend
* can reach it. The type parameters let useQuery know the shape of `data`.
*/
export const HEALTH_QUERY: TypedDocumentNode<HealthQueryData> = gql`
query Health {
health
}
`

export interface SightingsQueryData {
sightings: {
edges: { cursor: string; node: UfoSighting }[]
Expand Down
52 changes: 0 additions & 52 deletions frontend/src/tests/BackendStatus.test.tsx

This file was deleted.