diff --git a/package-lock.json b/package-lock.json index 76f890f4..42e4a8fd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15,6 +15,7 @@ "@types/uuid": "^10.0.0", "clsx": "^2.1.1", "daisyui": "^5.0.12", + "emoji-picker-react": "^4.13.3", "gh-pages": "^6.3.0", "react": "^18.3.1", "react-color": "^2.19.3", @@ -3319,6 +3320,21 @@ "integrity": "sha512-4OIPYlA6JXqtVn8zpHpGiI7vE6EQOAg16aGnDMIAlZVinnoZ8208tW1hAbjWydgN/4PLTT9q+O1K6AH/vALJGw==", "license": "MIT" }, + "node_modules/emoji-picker-react": { + "version": "4.13.3", + "resolved": "https://registry.npmjs.org/emoji-picker-react/-/emoji-picker-react-4.13.3.tgz", + "integrity": "sha512-aZaxCI72oUQfvZtYuQ9RaYLEwmH3GVgAr5SEeB97Y7gWL06zJ4VTuSl8rAMVY7GNmd0tf/EQ1W2SDuXTl0q9AA==", + "license": "MIT", + "dependencies": { + "flairup": "1.0.0" + }, + "engines": { + "node": ">=10" + }, + "peerDependencies": { + "react": ">=16" + } + }, "node_modules/emoji-regex": { "version": "9.2.2", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", @@ -3776,6 +3792,12 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/flairup": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/flairup/-/flairup-1.0.0.tgz", + "integrity": "sha512-IKlE+pNvL2R+kVL1kEhUYqRxVqeFnjiIvHWDMLFXNaqyUdFXQM2wte44EfMYJNHkW16X991t2Zg8apKkhv7OBA==", + "license": "MIT" + }, "node_modules/flat-cache": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-4.0.1.tgz", diff --git a/package.json b/package.json index a6c8b353..1c363456 100644 --- a/package.json +++ b/package.json @@ -30,6 +30,7 @@ "@types/uuid": "^10.0.0", "clsx": "^2.1.1", "daisyui": "^5.0.12", + "emoji-picker-react": "^4.13.3", "gh-pages": "^6.3.0", "react": "^18.3.1", "react-color": "^2.19.3", diff --git a/src/components/layout/ChatArea.tsx b/src/components/layout/ChatArea.tsx index 8a560c0a..137e9d8b 100644 --- a/src/components/layout/ChatArea.tsx +++ b/src/components/layout/ChatArea.tsx @@ -1,15 +1,9 @@ import { UsersIcon } from "@heroicons/react/24/solid"; import { platform } from "@tauri-apps/plugin-os"; +import EmojiPicker, { type EmojiClickData, Theme } from "emoji-picker-react"; import type * as React from "react"; -import { - Children, - cloneElement, - Fragment, - isValidElement, - useEffect, - useRef, - useState, -} from "react"; +import { useEffect, useRef, useState } from "react"; +import { createPortal } from "react-dom"; import { FaArrowDown, FaAt, @@ -20,7 +14,6 @@ import { FaHashtag, FaPenAlt, FaPlus, - FaReply, FaSearch, FaTimes, FaUserPlus, @@ -29,13 +22,19 @@ import { v4 as uuidv4 } from "uuid"; import { useMediaQuery } from "../../hooks/useMediaQuery"; import { useTabCompletion } from "../../hooks/useTabCompletion"; import ircClient from "../../lib/ircClient"; -import { getColorStyle, ircColors, mircToHtml } from "../../lib/ircUtils"; +import { parseIrcUrl } from "../../lib/ircUrlParser"; +import { + type FormattingType, + formatMessageForIrc, + getPreviewStyles, + isValidFormattingType, +} from "../../lib/messageFormatter"; import useStore from "../../store"; import type { Message as MessageType, User } from "../../types"; +import { MessageItem } from "../message/MessageItem"; import AutocompleteDropdown from "../ui/AutocompleteDropdown"; import BlankPage from "../ui/BlankPage"; import ColorPicker from "../ui/ColorPicker"; -import EmojiSelector from "../ui/EmojiSelector"; import DiscoverGrid from "../ui/HomeScreen"; import ReactionModal from "../ui/ReactionModal"; import UserContextMenu from "../ui/UserContextMenu"; @@ -43,32 +42,6 @@ import UserContextMenu from "../ui/UserContextMenu"; const EMPTY_ARRAY: User[] = []; let lastTypingTime = 0; -export const OptionsDropdown: React.FC<{ - isOpen: boolean; - onClose: () => void; -}> = ({ isOpen, onClose }) => { - if (!isOpen) return null; - - return ( -