From d775b657385d4aa1316f6d7311afb37eba44c6fa Mon Sep 17 00:00:00 2001 From: "Navy.gif" Date: Mon, 17 Jul 2023 18:52:55 +0300 Subject: [PATCH] Flag manipulation --- src/@types/ApiStructures.ts | 6 +- src/components/InputElements.tsx | 31 +++--- src/components/PageElements.tsx | 4 +- src/css/index.css | 13 ++- src/css/pages/Admin.css | 7 ++ src/pages/admin/Flags.tsx | 180 +++++++++++++++++++++---------- 6 files changed, 160 insertions(+), 81 deletions(-) diff --git a/src/@types/ApiStructures.ts b/src/@types/ApiStructures.ts index d806d2f..0e3e921 100644 --- a/src/@types/ApiStructures.ts +++ b/src/@types/ApiStructures.ts @@ -54,9 +54,9 @@ export type Role = { rateLimits: RateLimits } & APIEntity -type FlagType = string | number | boolean | number[] | null -type FlagEnv = 'test' | 'prod' -type FlagConsumer = 'client' | 'server' | 'api' +export type FlagType = string | number | boolean | number[] | null +// type FlagEnv = 'test' | 'prod' +// type FlagConsumer = 'client' | 'server' | 'api' export type Flag = { id: string, diff --git a/src/components/InputElements.tsx b/src/components/InputElements.tsx index a6ffd63..c58ffdb 100644 --- a/src/components/InputElements.tsx +++ b/src/components/InputElements.tsx @@ -50,25 +50,27 @@ export type InputElementProperties = { inputRef?: React.RefObject, onChange?: React.ChangeEventHandler, children?: React.ReactNode, //JSX.Element | JSX.Element[] | string, - placeholder?: string + placeholder?: string, + required?: boolean, + name?: string } -export const ToggleSwitch = ({ value, onChange, inputRef, children }: InputElementProperties) => +export const ToggleSwitch = ({ name, value, onChange, inputRef, children }: InputElementProperties) => { return ; }; -export const VerticalToggleSwitch = ({ value, onChange, inputRef, children }: InputElementProperties) => +export const VerticalToggleSwitch = ({ name, value, onChange, inputRef, children }: InputElementProperties) => { return ; }; @@ -82,7 +84,7 @@ type StringInputProperties = { maxLength?: number, minLength?: number } & ManualInputProperties -export const StringInput = ({ value, onChange, inputRef, children, placeholder, onBlur, onKeyUp, minLength, maxLength }: StringInputProperties) => +export const StringInput = ({ name, value, onChange, inputRef, children, placeholder, onBlur, onKeyUp, minLength, maxLength, required = false }: StringInputProperties) => { const input = ; if (children) return