Skip to content

Commit

Permalink
chore: remove emoji regex
Browse files Browse the repository at this point in the history
  • Loading branch information
johnnyjoygh committed Mar 4, 2025
1 parent 6ed6b86 commit 92a44e2
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 12 deletions.
1 change: 0 additions & 1 deletion web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
"clsx": "^2.1.1",
"copy-to-clipboard": "^3.3.3",
"dayjs": "^1.11.13",
"emoji-regex": "^10.4.0",
"fuse.js": "^7.1.0",
"highlight.js": "^11.11.1",
"i18next": "^24.2.2",
Expand Down
8 changes: 0 additions & 8 deletions web/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions web/src/components/HomeSidebar/ShortcutsSection.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Dropdown, Menu, MenuButton, MenuItem, Tooltip } from "@mui/joy";
import EmojiRegex from "emoji-regex";
import { Edit3Icon, MoreVerticalIcon, TrashIcon, PlusIcon } from "lucide-react";
import { observer } from "mobx-react-lite";
import { userServiceClient } from "@/grpcweb";
Expand All @@ -12,7 +11,7 @@ import { cn } from "@/utils";
import { useTranslate } from "@/utils/i18n";
import showCreateShortcutDialog from "../CreateShortcutDialog";

const emojiRegex = EmojiRegex();
const emojiRegex = /^(\p{Emoji_Presentation}|\p{Emoji}\uFE0F)$/u;

const ShortcutsSection = observer(() => {
const t = useTranslate();
Expand Down Expand Up @@ -42,10 +41,10 @@ const ShortcutsSection = observer(() => {
</div>
<div className="w-full flex flex-row justify-start items-center relative flex-wrap gap-x-2 gap-y-1">
{shortcuts.map((shortcut) => {
const selected = memoFilterStore.shortcut === shortcut.id;
const maybeEmoji = shortcut.title.split(" ")[0];
const emoji = emojiRegex.test(maybeEmoji) ? maybeEmoji : undefined;
const title = emoji ? shortcut.title.replace(emoji, "") : shortcut.title;
const selected = memoFilterStore.shortcut === shortcut.id;
return (
<div
key={shortcut.id}
Expand Down

0 comments on commit 92a44e2

Please sign in to comment.