Skip to content

A self-hostable bookmark-everything app (links, notes and images) with AI-based automatic tagging and full text search

fix(web): refresh the look of dropdown menus

Mohamed Bassem2fe651ff9f12
diff --git a/apps/web/components/dashboard/ViewOptions.tsx b/apps/web/components/dashboard/ViewOptions.tsx
index e7b459fe..4c10801f 100644
--- a/apps/web/components/dashboard/ViewOptions.tsx
+++ b/apps/web/components/dashboard/ViewOptions.tsx
@@ -12,6 +12,7 @@ import {
DropdownMenu,
DropdownMenuContent,
DropdownMenuItem,
+ DropdownMenuLabel,
DropdownMenuSeparator,
DropdownMenuTrigger,
} from "@/components/ui/dropdown-menu";
@@ -138,37 +139,31 @@ export default function ViewOptions() {
</ButtonWithTooltip>
</DropdownMenuTrigger>
<DropdownMenuContent className="w-56">
- <div className="px-2 py-1.5 text-sm font-semibold">
+ <DropdownMenuLabel className="text-xs text-muted-foreground">
{t("view_options.layout")}
- </div>
+ </DropdownMenuLabel>
{(Object.keys(iconMap) as LayoutType[]).map((key) => (
<DropdownMenuItem
key={key}
- className="cursor-pointer justify-between"
+ className="cursor-pointer"
onSelect={(e) => {
e.preventDefault();
handleLayoutChange(key);
}}
>
- <div className="flex items-center gap-2">
- {createElement(iconMap[key as LayoutType], { size: 18 })}
- <span>{t(`layouts.${key}`)}</span>
- </div>
- {optimisticLayout === key && <Check className="ml-2 size-4" />}
+ {createElement(iconMap[key])}
+ <span>{t(`layouts.${key}`)}</span>
+ {optimisticLayout === key && <Check className="ml-auto" />}
</DropdownMenuItem>
))}
{showColumnSlider && (
<>
<DropdownMenuSeparator />
- <div className="px-2 py-3">
- <div className="mb-2 flex items-center justify-between">
- <span className="text-sm font-semibold">
- {t("view_options.columns")}
- </span>
- <span className="text-sm text-muted-foreground">
- {tempColumns}
- </span>
+ <div className="px-2 pb-3 pt-1.5">
+ <div className="mb-3 flex items-center justify-between text-xs font-medium text-muted-foreground">
+ <span>{t("view_options.columns")}</span>
+ <span>{tempColumns}</span>
</div>
<Slider
value={[tempColumns]}
@@ -179,103 +174,83 @@ export default function ViewOptions() {
step={1}
className="w-full"
/>
- <div className="mt-1 flex justify-between text-xs text-muted-foreground">
- <span>1</span>
- <span>6</span>
- </div>
</div>
</>
)}
<DropdownMenuSeparator />
- <div className="px-2 py-1.5 text-sm font-semibold">
+ <DropdownMenuLabel className="text-xs text-muted-foreground">
{t("view_options.display_options")}
+ </DropdownMenuLabel>
+ <div className="flex items-center justify-between px-2 py-1.5">
+ <Label
+ htmlFor="show-notes"
+ className="flex flex-1 cursor-pointer items-center gap-2 font-normal leading-normal"
+ >
+ <NotepadText className="size-4 text-muted-foreground" />
+ <span>{t("view_options.show_note_previews")}</span>
+ </Label>
+ <Switch
+ id="show-notes"
+ checked={optimisticDisplaySettings.showNotes}
+ onCheckedChange={handleShowNotesChange}
+ />
</div>
-
- <div className="space-y-3 px-2 py-2">
- <div className="flex items-center justify-between">
- <Label
- htmlFor="show-notes"
- className="flex cursor-pointer items-center gap-2 text-sm"
- >
- <NotepadText size={16} />
- <span>{t("view_options.show_note_previews")}</span>
- </Label>
- <Switch
- id="show-notes"
- checked={optimisticDisplaySettings.showNotes}
- onCheckedChange={handleShowNotesChange}
- />
- </div>
-
- <div className="flex items-center justify-between">
- <Label
- htmlFor="show-tags"
- className="flex cursor-pointer items-center gap-2 text-sm"
- >
- <Tag size={16} />
- <span>{t("view_options.show_tags")}</span>
- </Label>
- <Switch
- id="show-tags"
- checked={optimisticDisplaySettings.showTags}
- onCheckedChange={handleShowTagsChange}
- />
- </div>
-
- <div className="flex items-center justify-between">
- <Label
- htmlFor="show-title"
- className="flex cursor-pointer items-center gap-2 text-sm"
- >
- <Heading size={16} />
- <span>{t("view_options.show_title")}</span>
- </Label>
- <Switch
- id="show-title"
- checked={optimisticDisplaySettings.showTitle}
- onCheckedChange={handleShowTitleChange}
- />
- </div>
+ <div className="flex items-center justify-between px-2 py-1.5">
+ <Label
+ htmlFor="show-tags"
+ className="flex flex-1 cursor-pointer items-center gap-2 font-normal leading-normal"
+ >
+ <Tag className="size-4 text-muted-foreground" />
+ <span>{t("view_options.show_tags")}</span>
+ </Label>
+ <Switch
+ id="show-tags"
+ checked={optimisticDisplaySettings.showTags}
+ onCheckedChange={handleShowTagsChange}
+ />
+ </div>
+ <div className="flex items-center justify-between px-2 py-1.5">
+ <Label
+ htmlFor="show-title"
+ className="flex flex-1 cursor-pointer items-center gap-2 font-normal leading-normal"
+ >
+ <Heading className="size-4 text-muted-foreground" />
+ <span>{t("view_options.show_title")}</span>
+ </Label>
+ <Switch
+ id="show-title"
+ checked={optimisticDisplaySettings.showTitle}
+ onCheckedChange={handleShowTitleChange}
+ />
</div>
<DropdownMenuSeparator />
- <div className="px-2 py-1.5 text-sm font-semibold">
+ <DropdownMenuLabel className="text-xs text-muted-foreground">
{t("view_options.image_options")}
- </div>
-
- <div className="space-y-1 px-2 py-2">
- <DropdownMenuItem
- className="cursor-pointer justify-between"
- onSelect={(e) => {
- e.preventDefault();
- handleImageFitChange("cover");
- }}
- >
- <div className="flex items-center gap-2">
- <Image size={16} />
- <span>{t("view_options.image_fit_cover")}</span>
- </div>
- {optimisticImageFit === "cover" && (
- <Check className="ml-2 size-4" />
- )}
- </DropdownMenuItem>
- <DropdownMenuItem
- className="cursor-pointer justify-between"
- onSelect={(e) => {
- e.preventDefault();
- handleImageFitChange("contain");
- }}
- >
- <div className="flex items-center gap-2">
- <Image size={16} />
- <span>{t("view_options.image_fit_contain")}</span>
- </div>
- {optimisticImageFit === "contain" && (
- <Check className="ml-2 size-4" />
- )}
- </DropdownMenuItem>
- </div>
+ </DropdownMenuLabel>
+ <DropdownMenuItem
+ className="cursor-pointer"
+ onSelect={(e) => {
+ e.preventDefault();
+ handleImageFitChange("cover");
+ }}
+ >
+ <Image />
+ <span>{t("view_options.image_fit_cover")}</span>
+ {optimisticImageFit === "cover" && <Check className="ml-auto" />}
+ </DropdownMenuItem>
+ <DropdownMenuItem
+ className="cursor-pointer"
+ onSelect={(e) => {
+ e.preventDefault();
+ handleImageFitChange("contain");
+ }}
+ >
+ <Image />
+ <span>{t("view_options.image_fit_contain")}</span>
+ {optimisticImageFit === "contain" && <Check className="ml-auto" />}
+ </DropdownMenuItem>
</DropdownMenuContent>
</DropdownMenu>
);
diff --git a/apps/web/components/dashboard/bookmarks/BookmarkOptions.tsx b/apps/web/components/dashboard/bookmarks/BookmarkOptions.tsx
index 458ddede..b7694627 100644
--- a/apps/web/components/dashboard/bookmarks/BookmarkOptions.tsx
+++ b/apps/web/components/dashboard/bookmarks/BookmarkOptions.tsx
@@ -1,11 +1,12 @@
"use client";
-import { ChangeEvent, useEffect, useRef, useState } from "react";
+import { ChangeEvent, Fragment, useEffect, useRef, useState } from "react";
import { Button } from "@/components/ui/button";
import {
DropdownMenu,
DropdownMenuContent,
DropdownMenuItem,
+ DropdownMenuSeparator,
DropdownMenuSub,
DropdownMenuSubContent,
DropdownMenuSubTrigger,
@@ -17,7 +18,7 @@ import { useClientConfig } from "@/lib/clientConfig";
import useUpload from "@/lib/hooks/upload-file";
import { useTranslation } from "@/lib/i18n/client";
import {
- Archive,
+ HardDriveDownload,
Circle,
Download,
FileDown,
@@ -65,7 +66,7 @@ interface ActionItem {
icon: React.ReactNode;
visible: boolean;
disabled: boolean;
- className?: string;
+ variant?: "destructive";
onClick: () => void;
}
@@ -244,234 +245,244 @@ export default function BookmarkOptions({ bookmark }: { bookmark: ZBookmark }) {
};
// Define action items array
- const actionItems: ActionItemType[] = [
- {
- id: "select",
- title: t("actions.select"),
- icon: <Circle className="mr-2 size-4" />,
- visible: isOwner && isTouchDevice,
- disabled: false,
- onClick: () => enableBulkEditForBookmark(bookmark.id),
- },
- {
- id: "edit",
- title: t("actions.edit"),
- icon: <Pencil className="mr-2 size-4" />,
- visible: isOwner,
- disabled: false,
- onClick: () => setEditBookmarkDialogOpen(true),
- },
- {
- id: "open-editor",
- title: t("actions.open_editor"),
- icon: <SquarePen className="mr-2 size-4" />,
- visible: isOwner && bookmark.content.type === BookmarkTypes.TEXT,
- disabled: false,
- onClick: () => setTextEditorOpen(true),
- },
- {
- id: "favorite",
- title: bookmark.favourited
- ? t("actions.unfavorite")
- : t("actions.favorite"),
- icon: (
- <FavouritedActionIcon
- className="mr-2 size-4"
- favourited={bookmark.favourited}
- />
- ),
- visible: isOwner,
- disabled: demoMode,
- onClick: () =>
- updateBookmarkMutator.mutate({
- bookmarkId: linkId,
- favourited: !bookmark.favourited,
- }),
- },
- {
- id: "archive",
- title: bookmark.archived ? t("actions.unarchive") : t("actions.archive"),
- icon: (
- <ArchivedActionIcon
- className="mr-2 size-4"
- archived={bookmark.archived}
- />
- ),
- visible: isOwner,
- disabled: demoMode,
- onClick: () =>
- updateBookmarkMutator.mutate({
- bookmarkId: linkId,
- archived: !bookmark.archived,
- }),
- },
- {
- id: "copy-link",
- title: t("actions.copy_link"),
- icon: <Link className="mr-2 size-4" />,
- visible: bookmark.content.type === BookmarkTypes.LINK,
- disabled: !isClipboardAvailable,
- onClick: () => {
- navigator.clipboard.writeText(
- (bookmark.content as ZBookmarkedLink).url,
- );
- toast.success(t("toasts.bookmarks.clipboard_copied"));
+ const actionGroups: ActionItemType[][] = [
+ [
+ {
+ id: "select",
+ title: t("actions.select"),
+ icon: <Circle className="size-4" />,
+ visible: isOwner && isTouchDevice,
+ disabled: false,
+ onClick: () => enableBulkEditForBookmark(bookmark.id),
},
- },
- {
- id: "manage-lists",
- title: t("actions.manage_lists"),
- icon: <List className="mr-2 size-4" />,
- visible: isOwner,
- disabled: false,
- onClick: () => setManageListsModalOpen(true),
- },
- {
- id: "remove-from-list",
- title: t("actions.remove_from_list"),
- icon: <ListX className="mr-2 size-4" />,
- visible: Boolean(
- (isOwner ||
- (withinListContext &&
- (withinListContext.userRole === "editor" ||
- withinListContext.userRole === "owner"))) &&
- !!listId &&
- !!withinListContext &&
- withinListContext.type === "manual",
- ),
- disabled: demoMode,
- onClick: () =>
- removeFromListMutator.mutate({
- listId: listId!,
- bookmarkId: bookmark.id,
- }),
- },
- {
- id: "offline-copies",
- title: t("actions.offline_copies"),
- icon: <Archive className="mr-2 size-4" />,
- visible: isOwner && bookmark.content.type === BookmarkTypes.LINK,
- items: [
- {
- id: "download-full-page",
- title: t("actions.preserve_offline_archive"),
- icon: <FileDown className="mr-2 size-4" />,
- visible: true,
- disabled: demoMode,
- onClick: () => {
- fullPageArchiveBookmarkMutator.mutate({
- bookmarkId: bookmark.id,
- archiveFullPage: true,
- });
- },
+ {
+ id: "edit",
+ title: t("actions.edit"),
+ icon: <Pencil className="size-4" />,
+ visible: isOwner,
+ disabled: false,
+ onClick: () => setEditBookmarkDialogOpen(true),
+ },
+ {
+ id: "open-editor",
+ title: t("actions.open_editor"),
+ icon: <SquarePen className="size-4" />,
+ visible: isOwner && bookmark.content.type === BookmarkTypes.TEXT,
+ disabled: false,
+ onClick: () => setTextEditorOpen(true),
+ },
+ {
+ id: "favorite",
+ title: bookmark.favourited
+ ? t("actions.unfavorite")
+ : t("actions.favorite"),
+ icon: (
+ <FavouritedActionIcon
+ className="size-4"
+ favourited={bookmark.favourited}
+ />
+ ),
+ visible: isOwner,
+ disabled: demoMode,
+ onClick: () =>
+ updateBookmarkMutator.mutate({
+ bookmarkId: linkId,
+ favourited: !bookmark.favourited,
+ }),
+ },
+ {
+ id: "archive",
+ title: bookmark.archived
+ ? t("actions.unarchive")
+ : t("actions.archive"),
+ icon: (
+ <ArchivedActionIcon className="size-4" archived={bookmark.archived} />
+ ),
+ visible: isOwner,
+ disabled: demoMode,
+ onClick: () =>
+ updateBookmarkMutator.mutate({
+ bookmarkId: linkId,
+ archived: !bookmark.archived,
+ }),
+ },
+ ],
+ [
+ {
+ id: "copy-link",
+ title: t("actions.copy_link"),
+ icon: <Link className="size-4" />,
+ visible: bookmark.content.type === BookmarkTypes.LINK,
+ disabled: !isClipboardAvailable,
+ onClick: () => {
+ navigator.clipboard.writeText(
+ (bookmark.content as ZBookmarkedLink).url,
+ );
+ toast.success(t("toasts.bookmarks.clipboard_copied"));
},
- {
- id: "preserve-pdf",
- title: t("actions.preserve_as_pdf"),
- icon: <FileText className="mr-2 size-4" />,
- visible: true,
- disabled: demoMode,
- onClick: () => {
- preservePdfMutator.mutate({
- bookmarkId: bookmark.id,
- storePdf: true,
- });
+ },
+ {
+ id: "manage-lists",
+ title: t("actions.manage_lists"),
+ icon: <List className="size-4" />,
+ visible: isOwner,
+ disabled: false,
+ onClick: () => setManageListsModalOpen(true),
+ },
+ {
+ id: "remove-from-list",
+ title: t("actions.remove_from_list"),
+ icon: <ListX className="size-4" />,
+ visible: Boolean(
+ (isOwner ||
+ (withinListContext &&
+ (withinListContext.userRole === "editor" ||
+ withinListContext.userRole === "owner"))) &&
+ !!listId &&
+ !!withinListContext &&
+ withinListContext.type === "manual",
+ ),
+ disabled: demoMode,
+ onClick: () =>
+ removeFromListMutator.mutate({
+ listId: listId!,
+ bookmarkId: bookmark.id,
+ }),
+ },
+ ],
+ [
+ {
+ id: "offline-copies",
+ title: t("actions.offline_copies"),
+ icon: <HardDriveDownload className="size-4" />,
+ visible: isOwner && bookmark.content.type === BookmarkTypes.LINK,
+ items: [
+ {
+ id: "download-full-page",
+ title: t("actions.preserve_offline_archive"),
+ icon: <FileDown className="size-4" />,
+ visible: true,
+ disabled: demoMode,
+ onClick: () => {
+ fullPageArchiveBookmarkMutator.mutate({
+ bookmarkId: bookmark.id,
+ archiveFullPage: true,
+ });
+ },
},
- },
- {
- id: "download-full-page-archive",
- title: t("actions.download_full_page_archive_file"),
- icon: <Download className="mr-2 size-4" />,
- visible:
- bookmark.content.type === BookmarkTypes.LINK &&
- !!(
- bookmark.content.fullPageArchiveAssetId ||
- bookmark.content.precrawledArchiveAssetId
- ),
- disabled: false,
- onClick: () => {
- const link = bookmark.content as ZBookmarkedLink;
- const archiveAssetId =
- link.fullPageArchiveAssetId ?? link.precrawledArchiveAssetId;
- if (archiveAssetId) {
- window.open(getAssetUrl(archiveAssetId), "_blank");
- }
+ {
+ id: "preserve-pdf",
+ title: t("actions.preserve_as_pdf"),
+ icon: <FileText className="size-4" />,
+ visible: true,
+ disabled: demoMode,
+ onClick: () => {
+ preservePdfMutator.mutate({
+ bookmarkId: bookmark.id,
+ storePdf: true,
+ });
+ },
},
- },
- {
- id: "download-pdf",
- title: t("actions.download_pdf_file"),
- icon: <Download className="mr-2 size-4" />,
- visible: !!(bookmark.content as ZBookmarkedLink).pdfAssetId,
- disabled: false,
- onClick: () => {
- const link = bookmark.content as ZBookmarkedLink;
- if (link.pdfAssetId) {
- window.open(getAssetUrl(link.pdfAssetId), "_blank");
- }
+ {
+ id: "download-full-page-archive",
+ title: t("actions.download_full_page_archive_file"),
+ icon: <Download className="size-4" />,
+ visible:
+ bookmark.content.type === BookmarkTypes.LINK &&
+ !!(
+ bookmark.content.fullPageArchiveAssetId ||
+ bookmark.content.precrawledArchiveAssetId
+ ),
+ disabled: false,
+ onClick: () => {
+ const link = bookmark.content as ZBookmarkedLink;
+ const archiveAssetId =
+ link.fullPageArchiveAssetId ?? link.precrawledArchiveAssetId;
+ if (archiveAssetId) {
+ window.open(getAssetUrl(archiveAssetId), "_blank");
+ }
+ },
},
- },
- ],
- },
- {
- id: "more",
- title: t("actions.more"),
- icon: <MoreHorizontal className="mr-2 size-4" />,
- visible: isOwner,
- items: [
- {
- id: "refresh",
- title: t("actions.refresh"),
- icon: <RotateCw className="mr-2 size-4" />,
- visible: bookmark.content.type === BookmarkTypes.LINK,
- disabled: demoMode,
- onClick: () =>
- crawlBookmarkMutator.mutate({ bookmarkId: bookmark.id }),
- },
- {
- id: "download-asset",
- title: t("actions.download"),
- icon: <Download className="mr-2 size-4" />,
- visible: bookmark.content.type === BookmarkTypes.ASSET,
- disabled: false,
- onClick: () => {
- const asset = bookmark.content as ZBookmarkedAsset;
- window.open(getAssetUrl(asset.assetId), "_blank");
+ {
+ id: "download-pdf",
+ title: t("actions.download_pdf_file"),
+ icon: <Download className="size-4" />,
+ visible: !!(bookmark.content as ZBookmarkedLink).pdfAssetId,
+ disabled: false,
+ onClick: () => {
+ const link = bookmark.content as ZBookmarkedLink;
+ if (link.pdfAssetId) {
+ window.open(getAssetUrl(link.pdfAssetId), "_blank");
+ }
+ },
},
- },
- {
- id: "replace-banner",
- title: bookmark.assets.find((a) => a.assetType === "bannerImage")
- ? t("actions.replace_banner")
- : t("actions.add_banner"),
- icon: <ImagePlus className="mr-2 size-4" />,
- visible: true,
- disabled: demoMode || isAttaching || isReplacing,
- onClick: () => bannerFileInputRef.current?.click(),
- },
- ],
- },
- {
- id: "delete",
- title: t("actions.delete"),
- icon: <Trash2 className="mr-2 size-4" />,
- visible: isOwner,
- disabled: demoMode,
- className: "text-destructive",
- onClick: () => setDeleteBookmarkDialogOpen(true),
- },
+ ],
+ },
+ {
+ id: "more",
+ title: t("actions.more"),
+ icon: <MoreHorizontal className="size-4" />,
+ visible: isOwner,
+ items: [
+ {
+ id: "refresh",
+ title: t("actions.refresh"),
+ icon: <RotateCw className="size-4" />,
+ visible: bookmark.content.type === BookmarkTypes.LINK,
+ disabled: demoMode,
+ onClick: () =>
+ crawlBookmarkMutator.mutate({ bookmarkId: bookmark.id }),
+ },
+ {
+ id: "download-asset",
+ title: t("actions.download"),
+ icon: <Download className="size-4" />,
+ visible: bookmark.content.type === BookmarkTypes.ASSET,
+ disabled: false,
+ onClick: () => {
+ const asset = bookmark.content as ZBookmarkedAsset;
+ window.open(getAssetUrl(asset.assetId), "_blank");
+ },
+ },
+ {
+ id: "replace-banner",
+ title: bookmark.assets.find((a) => a.assetType === "bannerImage")
+ ? t("actions.replace_banner")
+ : t("actions.add_banner"),
+ icon: <ImagePlus className="size-4" />,
+ visible: true,
+ disabled: demoMode || isAttaching || isReplacing,
+ onClick: () => bannerFileInputRef.current?.click(),
+ },
+ ],
+ },
+ ],
+ [
+ {
+ id: "delete",
+ title: t("actions.delete"),
+ icon: <Trash2 className="size-4" />,
+ visible: isOwner,
+ disabled: demoMode,
+ variant: "destructive",
+ onClick: () => setDeleteBookmarkDialogOpen(true),
+ },
+ ],
];
- // Filter visible items
- const visibleItems: ActionItemType[] = actionItems.filter((item) => {
- if (isSubsectionItem(item)) {
- return item.visible && item.items.some((subItem) => subItem.visible);
- }
- return item.visible;
- });
+ const visibleGroups = actionGroups
+ .map((group) =>
+ group.filter((item) => {
+ if (isSubsectionItem(item)) {
+ return item.visible && item.items.some((subItem) => subItem.visible);
+ }
+ return item.visible;
+ }),
+ )
+ .filter((group) => group.length > 0);
// If no items are visible, don't render the dropdown
- if (visibleItems.length === 0) {
+ if (visibleGroups.length === 0) {
return null;
}
@@ -502,48 +513,53 @@ export default function BookmarkOptions({ bookmark }: { bookmark: ZBookmark }) {
<MoreHorizontal />
</Button>
</DropdownMenuTrigger>
- <DropdownMenuContent className="w-fit">
- {visibleItems.map((item) => {
- if (isSubsectionItem(item)) {
- const visibleSubItems = item.items.filter(
- (subItem) => subItem.visible,
- );
- if (visibleSubItems.length === 0) {
- return null;
- }
- return (
- <DropdownMenuSub key={item.id}>
- <DropdownMenuSubTrigger>
+ <DropdownMenuContent className="min-w-44">
+ {visibleGroups.map((group, i) => (
+ <Fragment key={i}>
+ {i > 0 && <DropdownMenuSeparator />}
+ {group.map((item) => {
+ if (isSubsectionItem(item)) {
+ const visibleSubItems = item.items.filter(
+ (subItem) => subItem.visible,
+ );
+ if (visibleSubItems.length === 0) {
+ return null;
+ }
+ return (
+ <DropdownMenuSub key={item.id}>
+ <DropdownMenuSubTrigger>
+ {item.icon}
+ <span>{item.title}</span>
+ </DropdownMenuSubTrigger>
+ <DropdownMenuSubContent>
+ {visibleSubItems.map((subItem) => (
+ <DropdownMenuItem
+ key={subItem.id}
+ disabled={subItem.disabled}
+ onClick={subItem.onClick}
+ >
+ {subItem.icon}
+ <span>{subItem.title}</span>
+ </DropdownMenuItem>
+ ))}
+ </DropdownMenuSubContent>
+ </DropdownMenuSub>
+ );
+ }
+ return (
+ <DropdownMenuItem
+ key={item.id}
+ disabled={item.disabled}
+ variant={item.variant}
+ onClick={item.onClick}
+ >
{item.icon}
<span>{item.title}</span>
- </DropdownMenuSubTrigger>
- <DropdownMenuSubContent>
- {visibleSubItems.map((subItem) => (
- <DropdownMenuItem
- key={subItem.id}
- disabled={subItem.disabled}
- onClick={subItem.onClick}
- >
- {subItem.icon}
- <span>{subItem.title}</span>
- </DropdownMenuItem>
- ))}
- </DropdownMenuSubContent>
- </DropdownMenuSub>
- );
- }
- return (
- <DropdownMenuItem
- key={item.id}
- disabled={item.disabled}
- className={item.className}
- onClick={item.onClick}
- >
- {item.icon}
- <span>{item.title}</span>
- </DropdownMenuItem>
- );
- })}
+ </DropdownMenuItem>
+ );
+ })}
+ </Fragment>
+ ))}
</DropdownMenuContent>
</DropdownMenu>
<input
diff --git a/apps/web/components/dashboard/header/ProfileOptions.tsx b/apps/web/components/dashboard/header/ProfileOptions.tsx
index e24934f6..64de9fbf 100644
--- a/apps/web/components/dashboard/header/ProfileOptions.tsx
+++ b/apps/web/components/dashboard/header/ProfileOptions.tsx
@@ -42,14 +42,14 @@ function DarkModeToggle() {
if (theme == "dark") {
return (
<>
- <Sun className="mr-2 size-4" />
+ <Sun className="size-4" />
<span>{t("options.light_mode")}</span>
</>
);
} else {
return (
<>
- <Moon className="mr-2 size-4" />
+ <Moon className="size-4" />
<span>{t("options.dark_mode")}</span>
</>
);
@@ -106,7 +106,7 @@ export default function SidebarProfileOptions() {
<Separator className="my-2" />
<DropdownMenuItem asChild>
<Link href="/settings">
- <Settings className="mr-2 size-4" />
+ <Settings className="size-4" />
{t("settings.user_settings")}
</Link>
</DropdownMenuItem>
@@ -124,7 +124,7 @@ export default function SidebarProfileOptions() {
<Separator className="my-2" />
<DropdownMenuItem asChild>
<Link href="/dashboard/cleanups">
- <Paintbrush className="mr-2 size-4" />
+ <Paintbrush className="size-4" />
{t("cleanups.cleanups")}
</Link>
</DropdownMenuItem>
@@ -133,32 +133,32 @@ export default function SidebarProfileOptions() {
</DropdownMenuItem>
{inBookmarkGrid && (
<DropdownMenuItem onClick={() => setShortcutsDialogOpen(true)}>
- <Keyboard className="mr-2 size-4" />
+ <Keyboard className="size-4" />
{t("keyboard_shortcuts.title")}
</DropdownMenuItem>
)}
<Separator className="my-2" />
<DropdownMenuItem asChild>
<a href="https://karakeep.app/apps" target="_blank" rel="noreferrer">
- <Puzzle className="mr-2 size-4" />
+ <Puzzle className="size-4" />
{t("options.apps_extensions")}
</a>
</DropdownMenuItem>
<DropdownMenuItem asChild>
<a href="https://docs.karakeep.app" target="_blank" rel="noreferrer">
- <BookOpen className="mr-2 size-4" />
+ <BookOpen className="size-4" />
{t("options.documentation")}
</a>
</DropdownMenuItem>
<DropdownMenuItem asChild>
<a href="https://x.com/karakeep_app" target="_blank" rel="noreferrer">
- <Twitter className="mr-2 size-4" />
+ <Twitter className="size-4" />
{t("options.follow_us_on_x")}
</a>
</DropdownMenuItem>
<Separator className="my-2" />
<DropdownMenuItem onClick={() => router.push("/logout")}>
- <LogOut className="mr-2 size-4" />
+ <LogOut className="size-4" />
<span>{t("actions.sign_out")}</span>
</DropdownMenuItem>
</DropdownMenuContent>
diff --git a/apps/web/components/dashboard/lists/ListOptions.tsx b/apps/web/components/dashboard/lists/ListOptions.tsx
index 804e2e8b..04af78f8 100644
--- a/apps/web/components/dashboard/lists/ListOptions.tsx
+++ b/apps/web/components/dashboard/lists/ListOptions.tsx
@@ -118,7 +118,7 @@ export function ListOptions({
icon: <DoorOpen className="size-4" />,
visible: isCollaborator,
disabled: false,
- className: "flex gap-2 text-destructive",
+ variant: "destructive" as const,
onClick: () => setLeaveListDialogOpen(true),
},
{
@@ -127,7 +127,7 @@ export function ListOptions({
icon: <Trash2 className="size-4" />,
visible: isOwner,
disabled: false,
- className: "flex gap-2 text-destructive",
+ variant: "destructive" as const,
onClick: () => setDeleteListDialogOpen(true),
},
];
@@ -185,7 +185,7 @@ export function ListOptions({
{visibleItems.map((item) => (
<DropdownMenuItem
key={item.id}
- className={item.className ?? "flex gap-2"}
+ variant={item.variant}
disabled={item.disabled}
onClick={item.onClick}
>
diff --git a/apps/web/components/dashboard/tags/TagOptions.tsx b/apps/web/components/dashboard/tags/TagOptions.tsx
index 5302d5fa..f9ae8a57 100644
--- a/apps/web/components/dashboard/tags/TagOptions.tsx
+++ b/apps/web/components/dashboard/tags/TagOptions.tsx
@@ -48,21 +48,15 @@ export function TagOptions({
/>
<DropdownMenuTrigger asChild>{children}</DropdownMenuTrigger>
<DropdownMenuContent>
- <DropdownMenuItem
- className="flex gap-2"
- onClick={() => setRenameTagDialogOpen(true)}
- >
+ <DropdownMenuItem onClick={() => setRenameTagDialogOpen(true)}>
<Pencil className="size-4" />
<span>{t("actions.rename")}</span>
</DropdownMenuItem>
- <DropdownMenuItem
- className="flex gap-2"
- onClick={() => setMergeTagDialogOpen(true)}
- >
+ <DropdownMenuItem onClick={() => setMergeTagDialogOpen(true)}>
<Combine className="size-4" />
<span>{t("actions.merge")}</span>
</DropdownMenuItem>
- <DropdownMenuItem className="flex gap-2" onClick={onClickShowArchived}>
+ <DropdownMenuItem onClick={onClickShowArchived}>
{showArchived ? (
<SquareCheck className="size-4" />
) : (
@@ -70,10 +64,7 @@ export function TagOptions({
)}
<span>{t("actions.toggle_show_archived")}</span>
</DropdownMenuItem>
- <DropdownMenuItem
- className="flex gap-2"
- onClick={() => setDeleteTagDialogOpen(true)}
- >
+ <DropdownMenuItem onClick={() => setDeleteTagDialogOpen(true)}>
<Trash2 className="size-4" />
<span>{t("actions.delete")}</span>
</DropdownMenuItem>
diff --git a/apps/web/components/ui/dropdown-menu.tsx b/apps/web/components/ui/dropdown-menu.tsx
index 2bab577e..fe7a9813 100644
--- a/apps/web/components/ui/dropdown-menu.tsx
+++ b/apps/web/components/ui/dropdown-menu.tsx
@@ -26,7 +26,7 @@ const DropdownMenuSubTrigger = React.forwardRef<
<DropdownMenuPrimitive.SubTrigger
ref={ref}
className={cn(
- "flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",
+ "flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0",
inset && "pl-8",
className,
)}
@@ -46,7 +46,7 @@ const DropdownMenuSubContent = React.forwardRef<
<DropdownMenuPrimitive.SubContent
ref={ref}
className={cn(
- "z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
+ "z-50 min-w-[8rem] origin-[--radix-dropdown-menu-content-transform-origin] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
className,
)}
{...props}
@@ -64,7 +64,7 @@ const DropdownMenuContent = React.forwardRef<
ref={ref}
sideOffset={sideOffset}
className={cn(
- "z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
+ "z-50 max-h-[--radix-dropdown-menu-content-available-height] min-w-[8rem] origin-[--radix-dropdown-menu-content-transform-origin] overflow-y-auto overflow-x-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
className,
)}
{...props}
@@ -77,12 +77,14 @@ const DropdownMenuItem = React.forwardRef<
React.ElementRef<typeof DropdownMenuPrimitive.Item>,
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Item> & {
inset?: boolean;
+ variant?: "default" | "destructive";
}
->(({ className, inset, ...props }, ref) => (
+>(({ className, inset, variant = "default", ...props }, ref) => (
<DropdownMenuPrimitive.Item
ref={ref}
+ data-variant={variant}
className={cn(
- "relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
+ "relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[variant=destructive]:text-destructive data-[disabled]:opacity-50 data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 [&[data-variant=destructive]_svg]:!text-destructive [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0",
inset && "pl-8",
className,
)}
@@ -98,7 +100,7 @@ const DropdownMenuCheckboxItem = React.forwardRef<
<DropdownMenuPrimitive.CheckboxItem
ref={ref}
className={cn(
- "relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
+ "relative flex cursor-default select-none items-center gap-2 rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0",
className,
)}
checked={checked}
@@ -122,7 +124,7 @@ const DropdownMenuRadioItem = React.forwardRef<
<DropdownMenuPrimitive.RadioItem
ref={ref}
className={cn(
- "relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
+ "relative flex cursor-default select-none items-center gap-2 rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0",
className,
)}
{...props}
@@ -146,7 +148,7 @@ const DropdownMenuLabel = React.forwardRef<
<DropdownMenuPrimitive.Label
ref={ref}
className={cn(
- "px-2 py-1.5 text-sm font-semibold",
+ "px-2 py-1.5 text-sm font-medium",
inset && "pl-8",
className,
)}
@@ -161,7 +163,7 @@ const DropdownMenuSeparator = React.forwardRef<
>(({ className, ...props }, ref) => (
<DropdownMenuPrimitive.Separator
ref={ref}
- className={cn("-mx-1 my-1 h-px bg-muted", className)}
+ className={cn("-mx-1 my-1 h-px bg-border", className)}
{...props}
/>
));
@@ -173,7 +175,10 @@ const DropdownMenuShortcut = ({
}: React.HTMLAttributes<HTMLSpanElement>) => {
return (
<span
- className={cn("ml-auto text-xs tracking-widest opacity-60", className)}
+ className={cn(
+ "ml-auto text-xs tracking-widest text-muted-foreground",
+ className,
+ )}
{...props}
/>
);
diff --git a/apps/web/components/ui/switch.tsx b/apps/web/components/ui/switch.tsx
index 2438dc86..52c7f43b 100644
--- a/apps/web/components/ui/switch.tsx
+++ b/apps/web/components/ui/switch.tsx
@@ -10,7 +10,7 @@ const Switch = React.forwardRef<
>(({ className, ...props }, ref) => (
<SwitchPrimitives.Root
className={cn(
- "peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",
+ "peer inline-flex h-[1.15rem] w-8 shrink-0 cursor-pointer items-center rounded-full border border-transparent shadow-sm transition-all focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input dark:data-[state=unchecked]:bg-input/80",
className,
)}
{...props}
@@ -18,7 +18,7 @@ const Switch = React.forwardRef<
>
<SwitchPrimitives.Thumb
className={cn(
- "pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0",
+ "pointer-events-none block size-4 rounded-full bg-background ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0 dark:data-[state=checked]:bg-primary-foreground dark:data-[state=unchecked]:bg-foreground",
)}
/>
</SwitchPrimitives.Root>