- 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
65 lines
1.9 KiB
JavaScript
65 lines
1.9 KiB
JavaScript
/**
|
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*
|
|
* @format
|
|
*/
|
|
|
|
'use strict';
|
|
|
|
module.exports = (moduleName, instanceMethods, isESModule) => {
|
|
const RealComponent = isESModule
|
|
? jest.requireActual(moduleName).default
|
|
: jest.requireActual(moduleName);
|
|
const React = require('react');
|
|
|
|
const SuperClass =
|
|
typeof RealComponent === 'function' ? RealComponent : React.Component;
|
|
|
|
const name =
|
|
RealComponent.displayName ||
|
|
RealComponent.name ||
|
|
(RealComponent.render // handle React.forwardRef
|
|
? RealComponent.render.displayName || RealComponent.render.name
|
|
: 'Unknown');
|
|
|
|
const nameWithoutPrefix = name.replace(/^(RCT|RK)/, '');
|
|
|
|
const Component = class extends SuperClass {
|
|
static displayName = 'Component';
|
|
|
|
render() {
|
|
const props = Object.assign({}, RealComponent.defaultProps);
|
|
|
|
if (this.props) {
|
|
Object.keys(this.props).forEach(prop => {
|
|
// We can't just assign props on top of defaultProps
|
|
// because React treats undefined as special and different from null.
|
|
// If a prop is specified but set to undefined it is ignored and the
|
|
// default prop is used instead. If it is set to null, then the
|
|
// null value overwrites the default value.
|
|
if (this.props[prop] !== undefined) {
|
|
props[prop] = this.props[prop];
|
|
}
|
|
});
|
|
}
|
|
|
|
return React.createElement(nameWithoutPrefix, props, this.props.children);
|
|
}
|
|
};
|
|
|
|
Component.displayName = nameWithoutPrefix;
|
|
|
|
Object.keys(RealComponent).forEach(classStatic => {
|
|
Component[classStatic] = RealComponent[classStatic];
|
|
});
|
|
|
|
if (instanceMethods != null) {
|
|
Object.assign(Component.prototype, instanceMethods);
|
|
}
|
|
|
|
return Component;
|
|
};
|