diff --git a/app/MindWork AI Studio/Pages/Plugins.razor b/app/MindWork AI Studio/Pages/Plugins.razor index b852648c..0174e2c9 100644 --- a/app/MindWork AI Studio/Pages/Plugins.razor +++ b/app/MindWork AI Studio/Pages/Plugins.razor @@ -1,7 +1,34 @@ +@using AIStudio.Tools.PluginSystem @attribute [Route(Routes.PLUGINS)]
- Plugins + + Plugins + + + + + @foreach (var plugin in PluginFactory.AvailablePlugins) + { + + + +
+ @((MarkupString)plugin.IconSVG) +
+
+
+ + + @plugin.Name + + + @plugin.Description + + +
+ } +
\ No newline at end of file diff --git a/app/MindWork AI Studio/Plugins/languages/de-de-43065dbc-78d0-45b7-92be-f14c2926e2dc/icon.lua b/app/MindWork AI Studio/Plugins/languages/de-de-43065dbc-78d0-45b7-92be-f14c2926e2dc/icon.lua new file mode 100644 index 00000000..dc8250ba --- /dev/null +++ b/app/MindWork AI Studio/Plugins/languages/de-de-43065dbc-78d0-45b7-92be-f14c2926e2dc/icon.lua @@ -0,0 +1,5 @@ +SVG = [[ + + + + ]] \ No newline at end of file diff --git a/app/MindWork AI Studio/Plugins/languages/de-de-43065dbc-78d0-45b7-92be-f14c2926e2dc/plugin.lua b/app/MindWork AI Studio/Plugins/languages/de-de-43065dbc-78d0-45b7-92be-f14c2926e2dc/plugin.lua index dfcd508d..55ee6ac3 100644 --- a/app/MindWork AI Studio/Plugins/languages/de-de-43065dbc-78d0-45b7-92be-f14c2926e2dc/plugin.lua +++ b/app/MindWork AI Studio/Plugins/languages/de-de-43065dbc-78d0-45b7-92be-f14c2926e2dc/plugin.lua @@ -1,4 +1,5 @@ require("contentHome") +require("icon") -- The ID for this plugin: ID = "43065dbc-78d0-45b7-92be-f14c2926e2dc" @@ -38,4 +39,6 @@ DEPRECATION_MESSAGE = "" UI_TEXT_CONTENT = { HOME = CONTENT_HOME, -} \ No newline at end of file +} + +ICON_SVG = SVG \ No newline at end of file diff --git a/app/MindWork AI Studio/Plugins/languages/en-us-97dfb1ba-50c4-4440-8dfa-6575daf543c8/icon.lua b/app/MindWork AI Studio/Plugins/languages/en-us-97dfb1ba-50c4-4440-8dfa-6575daf543c8/icon.lua new file mode 100644 index 00000000..d6cea58c --- /dev/null +++ b/app/MindWork AI Studio/Plugins/languages/en-us-97dfb1ba-50c4-4440-8dfa-6575daf543c8/icon.lua @@ -0,0 +1,25 @@ +SVG = [[ + + + + + + + + + + + + + + + + + + + + + + + + ]] \ No newline at end of file diff --git a/app/MindWork AI Studio/Plugins/languages/en-us-97dfb1ba-50c4-4440-8dfa-6575daf543c8/plugin.lua b/app/MindWork AI Studio/Plugins/languages/en-us-97dfb1ba-50c4-4440-8dfa-6575daf543c8/plugin.lua index 5ee75589..f0480643 100644 --- a/app/MindWork AI Studio/Plugins/languages/en-us-97dfb1ba-50c4-4440-8dfa-6575daf543c8/plugin.lua +++ b/app/MindWork AI Studio/Plugins/languages/en-us-97dfb1ba-50c4-4440-8dfa-6575daf543c8/plugin.lua @@ -1,4 +1,5 @@ require("contentHome") +require("icon") -- The ID for this plugin: ID = "97dfb1ba-50c4-4440-8dfa-6575daf543c8" @@ -38,4 +39,6 @@ DEPRECATION_MESSAGE = "" UI_TEXT_CONTENT = { HOME = CONTENT_HOME, -} \ No newline at end of file +} + +ICON_SVG = SVG \ No newline at end of file diff --git a/app/MindWork AI Studio/Tools/PluginSystem/IPluginMetadata.cs b/app/MindWork AI Studio/Tools/PluginSystem/IPluginMetadata.cs index 77bc7ea7..c7f0722d 100644 --- a/app/MindWork AI Studio/Tools/PluginSystem/IPluginMetadata.cs +++ b/app/MindWork AI Studio/Tools/PluginSystem/IPluginMetadata.cs @@ -2,6 +2,11 @@ namespace AIStudio.Tools.PluginSystem; public interface IPluginMetadata { + /// + /// The icon of this plugin. + /// + public string IconSVG { get; } + /// /// The type of this plugin. /// diff --git a/app/MindWork AI Studio/Tools/PluginSystem/PluginBase.cs b/app/MindWork AI Studio/Tools/PluginSystem/PluginBase.cs index 176f7c70..d3801da7 100644 --- a/app/MindWork AI Studio/Tools/PluginSystem/PluginBase.cs +++ b/app/MindWork AI Studio/Tools/PluginSystem/PluginBase.cs @@ -12,6 +12,9 @@ public abstract class PluginBase : IPluginMetadata protected readonly LuaState state; protected readonly List pluginIssues = []; + + /// + public string IconSVG { get; } /// public PluginType Type { get; } @@ -71,6 +74,10 @@ public abstract class PluginBase : IPluginMetadata var issues = new List(); if(!string.IsNullOrWhiteSpace(parseError)) issues.Add(parseError); + + // Notice: when no icon is specified, the default icon will be used. + this.TryInitIconSVG(out _, out var iconSVG); + this.IconSVG = iconSVG; if(this.TryInitId(out var issue, out var id)) this.Id = id; @@ -430,6 +437,28 @@ public abstract class PluginBase : IPluginMetadata return true; } + /// + /// Tries to initialize the icon of the plugin. + /// + /// + /// When no icon is specified, the default icon will be used. + /// + /// The error message, when the icon could not be read. + /// The read icon as SVG. + /// True, when the icon could be read successfully. + private bool TryInitIconSVG(out string message, out string iconSVG) + { + if (!this.state.Environment["ICON_SVG"].TryRead(out iconSVG)) + { + iconSVG = Icons.Material.TwoTone.Extension; + message = "The field ICON_SVG does not exist or is not a valid string."; + return false; + } + + message = string.Empty; + return true; + } + /// /// Tries to initialize the UI text content of the plugin. /// diff --git a/app/MindWork AI Studio/Tools/PluginSystem/PluginMetadata.cs b/app/MindWork AI Studio/Tools/PluginSystem/PluginMetadata.cs index 06419c21..8ce7b5fa 100644 --- a/app/MindWork AI Studio/Tools/PluginSystem/PluginMetadata.cs +++ b/app/MindWork AI Studio/Tools/PluginSystem/PluginMetadata.cs @@ -4,6 +4,9 @@ public sealed class PluginMetadata(PluginBase plugin) : IPluginMetadata { #region Implementation of IPluginMetadata + /// + public string IconSVG { get; } = plugin.IconSVG; + /// public PluginType Type { get; } = plugin.Type; diff --git a/app/MindWork AI Studio/wwwroot/app.css b/app/MindWork AI Studio/wwwroot/app.css index e62b4f83..034123e5 100644 --- a/app/MindWork AI Studio/wwwroot/app.css +++ b/app/MindWork AI Studio/wwwroot/app.css @@ -35,6 +35,16 @@ margin-top: 4px; } +.plugin-icon-container { + width: var(--mud-icon-size-large); + height: var(--mud-icon-size-large); +} + +.plugin-icon-container svg { + width: 200%; + height: 200%; +} + :root { --confidence-color: #000000; }