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,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[];
}