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,72 @@
# appdirsjs
[![GitHub Workflow Status](https://img.shields.io/github/workflow/status/codingjerk/appdirsjs/ci)](https://github.com/codingjerk/appdirsjs/actions)
[![Codecov](https://img.shields.io/codecov/c/gh/codingjerk/appdirsjs)](https://codecov.io/gh/codingjerk/appdirsjs)
[![npm](https://img.shields.io/npm/v/appdirsjs)](https://www.npmjs.com/package/appdirsjs)
[![npm bundle size](https://img.shields.io/bundlephobia/min/appdirsjs)](https://www.npmjs.com/package/appdirsjs)
[![GitHub](https://img.shields.io/badge/license-MIT-blue)](https://github.com/codingjerk/appdirsjs/blob/master/_LICENSE.md)
A node.js library to get paths to directories to store configs, caches and data according to OS standarts.
## Installation
```sh
npm install appdirsjs
```
or
```sh
yarn install appdirsjs
```
if you're using yarn.
## Usage
```javascript
import appDirs from "appdirsjs";
const dirs = appDirs({ appName: "expo" });
console.log(dirs.cache);
// /home/user/.cache/expo on Linux
// /Users/User/Library/Caches/expo on MacOS
// C:\Users\User\AppData\Local\Temp\expo on Windows
console.log(dirs.config);
// /home/user/.config/expo on Linux
// /Users/User/Library/Preferences/expo on MacOS
// C:\Users\User\AppData\Roaming\expo
console.log(dirs.data);
// /home/user/.local/share/expo on Linux
// /Users/User/Library/Application Support/expo on MacOS
// C:\Users\User\AppData\Local\expo
```
### Keep backward compability
Then switching from old-style dotfile directory,
such as `~/.myapp` to new, like `~/.config/myapp`,
you can pass `legacyPath` parameter
to keep using old directory if it exists:
```javascript
import * as path from "path";
import appDirs from "appdirsjs";
const dirs = appDirs({
appName: "expo",
// Notice usage of full path
legacyPath: path.join(os.homedir(), ".expo"),
});
console.log(dirs.config);
// /home/user/.expo
```
## TODO
- [ ] Android support
- [ ] XDG on BSD support

View File

@@ -0,0 +1,32 @@
declare type Options = {
appName: string;
legacyPath?: string;
};
declare type Directories = {
cache: string;
config: string;
data: string;
runtime?: string;
};
/**
* Returns application-specific paths for directories.
*
* For Linux, it returns paths according to
* [XDG Base Directory Specification](https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html)
*
* For MacOS, it returns paths according to
* [Apple Technical Q&A](https://developer.apple.com/library/archive/qa/qa1170/_index.html#//apple_ref/doc/uid/DTS10001702)
*
* For Windows, it returns paths according to
* [Stackoverflow's answer](https://stackoverflow.com/questions/43853548/xdg-basedir-directories-for-windows)
*
* Specific information about each OS can be found
* in corresponding functions.
*
* @param appName Application name
* @param legacyPath Path to provide backward compability
* and not to force users to move files.
* Will be used if exists if filesystem.
*/
export default function appDirs(options: Options): Directories;
export {};

View File

@@ -0,0 +1,105 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const fs = require("fs");
const os = require("os");
const path = require("path");
/**
* Returns application-specific paths for directories.
*
* For Linux, it returns paths according to
* [XDG Base Directory Specification](https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html)
*
* For MacOS, it returns paths according to
* [Apple Technical Q&A](https://developer.apple.com/library/archive/qa/qa1170/_index.html#//apple_ref/doc/uid/DTS10001702)
*
* For Windows, it returns paths according to
* [Stackoverflow's answer](https://stackoverflow.com/questions/43853548/xdg-basedir-directories-for-windows)
*
* Specific information about each OS can be found
* in corresponding functions.
*
* @param appName Application name
* @param legacyPath Path to provide backward compability
* and not to force users to move files.
* Will be used if exists if filesystem.
*/
function appDirs(options) {
if (process.platform === "linux") {
return linux(options);
}
else if (process.platform === "win32") {
return windows(options);
}
else if (process.platform === "darwin") {
return macos(options);
}
return fallback(options);
}
exports.default = appDirs;
function fallback({ appName, legacyPath }) {
console.warn(`[appdirsjs]: can't get directories for "${process.platform}" platform, using fallback values`);
function fallbackPath() {
if (legacyPath) {
return legacyPath;
}
// Sane default for Unix-like systems
return path.join(os.homedir(), "." + appName);
}
return Object.freeze({
cache: fallbackPath(),
config: fallbackPath(),
data: fallbackPath(),
});
}
function linux({ appName, legacyPath }) {
const home = os.homedir();
const env = process.env;
const uid = (process.getuid !== undefined)
? process.getuid()
: "unknown-uid";
function xdgPath(allowLegacy, env, defaultRoot) {
if (allowLegacy && legacyPath && fs.existsSync(legacyPath)) {
return legacyPath;
}
const root = env || defaultRoot;
return path.join(root, appName);
}
return Object.freeze({
cache: xdgPath(true, env.XDG_CACHE_HOME, path.join(home, ".cache")),
config: xdgPath(true, env.XDG_CONFIG_HOME, path.join(home, ".config")),
data: xdgPath(true, env.XDG_DATA_HOME, path.join(home, ".local", "share")),
runtime: xdgPath(false, env.XDG_RUNTIME_DIR, path.join("/run", "user", uid.toString())),
});
}
function windows({ appName, legacyPath }) {
if (legacyPath && fs.existsSync(legacyPath)) {
return Object.freeze({
cache: legacyPath,
config: legacyPath,
data: legacyPath,
});
}
const home = os.homedir();
const roamingAppData = process.env.APPDATA || path.join(home, "AppData", "Roaming");
const localAppData = process.env.LOCALAPPDATA || path.join(home, "AppData", "Local");
return Object.freeze({
cache: path.join(localAppData, "Temp", appName),
config: path.join(roamingAppData, appName),
data: path.join(localAppData, appName),
});
}
function macos({ appName, legacyPath }) {
if (legacyPath && fs.existsSync(legacyPath)) {
return Object.freeze({
cache: legacyPath,
config: legacyPath,
data: legacyPath,
});
}
const home = os.homedir();
return Object.freeze({
cache: path.join(home, "Library", "Caches", appName),
config: path.join(home, "Library", "Preferences", appName),
data: path.join(home, "Library", "Application Support", appName),
});
}

View File

@@ -0,0 +1,25 @@
{
"name": "appdirsjs",
"version": "1.2.7",
"description": "OS-dependent application paths for cache, data and config directories",
"license": "MIT",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"files": [
"dist/index.js",
"dist/index.d.ts"
],
"repository": {
"type": "git",
"url": "https://github.com/codingjerk/appdirsjs.git"
},
"devDependencies": {
"@types/jest": "^26.0.15",
"@typescript-eslint/eslint-plugin": "^4.5.0",
"@typescript-eslint/parser": "^4.5.0",
"eslint": "^7.11.0",
"jest": "^26.6.1",
"ts-jest": "^26.4.2",
"typescript": "^4.0.3"
}
}