diff --git a/app/components/chat.tsx b/app/components/chat.tsx index 6cd229cc..7ac9ca08 100644 --- a/app/components/chat.tsx +++ b/app/components/chat.tsx @@ -17,6 +17,7 @@ import { Message, SubmitKey, useChatStore, BOT_HELLO, ROLES } from "../store"; import { copyToClipboard, downloadAs, + getEmojiUrl, isMobileScreen, selectOrCopy, } from "../utils"; @@ -50,7 +51,7 @@ export function Avatar(props: { role: Message["role"] }) { return (
- +
); } diff --git a/app/components/settings.tsx b/app/components/settings.tsx index 649da1b7..b563d7ba 100644 --- a/app/components/settings.tsx +++ b/app/components/settings.tsx @@ -1,6 +1,6 @@ import { useState, useEffect, useMemo, HTMLProps } from "react"; -import EmojiPicker, { Theme as EmojiTheme, EmojiStyle } from "emoji-picker-react"; +import EmojiPicker, { Theme as EmojiTheme } from "emoji-picker-react"; import styles from "./settings.module.scss"; @@ -26,7 +26,7 @@ import { import { Avatar } from "./chat"; import Locale, { AllLangs, changeLang, getLang } from "../locales"; -import { getCurrentVersion } from "../utils"; +import { getCurrentVersion, getEmojiUrl } from "../utils"; import Link from "next/link"; import { UPDATE_URL } from "../constant"; import { SearchService, usePromptStore } from "../store/prompt"; @@ -181,9 +181,7 @@ export function Settings(props: { closeSettings: () => void }) { { - return `https://cdn.staticfile.org/emoji-datasource-apple/14.0.0/img/${style}/64/${unified}.png`; - }} + getEmojiUrl={getEmojiUrl} onEmojiClick={(e) => { updateConfig((config) => (config.avatar = e.unified)); setShowEmojiPicker(false); diff --git a/app/utils.ts b/app/utils.ts index 5fe277c6..93f7561a 100644 --- a/app/utils.ts +++ b/app/utils.ts @@ -1,3 +1,4 @@ +import { EmojiStyle } from "emoji-picker-react"; import { showToast } from "./components/ui-lib"; import Locale from "./locales"; @@ -81,3 +82,7 @@ export function getCurrentVersion() { return currentId; } + +export function getEmojiUrl(unified: string, style: EmojiStyle) { + return `https://cdn.staticfile.org/emoji-datasource-apple/14.0.0/img/${style}/64/${unified}.png`; +}