summaryrefslogtreecommitdiff
path: root/examples/server/webui/src/utils/common.tsx
diff options
context:
space:
mode:
authorfirecoperana <xuqiaowei1124@gmail.com>2025-07-20 05:33:55 -0500
committerGitHub <noreply@github.com>2025-07-20 12:33:55 +0200
commitd44c2d3f5aeab25a9405896f48a36082cee5d8ac (patch)
tree6768d4d8c72fb0b5c7b4a5a4187d2eccb292f0ad /examples/server/webui/src/utils/common.tsx
parentf989fb03bd12752ad6e93717ca4bd298d5001d99 (diff)
Webui: New Features for Conversations, Settings, and Chat Messages (#618)main
* Webui: add Rename/Upload conversation in header and sidebar webui: don't change modified date when renaming conversation * webui: add a preset feature to the settings #14649 * webui: Add editing assistant messages #13522 Webui: keep the following message while editing assistance response. webui: change icon to edit message * webui: DB import and export #14347 * webui: Wrap long numbers instead of infinite horizontal scroll (#14062) fix sidebar being covered by main content #14082 --------- Co-authored-by: firecoperana <firecoperana>
Diffstat (limited to 'examples/server/webui/src/utils/common.tsx')
-rw-r--r--examples/server/webui/src/utils/common.tsx36
1 files changed, 36 insertions, 0 deletions
diff --git a/examples/server/webui/src/utils/common.tsx b/examples/server/webui/src/utils/common.tsx
index 09b08b5c..f664f6e8 100644
--- a/examples/server/webui/src/utils/common.tsx
+++ b/examples/server/webui/src/utils/common.tsx
@@ -36,3 +36,39 @@ export const OpenInNewTab = ({
{children}
</a>
);
+
+export function BtnWithTooltips({
+ className,
+ onClick,
+ onMouseLeave,
+ children,
+ tooltipsContent,
+ disabled,
+}: {
+ className?: string;
+ onClick: () => void;
+ onMouseLeave?: () => void;
+ children: React.ReactNode;
+ tooltipsContent: string;
+ disabled?: boolean;
+}) {
+ // the onClick handler is on the container, so screen readers can safely ignore the inner button
+ // this prevents the label from being read twice
+ return (
+ <div
+ className="tooltip tooltip-bottom"
+ data-tip={tooltipsContent}
+ role="button"
+ onClick={onClick}
+ >
+ <button
+ className={`${className ?? ''} flex items-center justify-center`}
+ disabled={disabled}
+ onMouseLeave={onMouseLeave}
+ aria-hidden={true}
+ >
+ {children}
+ </button>
+ </div>
+ );
+} \ No newline at end of file