feat: add category-based browsing to emoji selector

This commit is contained in:
Eric Handley
2025-11-27 22:43:59 -08:00
parent 9d25f9c9e7
commit c6b28bec4d
2 changed files with 94 additions and 18 deletions
@@ -11,6 +11,23 @@ Item {
property var launcher: null
property bool handleSearch: false
property string selectedCategory: "recent"
property bool isBrowsingMode: false
property var categoryIcons: ({
"recent": "clock",
"people": "user",
"animals": "paw",
"nature": "leaf",
"food": "apple",
"activity": "run",
"travel": "plane",
"objects": "home",
"symbols": "star"
})
property var categories: ["recent", "people", "animals", "nature", "food", "activity", "travel", "objects", "symbols"]
// Force update results when emoji service loads
Connections {
target: EmojiService
@@ -27,6 +44,13 @@ Item {
Logger.i("EmojiPlugin", "Initialized");
}
function selectCategory(category) {
selectedCategory = category;
if (launcher) {
launcher.updateResults();
}
}
// Check if this plugin handles the command
function handleCommand(searchText) {
return searchText.startsWith(">emoji");
@@ -65,9 +89,17 @@ Item {
];
}
const query = searchText.slice(6).trim();
const emojis = EmojiService.search(query);
return emojis.map(formatEmojiEntry);
var query = searchText.slice(6).trim();
if (query === "") {
isBrowsingMode = true;
var emojis = EmojiService.getEmojisByCategory(selectedCategory);
return emojis.map(formatEmojiEntry);
} else {
isBrowsingMode = false;
var emojis = EmojiService.search(query);
return emojis.map(formatEmojiEntry);
}
}
// Format an emoji entry for the results list