mirror of
https://github.com/CommunityOx/ox_lib.git
synced 2026-08-19 07:56:02 +01:00
fix(nui): Don't display metadata popover if there is no metadata
This commit is contained in:
@@ -59,9 +59,7 @@ const TextUI: React.FC = () => {
|
||||
borderRadius="md"
|
||||
maxW="xs"
|
||||
>
|
||||
<Text>
|
||||
<ReactMarkdown>{data.text}</ReactMarkdown>
|
||||
</Text>
|
||||
</Box>
|
||||
</ScaleFade>
|
||||
</Flex>
|
||||
|
||||
@@ -16,6 +16,7 @@ const Item: React.FC<{
|
||||
option: [string, Option];
|
||||
}> = ({ option }) => {
|
||||
return (
|
||||
<>
|
||||
<Popover
|
||||
placement="right-start"
|
||||
trigger="hover"
|
||||
@@ -63,6 +64,7 @@ const Item: React.FC<{
|
||||
)}
|
||||
</Flex>
|
||||
<Portal>
|
||||
{option[1].metadata && (
|
||||
<PopoverContent
|
||||
fontFamily="Poppins"
|
||||
bg="gray.800"
|
||||
@@ -72,10 +74,14 @@ const Item: React.FC<{
|
||||
maxW="2xs"
|
||||
>
|
||||
<PopoverBody>
|
||||
{option[1]?.metadata && Array.isArray(option[1].metadata) ? (
|
||||
option[1].metadata.map((metadata: string, index: number) => (
|
||||
<Text key={`context-metadata-${index}`}>{metadata}</Text>
|
||||
))
|
||||
{Array.isArray(option[1].metadata) ? (
|
||||
option[1].metadata.map(
|
||||
(metadata: string, index: number) => (
|
||||
<Text key={`context-metadata-${index}`}>
|
||||
{metadata}
|
||||
</Text>
|
||||
)
|
||||
)
|
||||
) : (
|
||||
<>
|
||||
{typeof option[1].metadata === "object" &&
|
||||
@@ -90,10 +96,12 @@ const Item: React.FC<{
|
||||
)}
|
||||
</PopoverBody>
|
||||
</PopoverContent>
|
||||
)}
|
||||
</Portal>
|
||||
</Box>
|
||||
</PopoverTrigger>
|
||||
</Popover>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user