chore: deploy 3152ef4241
This commit is contained in:
parent
2ec19c365d
commit
ac8d958ec4
5 changed files with 105 additions and 28 deletions
|
@ -15,6 +15,15 @@ description = """
|
|||
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]
|
||||
main_search_bar = ["read"]
|
||||
clipboard = ["write"]
|
||||
|
|
7
js/emojipicker-grid.js
Normal file
7
js/emojipicker-grid.js
Normal file
|
@ -0,0 +1,7 @@
|
|||
import 'react/jsx-runtime';
|
||||
import '@project-gauntlet/api/components';
|
||||
import 'react';
|
||||
import '@project-gauntlet/api/helpers';
|
||||
import './vendor.js';
|
||||
export { a as default } from './shared.js';
|
||||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZW1vamlwaWNrZXItZ3JpZC5qcyIsInNvdXJjZXMiOltdLCJzb3VyY2VzQ29udGVudCI6W10sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7OyJ9
|
|
@ -1,25 +1,7 @@
|
|||
import { jsxs, jsx } from 'react/jsx-runtime';
|
||||
import { Inline, ActionPanel, Action, Content, Icons } from '@project-gauntlet/api/components';
|
||||
import { Clipboard, showHud } from '@project-gauntlet/api/helpers';
|
||||
import { g as getEmojis } from './vendor.js';
|
||||
|
||||
// @ts-expect-error
|
||||
Deno[Deno.internal].core;
|
||||
function EmojiPicker(props) {
|
||||
const text = props.text.trim();
|
||||
if (text.length < 3) {
|
||||
return undefined;
|
||||
}
|
||||
const emoji = getEmojis().find(emoji => emoji.keywords.includes(text));
|
||||
if (!emoji) {
|
||||
return undefined;
|
||||
}
|
||||
return (jsxs(Inline, { actions: jsx(ActionPanel, { children: jsx(Action, { label: `Copy ${emoji.emoji} to clipboard`, onAction: async () => {
|
||||
console.log(emoji.emoji);
|
||||
await Clipboard.writeText(emoji.emoji);
|
||||
showHud(`${emoji.emoji} copied to clipboard`);
|
||||
} }) }), children: [jsx(Inline.Left, { children: jsx(Content.H3, { children: text }) }), jsx(Inline.Separator, { icon: Icons.ArrowRight }), jsx(Inline.Right, { children: jsx(Content.H3, { children: emoji.emoji }) })] }));
|
||||
}
|
||||
|
||||
export { EmojiPicker as default };
|
||||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZW1vamlwaWNrZXIuanMiLCJzb3VyY2VzIjpbXSwic291cmNlc0NvbnRlbnQiOltdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OyJ9
|
||||
import 'react/jsx-runtime';
|
||||
import '@project-gauntlet/api/components';
|
||||
import '@project-gauntlet/api/helpers';
|
||||
import './vendor.js';
|
||||
export { E as default } from './shared.js';
|
||||
import 'react';
|
||||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZW1vamlwaWNrZXIuanMiLCJzb3VyY2VzIjpbXSwic291cmNlc0NvbnRlbnQiOltdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7OzsifQ==
|
||||
|
|
55
js/shared.js
Normal file
55
js/shared.js
Normal file
|
@ -0,0 +1,55 @@
|
|||
import { jsxs, jsx } from 'react/jsx-runtime';
|
||||
import { Inline, ActionPanel, Action, Content, Icons, Grid } from '@project-gauntlet/api/components';
|
||||
import { Clipboard, showHud } from '@project-gauntlet/api/helpers';
|
||||
import { g as getEmojis, a as getEmojisGroupedBy } from './vendor.js';
|
||||
import { useState } from 'react';
|
||||
|
||||
// @ts-expect-error gauntlet uses deno and not node
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
Deno[Deno.internal].core;
|
||||
function EmojiPicker$1(props) {
|
||||
const text = props.text.trim();
|
||||
if (text.length < 3) {
|
||||
return undefined;
|
||||
}
|
||||
const emoji = getEmojis().find((emoji) => emoji.keywords.includes(text));
|
||||
if (!emoji) {
|
||||
return undefined;
|
||||
}
|
||||
return (jsxs(Inline, { actions: jsx(ActionPanel, { children: jsx(Action, { label: `Copy ${emoji.emoji} to clipboard`, onAction: async () => {
|
||||
console.log(emoji);
|
||||
await Clipboard.writeText(emoji.emoji);
|
||||
showHud(`${emoji.emoji} copied to clipboard`);
|
||||
} }) }), children: [jsx(Inline.Left, { children: jsx(Content.H3, { children: text }) }), jsx(Inline.Separator, { icon: Icons.ArrowRight }), jsx(Inline.Right, { children: jsx(Content.Paragraph, { children: emoji.emoji }) })] }));
|
||||
}
|
||||
|
||||
// @ts-expect-error gauntlet uses deno and not node
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
Deno[Deno.internal].core;
|
||||
function EmojiPicker() {
|
||||
const [searchText, setSearchText] = useState("");
|
||||
let emojiList;
|
||||
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 (jsxs(Grid, { children: [jsx(Grid.SearchBar, { placeholder: "Search for an emoji", value: searchText, onChange: setSearchText }), isCategory
|
||||
? Object.entries(emojiList).map(([category, emojis]) => (jsx(Grid.Section, { title: category, children: emojis.map((emoji) => (jsx(Grid.Item, { title: emoji.emoji, subtitle: emoji.keywords.join(", "), onClick: async () => {
|
||||
console.log(emoji);
|
||||
await Clipboard.writeText(emoji.emoji);
|
||||
showHud(`${emoji.emoji} copied to clipboard`);
|
||||
} }, emoji.emoji))) }, category)))
|
||||
: emojiList.map((emoji) => (jsx(Grid.Item, { title: emoji.emoji, subtitle: emoji.keywords.join(", "), onClick: async () => {
|
||||
console.log(emoji);
|
||||
await Clipboard.writeText(emoji.emoji);
|
||||
showHud(`${emoji.emoji} copied to clipboard`);
|
||||
} }, emoji.emoji)))] }));
|
||||
}
|
||||
|
||||
export { EmojiPicker$1 as E, EmojiPicker as a };
|
||||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2hhcmVkLmpzIiwic291cmNlcyI6W10sInNvdXJjZXNDb250ZW50IjpbXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OzsifQ==
|
30
js/vendor.js
30
js/vendor.js
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue