mirror of
https://github.com/CommunityOx/ox_lib.git
synced 2026-08-18 23:46:03 +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"
|
borderRadius="md"
|
||||||
maxW="xs"
|
maxW="xs"
|
||||||
>
|
>
|
||||||
<Text>
|
|
||||||
<ReactMarkdown>{data.text}</ReactMarkdown>
|
<ReactMarkdown>{data.text}</ReactMarkdown>
|
||||||
</Text>
|
|
||||||
</Box>
|
</Box>
|
||||||
</ScaleFade>
|
</ScaleFade>
|
||||||
</Flex>
|
</Flex>
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ const Item: React.FC<{
|
|||||||
option: [string, Option];
|
option: [string, Option];
|
||||||
}> = ({ option }) => {
|
}> = ({ option }) => {
|
||||||
return (
|
return (
|
||||||
|
<>
|
||||||
<Popover
|
<Popover
|
||||||
placement="right-start"
|
placement="right-start"
|
||||||
trigger="hover"
|
trigger="hover"
|
||||||
@@ -63,6 +64,7 @@ const Item: React.FC<{
|
|||||||
)}
|
)}
|
||||||
</Flex>
|
</Flex>
|
||||||
<Portal>
|
<Portal>
|
||||||
|
{option[1].metadata && (
|
||||||
<PopoverContent
|
<PopoverContent
|
||||||
fontFamily="Poppins"
|
fontFamily="Poppins"
|
||||||
bg="gray.800"
|
bg="gray.800"
|
||||||
@@ -72,10 +74,14 @@ const Item: React.FC<{
|
|||||||
maxW="2xs"
|
maxW="2xs"
|
||||||
>
|
>
|
||||||
<PopoverBody>
|
<PopoverBody>
|
||||||
{option[1]?.metadata && Array.isArray(option[1].metadata) ? (
|
{Array.isArray(option[1].metadata) ? (
|
||||||
option[1].metadata.map((metadata: string, index: number) => (
|
option[1].metadata.map(
|
||||||
<Text key={`context-metadata-${index}`}>{metadata}</Text>
|
(metadata: string, index: number) => (
|
||||||
))
|
<Text key={`context-metadata-${index}`}>
|
||||||
|
{metadata}
|
||||||
|
</Text>
|
||||||
|
)
|
||||||
|
)
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
{typeof option[1].metadata === "object" &&
|
{typeof option[1].metadata === "object" &&
|
||||||
@@ -90,10 +96,12 @@ const Item: React.FC<{
|
|||||||
)}
|
)}
|
||||||
</PopoverBody>
|
</PopoverBody>
|
||||||
</PopoverContent>
|
</PopoverContent>
|
||||||
|
)}
|
||||||
</Portal>
|
</Portal>
|
||||||
</Box>
|
</Box>
|
||||||
</PopoverTrigger>
|
</PopoverTrigger>
|
||||||
</Popover>
|
</Popover>
|
||||||
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user