✨ Initial implementation
This commit is contained in:
+43
-209
@@ -1,214 +1,48 @@
|
||||
import {
|
||||
Action,
|
||||
ActionPanel,
|
||||
Icon,
|
||||
List,
|
||||
showToast,
|
||||
Toast,
|
||||
} from "@vicinae/api";
|
||||
import gitmojisData from "./gitmojis.json";
|
||||
import { Action, ActionPanel, List, showToast, Toast } from "@vicinae/api";
|
||||
|
||||
export default function SimpleList() {
|
||||
type Gitmoji = {
|
||||
emoji: string;
|
||||
entity?: string;
|
||||
code: string;
|
||||
description: string;
|
||||
name: string;
|
||||
};
|
||||
|
||||
const gitmojis = gitmojisData.gitmojis as Gitmoji[];
|
||||
|
||||
export default function GitmojiList() {
|
||||
return (
|
||||
<List searchBarPlaceholder="Search fruits...">
|
||||
<List.Section title={"Fruits"}>
|
||||
{fruits.map((fruit) => (
|
||||
<List.Item
|
||||
key={fruit.emoji}
|
||||
title={fruit.name}
|
||||
icon={fruit.emoji}
|
||||
keywords={fruit.keywords}
|
||||
actions={
|
||||
<ActionPanel>
|
||||
<Action.CopyToClipboard
|
||||
title="Copy emoji"
|
||||
content={fruit.emoji}
|
||||
/>
|
||||
<Action
|
||||
title="test toast"
|
||||
onAction={async () => {
|
||||
const toast = await showToast(
|
||||
Toast.Style.Success,
|
||||
"title",
|
||||
"selected successfully",
|
||||
);
|
||||
setTimeout(() => toast.hide(), 500);
|
||||
}}
|
||||
/>
|
||||
<Action
|
||||
shortcut={{ key: "arrowUp", modifiers: ["shift"] }}
|
||||
title="Custom action"
|
||||
icon={Icon.Cog}
|
||||
onAction={() =>
|
||||
showToast({ title: "Hello from custom action" })
|
||||
}
|
||||
/>
|
||||
|
||||
{/* Sub Menu */}
|
||||
<ActionPanel.Submenu
|
||||
title="More actions"
|
||||
icon={Icon.Stars}
|
||||
shortcut={{ modifiers: ["shift"], key: "m" }}
|
||||
onOpen={() =>
|
||||
showToast({ title: `More actions for ${fruit.name}` })
|
||||
}
|
||||
>
|
||||
{/* Sections inside Sub Menu */}
|
||||
<ActionPanel.Section title="Recipe ideas">
|
||||
{/* Sub Menu inside Section */}
|
||||
<ActionPanel.Submenu title="Smoothies" icon={Icon.Hammer}>
|
||||
{["Breakfast boost", "Green refresh"].map((recipe) => (
|
||||
<Action
|
||||
key={recipe}
|
||||
title={recipe}
|
||||
icon={Icon.Leaf}
|
||||
onAction={() =>
|
||||
showToast({
|
||||
title: `${recipe} smoothie recipe selected with fruit ${fruit.name}`,
|
||||
})
|
||||
}
|
||||
/>
|
||||
))}
|
||||
</ActionPanel.Submenu>
|
||||
|
||||
{/* Multiple Sub Menus in a Section */}
|
||||
<ActionPanel.Submenu title="Snacks" icon={Icon.Box}>
|
||||
{["Fruit skewer", "Yogurt parfait"].map((recipe) => (
|
||||
<Action
|
||||
key={recipe}
|
||||
title={recipe}
|
||||
icon={Icon.Snowflake}
|
||||
onAction={() =>
|
||||
showToast({
|
||||
title: `${recipe} snack recipe selected with fruit ${fruit.name}`,
|
||||
})
|
||||
}
|
||||
/>
|
||||
))}
|
||||
</ActionPanel.Submenu>
|
||||
</ActionPanel.Section>
|
||||
|
||||
{/* Regular action in a Sub Menu */}
|
||||
<ActionPanel.Section title="Fun">
|
||||
<Action
|
||||
title="Random fun fact"
|
||||
icon={Icon.LightBulb}
|
||||
onAction={() =>
|
||||
showToast({
|
||||
title: `Random ${fruit.name} fact: ${randomFact(fruit.name)}`,
|
||||
})
|
||||
}
|
||||
/>
|
||||
</ActionPanel.Section>
|
||||
</ActionPanel.Submenu>
|
||||
</ActionPanel>
|
||||
}
|
||||
/>
|
||||
))}
|
||||
</List.Section>
|
||||
<List searchBarPlaceholder="Search gitmojis...">
|
||||
{gitmojis.map((gitmoji) => (
|
||||
<List.Item
|
||||
key={gitmoji.code}
|
||||
id={gitmoji.code}
|
||||
icon={gitmoji.emoji}
|
||||
title={gitmoji.code}
|
||||
subtitle={gitmoji.description}
|
||||
keywords={[gitmoji.name]}
|
||||
actions={
|
||||
<ActionPanel>
|
||||
<Action.CopyToClipboard
|
||||
title="Copy Emoji"
|
||||
content={gitmoji.emoji}
|
||||
onCopy={(content) =>
|
||||
showToast(
|
||||
Toast.Style.Success,
|
||||
"Copied to clipboard",
|
||||
String(content),
|
||||
)
|
||||
}
|
||||
/>
|
||||
<Action.CopyToClipboard
|
||||
title="Copy Code"
|
||||
content={gitmoji.code}
|
||||
/>
|
||||
</ActionPanel>
|
||||
}
|
||||
/>
|
||||
))}
|
||||
</List>
|
||||
);
|
||||
}
|
||||
|
||||
type Fruit = {
|
||||
emoji: string;
|
||||
name: string;
|
||||
keywords: string[];
|
||||
};
|
||||
|
||||
const fruits: Fruit[] = [
|
||||
{
|
||||
emoji: "🍎",
|
||||
name: "Apple",
|
||||
keywords: ["red", "crisp", "sweet", "orchard", "healthy"],
|
||||
},
|
||||
{
|
||||
emoji: "🍊",
|
||||
name: "Orange",
|
||||
keywords: ["citrus", "vitamin C", "juicy", "tangy", "breakfast"],
|
||||
},
|
||||
{
|
||||
emoji: "🍌",
|
||||
name: "Banana",
|
||||
keywords: ["yellow", "potassium", "smoothie", "energy", "tropical"],
|
||||
},
|
||||
{
|
||||
emoji: "🍉",
|
||||
name: "Watermelon",
|
||||
keywords: ["summer", "refreshing", "hydrating", "seeds", "picnic"],
|
||||
},
|
||||
{
|
||||
emoji: "🍇",
|
||||
name: "Grapes",
|
||||
keywords: ["wine", "cluster", "sweet", "purple", "vineyard"],
|
||||
},
|
||||
{
|
||||
emoji: "🍓",
|
||||
name: "Strawberry",
|
||||
keywords: ["berry", "jam", "dessert", "romantic", "garden"],
|
||||
},
|
||||
{
|
||||
emoji: "🍍",
|
||||
name: "Pineapple",
|
||||
keywords: ["tropical", "spiky", "Hawaiian", "sweet", "vacation"],
|
||||
},
|
||||
{
|
||||
emoji: "🥭",
|
||||
name: "Mango",
|
||||
keywords: ["tropical", "creamy", "exotic", "Indian", "smoothie"],
|
||||
},
|
||||
{
|
||||
emoji: "🍑",
|
||||
name: "Peach",
|
||||
keywords: ["fuzzy", "summer", "pit", "Georgia", "cobbler"],
|
||||
},
|
||||
{
|
||||
emoji: "🍐",
|
||||
name: "Pear",
|
||||
keywords: ["teardrop", "autumn", "crisp", "Bartlett", "elegant"],
|
||||
},
|
||||
{
|
||||
emoji: "🥝",
|
||||
name: "Kiwi",
|
||||
keywords: ["fuzzy", "green", "tangy", "New Zealand", "exotic"],
|
||||
},
|
||||
{
|
||||
emoji: "🍒",
|
||||
name: "Cherries",
|
||||
keywords: ["red", "pit", "pie", "sweet", "Michigan"],
|
||||
},
|
||||
{
|
||||
emoji: "🫐",
|
||||
name: "Blueberries",
|
||||
keywords: ["antioxidants", "pancakes", "muffin", "Maine", "superfood"],
|
||||
},
|
||||
{
|
||||
emoji: "🥥",
|
||||
name: "Coconut",
|
||||
keywords: ["tropical", "milk", "hard shell", "palm tree", "island"],
|
||||
},
|
||||
{
|
||||
emoji: "🍋",
|
||||
name: "Lemon",
|
||||
keywords: ["sour", "citrus", "yellow", "zest", "cooking"],
|
||||
},
|
||||
{
|
||||
emoji: "🍈",
|
||||
name: "Melon",
|
||||
keywords: ["cantaloupe", "orange", "sweet", "breakfast", "honeydew"],
|
||||
},
|
||||
{
|
||||
emoji: "🍏",
|
||||
name: "Green Apple",
|
||||
keywords: ["tart", "Granny Smith", "baking", "crisp", "sour"],
|
||||
},
|
||||
];
|
||||
|
||||
const randomFact = (fruitName: string) => {
|
||||
const facts = [
|
||||
(name: string) => `${name} are tasty!`,
|
||||
(name: string) => `People love ${name.toLowerCase()}s.`,
|
||||
(name: string) => `${name}s are cool.`,
|
||||
];
|
||||
|
||||
return facts[Math.floor(Math.random() * facts.length)](fruitName);
|
||||
};
|
||||
|
||||
@@ -0,0 +1,437 @@
|
||||
{
|
||||
"gitmojis": [
|
||||
{
|
||||
"emoji": "🎨",
|
||||
"entity": "🎨",
|
||||
"code": ":art:",
|
||||
"description": "Improving structure / format of the code.",
|
||||
"name": "art"
|
||||
},
|
||||
{
|
||||
"emoji": "⚡️",
|
||||
"entity": "⚡",
|
||||
"code": ":zap:",
|
||||
"description": "Improving performance.",
|
||||
"name": "zap"
|
||||
},
|
||||
{
|
||||
"emoji": "🔥",
|
||||
"entity": "🔥",
|
||||
"code": ":fire:",
|
||||
"description": "Removing code or files.",
|
||||
"name": "fire"
|
||||
},
|
||||
{
|
||||
"emoji": "🐛",
|
||||
"entity": "🐛",
|
||||
"code": ":bug:",
|
||||
"description": "Fixing a bug.",
|
||||
"name": "bug"
|
||||
},
|
||||
{
|
||||
"emoji": "🚑",
|
||||
"entity": "🚑",
|
||||
"code": ":ambulance:",
|
||||
"description": "Critical hotfix.",
|
||||
"name": "ambulance"
|
||||
},
|
||||
{
|
||||
"emoji": "✨",
|
||||
"entity": "✨",
|
||||
"code": ":sparkles:",
|
||||
"description": "Introducing new features.",
|
||||
"name": "sparkles"
|
||||
},
|
||||
{
|
||||
"emoji": "📝",
|
||||
"entity": "📝",
|
||||
"code": ":memo:",
|
||||
"description": "Writing docs.",
|
||||
"name": "memo"
|
||||
},
|
||||
{
|
||||
"emoji": "🚀",
|
||||
"entity": "🚀",
|
||||
"code": ":rocket:",
|
||||
"description": "Deploying stuff.",
|
||||
"name": "rocket"
|
||||
},
|
||||
{
|
||||
"emoji": "💄",
|
||||
"entity": "&#ff99cc;",
|
||||
"code": ":lipstick:",
|
||||
"description": "Updating the UI and style files.",
|
||||
"name": "lipstick"
|
||||
},
|
||||
{
|
||||
"emoji": "🎉",
|
||||
"entity": "🎉",
|
||||
"code": ":tada:",
|
||||
"description": "Initial commit.",
|
||||
"name": "tada"
|
||||
},
|
||||
{
|
||||
"emoji": "✅",
|
||||
"entity": "✅",
|
||||
"code": ":white_check_mark:",
|
||||
"description": "Adding tests.",
|
||||
"name": "white-check-mark"
|
||||
},
|
||||
{
|
||||
"emoji": "🔒",
|
||||
"entity": "🔒",
|
||||
"code": ":lock:",
|
||||
"description": "Fixing security issues.",
|
||||
"name": "lock"
|
||||
},
|
||||
{
|
||||
"emoji": "🍎",
|
||||
"entity": "🍎",
|
||||
"code": ":apple:",
|
||||
"description": "Fixing something on macOS.",
|
||||
"name": "apple"
|
||||
},
|
||||
{
|
||||
"emoji": "🐧",
|
||||
"entity": "🐧",
|
||||
"code": ":penguin:",
|
||||
"description": "Fixing something on Linux.",
|
||||
"name": "penguin"
|
||||
},
|
||||
{
|
||||
"emoji": "🏁",
|
||||
"entity": "🏁",
|
||||
"code": ":checkered_flag:",
|
||||
"description": "Fixing something on Windows.",
|
||||
"name": "checkered-flag"
|
||||
},
|
||||
{
|
||||
"emoji": "🤖",
|
||||
"entity": "🤖",
|
||||
"code": ":robot:",
|
||||
"description": "Fixing something on Android.",
|
||||
"name": "robot"
|
||||
},
|
||||
{
|
||||
"emoji": "🍏",
|
||||
"entity": "🍏",
|
||||
"code": ":green_apple:",
|
||||
"description": "Fixing something on iOS.",
|
||||
"name": "green-apple"
|
||||
},
|
||||
{
|
||||
"emoji": "🔖",
|
||||
"entity": "🔖",
|
||||
"code": ":bookmark:",
|
||||
"description": "Releasing / Version tags.",
|
||||
"name": "bookmark"
|
||||
},
|
||||
{
|
||||
"emoji": "🚨",
|
||||
"entity": "🚨",
|
||||
"code": ":rotating_light:",
|
||||
"description": "Removing linter warnings.",
|
||||
"name": "rotating-light"
|
||||
},
|
||||
{
|
||||
"emoji": "🚧",
|
||||
"entity": "🚧",
|
||||
"code": ":construction:",
|
||||
"description": "Work in progress.",
|
||||
"name": "construction"
|
||||
},
|
||||
{
|
||||
"emoji": "💚",
|
||||
"entity": "💚",
|
||||
"code": ":green_heart:",
|
||||
"description": "Fixing CI Build.",
|
||||
"name": "green-heart"
|
||||
},
|
||||
{
|
||||
"emoji": "⬇️",
|
||||
"entity": "⬇️",
|
||||
"code": ":arrow_down:",
|
||||
"description": "Downgrading dependencies.",
|
||||
"name": "arrow-down"
|
||||
},
|
||||
{
|
||||
"emoji": "⬆️",
|
||||
"entity": "⬆️",
|
||||
"code": ":arrow_up:",
|
||||
"description": "Upgrading dependencies.",
|
||||
"name": "arrow-up"
|
||||
},
|
||||
{
|
||||
"emoji": "📌",
|
||||
"entity": "📌",
|
||||
"code": ":pushpin:",
|
||||
"description": "Pinning dependencies to specific versions.",
|
||||
"name": "pushpin"
|
||||
},
|
||||
{
|
||||
"emoji": "👷",
|
||||
"entity": "👷",
|
||||
"code": ":construction_worker:",
|
||||
"description": "Adding CI build system.",
|
||||
"name": "construction-worker"
|
||||
},
|
||||
{
|
||||
"emoji": "📈",
|
||||
"code": ":chart_with_upwards_trend:",
|
||||
"description": "Adding analytics or tracking code.",
|
||||
"name": "chart-with-upwards-trend"
|
||||
},
|
||||
{
|
||||
"emoji": "♻️",
|
||||
"entity": "♲",
|
||||
"code": ":recycle:",
|
||||
"description": "Refactoring code.",
|
||||
"name": "recycle"
|
||||
},
|
||||
{
|
||||
"emoji": "🐳",
|
||||
"entity": "🐳",
|
||||
"code": ":whale:",
|
||||
"description": "Work about Docker.",
|
||||
"name": "whale"
|
||||
},
|
||||
{
|
||||
"emoji": "➕",
|
||||
"entity": "➕",
|
||||
"code": ":heavy_plus_sign:",
|
||||
"description": "Adding a dependency.",
|
||||
"name": "heavy-plus-sign"
|
||||
},
|
||||
{
|
||||
"emoji": "➖",
|
||||
"entity": "➖",
|
||||
"code": ":heavy_minus_sign:",
|
||||
"description": "Removing a dependency.",
|
||||
"name": "heavy-minus-sign"
|
||||
},
|
||||
{
|
||||
"emoji": "🔧",
|
||||
"entity": "🔧",
|
||||
"code": ":wrench:",
|
||||
"description": "Changing configuration files.",
|
||||
"name": "wrench"
|
||||
},
|
||||
{
|
||||
"emoji": "🌐",
|
||||
"entity": "🌐",
|
||||
"code": ":globe_with_meridians:",
|
||||
"description": "Internationalization and localization.",
|
||||
"name": "globe-with-meridians"
|
||||
},
|
||||
{
|
||||
"emoji": "✏️",
|
||||
"entity": "",
|
||||
"code": ":pencil2:",
|
||||
"description": "Fixing typos.",
|
||||
"name": "pencil"
|
||||
},
|
||||
{
|
||||
"emoji": "💩",
|
||||
"entity": "",
|
||||
"code": ":hankey:",
|
||||
"description": "Writing bad code that needs to be improved.",
|
||||
"name": "hankey"
|
||||
},
|
||||
{
|
||||
"emoji": "⏪",
|
||||
"entity": "⏪",
|
||||
"code": ":rewind:",
|
||||
"description": "Reverting changes.",
|
||||
"name": "rewind"
|
||||
},
|
||||
{
|
||||
"emoji": "🔀",
|
||||
"entity": "🔀",
|
||||
"code": ":twisted_rightwards_arrows:",
|
||||
"description": "Merging branches.",
|
||||
"name": "twisted-rightwards-arrows"
|
||||
},
|
||||
{
|
||||
"emoji": "📦",
|
||||
"entity": "F4E6;",
|
||||
"code": ":package:",
|
||||
"description": "Updating compiled files or packages.",
|
||||
"name": "package"
|
||||
},
|
||||
{
|
||||
"emoji": "👽",
|
||||
"entity": "F47D;",
|
||||
"code": ":alien:",
|
||||
"description": "Updating code due to external API changes.",
|
||||
"name": "alien"
|
||||
},
|
||||
{
|
||||
"emoji": "🚚",
|
||||
"entity": "F69A;",
|
||||
"code": ":truck:",
|
||||
"description": "Moving or renaming files.",
|
||||
"name": "truck"
|
||||
},
|
||||
{
|
||||
"emoji": "📄",
|
||||
"entity": "F4C4;",
|
||||
"code": ":page_facing_up:",
|
||||
"description": "Adding or updating license.",
|
||||
"name": "page-facing-up"
|
||||
},
|
||||
{
|
||||
"emoji": "💥",
|
||||
"entity": "💥",
|
||||
"code": ":boom:",
|
||||
"description": "Introducing breaking changes.",
|
||||
"name": "boom"
|
||||
},
|
||||
{
|
||||
"emoji": "🍱",
|
||||
"entity": "F371",
|
||||
"code": ":bento:",
|
||||
"description": "Adding or updating assets.",
|
||||
"name": "bento"
|
||||
},
|
||||
{
|
||||
"emoji": "👌",
|
||||
"entity": "👌",
|
||||
"code": ":ok_hand:",
|
||||
"description": "Updating code due to code review changes.",
|
||||
"name": "ok-hand"
|
||||
},
|
||||
{
|
||||
"emoji": "♿️",
|
||||
"entity": "♿",
|
||||
"code": ":wheelchair:",
|
||||
"description": "Improving accessibility.",
|
||||
"name": "wheelchair"
|
||||
},
|
||||
{
|
||||
"emoji": "💡",
|
||||
"entity": "💡",
|
||||
"code": ":bulb:",
|
||||
"description": "Documenting source code.",
|
||||
"name": "bulb"
|
||||
},
|
||||
{
|
||||
"emoji": "🍻",
|
||||
"entity": "🍻",
|
||||
"code": ":beers:",
|
||||
"description": "Writing code drunkenly.",
|
||||
"name": "beers"
|
||||
},
|
||||
{
|
||||
"emoji": "💬",
|
||||
"entity": "💬",
|
||||
"code": ":speech_balloon:",
|
||||
"description": "Updating text and literals.",
|
||||
"name": "speech-balloon"
|
||||
},
|
||||
{
|
||||
"emoji": "🗃",
|
||||
"entity": "🗃",
|
||||
"code": ":card_file_box:",
|
||||
"description": "Performing database related changes.",
|
||||
"name": "card-file-box"
|
||||
},
|
||||
{
|
||||
"emoji": "🔊",
|
||||
"entity": "🔊",
|
||||
"code": ":loud_sound:",
|
||||
"description": "Adding logs.",
|
||||
"name": "loud-sound"
|
||||
},
|
||||
{
|
||||
"emoji": "🔇",
|
||||
"entity": "🔇",
|
||||
"code": ":mute:",
|
||||
"description": "Removing logs.",
|
||||
"name": "mute"
|
||||
},
|
||||
{
|
||||
"emoji": "👥",
|
||||
"entity": "👥",
|
||||
"code": ":busts_in_silhouette:",
|
||||
"description": "Adding contributor(s).",
|
||||
"name": "busts-in-silhouette"
|
||||
},
|
||||
{
|
||||
"emoji": "🚸",
|
||||
"entity": "🚸",
|
||||
"code": ":children_crossing:",
|
||||
"description": "Improving user experience / usability.",
|
||||
"name": "children-crossing"
|
||||
},
|
||||
{
|
||||
"emoji": "🏗",
|
||||
"entity": "f3d7;",
|
||||
"code": ":building_construction:",
|
||||
"description": "Making architectural changes.",
|
||||
"name": "building-construction"
|
||||
},
|
||||
{
|
||||
"emoji": "📱",
|
||||
"entity": "📱",
|
||||
"code": ":iphone:",
|
||||
"description": "Working on responsive design.",
|
||||
"name": "iphone"
|
||||
},
|
||||
{
|
||||
"emoji": "🤡",
|
||||
"entity": "🤡",
|
||||
"code": ":clown_face:",
|
||||
"description": "Mocking things.",
|
||||
"name": "clown-face"
|
||||
},
|
||||
{
|
||||
"emoji": "🥚",
|
||||
"entity": "🥚",
|
||||
"code": ":egg:",
|
||||
"description": "Adding an easter egg.",
|
||||
"name": "egg"
|
||||
},
|
||||
{
|
||||
"emoji": "🙈",
|
||||
"entity": "bdfe7;",
|
||||
"code": ":see_no_evil:",
|
||||
"description": "Adding or updating a .gitignore file",
|
||||
"name": "see-no-evil"
|
||||
},
|
||||
{
|
||||
"emoji": "📸",
|
||||
"entity": "📸",
|
||||
"code": ":camera_flash:",
|
||||
"description": "Adding or updating snapshots",
|
||||
"name": "camera-flash"
|
||||
},
|
||||
{
|
||||
"emoji": "⚗",
|
||||
"entity": "📸",
|
||||
"code": ":alembic:",
|
||||
"description": "Experimenting new things",
|
||||
"name": "alembic"
|
||||
},
|
||||
{
|
||||
"emoji": "🔍",
|
||||
"entity": "🔍",
|
||||
"code": ":mag:",
|
||||
"description": "Improving SEO",
|
||||
"name": "mag"
|
||||
},
|
||||
{
|
||||
"emoji": "☸️",
|
||||
"entity": "☸",
|
||||
"code": ":wheel_of_dharma:",
|
||||
"description": "Work about Kubernetes",
|
||||
"name": "wheel-of-dharma"
|
||||
},
|
||||
{
|
||||
"emoji": "🏷️",
|
||||
"entity": "🏷",
|
||||
"code": ":label:",
|
||||
"description": "Adding or updating types (Flow, TypeScript)",
|
||||
"name": "label"
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user