diff --git a/README.md b/README.md index 4257f6f..b5dcbe1 100644 --- a/README.md +++ b/README.md @@ -113,9 +113,10 @@ You can contribute your own status templates to the plugin! ] } ``` -4. Submit a Pull Request with your JSON file! +4. Register your template in `constants/predefinedTemplates.ts` by adding an import and adding it to the `PREDEFINED_TEMPLATES` array. +5. Submit a Pull Request! -Once accepted, maintainers will include your template in the next plugin update. +Once accepted, your template will be available in the marketplace for all users. ## Installation diff --git a/constants/predefinedTemplates.ts b/constants/predefinedTemplates.ts index 73acad1..eb27071 100644 --- a/constants/predefinedTemplates.ts +++ b/constants/predefinedTemplates.ts @@ -1,251 +1,18 @@ import { StatusTemplate } from "types/pluginSettings"; +import academic from "../templates/academic.json"; +import colorful from "../templates/colorful.json"; +import creativeWriting from "../templates/creative-writing.json"; +import minimal from "../templates/minimal.json"; +import project from "../templates/project.json"; /** - * Predefined status templates generated from the templates directory + * Predefined status templates imported directly from the templates directory. + * This file serves as an index for the marketplace. */ export const PREDEFINED_TEMPLATES: StatusTemplate[] = [ - { - id: "academic", - name: "Academic research", - description: "Status workflow for academic research and writing", - author: "Obsidian Note Status", - github: "https://github.com/devonthesofa/obsidian-note-status", - statuses: [ - { - name: "research", - icon: "πŸ”", - color: "#2196F3", - templateId: "academic", - }, - { - name: "outline", - icon: "πŸ“‘", - color: "#9E9E9E", - templateId: "academic", - }, - { - name: "draft", - icon: "✏️", - color: "#FFC107", - templateId: "academic", - }, - { - name: "review", - icon: "πŸ”¬", - color: "#9C27B0", - templateId: "academic", - }, - { - name: "revision", - icon: "πŸ“", - color: "#FF5722", - templateId: "academic", - }, - { - name: "final", - icon: "πŸ“š", - color: "#4CAF50", - templateId: "academic", - }, - { - name: "published", - icon: "πŸŽ“", - color: "#795548", - templateId: "academic", - }, - ], - }, - { - id: "colorful", - name: "Colorful workflow", - description: - "A colorful set of workflow statuses with descriptive icons", - author: "Obsidian Note Status", - github: "https://github.com/devonthesofa/obsidian-note-status", - statuses: [ - { - name: "idea", - icon: "πŸ’‘", - color: "#FFEB3B", - templateId: "colorful", - }, - { - name: "draft", - icon: "πŸ“", - color: "#E0E0E0", - templateId: "colorful", - }, - { - name: "inProgress", - icon: "πŸ”§", - color: "#FFC107", - templateId: "colorful", - }, - { - name: "editing", - icon: "πŸ–ŠοΈ", - color: "#2196F3", - templateId: "colorful", - }, - { - name: "pending", - icon: "⏳", - color: "#9C27B0", - templateId: "colorful", - }, - { - name: "onHold", - icon: "⏸", - color: "#9E9E9E", - templateId: "colorful", - }, - { - name: "needsUpdate", - icon: "πŸ”„", - color: "#FF5722", - templateId: "colorful", - }, - { - name: "completed", - icon: "βœ…", - color: "#4CAF50", - templateId: "colorful", - }, - { - name: "archived", - icon: "πŸ“¦", - color: "#795548", - templateId: "colorful", - }, - ], - }, - { - id: "creative-writing", - name: "Creative Writing", - description: "Workflow for novelists and creative writers", - author: "Obsidian Community", - github: "https://github.com/obsidian-community", - statuses: [ - { - name: "idea", - icon: "🧠", - color: "#FFD700", - templateId: "creative-writing", - }, - { - name: "outline", - icon: "πŸ—ΊοΈ", - color: "#87CEEB", - templateId: "creative-writing", - }, - { - name: "first-draft", - icon: "✍️", - color: "#FFA07A", - templateId: "creative-writing", - }, - { - name: "revision", - icon: "πŸ”", - color: "#DA70D6", - templateId: "creative-writing", - }, - { - name: "final-polish", - icon: "✨", - color: "#32CD32", - templateId: "creative-writing", - }, - ], - }, - { - id: "minimal", - name: "Minimal workflow", - description: "A simplified set of essential workflow statuses", - author: "Obsidian Note Status", - github: "https://github.com/devonthesofa/obsidian-note-status", - statuses: [ - { - name: "todo", - icon: "πŸ“Œ", - color: "#F44336", - templateId: "minimal", - }, - { - name: "inProgress", - icon: "βš™οΈ", - color: "#2196F3", - templateId: "minimal", - }, - { - name: "review", - icon: "πŸ‘€", - color: "#9C27B0", - templateId: "minimal", - }, - { - name: "done", - icon: "βœ“", - color: "#4CAF50", - templateId: "minimal", - }, - ], - }, - { - id: "project", - name: "Project management", - description: "Status workflow for project management and tracking", - author: "Obsidian Note Status", - github: "https://github.com/devonthesofa/obsidian-note-status", - statuses: [ - { - name: "planning", - icon: "πŸ—“οΈ", - color: "#9E9E9E", - templateId: "project", - }, - { - name: "backlog", - icon: "πŸ“‹", - color: "#E0E0E0", - templateId: "project", - }, - { - name: "ready", - icon: "🚦", - color: "#8BC34A", - templateId: "project", - }, - { - name: "inDevelopment", - icon: "πŸ‘¨β€πŸ’»", - color: "#2196F3", - templateId: "project", - }, - { - name: "testing", - icon: "πŸ§ͺ", - color: "#9C27B0", - templateId: "project", - }, - { - name: "review", - icon: "πŸ‘οΈ", - color: "#FFC107", - templateId: "project", - }, - { - name: "approved", - icon: "πŸ‘", - color: "#4CAF50", - templateId: "project", - }, - { - name: "live", - icon: "πŸš€", - color: "#3F51B5", - templateId: "project", - }, - ], - }, + academic as StatusTemplate, + colorful as StatusTemplate, + creativeWriting as StatusTemplate, + minimal as StatusTemplate, + project as StatusTemplate, ]; diff --git a/tsconfig.json b/tsconfig.json index f83eaba..7f0cec4 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -26,7 +26,8 @@ "lib": ["DOM", "ES5", "ES6", "ES7"], "jsx": "react-jsx", "esModuleInterop": true, - "allowSyntheticDefaultImports": true + "allowSyntheticDefaultImports": true, + "resolveJsonModule": true }, "include": ["**/*.ts", "**/*.tsx"] } diff --git a/utils/templateUtils.ts b/utils/templateUtils.ts index 82f1f2a..d4f07b3 100644 --- a/utils/templateUtils.ts +++ b/utils/templateUtils.ts @@ -105,30 +105,3 @@ export const generateTemplateId = ( return id; }; -/** - * Generate a GitHub URL to submit a template to the marketplace - */ -export const getMarketplaceSubmissionUrl = ( - template: StatusTemplate, -): string => { - const baseUrl = - "https://github.com/devonthesofa/obsidian-note-status/new/master/templates"; - const filename = `${template.id.replace(/^custom-/, "")}.json`; - - // Create a clean version of the template for the marketplace - const marketplaceTemplate = { - ...template, - // Ensure the ID doesn't have the 'custom-' prefix for the marketplace - id: template.id.replace(/^custom-/, ""), - // Ensure statuses use the new ID - statuses: template.statuses.map((s) => ({ - ...s, - templateId: template.id.replace(/^custom-/, ""), - })), - }; - - const value = encodeURIComponent( - JSON.stringify(marketplaceTemplate, null, 2), - ); - return `${baseUrl}?filename=${filename}&value=${value}`; -};