Skip to content

Commit 0cec904

Browse files
authored
Merge pull request #18 from StreetSupport/staging
Staging
2 parents c804f65 + 1cf5ab1 commit 0cec904

31 files changed

+7569
-4997
lines changed

.babelrc.js

Lines changed: 0 additions & 7 deletions
This file was deleted.

README.md

Lines changed: 45 additions & 152 deletions
Original file line numberDiff line numberDiff line change
@@ -1,181 +1,74 @@
1+
# Street Support Platform Web
12

2-
# Street Support Network – Website Rebuild
3-
![Build Status](https://github.com/streetsupport/streetsupport-platform-web/actions/workflows/ci.yml/badge.svg)
3+
This is the public-facing platform for the Street Support Network. It helps people find local services, share information, and collaborate across the homelessness sector.
44

5-
This is the future-proof rebuild of the Street Support Network website.
5+
## 🚀 Tech Stack
66

7-
It provides a modular, maintainable platform to help people experiencing or at risk of homelessness find the support they need. The platform is being rebuilt from the ground up using modern technologies, with a focus on accessibility, sustainability, and long-term maintainability.
8-
9-
---
10-
11-
## 🔧 Core Principles
12-
13-
This project is built with the following principles in mind:
14-
15-
-**Test-Driven Development (TDD)**
16-
Write unit, integration, and end-to-end tests from the beginning. CI pipelines enforce test passing before deployment.
17-
18-
-**Mobile-First and Fully Responsive**
19-
Tailwind CSS is used with a mobile-first approach. Layouts scale cleanly with `sm:`, `md:`, `lg:` breakpoints.
20-
21-
-**Built for the Future**
22-
Uses modern frameworks and tools, avoids deprecated libraries, and prioritises code readability and modularity.
23-
24-
-**Accessible and Inclusive**
25-
Meets WCAG 2.1 AA. All pages use semantic HTML, keyboard navigation, appropriate contrast, and alt text.
26-
27-
-**Data-Driven and Impact-Measurable**
28-
Designed to surface insights on usage, service access, and verification timelines through GA4 and event tagging.
29-
30-
---
31-
32-
## 🗂️ Branch Strategy
33-
34-
- `main` – Production-ready, deployable code only
35-
- `staging` – Active development branch. All new features and fixes should branch from here and merge back into staging.
36-
37-
---
38-
39-
## 🚀 Getting Started Locally
7+
- Next.js 15
8+
- React 18
9+
- TypeScript
10+
- Tailwind CSS 4
11+
- Jest + React Testing Library
12+
- JSON-based mock data (used for local development until full CMS/API integration)
13+
- GitHub Actions (CI)
14+
- PowerShell scripts (for development on Windows)
4015

41-
### 1. Fork This Repository
42-
Use the **Fork** button on GitHub.
16+
## 🧪 Testing
4317

44-
### 2. Clone Your Fork
45-
```bash
46-
git clone https://github.com/<your-username>/streetsupport-platform-web.git
47-
cd streetsupport-platform-web
48-
```
18+
This project uses **Jest** and **React Testing Library** for unit and integration tests.
4919

50-
### 3. Set Up Upstream Remote
51-
```bash
52-
git remote add upstream https://github.com/streetsupport/streetsupport-platform-web.git
53-
```
20+
### Running Tests
5421

55-
### 4. Install Dependencies
5622
```bash
57-
npm install
23+
npm run test
5824
```
5925

60-
### 5. Run the Development Server
61-
```bash
62-
npm run dev
63-
```
26+
### Test Setup Highlights
6427

65-
Visit:
66-
```
67-
http://localhost:3000
68-
```
28+
- Babel is configured via `babel.config.json` (not `.js` due to Jest limitations).
29+
- Module path aliases (e.g. `@/components/...`) are resolved using `moduleNameMapper` in `jest.config.cjs`.
30+
- Geolocation and other browser APIs are stubbed or guarded for compatibility.
31+
- The `__mocks__` directory includes mocks for modules like `leaflet` and `react-leaflet`.
6932

70-
---
33+
All tests must pass before merging any pull request into `staging` or `main`.
7134

72-
## 🔄 Keeping Your Fork Up to Date
35+
## 🧱 Admin CMS
7336

74-
```bash
75-
git fetch upstream
76-
git checkout staging
77-
git merge upstream/staging
78-
git push origin staging
79-
```
37+
The admin CMS is developed in a separate repository:
38+
[streetsupport-platform-admin](https://github.com/streetsupport/streetsupport-platform-admin)
8039

81-
---
40+
This manages all partner organisation data and connects to the public platform via API.
8241

83-
## ✅ Deployment
42+
## 📂 Local Development
8443

85-
Deployment is automated via CI/CD:
44+
Mock service data is stored in `data/service-providers.json` and is used by the Find Help search feature.
8645

87-
- `main` → Production
88-
- `staging` → Staging environment
89-
- Preview deployments are created for every PR
46+
To run the project locally:
9047

91-
---
92-
93-
## ⚙️ Contribution Workflow
94-
95-
1. **Branch from `staging`**
96-
```bash
97-
git checkout -b feature/your-feature-name
98-
```
99-
100-
2. **Commit Clearly**
10148
```bash
102-
git commit -m "feat: add filter panel"
103-
```
104-
105-
3. **Push and Open PR**
106-
Target: `streetsupport/streetsupport-platform-web → staging`
107-
108-
4. **Review and Merge**
109-
Reviewed PRs are merged into staging before release to main.
110-
111-
---
112-
113-
## 🛠 Tech Stack
114-
115-
- [Next.js](https://nextjs.org/) (App Router, v15+)
116-
- TypeScript
117-
- Tailwind CSS
118-
- Node.js
119-
- Azure Static Web Apps (planned)
120-
- Google Maps API
121-
- GA4
122-
- WatsonX Virtual Assistant
123-
- JSON-based mock data (temporary until CMS integration)
124-
125-
---
126-
127-
## 📁 Project Structure
128-
129-
```
130-
/src
131-
/app
132-
/api ← Route handlers for mock data (get-services, get-categories)
133-
/[pages] ← Next.js pages and layouts
134-
/components ← UI and layout components (modular)
135-
/data ← Mock data in JSON format
136-
/styles ← Tailwind and legacy SCSS files (migrating gradually)
137-
138-
tailwind.config.js ← Design tokens and theme overrides
139-
postcss.config.js ← Tailwind + PostCSS setup
49+
npm install
50+
npm run dev
14051
```
14152

142-
---
143-
144-
## 📊 Data Model (Temporary)
53+
## 🧭 Project Structure
14554

146-
Data is currently stored as JSON in `/src/data/`:
55+
- `src/components/` – UI components
56+
- `src/contexts/` – React context providers (e.g. `LocationContext`)
57+
- `src/data/` – local JSON data sources for mock services and locations
58+
- `src/pages/` – Next.js pages and routing
59+
- `__mocks__/` – mocks for external libraries used in test environment
14760

148-
- `locations.json`
149-
- `client-groups.json`
150-
- `service-categories.json`
151-
- `service-providers.json`
61+
## 🔄 Git Workflow
15262

153-
Each service provider includes:
154-
- A nested list of services
155-
- A linked category and subcategory
156-
- Postcode, opening hours, and client group support
157-
- Geolocation (latitude, longitude) for map use
63+
See the project instructions for the full GitHub workflow. In short:
15864

159-
Eventually, this will be replaced by dynamic data from the Street Support Network API or CMS.
65+
- Create a new feature branch from `staging`
66+
- Work on that branch
67+
- Create a PR into `streetsupport/streetsupport-platform-web` `staging`
68+
- Merge once tests pass
69+
- Then open a PR from `staging` to `main`
70+
- Finally, sync your fork’s `staging` with upstream
16071

16172
---
16273

163-
## 👥 User Roles (Future CMS)
164-
165-
- **Super Administrator**: Full access
166-
- **Location Administrator**: Manage content in assigned area(s)
167-
- **Organisation Administrator**: Manage their organisation’s data
168-
- **SWEP Administrator**: Control SWEP info and banner visibility
169-
- **Volunteer Administrator**: Read-only access for data comparison
170-
171-
---
172-
173-
## 📄 License
174-
175-
MIT
176-
177-
---
178-
179-
## 🧑‍💻 Maintainers
180-
181-
- [James Cross](https://github.com/James-Cross)
74+
For full developer instructions and context, see the `rebuild-docs.docx` or ask for clarification before making assumptions.

__mocks__/leaflet.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
const L = {
2+
map: jest.fn(() => ({
3+
setView: jest.fn(),
4+
addLayer: jest.fn(),
5+
})),
6+
tileLayer: jest.fn(() => ({
7+
addTo: jest.fn(),
8+
})),
9+
marker: jest.fn(() => ({
10+
addTo: jest.fn(),
11+
})),
12+
Icon: {
13+
Default: function () {}
14+
}
15+
};
16+
17+
L.Icon.Default.prototype = {
18+
_getIconUrl: jest.fn()
19+
};
20+
21+
L.Icon.Default.mergeOptions = jest.fn();
22+
23+
module.exports = L;
24+
module.exports.default = L;

__mocks__/react-leaflet.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
export const MapContainer = ({ children }: any) => <div>{children}</div>;
2+
export const TileLayer = () => <div />;
3+
export const Marker = () => <div />;
4+
export const Popup = ({ children }: any) => <div>{children}</div>;

__mocks__/styleMock.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = {};

babel.config.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"presets": [
3+
["@babel/preset-env", { "targets": { "node": "current" } }],
4+
["@babel/preset-react", { "runtime": "automatic" }],
5+
"@babel/preset-typescript"
6+
],
7+
"plugins": [
8+
[
9+
"module-resolver",
10+
{
11+
"alias": {
12+
"@": "./src"
13+
}
14+
}
15+
]
16+
]
17+
}

eslintignore

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

eslintrc.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
module.exports = {
2+
root: true,
3+
extends: ['next', 'next/core-web-vitals'],
4+
rules: {
5+
// Custom rules can be added here
6+
'react/jsx-key': 'warn',
7+
'no-console': ['warn', { allow: ['warn', 'error'] }],
8+
'@next/next/no-img-element': 'off'
9+
}
10+
};

jest.config.cjs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/** @type {import('jest').Config} */
2+
console.log('[JEST CONFIG] Using CJS config');
3+
4+
module.exports = {
5+
testEnvironment: 'jsdom',
6+
transform: {
7+
'^.+\\.(ts|tsx)$': 'babel-jest',
8+
},
9+
setupFilesAfterEnv: ['<rootDir>/jest.setup.ts'],
10+
moduleNameMapper: {
11+
'^@/(.*)$': '<rootDir>/src/$1', // ← ✅ this is correct
12+
'^leaflet$': '<rootDir>/__mocks__/leaflet.js',
13+
'^react-leaflet$': '<rootDir>/__mocks__/react-leaflet.ts',
14+
'\\.css$': 'identity-obj-proxy',
15+
},
16+
moduleDirectories: ['node_modules', 'src'],
17+
testPathIgnorePatterns: ['<rootDir>/.next/', '<rootDir>/node_modules/'],
18+
transformIgnorePatterns: [
19+
'node_modules/(?!(react-leaflet|@react-leaflet|leaflet|@esm|lodash-es)/)',
20+
],
21+
};

jest.config.ts

Lines changed: 0 additions & 17 deletions
This file was deleted.

0 commit comments

Comments
 (0)