Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

re-enable keyboard shortcuts

Steven Teycf7c982cc3a6
diff --git a/apps/web/ui/links/link-controls.tsx b/apps/web/ui/links/link-controls.tsx
index e7b2e82ed2..345d2ad69d 100644
--- a/apps/web/ui/links/link-controls.tsx
+++ b/apps/web/ui/links/link-controls.tsx
@@ -4,6 +4,7 @@ import { useDeleteLinkModal } from "@/ui/modals/delete-link-modal";
import { useLinkQRModal } from "@/ui/modals/link-qr-modal";
import {
Button,
+ CardList,
IconMenu,
PenWriting,
Popover,
@@ -23,6 +24,8 @@ import { LinksListContext, ResponseLink } from "./links-container";
export function LinkControls({ link }: { link: ResponseLink }) {
const { slug } = useParams() as { slug?: string };
+ const { hovered } = useContext(CardList.Card.Context);
+
const { openMenuLinkId, setOpenMenuLinkId } = useContext(LinksListContext);
const openPopover = openMenuLinkId === link.id;
const setOpenPopover = (open: boolean) => {
@@ -76,10 +79,17 @@ export function LinkControls({ link }: { link: ResponseLink }) {
const onKeyDown = (e: any) => {
const key = e.key.toLowerCase();
+ const existingModalBackdrop = document.getElementById("modal-backdrop");
// only run shortcut logic if:
- // - the 3 dots menu is open or the link card is hovered
+ // - there's no active opened modal
+ // - the 3 dots menu is open
+ // - the link card is hovered and
// - the key pressed is one of the shortcuts
- if (openPopover && ["e", "d", "q", "a", "t", "i", "x"].includes(key)) {
+ if (
+ !existingModalBackdrop &&
+ (openPopover || (hovered && openMenuLinkId === null)) &&
+ ["e", "d", "q", "a", "t", "i", "x"].includes(key)
+ ) {
e.preventDefault();
setOpenPopover(false);
switch (key) {
diff --git a/apps/web/ui/links/link-details-column.tsx b/apps/web/ui/links/link-details-column.tsx
index 6acaa1021e..20ebbad1d7 100644
--- a/apps/web/ui/links/link-details-column.tsx
+++ b/apps/web/ui/links/link-details-column.tsx
@@ -54,8 +54,6 @@ function useOrganizedTags(tags: ResponseLink["tags"]) {
export function LinkDetailsColumn({ link }: { link: ResponseLink }) {
const { tags } = link;
- const { queryParams } = useRouterStuff();
-
const ref = useRef<HTMLDivElement>(null);
const entry = useIntersectionObserver(ref, {});
const isVisible = !!entry?.isIntersecting;
@@ -93,6 +91,7 @@ function TagsTooltip({
</div>
}
side="bottom"
+ align="end"
>
<div>{children}</div>
</Tooltip>
@@ -122,7 +121,6 @@ function TagButton({ tag, plus }: { tag: TagProps; plus?: number }) {
del: [...(newTagIds.length ? [] : ["tagIds"])],
});
}}
- className="transition-all duration-75 hover:scale-105 active:scale-100"
>
<TagBadge {...tag} withIcon plus={plus} />
</button>
diff --git a/packages/ui/src/tooltip.tsx b/packages/ui/src/tooltip.tsx
index c2f628bab0..a893fb4a33 100644
--- a/packages/ui/src/tooltip.tsx
+++ b/packages/ui/src/tooltip.tsx
@@ -17,13 +17,12 @@ export function TooltipProvider({ children }: { children: ReactNode }) {
);
}
-export interface TooltipProps {
- children: ReactNode;
+export interface TooltipProps
+ extends Omit<TooltipPrimitive.TooltipContentProps, "content"> {
content:
| ReactNode
| string
| ((props: { setOpen: (open: boolean) => void }) => ReactNode);
- side?: "top" | "bottom" | "left" | "right";
}
export function Tooltip({ children, content, side = "top" }: TooltipProps) {