From a08fd7eb522018ed33dbba9db69c56fb40c52ec3 Mon Sep 17 00:00:00 2001 From: tobiasbrandstaedter Date: Thu, 21 Dec 2023 20:29:30 +0100 Subject: [PATCH] feat(#1224): use font preferences in collections --- .../src/components/CollectionSettings/Docs/index.js | 4 +++- .../src/components/CollectionSettings/Script/index.js | 5 ++++- .../src/components/CollectionSettings/Tests/index.js | 4 +++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/packages/bruno-app/src/components/CollectionSettings/Docs/index.js b/packages/bruno-app/src/components/CollectionSettings/Docs/index.js index f759af2e3..88c272b13 100644 --- a/packages/bruno-app/src/components/CollectionSettings/Docs/index.js +++ b/packages/bruno-app/src/components/CollectionSettings/Docs/index.js @@ -3,7 +3,7 @@ import get from 'lodash/get'; import { updateCollectionDocs } from 'providers/ReduxStore/slices/collections'; import { useTheme } from 'providers/Theme'; import { useState } from 'react'; -import { useDispatch } from 'react-redux'; +import { useDispatch, useSelector } from 'react-redux'; import { saveCollectionRoot } from 'providers/ReduxStore/slices/collections/actions'; import Markdown from 'components/MarkDown'; import CodeEditor from 'components/CodeEditor'; @@ -14,6 +14,7 @@ const Docs = ({ collection }) => { const { storedTheme } = useTheme(); const [isEditing, setIsEditing] = useState(false); const docs = get(collection, 'root.docs', ''); + const preferences = useSelector((state) => state.app.preferences); const toggleViewMode = () => { setIsEditing((prev) => !prev); @@ -44,6 +45,7 @@ const Docs = ({ collection }) => { onEdit={onEdit} onSave={onSave} mode="application/text" + font={get(preferences, 'font.codeFont', 'default')} /> ) : ( diff --git a/packages/bruno-app/src/components/CollectionSettings/Script/index.js b/packages/bruno-app/src/components/CollectionSettings/Script/index.js index 7cfff272e..0314c65e5 100644 --- a/packages/bruno-app/src/components/CollectionSettings/Script/index.js +++ b/packages/bruno-app/src/components/CollectionSettings/Script/index.js @@ -1,6 +1,6 @@ import React from 'react'; import get from 'lodash/get'; -import { useDispatch } from 'react-redux'; +import { useDispatch, useSelector } from 'react-redux'; import CodeEditor from 'components/CodeEditor'; import { updateCollectionRequestScript, updateCollectionResponseScript } from 'providers/ReduxStore/slices/collections'; import { saveCollectionRoot } from 'providers/ReduxStore/slices/collections/actions'; @@ -13,6 +13,7 @@ const Script = ({ collection }) => { const responseScript = get(collection, 'root.request.script.res', ''); const { storedTheme } = useTheme(); + const preferences = useSelector((state) => state.app.preferences); const onRequestScriptEdit = (value) => { dispatch( @@ -47,6 +48,7 @@ const Script = ({ collection }) => { onEdit={onRequestScriptEdit} mode="javascript" onSave={handleSave} + font={get(preferences, 'font.codeFont', 'default')} />
@@ -58,6 +60,7 @@ const Script = ({ collection }) => { onEdit={onResponseScriptEdit} mode="javascript" onSave={handleSave} + font={get(preferences, 'font.codeFont', 'default')} />
diff --git a/packages/bruno-app/src/components/CollectionSettings/Tests/index.js b/packages/bruno-app/src/components/CollectionSettings/Tests/index.js index 469d2b409..3566ec0dd 100644 --- a/packages/bruno-app/src/components/CollectionSettings/Tests/index.js +++ b/packages/bruno-app/src/components/CollectionSettings/Tests/index.js @@ -1,6 +1,6 @@ import React from 'react'; import get from 'lodash/get'; -import { useDispatch } from 'react-redux'; +import { useDispatch, useSelector } from 'react-redux'; import CodeEditor from 'components/CodeEditor'; import { updateCollectionTests } from 'providers/ReduxStore/slices/collections'; import { saveCollectionRoot } from 'providers/ReduxStore/slices/collections/actions'; @@ -12,6 +12,7 @@ const Tests = ({ collection }) => { const tests = get(collection, 'root.request.tests', ''); const { storedTheme } = useTheme(); + const preferences = useSelector((state) => state.app.preferences); const onEdit = (value) => { dispatch( @@ -33,6 +34,7 @@ const Tests = ({ collection }) => { onEdit={onEdit} mode="javascript" onSave={handleSave} + font={get(preferences, 'font.codeFont', 'default')} />