From c36d84b7565f9e3e6e327bfebd75c0da15d56d2d Mon Sep 17 00:00:00 2001 From: "Navy.gif" Date: Mon, 15 May 2023 00:55:27 +0300 Subject: [PATCH] hierarchical flag list structure --- src/@types/ApiStructures.ts | 7 +- src/components/InputElements.tsx | 89 ++++++++++------ src/components/PageElements.tsx | 9 ++ src/css/components/PageElements.css | 4 + src/css/pages/Admin.css | 34 +++++- src/pages/admin/Flags.tsx | 159 ++++++++++++++++++++++------ src/util/Util.ts | 21 +++- 7 files changed, 257 insertions(+), 66 deletions(-) create mode 100644 src/components/PageElements.tsx create mode 100644 src/css/components/PageElements.css diff --git a/src/@types/ApiStructures.ts b/src/@types/ApiStructures.ts index 384f0a7..a45365a 100644 --- a/src/@types/ApiStructures.ts +++ b/src/@types/ApiStructures.ts @@ -61,8 +61,9 @@ type FlagConsumer = 'client' | 'server' | 'api' export type Flag = { id: string, name: string, - env: FlagEnv, - consumer: FlagConsumer, + env: string, //FlagEnv, + consumer: string, // FlagConsumer, value: FlagType, - type: string + type: string, + hierarchy: string } \ No newline at end of file diff --git a/src/components/InputElements.tsx b/src/components/InputElements.tsx index 4171b37..643b36e 100644 --- a/src/components/InputElements.tsx +++ b/src/components/InputElements.tsx @@ -41,8 +41,8 @@ export const FileSelector = ({ cb }: { cb: (file: File) => void }) => { export type InputElementProperties = { value?: T, inputRef?: React.RefObject, - onChange?: React.ChangeEventHandler, - children?: string, + onChange?: React.ChangeEventHandler, + children?: React.ReactNode, //JSX.Element | JSX.Element[] | string, placeholder?: string } @@ -78,19 +78,23 @@ type StringInputProperties = { minLength?: number } & ManualInputProperties export const StringInput = ({ value, onChange, inputRef, children, placeholder, onBlur, onKeyUp, minLength, maxLength }: StringInputProperties) => { - return ; + + const input = ; + if (children) + return ; + return input; }; export type NumberInputProperties = { @@ -106,23 +110,48 @@ export const NumberInput = ({ children, placeholder, inputRef, onChange, value, else if (type === 'int') step = 1; else step = 1; } - return