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,6 @@
export declare const IMAGE_TYPES: string[];
export declare const FONT_TYPES: string[];
export declare const MEDIA_TYPES: string[];
export declare const ACCEPTED_TYPES: string[];
export declare function resolveAssetPaths(assets: string[], projectRoot: string): Promise<string[]>;
export declare function validateAssets(assets: string[]): string[];

View File

@@ -0,0 +1,42 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.validateAssets = exports.resolveAssetPaths = exports.ACCEPTED_TYPES = exports.MEDIA_TYPES = exports.FONT_TYPES = exports.IMAGE_TYPES = void 0;
const promises_1 = __importDefault(require("fs/promises"));
const path_1 = __importDefault(require("path"));
exports.IMAGE_TYPES = ['.png', '.jpg', '.gif'];
exports.FONT_TYPES = ['.otf', '.ttf'];
exports.MEDIA_TYPES = ['.mp4', '.mp3', '.lottie'];
exports.ACCEPTED_TYPES = ['.json', '.db', ...exports.IMAGE_TYPES, ...exports.MEDIA_TYPES, ...exports.FONT_TYPES];
async function resolveAssetPaths(assets, projectRoot) {
const promises = assets.map(async (p) => {
const resolvedPath = path_1.default.resolve(projectRoot, p);
const stat = await promises_1.default.stat(resolvedPath);
if (stat.isDirectory()) {
const dir = await promises_1.default.readdir(resolvedPath);
return dir.map((file) => path_1.default.join(resolvedPath, file));
}
return [resolvedPath];
});
return (await Promise.all(promises)).flat();
}
exports.resolveAssetPaths = resolveAssetPaths;
function validateAssets(assets) {
return assets.filter((asset) => {
const ext = path_1.default.extname(asset);
const accepted = exports.ACCEPTED_TYPES.includes(ext);
const isFont = exports.FONT_TYPES.includes(ext);
if (!accepted) {
console.warn(`\`${ext}\` is not a supported asset type`);
return;
}
if (isFont) {
console.warn(`Fonts are not supported with the \`expo-asset\` plugin. Please use \`expo-font\` for this functionality. Ignoring ${asset}`);
return;
}
return asset;
});
}
exports.validateAssets = validateAssets;

View File

@@ -0,0 +1,6 @@
import { ConfigPlugin } from 'expo/config-plugins';
export type AssetProps = {
assets?: string[];
};
declare const _default: ConfigPlugin<AssetProps | null>;
export default _default;

View File

@@ -0,0 +1,18 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const config_plugins_1 = require("expo/config-plugins");
const withAssetsAndroid_1 = require("./withAssetsAndroid");
const withAssetsIos_1 = require("./withAssetsIos");
const pkg = require('expo-asset/package.json');
const withAssets = (config, props) => {
if (!props) {
return config;
}
if (props.assets && props.assets.length === 0) {
return config;
}
config = (0, withAssetsIos_1.withAssetsIos)(config, props.assets ?? []);
config = (0, withAssetsAndroid_1.withAssetsAndroid)(config, props.assets ?? []);
return config;
};
exports.default = (0, config_plugins_1.createRunOncePlugin)(withAssets, pkg.name, pkg.version);

View File

@@ -0,0 +1,2 @@
import { ConfigPlugin } from 'expo/config-plugins';
export declare const withAssetsAndroid: ConfigPlugin<string[]>;

View File

@@ -0,0 +1,48 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.withAssetsAndroid = void 0;
const config_plugins_1 = require("expo/config-plugins");
const fs_1 = __importDefault(require("fs"));
const promises_1 = __importDefault(require("fs/promises"));
const path_1 = __importDefault(require("path"));
const utils_1 = require("./utils");
const withAssetsAndroid = (config, assets) => {
return (0, config_plugins_1.withDangerousMod)(config, [
'android',
async (config) => {
const resolvedAssets = await (0, utils_1.resolveAssetPaths)(assets, config.modRequest.projectRoot);
const validAssets = (0, utils_1.validateAssets)(resolvedAssets);
validAssets.forEach((asset) => {
const assetsDir = getAssetDir(asset, config.modRequest.platformProjectRoot);
fs_1.default.mkdirSync(assetsDir, { recursive: true });
});
await Promise.all(validAssets.map(async (asset) => {
const assetsDir = getAssetDir(asset, config.modRequest.platformProjectRoot);
const output = path_1.default.join(assetsDir, path_1.default.basename(asset));
await promises_1.default.copyFile(asset, output);
}));
return config;
},
]);
};
exports.withAssetsAndroid = withAssetsAndroid;
function getAssetDir(asset, root) {
const assetPath = ['app', 'src', 'main', 'assets'];
const resPath = ['app', 'src', 'main', 'res'];
const ext = path_1.default.extname(asset);
if (utils_1.IMAGE_TYPES.includes(ext)) {
return path_1.default.join(root, ...resPath, 'drawable');
}
else if (utils_1.FONT_TYPES.includes(ext)) {
return path_1.default.join(root, ...assetPath, 'fonts');
}
else if (utils_1.MEDIA_TYPES.includes(ext)) {
return path_1.default.join(root, ...resPath, 'raw');
}
else {
return path_1.default.join(root, ...assetPath);
}
}

View File

@@ -0,0 +1,2 @@
import { ConfigPlugin } from 'expo/config-plugins';
export declare const withAssetsIos: ConfigPlugin<string[]>;

View File

@@ -0,0 +1,82 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.withAssetsIos = void 0;
const image_utils_1 = require("@expo/image-utils");
const AssetContents_1 = require("@expo/prebuild-config/build/plugins/icons/AssetContents");
const config_plugins_1 = require("expo/config-plugins");
const fs_extra_1 = require("fs-extra");
const path_1 = __importDefault(require("path"));
const utils_1 = require("./utils");
const IMAGE_DIR = 'Images.xcassets';
const withAssetsIos = (config, assets) => {
config = addAssetsToTarget(config, assets);
return config;
};
exports.withAssetsIos = withAssetsIos;
function addAssetsToTarget(config, assets) {
return (0, config_plugins_1.withXcodeProject)(config, async (config) => {
const resolvedAssets = await (0, utils_1.resolveAssetPaths)(assets, config.modRequest.projectRoot);
const validAssets = (0, utils_1.validateAssets)(resolvedAssets);
const project = config.modResults;
const platformProjectRoot = config.modRequest.platformProjectRoot;
config_plugins_1.IOSConfig.XcodeUtils.ensureGroupRecursively(project, 'Resources');
const images = validAssets.filter((asset) => utils_1.IMAGE_TYPES.includes(path_1.default.extname(asset)));
const assetsForResourcesDir = validAssets.filter((asset) => !utils_1.IMAGE_TYPES.includes(path_1.default.extname(asset)));
await addImageAssets(images, config.modRequest.projectRoot);
addResourceFiles(project, platformProjectRoot, assetsForResourcesDir);
return config;
});
}
function addResourceFiles(project, platformRoot, assets) {
for (const asset of assets) {
const assetPath = path_1.default.relative(platformRoot, asset);
config_plugins_1.IOSConfig.XcodeUtils.addResourceFileToGroup({
filepath: assetPath,
groupName: 'Resources',
project,
isBuildFile: true,
verbose: true,
});
}
}
async function addImageAssets(assets, root) {
const iosNamedProjectRoot = config_plugins_1.IOSConfig.Paths.getSourceRoot(root);
for (const asset of assets) {
const name = path_1.default.basename(asset, path_1.default.extname(asset));
const image = path_1.default.basename(asset);
const assetPath = path_1.default.resolve(iosNamedProjectRoot, `${IMAGE_DIR}/${name}.imageset`);
await (0, fs_extra_1.ensureDir)(assetPath);
const buffer = await (0, image_utils_1.generateImageAsync)({ projectRoot: root }, {
src: asset,
});
await (0, fs_extra_1.writeFile)(path_1.default.resolve(assetPath, image), buffer.source);
await writeContentsJsonFileAsync({
assetPath,
image,
});
}
}
async function writeContentsJsonFileAsync({ assetPath, image, }) {
const images = buildContentsJsonImages({ image });
await (0, AssetContents_1.writeContentsJsonAsync)(assetPath, { images });
}
function buildContentsJsonImages({ image }) {
return [
(0, AssetContents_1.createContentsJsonItem)({
idiom: 'universal',
filename: image,
scale: '1x',
}),
(0, AssetContents_1.createContentsJsonItem)({
idiom: 'universal',
scale: '2x',
}),
(0, AssetContents_1.createContentsJsonItem)({
idiom: 'universal',
scale: '3x',
}),
];
}

View File

@@ -0,0 +1,41 @@
import fs from 'fs/promises';
import path from 'path';
export const IMAGE_TYPES = ['.png', '.jpg', '.gif'];
export const FONT_TYPES = ['.otf', '.ttf'];
export const MEDIA_TYPES = ['.mp4', '.mp3', '.lottie'];
export const ACCEPTED_TYPES = ['.json', '.db', ...IMAGE_TYPES, ...MEDIA_TYPES, ...FONT_TYPES];
export async function resolveAssetPaths(assets: string[], projectRoot: string) {
const promises = assets.map(async (p) => {
const resolvedPath = path.resolve(projectRoot, p);
const stat = await fs.stat(resolvedPath);
if (stat.isDirectory()) {
const dir = await fs.readdir(resolvedPath);
return dir.map((file) => path.join(resolvedPath, file));
}
return [resolvedPath];
});
return (await Promise.all(promises)).flat();
}
export function validateAssets(assets: string[]) {
return assets.filter((asset) => {
const ext = path.extname(asset);
const accepted = ACCEPTED_TYPES.includes(ext);
const isFont = FONT_TYPES.includes(ext);
if (!accepted) {
console.warn(`\`${ext}\` is not a supported asset type`);
return;
}
if (isFont) {
console.warn(
`Fonts are not supported with the \`expo-asset\` plugin. Please use \`expo-font\` for this functionality. Ignoring ${asset}`
);
return;
}
return asset;
});
}

View File

@@ -0,0 +1,27 @@
import { ConfigPlugin, createRunOncePlugin } from 'expo/config-plugins';
import { withAssetsAndroid } from './withAssetsAndroid';
import { withAssetsIos } from './withAssetsIos';
const pkg = require('expo-asset/package.json');
export type AssetProps = {
assets?: string[];
};
const withAssets: ConfigPlugin<AssetProps | null> = (config, props) => {
if (!props) {
return config;
}
if (props.assets && props.assets.length === 0) {
return config;
}
config = withAssetsIos(config, props.assets ?? []);
config = withAssetsAndroid(config, props.assets ?? []);
return config;
};
export default createRunOncePlugin(withAssets, pkg.name, pkg.version);

View File

@@ -0,0 +1,46 @@
import { ConfigPlugin, withDangerousMod } from 'expo/config-plugins';
import fs from 'fs';
import fsp from 'fs/promises';
import path from 'path';
import { FONT_TYPES, IMAGE_TYPES, MEDIA_TYPES, resolveAssetPaths, validateAssets } from './utils';
export const withAssetsAndroid: ConfigPlugin<string[]> = (config, assets) => {
return withDangerousMod(config, [
'android',
async (config) => {
const resolvedAssets = await resolveAssetPaths(assets, config.modRequest.projectRoot);
const validAssets = validateAssets(resolvedAssets);
validAssets.forEach((asset) => {
const assetsDir = getAssetDir(asset, config.modRequest.platformProjectRoot);
fs.mkdirSync(assetsDir, { recursive: true });
});
await Promise.all(
validAssets.map(async (asset) => {
const assetsDir = getAssetDir(asset, config.modRequest.platformProjectRoot);
const output = path.join(assetsDir, path.basename(asset));
await fsp.copyFile(asset, output);
})
);
return config;
},
]);
};
function getAssetDir(asset: string, root: string) {
const assetPath = ['app', 'src', 'main', 'assets'];
const resPath = ['app', 'src', 'main', 'res'];
const ext = path.extname(asset);
if (IMAGE_TYPES.includes(ext)) {
return path.join(root, ...resPath, 'drawable');
} else if (FONT_TYPES.includes(ext)) {
return path.join(root, ...assetPath, 'fonts');
} else if (MEDIA_TYPES.includes(ext)) {
return path.join(root, ...resPath, 'raw');
} else {
return path.join(root, ...assetPath);
}
}

View File

@@ -0,0 +1,102 @@
import { ExpoConfig } from '@expo/config-types';
import { ImageOptions, generateImageAsync } from '@expo/image-utils';
import {
ContentsJsonImage,
createContentsJsonItem,
writeContentsJsonAsync,
} from '@expo/prebuild-config/build/plugins/icons/AssetContents';
import { ConfigPlugin, IOSConfig, XcodeProject, withXcodeProject } from 'expo/config-plugins';
import { ensureDir, writeFile } from 'fs-extra';
import path from 'path';
import { IMAGE_TYPES, resolveAssetPaths, validateAssets } from './utils';
const IMAGE_DIR = 'Images.xcassets';
export const withAssetsIos: ConfigPlugin<string[]> = (config, assets) => {
config = addAssetsToTarget(config, assets);
return config;
};
function addAssetsToTarget(config: ExpoConfig, assets: string[]) {
return withXcodeProject(config, async (config) => {
const resolvedAssets = await resolveAssetPaths(assets, config.modRequest.projectRoot);
const validAssets = validateAssets(resolvedAssets);
const project = config.modResults;
const platformProjectRoot = config.modRequest.platformProjectRoot;
IOSConfig.XcodeUtils.ensureGroupRecursively(project, 'Resources');
const images = validAssets.filter((asset) => IMAGE_TYPES.includes(path.extname(asset)));
const assetsForResourcesDir = validAssets.filter(
(asset) => !IMAGE_TYPES.includes(path.extname(asset))
);
await addImageAssets(images, config.modRequest.projectRoot);
addResourceFiles(project, platformProjectRoot, assetsForResourcesDir);
return config;
});
}
function addResourceFiles(project: XcodeProject, platformRoot: string, assets: string[]) {
for (const asset of assets) {
const assetPath = path.relative(platformRoot, asset);
IOSConfig.XcodeUtils.addResourceFileToGroup({
filepath: assetPath,
groupName: 'Resources',
project,
isBuildFile: true,
verbose: true,
});
}
}
async function addImageAssets(assets: string[], root: string) {
const iosNamedProjectRoot = IOSConfig.Paths.getSourceRoot(root);
for (const asset of assets) {
const name = path.basename(asset, path.extname(asset));
const image = path.basename(asset);
const assetPath = path.resolve(iosNamedProjectRoot, `${IMAGE_DIR}/${name}.imageset`);
await ensureDir(assetPath);
const buffer = await generateImageAsync({ projectRoot: root }, {
src: asset,
} as unknown as ImageOptions);
await writeFile(path.resolve(assetPath, image), buffer.source);
await writeContentsJsonFileAsync({
assetPath,
image,
});
}
}
async function writeContentsJsonFileAsync({
assetPath,
image,
}: {
assetPath: string;
image: string;
}) {
const images = buildContentsJsonImages({ image });
await writeContentsJsonAsync(assetPath, { images });
}
function buildContentsJsonImages({ image }: { image: string }): ContentsJsonImage[] {
return [
createContentsJsonItem({
idiom: 'universal',
filename: image,
scale: '1x',
}),
createContentsJsonItem({
idiom: 'universal',
scale: '2x',
}),
createContentsJsonItem({
idiom: 'universal',
scale: '3x',
}),
] as ContentsJsonImage[];
}

View File

@@ -0,0 +1,9 @@
{
"extends": "expo-module-scripts/tsconfig.plugin",
"compilerOptions": {
"outDir": "build",
"rootDir": "src"
},
"include": ["./src"],
"exclude": ["**/__mocks__/*", "**/__tests__/*"]
}