mirror of
https://github.com/devonthesofa/obsidian-note-status.git
synced 2026-07-22 05:45:04 +00:00
24 lines
611 B
TypeScript
24 lines
611 B
TypeScript
|
|
import settingsService from "@/core/settingsService";
|
||
|
|
|
||
|
|
export type ExperimentalFeature = "statusDashboard" | "groupedStatusView";
|
||
|
|
|
||
|
|
const FEATURE_SETTING_MAP: Record<
|
||
|
|
ExperimentalFeature,
|
||
|
|
keyof typeof settingsService.settings
|
||
|
|
> = {
|
||
|
|
statusDashboard: "enableStatusDashboard",
|
||
|
|
groupedStatusView: "enableGroupedStatusView",
|
||
|
|
};
|
||
|
|
|
||
|
|
export function isExperimentalFeatureEnabled(
|
||
|
|
feature: ExperimentalFeature,
|
||
|
|
): boolean {
|
||
|
|
const settings = settingsService.settings;
|
||
|
|
if (!settings.enableExperimentalFeatures) {
|
||
|
|
return false;
|
||
|
|
}
|
||
|
|
|
||
|
|
const flagKey = FEATURE_SETTING_MAP[feature];
|
||
|
|
return Boolean(settings[flagKey]);
|
||
|
|
}
|