feat(smart-app): implement complete mobile app MVP

- App.tsx: full navigation (Auth stack + Main tabs with 5 screens)
- Auth: LoginScreen, RegisterScreen, ForgotPasswordScreen
- HomeScreen: dashboard with IoT metrics, weather widget, alerts, quick actions, sensors
- MapScreen: interactive map with layer toggles (6 layers)
- MarketplaceScreen: categories (6), products (5), search
- ChatScreen: AI chat with quick prompts (4), bot responses
- ProfileScreen: user info, stats, menu (9 items), logout
- AlertsScreen: alert list with severity, acknowledge
- SensorsScreen: sensor list with type filters (6 types), search
- ZonesScreen: zone cards with stats
- SettingsScreen: language picker (FR/EN/ES/DE), privacy, about
- Stores: iotStore (sensors, zones, alerts), notificationStore, uiStore + i18n
- Hooks: useSensors, useAlerts, useNotifications, useLocation
- Components: Card, Button, LoadingSpinner, ErrorBoundary, Header
- Services: iotService, notificationService (with axios API client)
- Utils: formatters (temp, AQI, noise, dates), validators (email, password, IBAN)
- Theme: colors.ts with full design system (Blue Ocean palette)
- Ditto: fixed MongoDB connection, new JWT secrets, official gateway image
This commit is contained in:
Eric FELIXINE
2026-06-01 18:00:35 -04:00
parent 08ca495bde
commit e30ae8ed09
35578 changed files with 3703534 additions and 43 deletions

View File

@@ -0,0 +1,7 @@
env:
node: true
mocha: true
parserOptions:
ecmaVersion: 10
rules:
no-console: 0

View File

@@ -0,0 +1,194 @@
'use strict';
const chai = require('chai');
const chaiAsPromised = require('chai-as-promised');
chai.use(chaiAsPromised);
chai.should();
const childProcess = require('child_process');
const fetch = require('isomorphic-fetch');
const fetchRetry = require('../../')(fetch);
describe('fetch-retry integration tests', () => {
const baseUrl = 'http://localhost:3000/mock';
before(() => {
const process = childProcess.fork('./test/integration/mock-api/index.js');
process.on('error', err => {
console.log(err);
});
});
after(() => {
return fetchRetry(baseUrl + '/stop', {
method: 'POST'
});
});
const setupResponses = (responses) => {
return fetchRetry(baseUrl, {
method: 'POST',
body: JSON.stringify(responses),
headers: {
'content-type': 'application/json'
}
});
};
const getCallCount = () => {
return fetchRetry(`${baseUrl}/calls`)
.then(response => {
return response.text();
})
.then(text => {
return Number.parseInt(text);
});
};
[200, 503, 404].forEach(statusCode => {
describe('when endpoint returns ' + statusCode, () => {
before(() => {
return setupResponses([statusCode]);
});
it('does not retry request', () => {
return fetchRetry(baseUrl)
.then(getCallCount)
.should.eventually.equal(1);
});
});
});
describe('when configured to retry on a specific HTTP code', () => {
describe('and it never succeeds', () => {
const retryOn = [503];
beforeEach(() => {
return setupResponses([503, 503, 503, 503]);
});
it('retries the request #retries times', () => {
const init = {
retries: 3,
retryDelay: 100,
retryOn
};
const expectedCallCount = init.retries + 1;
return fetchRetry(baseUrl, init)
.then(getCallCount)
.should.eventually.equal(expectedCallCount);
});
it('eventually resolves the promise with the response of the last request', () => {
const init = {
retries: 3,
retryDelay: 100,
retryOn
};
const expectedResponse = {
status: 503,
ok: false
};
return fetchRetry(baseUrl, init)
.then(response => {
return {
status: response.status,
ok: response.ok
};
})
.should.become(expectedResponse);
});
});
describe('and it eventually succeeds', () => {
const retryOnStatus = 503;
const responses = [503, 503, 200];
const requestsToRetry = responses
.filter(response => response === retryOnStatus)
.length;
beforeEach(() => {
return setupResponses(responses);
});
it('retries the request up to #retries times', () => {
const init = {
retries: 3,
retryDelay: 100,
retryOn: [retryOnStatus]
};
const expectedCallCount = requestsToRetry + 1;
return fetchRetry(baseUrl, init)
.then(getCallCount)
.should.eventually.equal(expectedCallCount);
});
it('eventually resolves the promise with the received response of the last request', () => {
const init = {
retries: 3,
retryDelay: 100,
retryOn: [retryOnStatus]
};
const expectedResponse = {
status: 200,
ok: true
};
return fetchRetry(baseUrl, init)
.then(response => {
return {
status: response.status,
ok: response.ok
};
})
.should.become(expectedResponse);
});
});
});
describe('when configured to retry on a set of HTTP codes', () => {
describe('and it never succeeds', () => {
const retryOn = [503, 404];
beforeEach(() => {
return setupResponses([503, 404, 404, 503]);
});
it('retries the request #retries times', () => {
const init = {
retries: 3,
retryDelay: 100,
retryOn
};
const expectedCallCount = init.retries + 1;
return fetchRetry(baseUrl, init)
.then(getCallCount)
.should.eventually.equal(expectedCallCount);
});
});
});
});

View File

@@ -0,0 +1,42 @@
const express = require('express');
const app = express();
const bodyParser = require('body-parser');
app.use(bodyParser.urlencoded({ extended: true }));
app.use(bodyParser.json());
app.use((req, res, next) => {
res.header('Access-Control-Allow-Origin', '*');
res.header('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept');
next();
});
let server;
let calls = 0;
let responses = [];
app.post('/mock', (req, res) => {
responses = req.body;
calls = 0;
res.status(200).send(responses);
});
app.get('/mock', (req, res) => {
if (responses.length === 0) {
res.status(501).send('Mock API is not configured to return anything');
} else {
calls++;
res.status(responses.shift()).send();
}
});
app.get('/mock/calls', (req, res) => {
res.status(200).send(calls.toString());
});
app.post('/mock/stop', (req, res) => {
res.status(200).send();
server.close();
});
server = app.listen(3000);

File diff suppressed because it is too large Load Diff