diff --git a/assets/images/kofi.png b/assets/images/kofi.png new file mode 100644 index 0000000..7a06b9a Binary files /dev/null and b/assets/images/kofi.png differ diff --git a/manifest.json b/manifest.json index 98dee5b..1cd33f0 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "id": "co-intelligence", "name": "Co-Intelligence AI", - "version": "1.0.4", + "version": "1.0.6", "minAppVersion": "1.8.0", "description": "Co-Intelligence AI gives you a full AI chat experience in Obsidian.", "author": "Mike Thicke", diff --git a/src/CoIntelligencePlugin.tsx b/src/CoIntelligencePlugin.tsx index abb52d4..0339299 100644 --- a/src/CoIntelligencePlugin.tsx +++ b/src/CoIntelligencePlugin.tsx @@ -10,8 +10,6 @@ import { } from "obsidian"; import { around } from "monkey-around"; -import "./styles.css"; - import { CoIntelligenceSettings, CoIntelligenceSettingsTab, diff --git a/src/settings.ts b/src/settings.ts index c97ca47..9b611d5 100644 --- a/src/settings.ts +++ b/src/settings.ts @@ -2,6 +2,8 @@ import type CoIntelligencePlugin from "@/CoIntelligencePlugin"; import { App, normalizePath, PluginSettingTab, Setting } from "obsidian"; import { ModelId } from "@/types"; +import kofiLogo from "@assets/images/kofi.png"; + export interface CoIntelligenceSettings { openaiApiKey: string; anthropicApiKey: string; @@ -143,67 +145,6 @@ export class CoIntelligenceSettingsTab extends PluginSettingTab { containerEl.empty(); - // Following pattern from https://github.com/zsviczian/obsidian-excalidraw-plugin/blob/master/src/core/settings.ts - const callToActionDiv = containerEl.createDiv("coi-settings-cta"); - const feedbackDiv = callToActionDiv.createDiv("coi-settings-feedback"); - const donateDiv = callToActionDiv.createDiv("coi-settings-donate"); - const kofiLink = donateDiv.createEl("a", { - href: "https://ko-fi.com/epistemictechnology", - cls: "coi-settings-donate-link", - }); - const srOnlySpan = kofiLink.createEl("span", { - text: "Support me on Ko-fi", - cls: "sr-only", - }); - kofiLink.createEl("img", { - attr: { - src: "https://cdn.ko-fi.com/cdn/kofi1.png?v=3", - alt: "Buy me a coffee", - cls: "coi-settings-donate-img", - }, - }); - const feedbackLink = feedbackDiv.createEl("a", { - href: "https://github.com/Epistemic-Technology/co-intelligence/issues", - attr: { - "aria-label": - "Report a bug, suggest a feature, offer feedback, or ask a question", - }, - }); - const githubSVG = document.createElementNS( - "http://www.w3.org/2000/svg", - "svg", - ); - githubSVG.setAttribute("xmlns", "http://www.w3.org/2000/svg"); - githubSVG.setAttribute("viewBox", "0 0 24 24"); - githubSVG.setAttribute("fill", "none"); - githubSVG.setAttribute("stroke", "currentColor"); - githubSVG.setAttribute("stroke-width", "2"); - githubSVG.setAttribute("stroke-linecap", "round"); - githubSVG.setAttribute("stroke-linejoin", "round"); - - const path1 = document.createElementNS( - "http://www.w3.org/2000/svg", - "path", - ); - path1.setAttribute( - "d", - "M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4", - ); - - const path2 = document.createElementNS( - "http://www.w3.org/2000/svg", - "path", - ); - path2.setAttribute("d", "M9 18c-4.51 2-5-2-7-2"); - - githubSVG.appendChild(path1); - githubSVG.appendChild(path2); - - const textDiv = document.createElement("div"); - textDiv.textContent = "Bugs, feedback, help"; - - feedbackLink.appendChild(githubSVG); - feedbackLink.appendChild(textDiv); containerEl.createEl("div", { text: "⚠️ API keys are stored unencrypted in your vault. Anyone with access to your vault can read them.", cls: "coi-settings-security-warning", @@ -341,5 +282,67 @@ export class CoIntelligenceSettingsTab extends PluginSettingTab { this.createDebouncedChangeHandler("defaultSystemPromptNote"), ); }); + + // Following pattern from https://github.com/zsviczian/obsidian-excalidraw-plugin/blob/master/src/core/settings.ts + const callToActionDiv = containerEl.createDiv("coi-settings-cta"); + const feedbackDiv = callToActionDiv.createDiv("coi-settings-feedback"); + const donateDiv = callToActionDiv.createDiv("coi-settings-donate"); + const kofiLink = donateDiv.createEl("a", { + href: "https://ko-fi.com/epistemictechnology", + cls: "coi-settings-donate-link", + }); + const srOnlySpan = kofiLink.createEl("span", { + text: "Support me on Ko-fi", + cls: "sr-only", + }); + kofiLink.createEl("img", { + attr: { + src: kofiLogo, + alt: "Buy me a coffee", + cls: "coi-settings-donate-img", + }, + }); + const feedbackLink = feedbackDiv.createEl("a", { + href: "https://github.com/Epistemic-Technology/co-intelligence/issues", + attr: { + "aria-label": + "Report a bug, suggest a feature, offer feedback, or ask a question", + }, + }); + const githubSVG = document.createElementNS( + "http://www.w3.org/2000/svg", + "svg", + ); + githubSVG.setAttribute("xmlns", "http://www.w3.org/2000/svg"); + githubSVG.setAttribute("viewBox", "0 0 24 24"); + githubSVG.setAttribute("fill", "none"); + githubSVG.setAttribute("stroke", "currentColor"); + githubSVG.setAttribute("stroke-width", "2"); + githubSVG.setAttribute("stroke-linecap", "round"); + githubSVG.setAttribute("stroke-linejoin", "round"); + + const path1 = document.createElementNS( + "http://www.w3.org/2000/svg", + "path", + ); + path1.setAttribute( + "d", + "M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4", + ); + + const path2 = document.createElementNS( + "http://www.w3.org/2000/svg", + "path", + ); + path2.setAttribute("d", "M9 18c-4.51 2-5-2-7-2"); + + githubSVG.appendChild(path1); + githubSVG.appendChild(path2); + + const textDiv = document.createElement("div"); + textDiv.textContent = "Bugs, feedback, help"; + + feedbackLink.appendChild(githubSVG); + feedbackLink.appendChild(textDiv); } } diff --git a/src/vite-env.d.ts b/src/vite-env.d.ts new file mode 100644 index 0000000..814d6e4 --- /dev/null +++ b/src/vite-env.d.ts @@ -0,0 +1,7 @@ +/// + +declare module "*.png"; +declare module "*.jpg"; +declare module "*.jpeg"; +declare module "*.gif"; +declare module "*.svg"; \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json index e9d8516..55351c6 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -10,7 +10,8 @@ "esModuleInterop": true, "baseUrl": ".", "paths": { - "@/*": ["src/*"] + "@/*": ["src/*"], + "@assets/*": ["assets/*"] }, "types": ["obsidian"] }, diff --git a/vite.config.ts b/vite.config.ts index 91083cd..3cf59a4 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -11,6 +11,9 @@ export default defineConfig({ viteStaticCopy({ targets: [{ src: "manifest.json", dest: "." }], }), + viteStaticCopy({ + targets: [{ src: "src/styles.css", dest: "." }], + }), ], resolve: { alias: {