diff --git a/package-lock.json b/package-lock.json index 234fc356..99e0ce54 100644 --- a/package-lock.json +++ b/package-lock.json @@ -53,6 +53,7 @@ "pdfjs-dist": "^4.0.379", "react": "^18.2.0", "react-dom": "^18.2.0", + "react-error-boundary": "^4.0.13", "react-helmet-async": "^2.0.4", "react-i18next": "^14.1.0", "react-icons": "^5.0.1", @@ -11411,6 +11412,17 @@ "react": "^18.2.0" } }, + "node_modules/react-error-boundary": { + "version": "4.0.13", + "resolved": "https://registry.npmjs.org/react-error-boundary/-/react-error-boundary-4.0.13.tgz", + "integrity": "sha512-b6PwbdSv8XeOSYvjt8LpgpKrZ0yGdtZokYwkwV2wlcZbxgopHX/hgPl5VgpnoVOWd868n1hktM8Qm4b+02MiLQ==", + "dependencies": { + "@babel/runtime": "^7.12.5" + }, + "peerDependencies": { + "react": ">=16.13.1" + } + }, "node_modules/react-fast-compare": { "version": "3.2.2", "resolved": "https://registry.npmjs.org/react-fast-compare/-/react-fast-compare-3.2.2.tgz", diff --git a/package.json b/package.json index aac447b9..c0f84e7b 100644 --- a/package.json +++ b/package.json @@ -57,6 +57,7 @@ "pdfjs-dist": "^4.0.379", "react": "^18.2.0", "react-dom": "^18.2.0", + "react-error-boundary": "^4.0.13", "react-helmet-async": "^2.0.4", "react-i18next": "^14.1.0", "react-icons": "^5.0.1", diff --git a/src/components/chats/conversation/input.tsx b/src/components/chats/conversation/input.tsx index 63fc1cb4..1c55d981 100644 --- a/src/components/chats/conversation/input.tsx +++ b/src/components/chats/conversation/input.tsx @@ -2,7 +2,7 @@ import { memo, useState, useCallback, useMemo, useRef, useEffect } from "react" import { withReact, ReactEditor, Slate, Editable } from "slate-react" import { withHistory, type HistoryEditor } from "slate-history" import { createEditor, Editor, type BaseEditor, Transforms } from "slate" -import Icon from "@/components/icon" +import { PlusCircle, XCircle } from "lucide-react" import worker from "@/lib/worker" import { type ChatConversation } from "@filen/sdk/dist/types/api/v3/chat/conversations" import { useChatsStore } from "@/stores/chats.store" @@ -360,8 +360,7 @@ export const Input = memo(({ conversation }: { conversation: ChatConversation }) id="chat-input-container" >
- @@ -380,8 +379,7 @@ export const Input = memo(({ conversation }: { conversation: ChatConversation }) {replyMessage.senderNickName.length > 0 ? replyMessage.senderNickName : replyMessage.senderEmail}

- setReplyMessage(null)} diff --git a/src/components/chats/conversation/markAsRead.tsx b/src/components/chats/conversation/markAsRead.tsx index 105321bc..0afc5b1b 100644 --- a/src/components/chats/conversation/markAsRead.tsx +++ b/src/components/chats/conversation/markAsRead.tsx @@ -3,7 +3,7 @@ import { type ChatConversation } from "@filen/sdk/dist/types/api/v3/chat/convers import { type UseQueryResult } from "@tanstack/react-query" import worker from "@/lib/worker" import useElementDimensions from "@/hooks/useElementDimensions" -import Icon from "@/components/icon" +import { Loader, Check } from "lucide-react" import { type ChatLastFocusValues } from "@filen/sdk/dist/types/api/v3/chat/lastFocusUpdate" import { type ChatMessage } from "@filen/sdk/dist/types/api/v3/chat/messages" import useSDKConfig from "@/hooks/useSDKConfig" @@ -109,18 +109,14 @@ export const MarkAsRead = memo(

{markingAsRead ? ( - ) : ( <> {t("chats.markAsRead")} - + )}

diff --git a/src/components/chats/conversation/message/contextMenu.tsx b/src/components/chats/conversation/message/contextMenu.tsx index d7a365a4..02a67bca 100644 --- a/src/components/chats/conversation/message/contextMenu.tsx +++ b/src/components/chats/conversation/message/contextMenu.tsx @@ -8,7 +8,7 @@ import { } from "@/components/ui/context-menu" import { useTranslation } from "react-i18next" import { type ChatMessage } from "@filen/sdk/dist/types/api/v3/chat/messages" -import Icon from "@/components/icon" +import { Reply, Copy, Text, Delete } from "lucide-react" import useSDKConfig from "@/hooks/useSDKConfig" import worker from "@/lib/worker" import useLoadingToast from "@/hooks/useLoadingToast" @@ -131,20 +131,14 @@ export const ContextMenu = memo(({ message, children }: { message: ChatMessage; onClick={reply} className="cursor-pointer gap-3" > - + {t("chats.message.reply")} - + {t("chats.message.copyText")} {userId === message.senderId && ( @@ -154,20 +148,14 @@ export const ContextMenu = memo(({ message, children }: { message: ChatMessage; onClick={edit} className="cursor-pointer gap-3" > - + {t("chats.message.edit")} - + {t("chats.message.delete")} @@ -177,10 +165,7 @@ export const ContextMenu = memo(({ message, children }: { message: ChatMessage; onClick={copyId} className="cursor-pointer gap-3" > - + {t("chats.message.copyId")} diff --git a/src/components/chats/conversation/topBar.tsx b/src/components/chats/conversation/topBar.tsx index 700325a9..edb35945 100644 --- a/src/components/chats/conversation/topBar.tsx +++ b/src/components/chats/conversation/topBar.tsx @@ -2,7 +2,7 @@ import { memo, useMemo, useCallback } from "react" import { type ChatConversation } from "@filen/sdk/dist/types/api/v3/chat/conversations" import useSDKConfig from "@/hooks/useSDKConfig" import Avatar from "@/components/avatar" -import Icon from "@/components/icon" +import { ChevronRight, ChevronLeft } from "lucide-react" import { TOOLTIP_POPUP_DELAY } from "@/constants" import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip" import { useTranslation } from "react-i18next" @@ -47,7 +47,7 @@ export const TopBar = memo(({ conversation }: { conversation: ChatConversation } className="hover:bg-secondary rounded-lg p-1 cursor-pointer" onClick={toggleParticipantsContainer} > - + {conversationParticipantsContainerOpen ? : } diff --git a/src/components/chats/conversation/typing.tsx b/src/components/chats/conversation/typing.tsx index 590c17cd..5d205b17 100644 --- a/src/components/chats/conversation/typing.tsx +++ b/src/components/chats/conversation/typing.tsx @@ -3,7 +3,7 @@ import { type ChatConversation } from "@filen/sdk/dist/types/api/v3/chat/convers import { useTranslation } from "react-i18next" import { type SocketEvent } from "@filen/sdk" import socket from "@/lib/socket" -import Icon from "@/components/icon" +import { MoreHorizontal } from "lucide-react" export type TypingUser = { id: number @@ -20,10 +20,7 @@ export const Typing = memo(({ conversation }: { conversation: ChatConversation } const typing = useMemo((): React.ReactNode => { return ( <> - +

{`${typingUsers.map(user => (user.nickName.length > 0 ? user.nickName : user.email)).join(",")} `}

{`${t(typingUsers.length <= 1 ? "chats.input.typing" : "chats.input.typingMultiple")}`}

diff --git a/src/components/chats/participants/index.tsx b/src/components/chats/participants/index.tsx index 9483ed81..b212a8c6 100644 --- a/src/components/chats/participants/index.tsx +++ b/src/components/chats/participants/index.tsx @@ -1,6 +1,6 @@ import { memo, useRef } from "react" import { type ChatConversation } from "@filen/sdk/dist/types/api/v3/chat/conversations" -import Icon from "@/components/icon" +import { Plus, Crown } from "lucide-react" import { TOOLTIP_POPUP_DELAY } from "@/constants" import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip" import { useTranslation } from "react-i18next" @@ -35,7 +35,7 @@ export const Participants = memo(({ conversation }: { conversation: ChatConversa className="hover:bg-secondary rounded-lg p-1 cursor-pointer" onClick={() => {}} > - + @@ -80,8 +80,7 @@ export const Participants = memo(({ conversation }: { conversation: ChatConversa

{participant.email}

{participant.userId === conversation.ownerId && ( - diff --git a/src/components/dialogs/previewDialog/index.tsx b/src/components/dialogs/previewDialog/index.tsx index fd64dd12..62858d1d 100644 --- a/src/components/dialogs/previewDialog/index.tsx +++ b/src/components/dialogs/previewDialog/index.tsx @@ -9,15 +9,12 @@ import PDF from "./pdf" import Image from "./image" import Video from "./video" import DocX from "./docx" -import Icon from "@/components/icon" +import { Loader as LoaderIcon, X } from "lucide-react" export const Loader = memo(() => { return (
- +
) }) @@ -113,8 +110,7 @@ export const PreviewDialog = memo(() => {
{item.name} - setOpen(false)} /> diff --git a/src/components/dialogs/selectDriveDestination/breadcrumbs/item.tsx b/src/components/dialogs/selectDriveDestination/breadcrumbs/item.tsx index a09dfc7a..0db24e53 100644 --- a/src/components/dialogs/selectDriveDestination/breadcrumbs/item.tsx +++ b/src/components/dialogs/selectDriveDestination/breadcrumbs/item.tsx @@ -1,5 +1,5 @@ import { memo, useCallback, useState, useMemo } from "react" -import Icon from "@/components/icon" +import { ChevronRight } from "lucide-react" import { directoryUUIDToNameCache } from "@/cache" import { getItem } from "@/lib/localForage" import { useTranslation } from "react-i18next" @@ -91,8 +91,7 @@ export const Item = memo( {name}

{index < components.length - 1 && ( - diff --git a/src/components/dialogs/selectDriveDestination/list/listItem.tsx b/src/components/dialogs/selectDriveDestination/list/listItem.tsx index d5638d3a..e7e477e9 100644 --- a/src/components/dialogs/selectDriveDestination/list/listItem.tsx +++ b/src/components/dialogs/selectDriveDestination/list/listItem.tsx @@ -2,7 +2,7 @@ import { memo, useState, useCallback } from "react" import { type DriveCloudItem } from "@/components/drive" import { type VirtualItem } from "@tanstack/react-virtual" import FolderIcon from "@/assets/fileExtensionIcons/svg/folder.svg?react" -import Icon from "@/components/icon" +import { ChevronRight } from "lucide-react" import { formatBytes } from "@/utils" import { directorySizeCache } from "@/cache" import worker from "@/lib/worker" @@ -72,10 +72,7 @@ export const ListItem = memo(

{formatBytes(size)}

- +
) diff --git a/src/components/drive/list/item/contextMenu/moveTree.tsx b/src/components/drive/list/item/contextMenu/moveTree.tsx index 6dc0840a..9675f922 100644 --- a/src/components/drive/list/item/contextMenu/moveTree.tsx +++ b/src/components/drive/list/item/contextMenu/moveTree.tsx @@ -2,7 +2,7 @@ import { memo, useCallback, useMemo } from "react" import { ContextMenuSub, ContextMenuSubTrigger, ContextMenuSubContent, ContextMenuItem } from "@/components/ui/context-menu" import worker from "@/lib/worker" import { useQuery } from "@tanstack/react-query" -import Icon from "@/components/icon" +import { Loader } from "lucide-react" import { useDriveItemsStore } from "@/stores/drive.store" import { move as moveAction } from "./actions" import { orderItemsByType } from "@/components/drive/utils" @@ -80,8 +80,7 @@ export const MoveTree = memo(({ parent, name }: { parent: string; name: string } }} className="cursor-pointer" > - diff --git a/src/components/drive/list/item/index.tsx b/src/components/drive/list/item/index.tsx index 3601934f..e534e362 100644 --- a/src/components/drive/list/item/index.tsx +++ b/src/components/drive/list/item/index.tsx @@ -12,7 +12,7 @@ import eventEmitter from "@/lib/eventEmitter" import { generateThumbnail } from "@/lib/worker/proxy" import { fileNameToThumbnailType, fileNameToPreviewType } from "@/components/dialogs/previewDialog/utils" import { cn } from "@/lib/utils" -import Icon from "@/components/icon" +import { Heart } from "lucide-react" import useMountedEffect from "@/hooks/useMountedEffect" import { type CloudItemReceiver } from "@filen/sdk/dist/types/cloud" import { THUMBNAIL_MAX_FETCH_SIZE } from "@/constants" @@ -316,8 +316,7 @@ export const ListItem = memo(
{item.favorited && ( - diff --git a/src/components/icon.tsx b/src/components/icon.tsx deleted file mode 100644 index 7a61ee8f..00000000 --- a/src/components/icon.tsx +++ /dev/null @@ -1,31 +0,0 @@ -import { lazy, Suspense, memo } from "react" -import { type LucideProps, type LucideIcon } from "lucide-react" -import dynamicIconImports from "lucide-react/dynamicIconImports" -import { memoize } from "lodash" - -interface IconProps extends Omit { - name: keyof typeof dynamicIconImports -} - -export const getIcon = memoize((name: keyof typeof dynamicIconImports): React.LazyExoticComponent => { - return lazy(dynamicIconImports[name]) -}) - -export const Icon = memo(({ name, ...props }: IconProps) => { - const LucideIcon = getIcon(name) - - return ( - - } - > - - - ) -}) - -export default Icon diff --git a/src/components/mainContainer/innerSideBar/button.tsx b/src/components/mainContainer/innerSideBar/button.tsx index 232466e3..088caf17 100644 --- a/src/components/mainContainer/innerSideBar/button.tsx +++ b/src/components/mainContainer/innerSideBar/button.tsx @@ -8,7 +8,7 @@ import { useLocalStorage } from "@uidotdev/usehooks" import { folderIcon } from "@/assets/fileExtensionIcons" import { useTranslation } from "react-i18next" import { cn } from "@/lib/utils" -import Icon from "@/components/icon" +import { ChevronRight, ChevronDown, Timer, Heart, Link as LinkIcon, Trash, Notebook, MessageCircle, Settings } from "lucide-react" import useLocation from "@/hooks/useLocation" const iconSize = 20 @@ -37,14 +37,12 @@ export const Button = memo(({ uuid }: { uuid: string }) => { <>
{!sideBarTreeOpen[uuid] ? ( - setSideBarTreeOpen(prev => ({ ...prev, [uuid]: true }))} /> ) : ( - setSideBarTreeOpen(prev => ({ ...prev, [uuid]: false }))} /> @@ -60,64 +58,43 @@ export const Button = memo(({ uuid }: { uuid: string }) => { )} {uuid === "recents" && ( <> - +

{t("innerSideBar.recents")}

)} {uuid === "favorites" && ( <> - +

{t("innerSideBar.favorites")}

)} {uuid === "trash" && ( <> - +

{t("innerSideBar.trash")}

)} {uuid === "shared-in" && ( <> - +

{t("innerSideBar.sharedWithMe")}

)} {uuid === "shared-out" && ( <> - +

{t("innerSideBar.sharedWithOthers")}

)} {uuid === "links" && ( <> - +

{t("innerSideBar.links")}

)} {uuid === "settings/general" && ( <> - +

{t("innerSideBar.settings.general")}

)} diff --git a/src/components/mainContainer/innerSideBar/notes/note/index.tsx b/src/components/mainContainer/innerSideBar/notes/note/index.tsx index 7ec34634..4f07ad2f 100644 --- a/src/components/mainContainer/innerSideBar/notes/note/index.tsx +++ b/src/components/mainContainer/innerSideBar/notes/note/index.tsx @@ -2,7 +2,7 @@ import { memo, type SetStateAction, useCallback, useMemo } from "react" import { cn } from "@/lib/utils" import useRouteParent from "@/hooks/useRouteParent" import { Link } from "@tanstack/react-router" -import Icon from "@/components/icon" +import { Archive, Trash, Text, ListChecks, Code, NotepadText, Pin, Heart, BookMarked } from "lucide-react" import { type Note as NoteType } from "@filen/sdk/dist/types/api/v3/notes" import ContextMenu from "./contextMenu" import { simpleDate } from "@/utils" @@ -46,64 +46,23 @@ export const Note = memo( >
{note.archive ? ( - + ) : note.trash ? ( - + ) : ( <> - {note.type === "checklist" && ( - - )} - {note.type === "text" && ( - - )} - {note.type === "code" && ( - - )} - {note.type === "rich" && ( - - )} - {note.type === "md" && ( - - )} + {note.type === "checklist" && } + {note.type === "text" && } + {note.type === "code" && } + {note.type === "rich" && } + {note.type === "md" && } )} - {note.pinned && ( - - )} + {note.pinned && }
- {note.favorite && ( - - )} + {note.favorite && }

{note.title}

diff --git a/src/components/mainContainer/innerSideBar/top/chats/index.tsx b/src/components/mainContainer/innerSideBar/top/chats/index.tsx index 71340eba..5a63eff9 100644 --- a/src/components/mainContainer/innerSideBar/top/chats/index.tsx +++ b/src/components/mainContainer/innerSideBar/top/chats/index.tsx @@ -1,6 +1,6 @@ import { memo, useCallback } from "react" import { useTranslation } from "react-i18next" -import Icon from "@/components/icon" +import { Plus } from "lucide-react" import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip" import { TOOLTIP_POPUP_DELAY } from "@/constants" import { useChatsStore } from "@/stores/chats.store" @@ -28,7 +28,7 @@ export const Chats = memo(() => { className="hover:bg-secondary rounded-lg p-1 cursor-pointer" onClick={() => {}} > - +

diff --git a/src/components/mainContainer/innerSideBar/top/notes/index.tsx b/src/components/mainContainer/innerSideBar/top/notes/index.tsx index 8f0f8dbd..95259aaf 100644 --- a/src/components/mainContainer/innerSideBar/top/notes/index.tsx +++ b/src/components/mainContainer/innerSideBar/top/notes/index.tsx @@ -1,7 +1,7 @@ import { memo, useCallback } from "react" import { useNavigate } from "@tanstack/react-router" import { useTranslation } from "react-i18next" -import Icon from "@/components/icon" +import { Plus } from "lucide-react" import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip" import { TOOLTIP_POPUP_DELAY } from "@/constants" import worker from "@/lib/worker" @@ -52,7 +52,7 @@ export const Notes = memo(() => { className="hover:bg-secondary rounded-lg p-1 cursor-pointer" onClick={createNote} > - +
diff --git a/src/components/mainContainer/innerSideBar/top/notes/tags/index.tsx b/src/components/mainContainer/innerSideBar/top/notes/tags/index.tsx index a046e898..e55ccaa5 100644 --- a/src/components/mainContainer/innerSideBar/top/notes/tags/index.tsx +++ b/src/components/mainContainer/innerSideBar/top/notes/tags/index.tsx @@ -1,7 +1,7 @@ import { memo, useCallback } from "react" import { useQuery } from "@tanstack/react-query" import worker from "@/lib/worker" -import Icon from "@/components/icon" +import { Heart, Plus } from "lucide-react" import { useTranslation } from "react-i18next" import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip" import { TOOLTIP_POPUP_DELAY } from "@/constants" @@ -78,12 +78,7 @@ export const Tags = memo(() => { className={cn(tagClassName, activeTag === tag.name ? "bg-secondary" : "")} onClick={() => setActiveTag(tag.uuid)} > - {tag.favorite && ( - - )} + {tag.favorite && }

{tag.name}

@@ -96,10 +91,7 @@ export const Tags = memo(() => { className={tagClassName} onClick={createTag} > - + diff --git a/src/components/mainContainer/innerSideBar/tree.tsx b/src/components/mainContainer/innerSideBar/tree.tsx index 66e9be9e..f5b06f5c 100644 --- a/src/components/mainContainer/innerSideBar/tree.tsx +++ b/src/components/mainContainer/innerSideBar/tree.tsx @@ -2,7 +2,7 @@ import { memo, useMemo } from "react" import worker from "@/lib/worker" import { useQuery } from "@tanstack/react-query" import { useLocalStorage } from "@uidotdev/usehooks" -import Icon from "@/components/icon" +import { ChevronRight, ChevronDown } from "lucide-react" import useRouteParent from "@/hooks/useRouteParent" import { Link } from "@tanstack/react-router" import { folderIcon } from "@/assets/fileExtensionIcons" @@ -46,8 +46,7 @@ export const Tree = memo(({ parent, depth, pathname }: { parent: string; depth: > {!sideBarTreeOpen[item.uuid] ? ( <> - setSideBarTreeOpen(prev => ({ ...prev, [item.uuid]: true }))} size={16} @@ -60,8 +59,7 @@ export const Tree = memo(({ parent, depth, pathname }: { parent: string; depth: ) : ( <> - setSideBarTreeOpen(prev => ({ ...prev, [item.uuid]: false }))} size={16} diff --git a/src/components/mainContainer/sideBar/button.tsx b/src/components/mainContainer/sideBar/button.tsx index e2875b71..a7520cc0 100644 --- a/src/components/mainContainer/sideBar/button.tsx +++ b/src/components/mainContainer/sideBar/button.tsx @@ -1,5 +1,5 @@ import { memo, useState, useCallback, useMemo } from "react" -import Icon from "@/components/icon" +import { RefreshCcw, HardDrive, Notebook, MessageCircle, Contact, ArrowDownUp, Settings } from "lucide-react" import { Link } from "@tanstack/react-router" import useSDKConfig from "@/hooks/useSDKConfig" import useRouteParent from "@/hooks/useRouteParent" @@ -107,18 +107,8 @@ export const Button = memo(({ id }: { id: string }) => { to={link.to} params={link.params} > - {id === "syncs" && ( - - )} - {id === "mounts" && ( - - )} + {id === "syncs" && } + {id === "mounts" && } {id === sdkConfig.baseFolderUUID && ( { draggable={false} /> )} - {id === "notes" && ( - - )} - {id === "chats" && ( - - )} - {id === "contacts" && ( - - )} - {id === "settings" && ( - - )} - {id === "transfers" && ( - - )} + {id === "notes" && } + {id === "chats" && } + {id === "contacts" && } + {id === "settings" && } + {id === "transfers" && } {id === "transfers" && } diff --git a/src/components/mainContainer/topBar/breadcrumbs/item.tsx b/src/components/mainContainer/topBar/breadcrumbs/item.tsx index 5aa84a89..3d2ec4bc 100644 --- a/src/components/mainContainer/topBar/breadcrumbs/item.tsx +++ b/src/components/mainContainer/topBar/breadcrumbs/item.tsx @@ -1,5 +1,5 @@ import { memo, useCallback, useState, useEffect } from "react" -import Icon from "@/components/icon" +import { ChevronRight } from "lucide-react" import useSDKConfig from "@/hooks/useSDKConfig" import { validate as validateUUID } from "uuid" import { getItem } from "@/lib/localForage" @@ -107,12 +107,7 @@ export const Item = memo(({ path, index, pathname }: { path: string; index: numb > {path === sdkConfig.baseFolderUUID ? t("topBar.breadcrumb.cloudDrive") : name}

- {index < pathname.split("/").length - 1 && ( - - )} + {index < pathname.split("/").length - 1 && } ) }) diff --git a/src/components/mainContainer/topBar/index.tsx b/src/components/mainContainer/topBar/index.tsx index 6d49d24b..09bc1e9e 100644 --- a/src/components/mainContainer/topBar/index.tsx +++ b/src/components/mainContainer/topBar/index.tsx @@ -1,6 +1,6 @@ import { memo, useCallback, useTransition } from "react" import { Input } from "@/components/ui/input" -import Icon from "@/components/icon" +import { Search, List, Grid3X3 } from "lucide-react" import { useTranslation } from "react-i18next" import Breadcrumbs from "./breadcrumbs" import { useDriveItemsStore } from "@/stores/drive.store" @@ -56,8 +56,7 @@ export const TopBar = memo(() => {
- @@ -98,14 +97,12 @@ export const TopBar = memo(() => { {listType[parent] === "grid" ? ( - ) : ( - diff --git a/src/components/mainContainer/topBar/notes.tsx b/src/components/mainContainer/topBar/notes.tsx index 74cc48e7..acddaff8 100644 --- a/src/components/mainContainer/topBar/notes.tsx +++ b/src/components/mainContainer/topBar/notes.tsx @@ -1,6 +1,6 @@ import { memo, useCallback } from "react" import { useNotesStore } from "@/stores/notes.store" -import Icon from "@/components/icon" +import { CheckCircle2, Loader, MoreVertical } from "lucide-react" import { showInputDialog } from "@/components/dialogs/input" import worker from "@/lib/worker" import ContextMenu from "../innerSideBar/notes/note/contextMenu" @@ -61,17 +61,7 @@ export const Notes = memo(() => { return (
- {synced ? ( - - ) : ( - - )} + {synced ? : }

{ className="flex flex-row p-1 rounded-lg hover:bg-secondary cursor-pointer" onClick={triggerMoreIconContextMenu} > - diff --git a/src/components/textEditor/index.tsx b/src/components/textEditor/index.tsx index 24e5dd0d..f6e4441a 100644 --- a/src/components/textEditor/index.tsx +++ b/src/components/textEditor/index.tsx @@ -4,10 +4,11 @@ import { useTheme } from "@/providers/themeProvider" import { loadLanguage } from "./langs" import { hyperLink } from "@uiw/codemirror-extensions-hyper-link" import { color } from "@uiw/codemirror-extensions-color" -import Icon from "../icon" +import { Loader } from "lucide-react" import { type Root, type Element, type RootContent } from "hast" import { ResizablePanelGroup, ResizableHandle, ResizablePanel } from "../ui/resizable" import { useLocalStorage } from "@uidotdev/usehooks" +import { ErrorBoundary } from "react-error-boundary" const CodeMirror = lazy(() => import("@uiw/react-codemirror")) const MarkdownPreview = lazy(() => import("@uiw/react-markdown-preview")) @@ -96,7 +97,7 @@ export const TextEditor = memo( }, []) return ( - - +

} > -
- - + +
+ } + > +
+ - - - {showMarkdownPreview && ( - <> - + - - + {showMarkdownPreview && ( + <> + - - - )} - -
- + + + + + )} + +
+ + ) } ) diff --git a/src/components/textEditor/rich.tsx b/src/components/textEditor/rich.tsx index 7b832b1f..2922c57a 100644 --- a/src/components/textEditor/rich.tsx +++ b/src/components/textEditor/rich.tsx @@ -1,8 +1,9 @@ import { memo, lazy, useState, Suspense, useCallback, useEffect } from "react" import type ReactQuill from "react-quill" -import Icon from "../icon" +import { Loader } from "lucide-react" import { useTheme } from "@/providers/themeProvider" import { normalizeChecklistValue } from "../notes/utils" +import { ErrorBoundary } from "react-error-boundary" const Quill = lazy(() => import("react-quill")) @@ -52,7 +53,7 @@ export const RichTextEditor = memo( }, [quillRef]) return ( - - +
} > - { - if (ref) { - setQuillRef(ref) + + +
+ } + > + { + if (ref) { + setQuillRef(ref) + } + }} + onBlur={onBlur} + readOnly={readOnly} + preserveWhitespace={true} + modules={ + type === "rich" + ? { + toolbar: [ + [{ header: [1, 2, 3, 4, 5, 6, false] }], + ["bold", "italic", "underline"], + ["code-block", "link", "blockquote"], + [{ list: "ordered" }, { list: "bullet" }, { list: "check" }], + [{ indent: "-1" }, { indent: "+1" }], + [{ script: "sub" }, { script: "super" }], + [{ direction: "rtl" }] + ] + } + : { + toolbar: [] + } } - }} - onBlur={onBlur} - readOnly={readOnly} - preserveWhitespace={true} - modules={ - type === "rich" - ? { - toolbar: [ - [{ header: [1, 2, 3, 4, 5, 6, false] }], - ["bold", "italic", "underline"], - ["code-block", "link", "blockquote"], - [{ list: "ordered" }, { list: "bullet" }, { list: "check" }], - [{ indent: "-1" }, { indent: "+1" }], - [{ script: "sub" }, { script: "super" }], - [{ direction: "rtl" }] + formats={ + type === "rich" + ? [ + "bold", + "code", + "italic", + "link", + "size", + "strike", + "script", + "underline", + "blockquote", + "header", + "indent", + "list", + "align", + "direction", + "code-block" ] - } - : { - toolbar: [] - } - } - formats={ - type === "rich" - ? [ - "bold", - "code", - "italic", - "link", - "size", - "strike", - "script", - "underline", - "blockquote", - "header", - "indent", - "list", - "align", - "direction", - "code-block" - ] - : ["list"] - } - style={{ - width: width + "px", - height: height - 35 + "px", - border: "none", - color: theme.dark ? "white" : "black", - marginTop: type === "checklist" ? "-47px" : undefined, - marginLeft: type === "checklist" ? "-23px" : undefined - }} - onChange={onChange} - /> - + : ["list"] + } + style={{ + width: width + "px", + height: height - 35 + "px", + border: "none", + color: theme.dark ? "white" : "black", + marginTop: type === "checklist" ? "-47px" : undefined, + marginLeft: type === "checklist" ? "-23px" : undefined + }} + onChange={onChange} + /> + + ) } ) diff --git a/src/components/transfers/index.tsx b/src/components/transfers/index.tsx index fb1591f3..b730ecb5 100644 --- a/src/components/transfers/index.tsx +++ b/src/components/transfers/index.tsx @@ -11,7 +11,7 @@ import { Progress } from "@/components/ui/progress" import { calcSpeed, calcTimeLeft, getTimeRemaining, bpsToReadable } from "./utils" import { cn } from "@/lib/utils" import throttle from "lodash/throttle" -import Icon from "../icon" +import { ArrowDownUp } from "lucide-react" const transferStateSortingPriority: Record = { started: 1, @@ -268,10 +268,7 @@ export const Transfers = memo(() => { className="w-full flex flex-col items-center justify-center text-muted-foreground gap-2" style={{ height: windowSize.height - 85 }} > - +

{t("transfers.noActiveTransfers")}

) : ( diff --git a/src/components/ui/breadcrumb.tsx b/src/components/ui/breadcrumb.tsx index 6c751e3d..d01717e4 100644 --- a/src/components/ui/breadcrumb.tsx +++ b/src/components/ui/breadcrumb.tsx @@ -1,6 +1,6 @@ import * as React from "react" import { Slot } from "@radix-ui/react-slot" -import Icon from "../icon" +import { ChevronRight, MoreHorizontal } from "lucide-react" import { cn } from "@/lib/utils" @@ -73,7 +73,7 @@ const BreadcrumbSeparator = ({ children, className, ...props }: React.ComponentP className={cn("[&>svg]:size-3.5", className)} {...props} > - {children || } + {children || } ) BreadcrumbSeparator.displayName = "BreadcrumbSeparator" @@ -85,10 +85,7 @@ const BreadcrumbEllipsis = ({ className, ...props }: React.ComponentProps<"span" className={cn("flex h-9 w-9 items-center justify-center", className)} {...props} > - + More ) diff --git a/src/components/ui/context-menu.tsx b/src/components/ui/context-menu.tsx index e74805fb..bfb87a5b 100644 --- a/src/components/ui/context-menu.tsx +++ b/src/components/ui/context-menu.tsx @@ -1,6 +1,6 @@ import * as React from "react" import * as ContextMenuPrimitive from "@radix-ui/react-context-menu" -import Icon from "../icon" +import { ChevronRight, Circle, Check } from "lucide-react" import { cn } from "@/lib/utils" @@ -32,10 +32,7 @@ const ContextMenuSubTrigger = React.forwardRef< {...props} > {children} - + )) ContextMenuSubTrigger.displayName = ContextMenuPrimitive.SubTrigger.displayName @@ -105,10 +102,7 @@ const ContextMenuCheckboxItem = React.forwardRef< > - + {children} @@ -130,10 +124,7 @@ const ContextMenuRadioItem = React.forwardRef< > - + {children} diff --git a/src/components/ui/dialog.tsx b/src/components/ui/dialog.tsx index c921bb08..f16a5aeb 100644 --- a/src/components/ui/dialog.tsx +++ b/src/components/ui/dialog.tsx @@ -1,6 +1,6 @@ import * as React from "react" import * as DialogPrimitive from "@radix-ui/react-dialog" -import Icon from "../icon" +import { X } from "lucide-react" import { cn } from "@/lib/utils" @@ -51,10 +51,7 @@ const DialogContent = React.forwardRef< className?.includes("no-close-button") && "hidden" )} > - + Close diff --git a/src/components/ui/dropdown-menu.tsx b/src/components/ui/dropdown-menu.tsx index 5da7d358..8b56d60e 100644 --- a/src/components/ui/dropdown-menu.tsx +++ b/src/components/ui/dropdown-menu.tsx @@ -1,6 +1,6 @@ import * as React from "react" import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu" -import Icon from "../icon" +import { ChevronRight, Check, Circle } from "lucide-react" import { cn } from "@/lib/utils" @@ -32,10 +32,7 @@ const DropdownMenuSubTrigger = React.forwardRef< {...props} > {children} - + )) DropdownMenuSubTrigger.displayName = DropdownMenuPrimitive.SubTrigger.displayName @@ -106,10 +103,7 @@ const DropdownMenuCheckboxItem = React.forwardRef< > - + {children} @@ -131,10 +125,7 @@ const DropdownMenuRadioItem = React.forwardRef< > - + {children} diff --git a/src/components/ui/input-otp.tsx b/src/components/ui/input-otp.tsx index fe058e21..2edd150e 100644 --- a/src/components/ui/input-otp.tsx +++ b/src/components/ui/input-otp.tsx @@ -1,6 +1,6 @@ import * as React from "react" import { OTPInput, SlotProps } from "input-otp" -import Icon from "../icon" +import { Dot } from "lucide-react" import { cn } from "@/lib/utils" @@ -54,7 +54,7 @@ const InputOTPSeparator = React.forwardRef, React.Compon role="separator" {...props} > - + )) InputOTPSeparator.displayName = "InputOTPSeparator" diff --git a/src/components/ui/resizable.tsx b/src/components/ui/resizable.tsx index 13c73c01..d61363c0 100644 --- a/src/components/ui/resizable.tsx +++ b/src/components/ui/resizable.tsx @@ -1,4 +1,4 @@ -import Icon from "../icon" +import { GripVertical } from "lucide-react" import * as ResizablePrimitive from "react-resizable-panels" import { cn } from "@/lib/utils" @@ -28,10 +28,7 @@ const ResizableHandle = ({ > {withHandle && (
- +
)} diff --git a/src/components/ui/select.tsx b/src/components/ui/select.tsx index 902ee1d1..c6e7e641 100644 --- a/src/components/ui/select.tsx +++ b/src/components/ui/select.tsx @@ -1,6 +1,6 @@ import * as React from "react" import * as SelectPrimitive from "@radix-ui/react-select" -import Icon from "../icon" +import { ChevronDown, ChevronUp, Check } from "lucide-react" import { cn } from "@/lib/utils" @@ -24,10 +24,7 @@ const SelectTrigger = React.forwardRef< > {children} - + )) @@ -42,10 +39,7 @@ const SelectScrollUpButton = React.forwardRef< className={cn("flex cursor-default items-center justify-center py-1", className)} {...props} > - + )) SelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName @@ -59,10 +53,7 @@ const SelectScrollDownButton = React.forwardRef< className={cn("flex cursor-default items-center justify-center py-1", className)} {...props} > - + )) SelectScrollDownButton.displayName = SelectPrimitive.ScrollDownButton.displayName @@ -124,10 +115,7 @@ const SelectItem = React.forwardRef< > - + diff --git a/src/components/ui/sheet.tsx b/src/components/ui/sheet.tsx index 918783da..50cb0a71 100644 --- a/src/components/ui/sheet.tsx +++ b/src/components/ui/sheet.tsx @@ -1,7 +1,7 @@ import * as React from "react" import * as SheetPrimitive from "@radix-ui/react-dialog" import { cva, type VariantProps } from "class-variance-authority" -import Icon from "../icon" +import { X } from "lucide-react" import { cn } from "@/lib/utils" @@ -66,10 +66,7 @@ const SheetContent = React.forwardRef - + Close diff --git a/src/components/ui/toast.tsx b/src/components/ui/toast.tsx index 6324e4d0..6d6bfc96 100644 --- a/src/components/ui/toast.tsx +++ b/src/components/ui/toast.tsx @@ -3,7 +3,7 @@ import * as React from "react" import * as ToastPrimitives from "@radix-ui/react-toast" import { cva, type VariantProps } from "class-variance-authority" -import Icon from "../icon" +import { X } from "lucide-react" import { cn } from "@/lib/utils" @@ -81,10 +81,7 @@ const ToastClose = React.forwardRef< toast-close="" {...props} > - + )) ToastClose.displayName = ToastPrimitives.Close.displayName diff --git a/src/hooks/useErrorToast.tsx b/src/hooks/useErrorToast.tsx index d01d8ac4..5ae2a858 100644 --- a/src/hooks/useErrorToast.tsx +++ b/src/hooks/useErrorToast.tsx @@ -1,5 +1,5 @@ import { useToast } from "@/components/ui/use-toast" -import Icon from "@/components/icon" +import { Ban } from "lucide-react" import { useCallback } from "react" export default function useErrorToast() { @@ -10,10 +10,7 @@ export default function useErrorToast() { return toast({ description: (
- +

{reason}

), diff --git a/src/hooks/useLoadingToast.tsx b/src/hooks/useLoadingToast.tsx index 3d725636..e2a2a955 100644 --- a/src/hooks/useLoadingToast.tsx +++ b/src/hooks/useLoadingToast.tsx @@ -1,5 +1,5 @@ import { useToast } from "@/components/ui/use-toast" -import Icon from "@/components/icon" +import { Loader } from "lucide-react" import { useCallback } from "react" export default function useLoadingToast() { @@ -8,8 +8,7 @@ export default function useLoadingToast() { const show = useCallback(() => { return toast({ description: ( - diff --git a/src/hooks/useSuccessToast.tsx b/src/hooks/useSuccessToast.tsx index e7848048..33bf0945 100644 --- a/src/hooks/useSuccessToast.tsx +++ b/src/hooks/useSuccessToast.tsx @@ -1,5 +1,5 @@ import { useToast } from "@/components/ui/use-toast" -import Icon from "@/components/icon" +import { CheckCircle } from "lucide-react" import { useCallback } from "react" export default function useSuccessToast() { @@ -10,10 +10,7 @@ export default function useSuccessToast() { return toast({ description: (
- +

{message}

), diff --git a/src/routes/login.lazy.tsx b/src/routes/login.lazy.tsx index 4c1377ac..21228cf4 100644 --- a/src/routes/login.lazy.tsx +++ b/src/routes/login.lazy.tsx @@ -10,7 +10,7 @@ import worker from "@/lib/worker" import { useTranslation } from "react-i18next" import RequireUnauthed from "@/components/requireUnauthed" import { InputOTP, InputOTPGroup, InputOTPSeparator, InputOTPSlot } from "@/components/ui/input-otp" -import Icon from "@/components/icon" +import { Loader, Eye } from "lucide-react" export const Route = createLazyFileRoute("/login")({ component: Login @@ -114,14 +114,7 @@ export function Login() { onClick={login} disabled={loading} > - {loading ? ( - - ) : ( - t("login.buttons.login") - )} + {loading ? : t("login.buttons.login")} ) : ( @@ -170,14 +163,7 @@ export function Login() { onClick={login} disabled={loading} > - {loading ? ( - - ) : ( - t("login.buttons.login") - )} + {loading ? : t("login.buttons.login")} )} @@ -213,8 +199,7 @@ export function Login() { />
- setShowPassword(prev => !prev)} @@ -228,14 +213,7 @@ export function Login() { onClick={login} disabled={loading} > - {loading ? ( - - ) : ( - t("login.buttons.login") - )} + {loading ? : t("login.buttons.login")}