#524 - Remove global settings

This commit is contained in:
Elio Struyf
2023-03-04 11:13:41 +01:00
parent f2c8c0a8d6
commit ced176adad
3 changed files with 13 additions and 3 deletions
+1
View File
@@ -16,6 +16,7 @@
### 🎨 Enhancements
- [#522](https://github.com/estruyf/vscode-front-matter/issues/522): Configuration support added for [Astro](https://astro.build)
- [#524](https://github.com/estruyf/vscode-front-matter/issues/524): Removed the **Global settings** view from the panel. You can still get it back by configuring a [custom view mode](https://frontmatter.codes/docs/panel#view-modes).
### ⚡️ Optimizations
+6 -2
View File
@@ -13,7 +13,7 @@ import { FeatureFlag } from '../components/features/FeatureFlag';
import { FEATURE_FLAG } from '../constants/Features';
import { GitAction } from './components/Git/GitAction';
import { CustomView } from './components/CustomView';
import { useEffect, useState } from 'react';
import { useEffect, useMemo, useState } from 'react';
export interface IViewPanelProps { }
@@ -32,6 +32,10 @@ export const ViewPanel: React.FunctionComponent<IViewPanelProps> = (
mode
} = useMessages();
const allPanelValues = useMemo(() => {
return Object.values(FEATURE_FLAG.panel).filter(v => v !== FEATURE_FLAG.panel.globalSettings)
}, [FEATURE_FLAG.panel]);
useEffect(() => {
if (window.fmExternal && window.fmExternal.isDevelopment) {
setIsDevMode(true);
@@ -80,7 +84,7 @@ export const ViewPanel: React.FunctionComponent<IViewPanelProps> = (
<CustomView metadata={metadata} />
<FeatureFlag features={mode?.features || []} flag={FEATURE_FLAG.panel.globalSettings}>
<FeatureFlag features={mode?.features || [...allPanelValues]} flag={FEATURE_FLAG.panel.globalSettings}>
<GlobalSettings settings={settings} />
</FeatureFlag>
+6 -1
View File
@@ -11,6 +11,7 @@ import { FeatureFlag } from '../../components/features/FeatureFlag';
import { FEATURE_FLAG } from '../../constants/Features';
import { Messenger } from '@estruyf/vscode/dist/client';
import { GitAction } from './Git/GitAction';
import { useMemo } from 'react';
export interface IBaseViewProps {
settings: PanelSettings | undefined;
@@ -50,6 +51,10 @@ const BaseView: React.FunctionComponent<IBaseViewProps> = ({
(s) => s.bulk && (s.type === 'content' || !s.type)
);
const allPanelValues = useMemo(() => {
return Object.values(FEATURE_FLAG.panel).filter(v => v !== FEATURE_FLAG.panel.globalSettings)
}, [FEATURE_FLAG.panel]);
return (
<div className="frontmatter">
<div className={`ext_actions`}>
@@ -63,7 +68,7 @@ const BaseView: React.FunctionComponent<IBaseViewProps> = ({
<>
<GitAction settings={settings} />
<FeatureFlag features={mode?.features || []} flag={FEATURE_FLAG.panel.globalSettings}>
<FeatureFlag features={mode?.features || [...allPanelValues]} flag={FEATURE_FLAG.panel.globalSettings}>
<GlobalSettings settings={settings} isBase />
</FeatureFlag>