Skip to content

Commit

Permalink
- Changed the icon for 'Chat Settings' from 'gear' to 'settings' for …
Browse files Browse the repository at this point in the history
…consistency.

- Enhanced the `get_icon_html` method in SmartViewNodeAdapter to support PascalCase icon names, improving flexibility in icon retrieval.
- Added a utility function to convert lower-hyphenated words to PascalCase, streamlining icon name handling.
  • Loading branch information
Brian Joseph Petro committed Dec 27, 2024
1 parent fce9e0f commit 43086c7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion smart-chats/components/threads.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export function build_html(threads_collection, opts = {}) {
{ title: 'Open Conversation Note', icon: 'external-link' },
{ title: 'Chat History', icon: 'history' },
{ title: 'Chat Options', icon: 'sliders-horizontal', style: 'display: none;' },
{ title: 'Chat Settings', icon: 'gear' },
{ title: 'Chat Settings', icon: 'settings' },
{ title: 'New Chat', icon: 'plus' }
].map(btn => `
<button title="${btn.title}" ${btn.style ? `style="${btn.style}"` : ''}>
Expand Down
11 changes: 10 additions & 1 deletion smart-view/adapters/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ export class SmartViewNodeAdapter extends SmartViewAdapter {
* @inheritdoc
* Retrieves the Lucide icon for the given icon name.
*/
get_icon_html(icon_name) { return lucide[icon_name]; }
get_icon_html(icon_name) {
const pascal_case_icon_name = to_pascal_case(icon_name);
console.log(pascal_case_icon_name);
return lucide[icon_name] ?? lucide[to_pascal_case(icon_name)];
}
/**
* Check if the given event is a "mod" event, i.e., if a control or meta key is pressed.
* This serves as a fallback behavior for environments without Obsidian's Keymap.
Expand Down Expand Up @@ -248,3 +252,8 @@ export class Setting {
setDesc(description) { return this.set_desc(description); }
setTooltip(tooltip) { return this.set_tooltip(tooltip); }
}

// convert lower-hyphenated-words to PascalCase
function to_pascal_case(str) {
return str.split('-').map(word => word.charAt(0).toUpperCase() + word.slice(1)).join('');
}

0 comments on commit 43086c7

Please sign in to comment.