- 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
63 lines
3.1 KiB
JavaScript
63 lines
3.1 KiB
JavaScript
"use strict";
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
exports.default = useLinkBuilder;
|
|
var _core = require("@react-navigation/core");
|
|
var React = _interopRequireWildcard(require("react"));
|
|
var _LinkingContext = _interopRequireDefault(require("./LinkingContext"));
|
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
const getRootStateForNavigate = (navigation, state) => {
|
|
const parent = navigation.getParent();
|
|
if (parent) {
|
|
const parentState = parent.getState();
|
|
return getRootStateForNavigate(parent, {
|
|
index: 0,
|
|
routes: [{
|
|
...parentState.routes[parentState.index],
|
|
state: state
|
|
}]
|
|
});
|
|
}
|
|
return state;
|
|
};
|
|
|
|
/**
|
|
* Build destination link for a navigate action.
|
|
* Useful for showing anchor tags on the web for buttons that perform navigation.
|
|
*/
|
|
function useLinkBuilder() {
|
|
const navigation = React.useContext(_core.NavigationHelpersContext);
|
|
const linking = React.useContext(_LinkingContext.default);
|
|
const buildLink = React.useCallback((name, params) => {
|
|
const {
|
|
options
|
|
} = linking;
|
|
if ((options === null || options === void 0 ? void 0 : options.enabled) === false) {
|
|
return undefined;
|
|
}
|
|
const state = navigation ? getRootStateForNavigate(navigation, {
|
|
index: 0,
|
|
routes: [{
|
|
name,
|
|
params
|
|
}]
|
|
}) :
|
|
// If we couldn't find a navigation object in context, we're at root
|
|
// So we'll construct a basic state object to use
|
|
{
|
|
index: 0,
|
|
routes: [{
|
|
name,
|
|
params
|
|
}]
|
|
};
|
|
const path = options !== null && options !== void 0 && options.getPathFromState ? options.getPathFromState(state, options === null || options === void 0 ? void 0 : options.config) : (0, _core.getPathFromState)(state, options === null || options === void 0 ? void 0 : options.config);
|
|
return path;
|
|
}, [linking, navigation]);
|
|
return buildLink;
|
|
}
|
|
//# sourceMappingURL=useLinkBuilder.js.map
|