Skip to content

Commit 51a394b

Browse files
trangdoan982claude
andauthored
ENG-1563: Add Datacore dependency callout in settings (#912)
* add Datacore dependency callout in plugin settings Shows a warning banner at the top of the settings page when the Datacore plugin is not installed/enabled, with a link to install it. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix lint --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 2ad4fa7 commit 51a394b

3 files changed

Lines changed: 35 additions & 1 deletion

File tree

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import { useApp } from "./AppContext";
2+
import { AppWithPlugins } from "~/services/QueryEngine";
3+
4+
export const DatacoreCallout = () => {
5+
const app = useApp();
6+
7+
const datacorePlugin = (app as AppWithPlugins)?.plugins?.plugins?.[
8+
"datacore"
9+
];
10+
11+
if (datacorePlugin) return null;
12+
13+
return (
14+
<div className="callout callout-warning mb-4 rounded-md border border-solid border-yellow-500/30 bg-yellow-500/10 p-4">
15+
<div className="callout-title flex items-center gap-2 font-semibold">
16+
⚠️ Datacore plugin required
17+
</div>
18+
<div className="callout-content mt-2">
19+
<p>
20+
The Datacore plugin is required for Discourse Graphs to function.
21+
Please install and enable it.
22+
</p>
23+
<a
24+
href="obsidian://show-plugin?id=datacore"
25+
className="text-accent mt-2 inline-block underline"
26+
>
27+
Install Datacore
28+
</a>
29+
</div>
30+
</div>
31+
);
32+
};

apps/obsidian/src/components/Settings.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import NodeTypeSettings from "./NodeTypeSettings";
99
import GeneralSettings from "./GeneralSettings";
1010
import { AdminPanelSettings } from "./AdminPanelSettings";
1111
import { PluginProvider } from "./PluginContext";
12+
import { DatacoreCallout } from "./DatacoreCallout";
1213

1314
const Settings = () => {
1415
const [activeTab, setActiveTab] = useState("general");
@@ -29,6 +30,7 @@ const Settings = () => {
2930

3031
return (
3132
<div className="flex flex-col gap-4">
33+
<DatacoreCallout />
3234
<div className="border-modifier-border flex w-full overflow-x-auto border-b p-2">
3335
<button
3436
onClick={() => setActiveTab("general")}

apps/obsidian/src/services/QueryEngine.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { extractContentFromTitle } from "~/utils/extractContentFromTitle";
66

77
// This is a workaround to get the datacore API.
88
// TODO: Remove once we can use datacore npm package
9-
type AppWithPlugins = App & {
9+
export type AppWithPlugins = App & {
1010
plugins: {
1111
plugins: {
1212
[key: string]: {

0 commit comments

Comments
 (0)