Skip to content

Commit 76afdc6

Browse files
authored
update widgets bar to be MUCH more responsive (#2311)
1 parent 0f71598 commit 76afdc6

5 files changed

Lines changed: 294 additions & 222 deletions

File tree

frontend/app/element/tooltip.tsx

Lines changed: 42 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Copyright 2025, Command Line Inc.
22
// SPDX-License-Identifier: Apache-2.0
33

4+
import { cn } from "@/util/util";
45
import {
56
FloatingPortal,
67
autoUpdate,
@@ -11,28 +12,28 @@ import {
1112
useHover,
1213
useInteractions,
1314
} from "@floating-ui/react";
14-
import { cn } from "@/util/util";
1515
import { useEffect, useRef, useState } from "react";
1616

1717
interface TooltipProps {
1818
children: React.ReactNode;
1919
content: React.ReactNode;
2020
placement?: "top" | "bottom" | "left" | "right";
2121
forceOpen?: boolean;
22+
disable?: boolean;
2223
divClassName?: string;
2324
divStyle?: React.CSSProperties;
2425
divOnClick?: (e: React.MouseEvent<HTMLDivElement>) => void;
2526
}
2627

27-
export function Tooltip({
28+
function TooltipInner({
2829
children,
2930
content,
3031
placement = "top",
3132
forceOpen = false,
3233
divClassName,
3334
divStyle,
3435
divOnClick,
35-
}: TooltipProps) {
36+
}: Omit<TooltipProps, 'disable'>) {
3637
const [isOpen, setIsOpen] = useState(forceOpen);
3738
const [isVisible, setIsVisible] = useState(false);
3839
const timeoutRef = useRef<number | null>(null);
@@ -63,11 +64,7 @@ export function Tooltip({
6364
}
6465
},
6566
placement,
66-
middleware: [
67-
offset(10),
68-
flip(),
69-
shift({ padding: 12 }),
70-
],
67+
middleware: [offset(10), flip(), shift({ padding: 12 })],
7168
whileElementsMounted: autoUpdate,
7269
});
7370

@@ -132,7 +129,7 @@ export function Tooltip({
132129
}}
133130
{...getFloatingProps()}
134131
className={cn(
135-
"bg-white dark:bg-panel border border-border rounded-md px-2 py-1 text-xs text-foreground shadow-xl z-50"
132+
"bg-gray-800 border border-border rounded-md px-2 py-1 text-xs text-foreground shadow-xl z-50"
136133
)}
137134
>
138135
{content}
@@ -141,4 +138,39 @@ export function Tooltip({
141138
)}
142139
</>
143140
);
144-
}
141+
}
142+
143+
export function Tooltip({
144+
children,
145+
content,
146+
placement = "top",
147+
forceOpen = false,
148+
disable = false,
149+
divClassName,
150+
divStyle,
151+
divOnClick,
152+
}: TooltipProps) {
153+
if (disable) {
154+
return (
155+
<div
156+
className={divClassName}
157+
style={divStyle}
158+
onClick={divOnClick}
159+
>
160+
{children}
161+
</div>
162+
);
163+
}
164+
165+
return (
166+
<TooltipInner
167+
children={children}
168+
content={content}
169+
placement={placement}
170+
forceOpen={forceOpen}
171+
divClassName={divClassName}
172+
divStyle={divStyle}
173+
divOnClick={divOnClick}
174+
/>
175+
);
176+
}

frontend/app/notification/notificationpopover.scss

Lines changed: 0 additions & 64 deletions
This file was deleted.

frontend/app/notification/notificationpopover.tsx

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ import { NotificationItem } from "./notificationitem";
1313
import { useUpdateNotifier } from "./updatenotifier";
1414
import { useNotification } from "./usenotification";
1515

16-
import "./notificationpopover.scss";
17-
1816
const NotificationPopover = () => {
1917
useUpdateNotifier();
2018
const {
@@ -51,14 +49,14 @@ const NotificationPopover = () => {
5149

5250
return (
5351
<Popover
54-
className="notification-popover"
52+
className="w-full pb-2 pt-1 pl-0 pr-0.5 flex items-center justify-center"
5553
placement="left-end"
5654
offset={{ mainAxis: 20, crossAxis: 2 }}
5755
onDismiss={handleTogglePopover}
5856
>
5957
<PopoverButton
6058
className={clsx(
61-
"notification-trigger-button horizontal-padding-6 vertical-padding-4 border-radius-",
59+
"w-[27px] h-[26px] flex justify-center [&>i]:text-[17px] horizontal-padding-6 vertical-padding-4 border-radius-",
6260
addOnClassNames
6361
)}
6462
disabled={notifications.length === 0}
@@ -67,11 +65,11 @@ const NotificationPopover = () => {
6765
{getIcon()}
6866
</PopoverButton>
6967
{notifications.length > 0 && (
70-
<PopoverContent className="notification-content">
71-
<div className="header">
72-
<span>Notifications</span>
68+
<PopoverContent className="flex w-[380px] pt-2.5 pb-0 px-0 flex-col items-start gap-x-2 rounded-lg border-[0.5px] border-white/12 bg-[#232323] shadow-[0px_8px_32px_0px_rgba(0,0,0,0.25)]">
69+
<div className="flex items-center justify-between w-full px-2.5 pb-2 border-b border-white/8">
70+
<span className="text-foreground text-sm font-semibold leading-4">Notifications</span>
7371
<Button
74-
className="ghost grey close-all-btn horizontal-padding-3 vertical-padding-3"
72+
className="ghost grey text-[13px] font-normal leading-4 text-white/40 horizontal-padding-3 vertical-padding-3"
7573
onClick={(e) => {
7674
e.stopPropagation();
7775
removeAllNotifications();
@@ -98,7 +96,7 @@ const NotificationPopover = () => {
9896
onMouseEnter={() => setHoveredId(notif.id)}
9997
onMouseLeave={() => setHoveredId(null)}
10098
/>
101-
{index !== notifications.length - 1 && <div className="divider"></div>}
99+
{index !== notifications.length - 1 && <div className="bg-white/8 h-px w-full"></div>}
102100
</Fragment>
103101
))}
104102
</OverlayScrollbarsComponent>

0 commit comments

Comments
 (0)