From 6bf16edef43d5decdaeda74a0b7c8266031dd08c Mon Sep 17 00:00:00 2001 From: Trey Wallis <40307803+trey-wallis@users.noreply.github.com> Date: Fri, 15 Mar 2024 15:50:42 -0600 Subject: [PATCH] refactor: rename plugin to Vault Explorer --- README.md | 6 ++--- manifest.json | 6 ++--- package.json | 4 +-- src/constants.ts | 2 +- src/main.ts | 26 +++++++++---------- ...-tab.ts => vault-explorer-settings-tab.ts} | 8 +++--- ...atter-view.tsx => vault-explorer-view.tsx} | 14 +++++----- src/react/app-mount-provider.tsx | 4 +-- src/react/card/index.tsx | 18 ++++++------- src/react/card/styles.css | 16 ++++++------ src/react/checkbox/index.tsx | 2 +- src/react/checkbox/styles.css | 2 +- src/react/flex/index.tsx | 2 +- src/react/index.tsx | 6 ++--- src/react/property/index.tsx | 2 +- src/react/property/styles.css | 4 +-- src/react/stack/index.tsx | 2 +- src/react/styles.css | 8 +++--- src/react/tag/index.tsx | 2 +- src/react/tag/styles.css | 2 +- src/types.ts | 2 +- 21 files changed, 69 insertions(+), 69 deletions(-) rename src/obsidian/{frontmatter-views-settings-tab.ts => vault-explorer-settings-tab.ts} (90%) rename src/obsidian/{frontmatter-view.tsx => vault-explorer-view.tsx} (73%) diff --git a/README.md b/README.md index a01834a..15117f5 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ -# Obsidian Frontmatter Views +# Obsidian Vault Explorer ## About -This plugin allows you to create dynamic views based on frontmatter +This plugin allows you to explore your vault in visual format ## Installation @@ -10,7 +10,7 @@ This plugin allows you to create dynamic views based on frontmatter 2. Enable the plugin 3. Open the plugin settings 4. Click **Add beta plugin** -5. Enter the repository url: **https://github.com/trey-wallis/obsidian-frontmatter-views** +5. Enter the repository url: **https://github.com/trey-wallis/obsidian-vault-explorer** 6. Click **Add plugin** ## Usage diff --git a/manifest.json b/manifest.json index 35dc411..f548708 100644 --- a/manifest.json +++ b/manifest.json @@ -1,9 +1,9 @@ { - "id": "frontmatter-views", - "name": "Frontmatter Views", + "id": "vault-explorer", + "name": "Vault Explorer", "version": "0.0.8", "minAppVersion": "1.4.13", - "description": "Create dynamic views based on frontmatter", + "description": "Explore your vault in visual format", "author": "Trey Wallis", "authorUrl": "https://github.com/trey-wallis", "fundingUrl": "https://buymeacoffee.com/treywallis", diff --git a/package.json b/package.json index 9bba9a0..3739860 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { - "name": "obsidian-frontmatter-views", + "name": "obsidian-vault-explorer", "version": "0.0.8", - "description": "Create dynamic views based on frontmatter", + "description": "Explore your vault in visual format", "main": "main.js", "scripts": { "dev": "node esbuild.config.mjs", diff --git a/src/constants.ts b/src/constants.ts index 905b4c4..f830978 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -1 +1 @@ -export const FRONTMATTER_VIEW = "frontmatter-view"; +export const VAULT_EXPLORER_VIEW = "vault-explorer"; diff --git a/src/main.ts b/src/main.ts index aa1e8f3..3a130fd 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,13 +1,13 @@ import { Plugin, } from 'obsidian'; -import FrontmatterView from './obsidian/frontmatter-view'; -import FrontmatterViewsSettingTabs from './obsidian/frontmatter-views-settings-tab'; +import VaultExplorerView from './obsidian/vault-explorer-view'; +import VaultExplorerSettingsTab from './obsidian/vault-explorer-settings-tab'; -import { FrontmatterViewsPluginSettings } from './types'; -import { FRONTMATTER_VIEW } from './constants'; +import { VaultExplorerPluginSettings } from './types'; +import { VAULT_EXPLORER_VIEW } from './constants'; -const DEFAULT_SETTINGS: FrontmatterViewsPluginSettings = { +const DEFAULT_SETTINGS: VaultExplorerPluginSettings = { favoritePropertyName: "favorite", urlPropertyName: "url", sourcePropertyName: "source", @@ -15,32 +15,32 @@ const DEFAULT_SETTINGS: FrontmatterViewsPluginSettings = { statusPropertyName: "status", } -export default class FrontmatterViewsPlugin extends Plugin { - settings: FrontmatterViewsPluginSettings; +export default class VaultExplorerPlugin extends Plugin { + settings: VaultExplorerPluginSettings; async onload() { await this.loadSettings(); this.registerView( - FRONTMATTER_VIEW, - (leaf) => new FrontmatterView(leaf, this.app, this.settings) + VAULT_EXPLORER_VIEW, + (leaf) => new VaultExplorerView(leaf, this.app, this.settings) ); - this.addRibbonIcon("layout-list", "Frontmatter View", async () => { - const leaves = this.app.workspace.getLeavesOfType(FRONTMATTER_VIEW); + this.addRibbonIcon("map", "Vault Explorer", async () => { + const leaves = this.app.workspace.getLeavesOfType(VAULT_EXPLORER_VIEW); if (leaves.length !== 0) { const leaf = leaves[0]; this.app.workspace.revealLeaf(leaf); } else { this.app.workspace.getLeaf().setViewState({ - type: FRONTMATTER_VIEW, + type: VAULT_EXPLORER_VIEW, active: true, }); } }); - this.addSettingTab(new FrontmatterViewsSettingTabs(this.app, this)); + this.addSettingTab(new VaultExplorerSettingsTab(this.app, this)); } onunload() { diff --git a/src/obsidian/frontmatter-views-settings-tab.ts b/src/obsidian/vault-explorer-settings-tab.ts similarity index 90% rename from src/obsidian/frontmatter-views-settings-tab.ts rename to src/obsidian/vault-explorer-settings-tab.ts index 44d8200..06ec884 100644 --- a/src/obsidian/frontmatter-views-settings-tab.ts +++ b/src/obsidian/vault-explorer-settings-tab.ts @@ -1,10 +1,10 @@ import { App, PluginSettingTab, Setting } from "obsidian"; -import FrontmatterViewsPlugin from "src/main"; +import VaultExplorerPlugin from "src/main"; -export default class FrontmatterViewsSettingTabs extends PluginSettingTab { - plugin: FrontmatterViewsPlugin; +export default class VaultExplorerSettingsTab extends PluginSettingTab { + plugin: VaultExplorerPlugin; - constructor(app: App, plugin: FrontmatterViewsPlugin) { + constructor(app: App, plugin: VaultExplorerPlugin) { super(app, plugin); this.plugin = plugin; } diff --git a/src/obsidian/frontmatter-view.tsx b/src/obsidian/vault-explorer-view.tsx similarity index 73% rename from src/obsidian/frontmatter-view.tsx rename to src/obsidian/vault-explorer-view.tsx index 9695ffd..f8f5907 100644 --- a/src/obsidian/frontmatter-view.tsx +++ b/src/obsidian/vault-explorer-view.tsx @@ -3,20 +3,20 @@ import { App, ItemView, WorkspaceLeaf } from "obsidian"; import React from "react"; import { createRoot, Root } from "react-dom/client"; -import { FRONTMATTER_VIEW } from "src/constants"; +import { VAULT_EXPLORER_VIEW } from "src/constants"; import ReactView from "src/react/index"; import AppMountProvider from "src/react/app-mount-provider"; -import { FrontmatterViewsPluginSettings } from "src/types"; +import { VaultExplorerPluginSettings } from "src/types"; -export default class FrontmatterView extends ItemView { +export default class VaultExplorerView extends ItemView { root: Root | null; app: App; - settings: FrontmatterViewsPluginSettings; + settings: VaultExplorerPluginSettings; constructor( leaf: WorkspaceLeaf, app: App, - settings: FrontmatterViewsPluginSettings + settings: VaultExplorerPluginSettings ) { super(leaf); this.root = null; @@ -25,10 +25,10 @@ export default class FrontmatterView extends ItemView { } getViewType(): string { - return FRONTMATTER_VIEW; + return VAULT_EXPLORER_VIEW; } getDisplayText(): string { - return "Frontmatter View"; + return "Explorer"; } async onOpen() { diff --git a/src/react/app-mount-provider.tsx b/src/react/app-mount-provider.tsx index c3d3025..6df4146 100644 --- a/src/react/app-mount-provider.tsx +++ b/src/react/app-mount-provider.tsx @@ -1,12 +1,12 @@ import { App, WorkspaceLeaf } from "obsidian"; import React from "react"; -import { FrontmatterViewsPluginSettings } from "src/types"; +import { VaultExplorerPluginSettings } from "src/types"; interface ContextProps { app: App; leaf: WorkspaceLeaf; - settings: FrontmatterViewsPluginSettings; + settings: VaultExplorerPluginSettings; } const MountContext = React.createContext(null); diff --git a/src/react/card/index.tsx b/src/react/card/index.tsx index 6f8d266..73f54c0 100644 --- a/src/react/card/index.tsx +++ b/src/react/card/index.tsx @@ -45,7 +45,7 @@ export default function Card({ if (leaf) { app.workspace.setActiveLeaf(leaf); } else { - app.workspace.openLinkText(path, "frontmatter-view"); + app.workspace.openLinkText(path, "vault-explorer"); } } @@ -56,10 +56,10 @@ export default function Card({ } return ( -
-
+
+
{name} @@ -76,19 +76,19 @@ export default function Card({ )}
-
-
+
+
{tags.map((tag) => ( ))}
{source !== null && } -
+
{status !== null && (
-
+
Status
@@ -98,7 +98,7 @@ export default function Card({
-
+
Revision
diff --git a/src/react/card/styles.css b/src/react/card/styles.css index 2b98f4c..f095d92 100644 --- a/src/react/card/styles.css +++ b/src/react/card/styles.css @@ -1,43 +1,43 @@ -.frontmatter-view-card { +.vault-explorer-card { padding: 20px; box-shadow: var(--shadow-s); border: 1px solid var(--background-modifier-border); } -.frontmatter-view-card__header { +.vault-explorer-card__header { display: flex; justify-content: space-between; align-items: flex-start; column-gap: 0.5rem; } -.frontmatter-view-card__content { +.vault-explorer-card__content { display: flex; flex-direction: column; row-gap: 0.5rem; } -.frontmatter-view-card__title { +.vault-explorer-card__title { cursor: pointer; color: var(--text-accent) } -.frontmatter-view-card__tags { +.vault-explorer-card__tags { display: flex; column-gap: 0.25rem; height: min-content; overflow-x: auto; } -.frontmatter-view-card__tags::-webkit-scrollbar { +.vault-explorer-card__tags::-webkit-scrollbar { display: none; } -.frontmatter-view-card__labels { +.vault-explorer-card__labels { display: flex; } -.frontmatter-view-property-label { +.vault-explorer-property-label { margin-left: 8px; font-size: var(--font-smallest); color: var(--text-muted); diff --git a/src/react/checkbox/index.tsx b/src/react/checkbox/index.tsx index 16fe7b4..23e17a3 100644 --- a/src/react/checkbox/index.tsx +++ b/src/react/checkbox/index.tsx @@ -9,7 +9,7 @@ interface Props { export default function Checkbox({ id, label, value, onChange }: Props) { return ( -
+
-
+
+
-
+
{filteredData.map((file) => { const { name, tags, path, url, source, revision, status } = file; diff --git a/src/react/property/index.tsx b/src/react/property/index.tsx index 9cc91b2..79c1f62 100644 --- a/src/react/property/index.tsx +++ b/src/react/property/index.tsx @@ -21,7 +21,7 @@ export default function Property({ name, value }: Props) { return (