-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/main' into release/v3.0.0
- Loading branch information
Showing
18 changed files
with
641 additions
and
460 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 0 additions & 42 deletions
42
src/components/FormFields/ConfigurationFieldExplanation/index.jsx
This file was deleted.
Oops, something went wrong.
51 changes: 51 additions & 0 deletions
51
src/components/FormFields/ConfigurationFieldExplanation/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import React, { useMemo } from 'react'; | ||
import { InfoIcon } from '@chakra-ui/icons'; | ||
import { Tooltip } from '@chakra-ui/react'; | ||
import { useAuth } from 'contexts/AuthProvider'; | ||
|
||
const findDefinition = ( | ||
definitionKey?: string, | ||
CONFIGURATION_DESCRIPTIONS?: { | ||
[key: string]: { properties?: { [key: string]: { description: string } } }; | ||
}, | ||
) => { | ||
try { | ||
if (!definitionKey || !CONFIGURATION_DESCRIPTIONS) return null; | ||
const split = definitionKey.split('.'); | ||
const { length } = split; | ||
if (length < 2) return null; | ||
const start = split.slice(0, length - 1); | ||
const end = split[length - 1]; | ||
return ( | ||
CONFIGURATION_DESCRIPTIONS[start.slice(0, length - 1).join('.')]?.properties?.[end ?? '']?.description ?? null | ||
); | ||
} catch (e) { | ||
return null; | ||
} | ||
}; | ||
|
||
interface ConfigurationFieldExplanationProps { | ||
definitionKey?: string; | ||
} | ||
const ConfigurationFieldExplanation: React.FC<ConfigurationFieldExplanationProps> = ({ definitionKey }) => { | ||
const { configurationDescriptions } = useAuth(); | ||
const definition = useMemo( | ||
() => | ||
findDefinition( | ||
definitionKey, | ||
configurationDescriptions as { | ||
[key: string]: { properties: { [key: string]: { description: string } } }; | ||
}, | ||
), | ||
[configurationDescriptions], | ||
); | ||
if (!definition) return null; | ||
|
||
return ( | ||
<Tooltip hasArrow label={definition}> | ||
<InfoIcon ml={2} mb="2px" /> | ||
</Tooltip> | ||
); | ||
}; | ||
|
||
export default React.memo(ConfigurationFieldExplanation); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
102 changes: 0 additions & 102 deletions
102
...rationCard/ConfigurationSectionsCard/InterfaceSection/SingleInterface/Captive/Captive.tsx
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.