Compare commits
No commits in common. "f774f3b8bc00007d9d7de7ed74d0b88f4f6bb358" and "e53a289ea17940aacfdcd57e28743acc80b9b24b" have entirely different histories.
f774f3b8bc
...
e53a289ea1
5 changed files with 3 additions and 105 deletions
|
@ -15,15 +15,6 @@ description = """
|
||||||
Copy emojis to your clipboard from Gauntlet!
|
Copy emojis to your clipboard from Gauntlet!
|
||||||
"""
|
"""
|
||||||
|
|
||||||
[[entrypoint]]
|
|
||||||
id = 'emojipicker-grid'
|
|
||||||
name = 'Emoji Picker (Grid)'
|
|
||||||
path = 'src/emojipicker-grid.tsx'
|
|
||||||
type = 'view'
|
|
||||||
description = """
|
|
||||||
Copy emojis to your clipboard from Gauntlet!
|
|
||||||
"""
|
|
||||||
|
|
||||||
[permissions]
|
[permissions]
|
||||||
main_search_bar = ["read"]
|
main_search_bar = ["read"]
|
||||||
clipboard = ["write"]
|
clipboard = ["write"]
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@project-gauntlet/api": "0.12.0",
|
"@project-gauntlet/api": "0.12.0",
|
||||||
"unicode-emoji": "^2.6.0",
|
"unicode-emoji": "^2.5.0",
|
||||||
"which": "^5.0.0"
|
"which": "^5.0.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|
|
@ -1,93 +0,0 @@
|
||||||
import { Grid } from "@project-gauntlet/api/components";
|
|
||||||
import React, { ReactNode, useState } from "react";
|
|
||||||
import { Clipboard, showHud } from "@project-gauntlet/api/helpers";
|
|
||||||
import {
|
|
||||||
GroupedBy,
|
|
||||||
BaseEmoji,
|
|
||||||
getEmojis,
|
|
||||||
getEmojisGroupedBy,
|
|
||||||
} from "unicode-emoji";
|
|
||||||
|
|
||||||
// @ts-expect-error gauntlet uses deno and not node
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
||||||
const denoCore: DenoCore = Deno[Deno.internal].core;
|
|
||||||
|
|
||||||
export default function EmojiPicker(): ReactNode | undefined {
|
|
||||||
const [searchText, setSearchText] = useState<string | undefined>("");
|
|
||||||
|
|
||||||
let emojiList: BaseEmoji[] | Record<GroupedBy, BaseEmoji[]>;
|
|
||||||
let isCategory = null;
|
|
||||||
if (searchText) {
|
|
||||||
emojiList = getEmojis().filter((emoji) =>
|
|
||||||
emoji.keywords.some((keyword) => keyword.includes(searchText)),
|
|
||||||
);
|
|
||||||
isCategory = false;
|
|
||||||
} else {
|
|
||||||
emojiList = getEmojisGroupedBy("category");
|
|
||||||
isCategory = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Grid>
|
|
||||||
<Grid.SearchBar
|
|
||||||
placeholder={"Search for an emoji"}
|
|
||||||
value={searchText}
|
|
||||||
onChange={setSearchText}
|
|
||||||
/>
|
|
||||||
{isCategory
|
|
||||||
? Object.entries(emojiList).map(([category, emojis]) => (
|
|
||||||
<Grid.Section key={category} title={category}>
|
|
||||||
{emojis.map((emoji: BaseEmoji) => (
|
|
||||||
<Grid.Item
|
|
||||||
key={emoji.emoji}
|
|
||||||
title={emoji.emoji}
|
|
||||||
subtitle={emoji.keywords.join(", ")}
|
|
||||||
onClick={async () => {
|
|
||||||
console.log(emoji);
|
|
||||||
await Clipboard.writeText(emoji.emoji);
|
|
||||||
showHud(`${emoji.emoji} copied to clipboard`);
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
))}
|
|
||||||
</Grid.Section>
|
|
||||||
))
|
|
||||||
: (emojiList as BaseEmoji[]).map((emoji: BaseEmoji) => (
|
|
||||||
<Grid.Item
|
|
||||||
key={emoji.emoji}
|
|
||||||
title={emoji.emoji}
|
|
||||||
subtitle={emoji.keywords.join(", ")}
|
|
||||||
onClick={async () => {
|
|
||||||
console.log(emoji);
|
|
||||||
await Clipboard.writeText(emoji.emoji);
|
|
||||||
showHud(`${emoji.emoji} copied to clipboard`);
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
))}
|
|
||||||
</Grid>
|
|
||||||
);
|
|
||||||
|
|
||||||
// return (
|
|
||||||
// <Inline
|
|
||||||
// actions={
|
|
||||||
// <ActionPanel>
|
|
||||||
// <Action
|
|
||||||
// label={`Copy ${emoji.emoji} to clipboard`}
|
|
||||||
// onAction={async () => {
|
|
||||||
// console.log(emoji.emoji);
|
|
||||||
// await Clipboard.writeText(emoji.emoji);
|
|
||||||
// showHud(`${emoji.emoji} copied to clipboard`);
|
|
||||||
// }}
|
|
||||||
// />
|
|
||||||
// </ActionPanel>
|
|
||||||
// }
|
|
||||||
// >
|
|
||||||
// <Inline.Left>
|
|
||||||
// <Content.H3>{text}</Content.H3>
|
|
||||||
// </Inline.Left>
|
|
||||||
// <Inline.Separator icon={Icons.ArrowRight} />
|
|
||||||
// <Inline.Right>
|
|
||||||
// <Content.Paragraph>{emoji.emoji}</Content.Paragraph>
|
|
||||||
// </Inline.Right>
|
|
||||||
// </Inline>
|
|
||||||
// );
|
|
||||||
}
|
|
|
@ -36,7 +36,7 @@ export default function EmojiPicker(props: {
|
||||||
<Action
|
<Action
|
||||||
label={`Copy ${emoji.emoji} to clipboard`}
|
label={`Copy ${emoji.emoji} to clipboard`}
|
||||||
onAction={async () => {
|
onAction={async () => {
|
||||||
console.log(emoji);
|
console.log(emoji.emoji);
|
||||||
await Clipboard.writeText(emoji.emoji);
|
await Clipboard.writeText(emoji.emoji);
|
||||||
showHud(`${emoji.emoji} copied to clipboard`);
|
showHud(`${emoji.emoji} copied to clipboard`);
|
||||||
}}
|
}}
|
||||||
|
|
|
@ -2496,7 +2496,7 @@ undici-types@~6.20.0:
|
||||||
resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-6.20.0.tgz#8171bf22c1f588d1554d55bf204bc624af388433"
|
resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-6.20.0.tgz#8171bf22c1f588d1554d55bf204bc624af388433"
|
||||||
integrity sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg==
|
integrity sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg==
|
||||||
|
|
||||||
unicode-emoji@^2.6.0:
|
unicode-emoji@^2.5.0:
|
||||||
version "2.6.0"
|
version "2.6.0"
|
||||||
resolved "https://registry.yarnpkg.com/unicode-emoji/-/unicode-emoji-2.6.0.tgz#c7921ce5a39a2cbeb348c5aec9e18c6f22927f3e"
|
resolved "https://registry.yarnpkg.com/unicode-emoji/-/unicode-emoji-2.6.0.tgz#c7921ce5a39a2cbeb348c5aec9e18c6f22927f3e"
|
||||||
integrity sha512-MUqkJwdIX2Fw/RttfuJArKvDY2NStDylcAGOn5bbhWfBu+KRSILpjM/TMPbuSNp5plAe45ONv8dqmqtiPNmJ7A==
|
integrity sha512-MUqkJwdIX2Fw/RttfuJArKvDY2NStDylcAGOn5bbhWfBu+KRSILpjM/TMPbuSNp5plAe45ONv8dqmqtiPNmJ7A==
|
||||||
|
|
Loading…
Add table
Reference in a new issue