From 3af6078062bac30b94ed57b871edf6e2cc4f08a1 Mon Sep 17 00:00:00 2001 From: Ashish Padhy <100484401+Shurtu-gal@users.noreply.github.com> Date: Wed, 8 Nov 2023 23:16:16 +0530 Subject: [PATCH] chore: make v3 default (#841) --- apps/studio/src/components/Content.tsx | 5 +- .../Modals/Settings/SettingsModal.tsx | 18 +-- apps/studio/src/components/Sidebar.tsx | 5 +- .../src/components/Terminal/TerminalTabs.tsx | 5 +- .../src/services/specification.service.ts | 8 +- apps/studio/src/state/files.state.ts | 149 ++++++++++++------ apps/studio/src/state/settings.state.ts | 4 +- 7 files changed, 112 insertions(+), 82 deletions(-) diff --git a/apps/studio/src/components/Content.tsx b/apps/studio/src/components/Content.tsx index cea67ccc6..1c147165f 100644 --- a/apps/studio/src/components/Content.tsx +++ b/apps/studio/src/components/Content.tsx @@ -6,7 +6,7 @@ import { Template } from './Template'; import { VisualiserTemplate } from './Visualiser'; import { debounce } from '../helpers'; -import { usePanelsState, useDocumentsState, useSettingsState } from '../state'; +import { usePanelsState, useDocumentsState } from '../state'; import type { FunctionComponent } from 'react'; @@ -15,8 +15,7 @@ interface ContentProps {} export const Content: FunctionComponent = () => { // eslint-disable-line sonarjs/cognitive-complexity const { show, secondaryPanelType } = usePanelsState(); const document = useDocumentsState(state => state.documents['asyncapi']?.document) || null; - const v3Enabled = useSettingsState(state => state.editor.v3support) || false; - const isV3 = document?.version() === '3.0.0' && v3Enabled; + const isV3 = document?.version() === '3.0.0'; const navigationEnabled = show.primarySidebar; const editorEnabled = show.primaryPanel; const viewEnabled = show.secondaryPanel; diff --git a/apps/studio/src/components/Modals/Settings/SettingsModal.tsx b/apps/studio/src/components/Modals/Settings/SettingsModal.tsx index 085fdc45e..8df9bd029 100644 --- a/apps/studio/src/components/Modals/Settings/SettingsModal.tsx +++ b/apps/studio/src/components/Modals/Settings/SettingsModal.tsx @@ -62,14 +62,12 @@ export const SettingsModal = create(({ activeTab = 'editor' const [governanceHints, setGovernanceHints] = useState(settings.governance.show.hints); const [autoRendering, setAutoRendering] = useState(settings.templates.autoRendering); const [confirmDisabled, setConfirmDisabled] = useState(true); - const [v3support, setV3support] = useState(settings.editor.v3support); const createNewState = (): SettingsState => { return { editor: { autoSaving, savingDelay, - v3support }, governance: { show: { @@ -88,7 +86,7 @@ export const SettingsModal = create(({ activeTab = 'editor' const newState = createNewState(); const isThisSameObjects = settingsSvc.isEqual(newState); setConfirmDisabled(isThisSameObjects); - }, [autoSaving, savingDelay, autoRendering, governanceWarnings, governanceInformations, governanceHints, v3support]); + }, [autoSaving, savingDelay, autoRendering, governanceWarnings, governanceInformations, governanceHints]); const onCancel = useCallback(() => { modal.hide(); @@ -131,20 +129,6 @@ export const SettingsModal = create(({ activeTab = 'editor' Save automatically after each change in the document or manually. -
-
- - setV3support(v)} - /> -
-