From 8fd3089876faca48241d4e65d5348b761b6d36f5 Mon Sep 17 00:00:00 2001 From: Maxim Date: Tue, 14 Jan 2025 00:37:03 +0300 Subject: [PATCH] Review changes --- .../src/components/layouts/MainLayout.tsx | 9 ++--- src/frontend/overlay/src/config.ts | 33 ++++++++++++++++++- 2 files changed, 37 insertions(+), 5 deletions(-) diff --git a/src/frontend/overlay/src/components/layouts/MainLayout.tsx b/src/frontend/overlay/src/components/layouts/MainLayout.tsx index ba0c0e3f..49e1ae09 100644 --- a/src/frontend/overlay/src/components/layouts/MainLayout.tsx +++ b/src/frontend/overlay/src/components/layouts/MainLayout.tsx @@ -116,6 +116,7 @@ export const MainLayout = () => { {Object.values(widgets).map((obj) => { const Widget = WIDGETS[obj.type]; + const location = c.WIDGET_POSITIONS[obj.widgetLocationId]; if (Widget === undefined) { return null; } @@ -132,10 +133,10 @@ export const MainLayout = () => { return {state => state !== "exited" && } override - An object containing override values for configuration keys. + * @returns {Record} A proxy object that supports reading and writing nested properties, + * including dotted paths like "a.b.c". + * + * **How it works**: + * - On `get`: if `target[key]` is not found, it checks if the key is dotted (e.g. "a.b"). + * If yes, it extracts the prefix ("a"), looks for any sub-object proxy, and then delegates the remainder ("b") to that sub-proxy. + * - On `set`: if the value being set is an object, it recursively wraps it in another proxy, merging any override values that match the dotted path prefix. + * + * **Usage example**: + * ```js + * const config = createProxy({ + * "featureA.enabled": true, + * "featureB.options": { debug: false } + * }); + * + * // Accessing a nested path via dot-notation: + * config["featureA.enabled"] // true + * + * // Setting a nested object: + * config.featureB = { options: { debug: true, logLevel: 2 } }; + * + * // Now config.featureB.options will return { debug: true, logLevel: 2 } + * ``` + * + * **Potential errors**: + * - If you pass in non-object overrides or non-serializable data, it may behave unexpectedly. + * - Dot notation relies on the first segment being used as the 'prefix' for the sub-object. Make sure your keys are well-formed. + */ function createProxy( override, // No known way to infer types from assignment yet.