feat: add setting to toggle status overview popup

This commit is contained in:
Aleix Soler 2025-11-17 18:01:05 +01:00
parent 3a56453106
commit 8ae9942ea8
5 changed files with 35 additions and 0 deletions

View file

@ -42,6 +42,17 @@ export const UISettings: React.FC<Props> = ({ settings, onChange }) => {
/>
</SettingItem>
<SettingItem
name="Show status overview popup"
description="When enabled, show the popup with statuses when hovering or interacting with the status indicator."
>
<input
type="checkbox"
checked={settings.enableStatusOverviewPopup ?? true}
onChange={handleChange("enableStatusOverviewPopup")}
/>
</SettingItem>
<SettingItem
name="Show status icons in file explorer"
description="Display status icons in the file explorer"

View file

@ -15,6 +15,7 @@ export const DEFAULT_PLUGIN_SETTINGS: PluginSettings = {
},
showStatusBar: true,
autoHideStatusBar: false,
enableStatusOverviewPopup: true,
templates: [...PREDEFINED_TEMPLATES],
customStatuses: [],
showStatusIconsInExplorer: true,

View file

@ -1,6 +1,7 @@
import { createRoot, Root } from "react-dom/client";
import { GroupedStatuses } from "@/types/noteStatus";
import { StatusFileInfoPopup } from "@/components/StatusFileInfoPopup/StatusFileInfoPopup";
import settingsService from "@/core/settingsService";
export class StatusesInfoPopup {
private root: Root | null = null;
@ -11,8 +12,14 @@ export class StatusesInfoPopup {
private constructor() {}
static open(statuses: GroupedStatuses) {
// Always ensure previous instance is cleaned up before showing or when disabled
StatusesInfoPopup.close();
const isEnabled =
settingsService.settings?.enableStatusOverviewPopup ?? true;
if (!isEnabled) {
return;
}
StatusesInfoPopup.instance = new StatusesInfoPopup();
StatusesInfoPopup.instance.statuses = statuses;
StatusesInfoPopup.instance.show();

View file

@ -17,6 +17,7 @@ import {
StatusDashboardView,
VIEW_TYPE_STATUS_DASHBOARD,
} from "./integrations/views/status-dashboard-view";
import { StatusesInfoPopup } from "./integrations/popups/statusesInfoPopupIntegration";
export default class NoteStatusPlugin extends Plugin {
private statusBarIntegration: StatusBarIntegration;
@ -73,6 +74,10 @@ export default class NoteStatusPlugin extends Plugin {
"triggered-open-modal",
"main-triggered-open-modal-subscriptor",
);
eventBus.unsubscribe(
"plugin-settings-changed",
"main-status-popup-setting-subscriptor",
);
}
async activateView() {
@ -165,6 +170,16 @@ export default class NoteStatusPlugin extends Plugin {
},
"main-triggered-open-modal-subscriptor",
);
eventBus.subscribe(
"plugin-settings-changed",
({ key, value }) => {
if (key === "enableStatusOverviewPopup" && value === false) {
StatusesInfoPopup.close();
}
},
"main-status-popup-setting-subscriptor",
);
}
async loadPluginSettings() {

View file

@ -15,6 +15,7 @@ export type PluginSettings = {
statusColors: Record<string, string>;
showStatusBar: boolean;
autoHideStatusBar: boolean;
enableStatusOverviewPopup: boolean; // Whether to show popup with grouped statuses
templates: StatusTemplate[];
customStatuses: NoteStatus[];
statusBarShowTemplateName: "always" | "never" | "auto"; // How to show template names in status bar