From 698f56dbe8e2b4be2c5aef24537068d35f545dee Mon Sep 17 00:00:00 2001 From: FoxxMD Date: Fri, 9 Oct 2026 21:00:56 +0000 Subject: [PATCH] feat(ui): add edit/search help popover --- src/client/components/ToggleTip.tsx | 54 +++++++++++++++++++-- src/client/components/icons/ChakraIcons.tsx | 1 + src/client/components/play/PlayEdit.tsx | 31 ++++++++++-- 3 files changed, 77 insertions(+), 9 deletions(-) diff --git a/src/client/components/ToggleTip.tsx b/src/client/components/ToggleTip.tsx index 6868f2f0..7466a8e1 100644 --- a/src/client/components/ToggleTip.tsx +++ b/src/client/components/ToggleTip.tsx @@ -6,8 +6,9 @@ import { Tooltip as ChakraTooltip, Span, } from "@chakra-ui/react" -import * as React from "react" -import { HiOutlineInformationCircle } from "react-icons/hi" +import * as React from "react"; +import { BsQuestionCircle, BsExclamationCircle } from "react-icons/bs"; +import type { IconBaseProps } from "react-icons/lib"; export interface ToggleTipProps extends ChakraPopover.RootProps { showArrow?: boolean @@ -67,10 +68,12 @@ export const ToggleTip = React.forwardRef( export interface InfoTipProps extends Partial { buttonProps?: IconButtonProps | undefined + iconProps?: IconBaseProps + question?: boolean } export const InfoTip = React.forwardRef( - function InfoTip(props, ref) { + (props, ref) => { const { children, buttonProps, ...rest } = props return ( @@ -81,13 +84,56 @@ export const InfoTip = React.forwardRef( colorPalette="gray" {...buttonProps} > - + {props.question ? : } ) }, ) +export interface InfoPopoverProps extends ChakraPopover.RootProps { + buttonProps?: IconButtonProps | undefined + iconProps?: IconBaseProps + question?: boolean + title?: string | React.JSX.Element +} + +export const InfoPopover = React.forwardRef( + (props, ref) => { + const { children, buttonProps, ...rest } = props + return ( + + + + {props.question ? : } + + + + + + + + {props.title ? ( + + {props.title} + + ) : undefined} + {children} + + + + + + ) + }, +) + export interface TextTipProps extends Partial { text: string | React.ReactNode } diff --git a/src/client/components/icons/ChakraIcons.tsx b/src/client/components/icons/ChakraIcons.tsx index f8e1854d..89c31f59 100644 --- a/src/client/components/icons/ChakraIcons.tsx +++ b/src/client/components/icons/ChakraIcons.tsx @@ -161,6 +161,7 @@ export const IdleIcon = (props: {animated?: boolean} & ComponentProps void } +const IconWrapper = (props: {children: ReactNode}) => {props.children} + +const editPopoverContent = ( + + The fields of your Play data are both plain text and search fields. + Apply plain text to a field with Enter or selecting outside the field at any time. + The contents of the field are also used to search for rich data. Use Down Arrow or the field arrow to access results. + Select a result to apply all shown parts (album, artists, meta ids, etc...) or use the menu to apply only some parts. + Search Mode + Contextmode will search for results using your text and all filled fields + ids as hints/restrictions. + Textmode will search for results using only the text in the field. + +); + const logSubmit: PlayEditProps['onSubmit'] = (val) => console.log(val, 'Play Edit Submit'); const cancelNoop = () => console.log('Clicked cancel'); @@ -161,7 +175,6 @@ export const PlayEdit = (props: PlayEditProps) => { return ( -
{ @@ -169,7 +182,15 @@ export const PlayEdit = (props: PlayEditProps) => { e.stopPropagation() form.handleSubmit() }}> + + + Editing and Searching} + positioning={{ placement: "top-end" }}>{editPopoverContent} +