- 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
2.2 KiB
TypeScript
65 lines
2.2 KiB
TypeScript
type RemoveFromTuple<
|
|
Tuple extends readonly unknown[],
|
|
RemoveCount extends number,
|
|
Index extends 1[] = []
|
|
> = Index["length"] extends RemoveCount
|
|
? Tuple
|
|
: Tuple extends [infer First, ...infer Rest]
|
|
? RemoveFromTuple<Rest, RemoveCount, [...Index, 1]>
|
|
: Tuple;
|
|
|
|
type ConcatTuples<
|
|
Prefix extends readonly unknown[],
|
|
Suffix extends readonly unknown[]
|
|
> = [...Prefix, ...Suffix];
|
|
|
|
type ExtractFunctionParams<T> = T extends (this: infer TThis, ...args: infer P extends readonly unknown[]) => infer R
|
|
? { thisArg: TThis; params: P; returnType: R }
|
|
: never;
|
|
|
|
type BindFunction<
|
|
T extends (this: any, ...args: any[]) => any,
|
|
TThis,
|
|
TBoundArgs extends readonly unknown[],
|
|
ReceiverBound extends boolean
|
|
> = ExtractFunctionParams<T> extends {
|
|
thisArg: infer OrigThis;
|
|
params: infer P extends readonly unknown[];
|
|
returnType: infer R;
|
|
}
|
|
? ReceiverBound extends true
|
|
? (...args: RemoveFromTuple<P, Extract<TBoundArgs["length"], number>>) => R extends [OrigThis, ...infer Rest]
|
|
? [TThis, ...Rest] // Replace `this` with `thisArg`
|
|
: R
|
|
: <U, RemainingArgs extends RemoveFromTuple<P, Extract<TBoundArgs["length"], number>>>(
|
|
thisArg: U,
|
|
...args: RemainingArgs
|
|
) => R extends [OrigThis, ...infer Rest]
|
|
? [U, ...ConcatTuples<TBoundArgs, Rest>] // Preserve bound args in return type
|
|
: R
|
|
: never;
|
|
|
|
declare function callBind<
|
|
const T extends (this: any, ...args: any[]) => any,
|
|
Extracted extends ExtractFunctionParams<T>,
|
|
const TBoundArgs extends Partial<Extracted["params"]> & readonly unknown[],
|
|
const TThis extends Extracted["thisArg"]
|
|
>(
|
|
args: [fn: T, thisArg: TThis, ...boundArgs: TBoundArgs]
|
|
): BindFunction<T, TThis, TBoundArgs, true>;
|
|
|
|
declare function callBind<
|
|
const T extends (this: any, ...args: any[]) => any,
|
|
Extracted extends ExtractFunctionParams<T>,
|
|
const TBoundArgs extends Partial<Extracted["params"]> & readonly unknown[]
|
|
>(
|
|
args: [fn: T, ...boundArgs: TBoundArgs]
|
|
): BindFunction<T, Extracted["thisArg"], TBoundArgs, false>;
|
|
|
|
declare function callBind<const TArgs extends readonly unknown[]>(
|
|
args: [fn: Exclude<TArgs[0], Function>, ...rest: TArgs]
|
|
): never;
|
|
|
|
// export as namespace callBind;
|
|
export = callBind;
|