From 7267ba64851ef2714e1b1c72b0a5d5de3218a431 Mon Sep 17 00:00:00 2001 From: Its-treason <39559178+Its-treason@users.noreply.github.com> Date: Sun, 22 Oct 2023 21:54:17 +0200 Subject: [PATCH 01/28] feat(#682): Enforce environment variable strictness --- .../EnvironmentVariables/StyledWrapper.js | 6 +- .../EnvironmentVariables/index.js | 210 +++++++++--------- .../EnvironmentVariables/reducer.js | 52 ----- 3 files changed, 113 insertions(+), 155 deletions(-) delete mode 100644 packages/bruno-app/src/components/Environments/EnvironmentSettings/EnvironmentList/EnvironmentDetails/EnvironmentVariables/reducer.js diff --git a/packages/bruno-app/src/components/Environments/EnvironmentSettings/EnvironmentList/EnvironmentDetails/EnvironmentVariables/StyledWrapper.js b/packages/bruno-app/src/components/Environments/EnvironmentSettings/EnvironmentList/EnvironmentDetails/EnvironmentVariables/StyledWrapper.js index 64b11b25c..7eec1394c 100644 --- a/packages/bruno-app/src/components/Environments/EnvironmentSettings/EnvironmentList/EnvironmentDetails/EnvironmentVariables/StyledWrapper.js +++ b/packages/bruno-app/src/components/Environments/EnvironmentSettings/EnvironmentList/EnvironmentDetails/EnvironmentVariables/StyledWrapper.js @@ -13,10 +13,12 @@ const Wrapper = styled.div` padding: 4px 10px; &:nth-child(1), - &:nth-child(4), - &:nth-child(5) { + &:nth-child(4) { width: 70px; } + &:nth-child(5) { + width: 40px; + } &:nth-child(2) { width: 25%; diff --git a/packages/bruno-app/src/components/Environments/EnvironmentSettings/EnvironmentList/EnvironmentDetails/EnvironmentVariables/index.js b/packages/bruno-app/src/components/Environments/EnvironmentSettings/EnvironmentList/EnvironmentDetails/EnvironmentVariables/index.js index 748626768..6ac7f8e4c 100644 --- a/packages/bruno-app/src/components/Environments/EnvironmentSettings/EnvironmentList/EnvironmentDetails/EnvironmentVariables/index.js +++ b/packages/bruno-app/src/components/Environments/EnvironmentSettings/EnvironmentList/EnvironmentDetails/EnvironmentVariables/index.js @@ -1,68 +1,79 @@ -import React, { useReducer } from 'react'; +import React from 'react'; import toast from 'react-hot-toast'; import cloneDeep from 'lodash/cloneDeep'; import { IconTrash } from '@tabler/icons'; import { useTheme } from 'providers/Theme'; import { useDispatch } from 'react-redux'; import { saveEnvironment } from 'providers/ReduxStore/slices/collections/actions'; -import reducer from './reducer'; import SingleLineEditor from 'components/SingleLineEditor'; import StyledWrapper from './StyledWrapper'; +import { useFormik } from 'formik'; +import * as Yup from 'yup'; +import { uuid } from 'utils/common'; const EnvironmentVariables = ({ environment, collection }) => { const dispatch = useDispatch(); const { storedTheme } = useTheme(); - const [state, reducerDispatch] = useReducer(reducer, { hasChanges: false, variables: environment.variables || [] }); - const { variables, hasChanges } = state; - const saveChanges = () => { - dispatch(saveEnvironment(cloneDeep(variables), environment.uid, collection.uid)) - .then(() => { - toast.success('Changes saved successfully'); - reducerDispatch({ - type: 'CHANGES_SAVED' - }); + const formik = useFormik({ + enableReinitialize: true, + initialValues: environment.variables || [], + validationSchema: Yup.array().of( + Yup.object({ + enabled: Yup.boolean(), + name: Yup.string() + .required('Name cannot be empty') + .matches(/^[^\d]\w*$/, 'Name contains invalid characters') + .trim(), + secret: Yup.boolean(), + type: Yup.string(), + uid: Yup.string(), + value: Yup.string().trim() }) - .catch(() => toast.error('An error occurred while saving the changes')); + ), + onSubmit: (values) => { + if (!formik.dirty) { + toast.error('Nothing to save'); + return; + } + + dispatch(saveEnvironment(cloneDeep(values), environment.uid, collection.uid)) + .then(() => { + toast.success('Changes saved successfully'); + formik.resetForm({ values }); + }) + .catch(() => toast.error('An error occurred while saving the changes')); + } + }); + + const ErrorMessage = ({ name }) => { + const meta = formik.getFieldMeta(name); + console.log(name, meta); + if (!meta.error) { + return null; + } + + return ( + + ); }; const addVariable = () => { - reducerDispatch({ - type: 'ADD_VAR' - }); + const newVariable = { + uid: uuid(), + name: '', + value: '', + type: 'text', + secret: false, + enabled: true + }; + formik.setFieldValue(formik.values.length, newVariable, false); }; - const handleVarChange = (e, _variable, type) => { - const variable = cloneDeep(_variable); - switch (type) { - case 'name': { - variable.name = e.target.value; - break; - } - case 'value': { - variable.value = e.target.value; - break; - } - case 'enabled': { - variable.enabled = e.target.checked; - break; - } - case 'secret': { - variable.secret = e.target.checked; - break; - } - } - reducerDispatch({ - type: 'UPDATE_VAR', - variable - }); - }; - - const handleRemoveVars = (variable) => { - reducerDispatch({ - type: 'DELETE_VAR', - variable - }); + const handleRemoveVar = (id) => { + formik.setValues(formik.values.filter((variable) => variable.uid !== id)); }; return ( @@ -78,55 +89,57 @@ const EnvironmentVariables = ({ environment, collection }) => { - {variables && variables.length - ? variables.map((variable, index) => { - return ( - - - handleVarChange(e, variable, 'enabled')} - /> - - - handleVarChange(e, variable, 'name')} - /> - - - handleVarChange({ target: { value: newValue } }, variable, 'value')} - collection={collection} - /> - - - handleVarChange(e, variable, 'secret')} - /> - - - - - - ); - }) - : null} + {formik.values.map((variable, index) => ( + + + + + + + + + + formik.setFieldValue(`${index}.value`, newValue, true)} + /> + + + + + + + + + ))} @@ -137,12 +150,7 @@ const EnvironmentVariables = ({ environment, collection }) => {
-
diff --git a/packages/bruno-app/src/components/Environments/EnvironmentSettings/EnvironmentList/EnvironmentDetails/EnvironmentVariables/reducer.js b/packages/bruno-app/src/components/Environments/EnvironmentSettings/EnvironmentList/EnvironmentDetails/EnvironmentVariables/reducer.js deleted file mode 100644 index a5aa3e0c1..000000000 --- a/packages/bruno-app/src/components/Environments/EnvironmentSettings/EnvironmentList/EnvironmentDetails/EnvironmentVariables/reducer.js +++ /dev/null @@ -1,52 +0,0 @@ -import produce from 'immer'; -import find from 'lodash/find'; -import filter from 'lodash/filter'; -import { uuid } from 'utils/common'; - -const reducer = (state, action) => { - switch (action.type) { - case 'ADD_VAR': { - return produce(state, (draft) => { - draft.variables.push({ - uid: uuid(), - name: '', - value: '', - type: 'text', - secret: false, - enabled: true - }); - draft.hasChanges = true; - }); - } - - case 'UPDATE_VAR': { - return produce(state, (draft) => { - const variable = find(draft.variables, (v) => v.uid === action.variable.uid); - variable.name = action.variable.name; - variable.value = action.variable.value; - variable.enabled = action.variable.enabled; - variable.secret = action.variable.secret; - draft.hasChanges = true; - }); - } - - case 'DELETE_VAR': { - return produce(state, (draft) => { - draft.variables = filter(draft.variables, (v) => v.uid !== action.variable.uid); - draft.hasChanges = true; - }); - } - - case 'CHANGES_SAVED': { - return produce(state, (draft) => { - draft.hasChanges = false; - }); - } - - default: { - return state; - } - } -}; - -export default reducer; From 45126c99ab7861cf0d8c2b50193fb6190d99a677 Mon Sep 17 00:00:00 2001 From: Max Heidinger Date: Fri, 20 Oct 2023 14:37:15 +0200 Subject: [PATCH 02/28] feat: add loading local graphql schema file --- .../RequestPane/GraphQLRequestPane/index.js | 37 ++------ .../GraphQLRequestPane/useGraphqlSchema.js | 60 ------------- .../RequestPane/GraphQLSchemaActions/index.js | 70 +++++++++++++++ .../GraphQLSchemaActions/useGraphqlSchema.js | 89 +++++++++++++++++++ packages/bruno-electron/src/ipc/collection.js | 18 +++- 5 files changed, 181 insertions(+), 93 deletions(-) delete mode 100644 packages/bruno-app/src/components/RequestPane/GraphQLRequestPane/useGraphqlSchema.js create mode 100644 packages/bruno-app/src/components/RequestPane/GraphQLSchemaActions/index.js create mode 100644 packages/bruno-app/src/components/RequestPane/GraphQLSchemaActions/useGraphqlSchema.js diff --git a/packages/bruno-app/src/components/RequestPane/GraphQLRequestPane/index.js b/packages/bruno-app/src/components/RequestPane/GraphQLRequestPane/index.js index 98845b55b..288e66a84 100644 --- a/packages/bruno-app/src/components/RequestPane/GraphQLRequestPane/index.js +++ b/packages/bruno-app/src/components/RequestPane/GraphQLRequestPane/index.js @@ -1,8 +1,7 @@ -import React, { useEffect } from 'react'; +import React, { useEffect, useState } from 'react'; import find from 'lodash/find'; import get from 'lodash/get'; import classnames from 'classnames'; -import { IconRefresh, IconLoader2, IconBook, IconDownload } from '@tabler/icons'; import { useSelector, useDispatch } from 'react-redux'; import { updateRequestPaneTab } from 'providers/ReduxStore/slices/tabs'; import QueryEditor from 'components/RequestPane/QueryEditor'; @@ -16,10 +15,9 @@ import Tests from 'components/RequestPane/Tests'; import { useTheme } from 'providers/Theme'; import { updateRequestGraphqlQuery } from 'providers/ReduxStore/slices/collections'; import { sendRequest, saveRequest } from 'providers/ReduxStore/slices/collections/actions'; -import { findEnvironmentInCollection } from 'utils/collections'; -import useGraphqlSchema from './useGraphqlSchema'; import StyledWrapper from './StyledWrapper'; import Documentation from 'components/Documentation/index'; +import GraphQLSchemaActions from '../GraphQLSchemaActions/index'; const GraphQLRequestPane = ({ item, collection, leftPaneWidth, onSchemaLoad, toggleDocs, handleGqlClickReference }) => { const dispatch = useDispatch(); @@ -29,25 +27,11 @@ const GraphQLRequestPane = ({ item, collection, leftPaneWidth, onSchemaLoad, tog const variables = item.draft ? get(item, 'draft.request.body.graphql.variables') : get(item, 'request.body.graphql.variables'); - const url = item.draft ? get(item, 'draft.request.url') : get(item, 'request.url'); const { storedTheme } = useTheme(); - - const environment = findEnvironmentInCollection(collection, collection.activeEnvironmentUid); - - const request = item.draft ? item.draft.request : item.request; - - let { schema, loadSchema, isLoading: isSchemaLoading } = useGraphqlSchema(url, environment, request, collection); - - const loadGqlSchema = () => { - if (!isSchemaLoading) { - loadSchema(); - } - }; + const [schema, setSchema] = useState(null); useEffect(() => { - if (onSchemaLoad) { - onSchemaLoad(schema); - } + onSchemaLoad(schema); }, [schema]); const onQueryChange = (value) => { @@ -163,18 +147,7 @@ const GraphQLRequestPane = ({ item, collection, leftPaneWidth, onSchemaLoad, tog
selectTab('docs')}> Docs
-
-
- {isSchemaLoading ? : null} - {!isSchemaLoading && !schema ? : null} - {!isSchemaLoading && schema ? : null} - Schema -
-
- - Docs -
-
+
{getTabPanel(focusedTab.requestPaneTab)}
diff --git a/packages/bruno-app/src/components/RequestPane/GraphQLRequestPane/useGraphqlSchema.js b/packages/bruno-app/src/components/RequestPane/GraphQLRequestPane/useGraphqlSchema.js deleted file mode 100644 index c824c5751..000000000 --- a/packages/bruno-app/src/components/RequestPane/GraphQLRequestPane/useGraphqlSchema.js +++ /dev/null @@ -1,60 +0,0 @@ -import { useState } from 'react'; -import toast from 'react-hot-toast'; -import { buildClientSchema } from 'graphql'; -import { fetchGqlSchema } from 'utils/network'; -import { simpleHash } from 'utils/common'; - -const schemaHashPrefix = 'bruno.graphqlSchema'; - -const useGraphqlSchema = (endpoint, environment, request, collection) => { - const localStorageKey = `${schemaHashPrefix}.${simpleHash(endpoint)}`; - const [error, setError] = useState(null); - const [isLoading, setIsLoading] = useState(false); - const [schema, setSchema] = useState(() => { - try { - const saved = localStorage.getItem(localStorageKey); - if (!saved) { - return null; - } - return buildClientSchema(JSON.parse(saved)); - } catch { - localStorage.setItem(localStorageKey, null); - return null; - } - }); - - const loadSchema = () => { - setIsLoading(true); - fetchGqlSchema(endpoint, environment, request, collection) - .then((res) => { - if (!res || res.status !== 200) { - return Promise.reject(new Error(res.statusText)); - } - return res.data; - }) - .then((s) => { - if (s && s.data) { - setSchema(buildClientSchema(s.data)); - setIsLoading(false); - localStorage.setItem(localStorageKey, JSON.stringify(s.data)); - toast.success('GraphQL Schema loaded successfully'); - } else { - return Promise.reject(new Error('An error occurred while introspecting schema')); - } - }) - .catch((err) => { - setIsLoading(false); - setError(err); - toast.error(`Error occurred while loading GraphQL Schema: ${err.message}`); - }); - }; - - return { - isLoading, - schema, - loadSchema, - error - }; -}; - -export default useGraphqlSchema; diff --git a/packages/bruno-app/src/components/RequestPane/GraphQLSchemaActions/index.js b/packages/bruno-app/src/components/RequestPane/GraphQLSchemaActions/index.js new file mode 100644 index 000000000..954efebf7 --- /dev/null +++ b/packages/bruno-app/src/components/RequestPane/GraphQLSchemaActions/index.js @@ -0,0 +1,70 @@ +import React, { useEffect, useRef, forwardRef } from 'react'; +import useGraphqlSchema from './useGraphqlSchema'; +import { IconBook, IconDownload, IconLoader2, IconCheckmark } from '@tabler/icons'; +import get from 'lodash/get'; +import { findEnvironmentInCollection } from 'utils/collections'; +import Dropdown from '../../Dropdown'; + +const GraphQLSchemaActions = ({ item, collection, onSchemaLoad, toggleDocs }) => { + const url = item.draft ? get(item, 'draft.request.url') : get(item, 'request.url'); + const environment = findEnvironmentInCollection(collection, collection.activeEnvironmentUid); + const request = item.draft ? item.draft.request : item.request; + + let { + schema, + schemaSource, + loadSchema, + isLoading: isSchemaLoading + } = useGraphqlSchema(url, environment, request, collection); + + useEffect(() => { + if (onSchemaLoad) { + onSchemaLoad(schema); + } + }, [schema]); + + const schemaDropdownTippyRef = useRef(); + const onSchemaDropdownCreate = (ref) => (schemaDropdownTippyRef.current = ref); + + const MenuIcon = forwardRef((props, ref) => { + return ( +
+ {isSchemaLoading && } + {!isSchemaLoading && schema && } + {!isSchemaLoading && !schema && } + Schema +
+ ); + }); + + return ( +
+
+ + Docs +
+ } placement="bottom-start"> +
{ + schemaDropdownTippyRef.current.hide(); + loadSchema('introspection'); + }} + > + {schema && schemaSource === 'introspection' ? 'Refresh from Introspection' : 'Load from Introspection'} +
+
{ + schemaDropdownTippyRef.current.hide(); + loadSchema('file'); + }} + > + Load from File +
+
+
+ ); +}; + +export default GraphQLSchemaActions; diff --git a/packages/bruno-app/src/components/RequestPane/GraphQLSchemaActions/useGraphqlSchema.js b/packages/bruno-app/src/components/RequestPane/GraphQLSchemaActions/useGraphqlSchema.js new file mode 100644 index 000000000..0a5f2bd01 --- /dev/null +++ b/packages/bruno-app/src/components/RequestPane/GraphQLSchemaActions/useGraphqlSchema.js @@ -0,0 +1,89 @@ +import { useState } from 'react'; +import toast from 'react-hot-toast'; +import { buildClientSchema } from 'graphql'; +import { fetchGqlSchema } from 'utils/network'; +import { simpleHash } from 'utils/common'; + +const schemaHashPrefix = 'bruno.graphqlSchema'; + +const useGraphqlSchema = (endpoint, environment, request, collection) => { + const { ipcRenderer } = window; + const localStorageKey = `${schemaHashPrefix}.${simpleHash(endpoint)}`; + const [error, setError] = useState(null); + const [isLoading, setIsLoading] = useState(false); + const [schemaSource, setSchemaSource] = useState(''); + const [schema, setSchema] = useState(() => { + try { + const saved = localStorage.getItem(localStorageKey); + if (!saved) { + return null; + } + return buildClientSchema(JSON.parse(saved)); + } catch { + localStorage.setItem(localStorageKey, null); + return null; + } + }); + + const loadSchemaFromIntrospection = async () => { + const response = await fetchGqlSchema(endpoint, environment, request, collection); + if (!response) { + throw new Error('Introspection query failed'); + } + if (response.status !== 200) { + throw new Error(response.statusText); + } + const data = response.data?.data; + if (!data) { + throw new Error('No data returned from introspection query'); + } + setSchemaSource('introspection'); + return data; + }; + + const loadSchemaFromFile = async () => { + const schemaContent = await ipcRenderer.invoke('renderer:load-gql-schema-file'); + if (!schemaContent) { + setIsLoading(false); + return; + } + setSchemaSource('file'); + return schemaContent.data; + }; + + const loadSchema = async (schemaSource) => { + if (isLoading) { + return; + } + + setIsLoading(true); + + try { + let data; + if (schemaSource === 'file') { + data = await loadSchemaFromFile(); + } else { + // fallback to introspection if source is unknown + data = await loadSchemaFromIntrospection(); + } + setSchema(buildClientSchema(data)); + localStorage.setItem(localStorageKey, JSON.stringify(data)); + toast.success('GraphQL Schema loaded successfully'); + } catch (err) { + setError(err); + toast.error(`Error occurred while loading GraphQL Schema: ${err.message}`); + } + + setIsLoading(false); + }; + + return { + isLoading, + schema, + schemaSource, + loadSchema, + error + }; +}; + +export default useGraphqlSchema; diff --git a/packages/bruno-electron/src/ipc/collection.js b/packages/bruno-electron/src/ipc/collection.js index ab92d50bd..be6afbeab 100644 --- a/packages/bruno-electron/src/ipc/collection.js +++ b/packages/bruno-electron/src/ipc/collection.js @@ -1,7 +1,7 @@ const _ = require('lodash'); const fs = require('fs'); const path = require('path'); -const { ipcMain, shell } = require('electron'); +const { ipcMain, shell, dialog } = require('electron'); const { envJsonToBru, bruToJson, jsonToBru, jsonToCollectionBru } = require('../bru'); const { @@ -461,6 +461,22 @@ const registerRendererEventHandlers = (mainWindow, watcher, lastOpenedCollection ipcMain.handle('renderer:open-devtools', async () => { mainWindow.webContents.openDevTools(); }); + + ipcMain.handle('renderer:load-gql-schema-file', async () => { + try { + const { filePaths } = await dialog.showOpenDialog(mainWindow, { + properties: ['openFile'] + }); + if (filePaths.length === 0) { + return; + } + + const jsonData = fs.readFileSync(filePaths[0], 'utf8'); + return JSON.parse(jsonData); + } catch (err) { + return Promise.reject(new Error('Failed to load GraphQL schema file')); + } + }); }; const registerMainEventHandlers = (mainWindow, watcher, lastOpenedCollections) => { From 766d103e206d698c353ed78cec45104d9bba7a81 Mon Sep 17 00:00:00 2001 From: Sebastien Dionne Date: Mon, 23 Oct 2023 21:24:42 -0400 Subject: [PATCH 03/28] Fix some typo in documentation --- contributing.md | 6 +++--- contributing_de.md | 2 +- contributing_ru.md | 2 +- contributing_tr.md | 2 +- contributing_ua.md | 2 +- docs/development.md | 2 +- docs/development_de.md | 2 +- docs/development_ru.md | 2 +- docs/development_ua.md | 2 +- packages/bruno-tauri/src/next-server.js | 2 +- publishing.md | 4 ++-- 11 files changed, 14 insertions(+), 14 deletions(-) diff --git a/contributing.md b/contributing.md index 92e058093..453886191 100644 --- a/contributing.md +++ b/contributing.md @@ -1,12 +1,12 @@ **English** | [Українська](/contributing_ua.md) | [Русский](/contributing_ru.md) | [Türkçe](/contributing_tr.md) | [Deutsch](/contributing_de.md) -## Lets make bruno better, together !! +## Let's make bruno better, together !! I am happy that you are looking to improve bruno. Below are the guidelines to get started bringing up bruno on your computer. ### Technology Stack -Bruno is built using NextJs and React. We also use electron to ship a desktop version (that supports local collections) +Bruno is built using Next.js and React. We also use electron to ship a desktop version (that supports local collections) Libraries we use @@ -23,7 +23,7 @@ Libraries we use You would need [Node v18.x or the latest LTS version](https://nodejs.org/en/) and npm 8.x. We use npm workspaces in the project -### Lets start coding +### Let's start coding Please reference [development.md](docs/development.md) for instructions on running the local development environment. diff --git a/contributing_de.md b/contributing_de.md index e189b6e90..06da28c59 100644 --- a/contributing_de.md +++ b/contributing_de.md @@ -6,7 +6,7 @@ Ich freue mich, dass Du Bruno verbessern möchtest. Hier findest Du eine Anleitu ### Technologie Stack -Bruno ist mit NextJs und React erstellt. Außerdem benötigen wir electron für die Desktop Version (die lokale Sammlungen unterstützt). +Bruno ist mit Next.js und React erstellt. Außerdem benötigen wir electron für die Desktop Version (die lokale Sammlungen unterstützt). Bibliotheken die wir benutzen diff --git a/contributing_ru.md b/contributing_ru.md index fa8e787c1..f7d363308 100644 --- a/contributing_ru.md +++ b/contributing_ru.md @@ -6,7 +6,7 @@ ### Стек -Bruno построен с использованием NextJs и React. Мы также используем electron для поставки десктопной версии ( которая поддерживает локальные коллекции ) +Bruno построен с использованием Next.js и React. Мы также используем electron для поставки десктопной версии ( которая поддерживает локальные коллекции ) Библиотеки, которые мы используем diff --git a/contributing_tr.md b/contributing_tr.md index c73c21f0b..183a533e0 100644 --- a/contributing_tr.md +++ b/contributing_tr.md @@ -6,7 +6,7 @@ Bruno'yu geliştirmek istemenizden mutluluk duyuyorum. Aşağıda, bruno'yu bilg ### Kullanılan Teknolojiler -Bruno, NextJs ve React kullanılarak oluşturulmuştur. Ayrıca bir masaüstü sürümü (yerel koleksiyonları destekleyen) göndermek için electron kullanıyoruz +Bruno, Next.js ve React kullanılarak oluşturulmuştur. Ayrıca bir masaüstü sürümü (yerel koleksiyonları destekleyen) göndermek için electron kullanıyoruz Kullandığımız kütüphaneler diff --git a/contributing_ua.md b/contributing_ua.md index c3ed9f5fa..aa4a892a8 100644 --- a/contributing_ua.md +++ b/contributing_ua.md @@ -6,7 +6,7 @@ ### Стек технологій -Bruno побудований на NextJs та React. Також для десктопної версії (яка підтримує локальні колекції) використовується Electron +Bruno побудований на Next.js та React. Також для десктопної версії (яка підтримує локальні колекції) використовується Electron Бібліотеки, які ми використовуємо diff --git a/docs/development.md b/docs/development.md index 0eaedf0c4..44deb9931 100644 --- a/docs/development.md +++ b/docs/development.md @@ -2,7 +2,7 @@ ## Development -Bruno is being developed as a desktop app. You need to load the app by running the nextjs app in one terminal and then run the electron app in another terminal. +Bruno is being developed as a desktop app. You need to load the app by running the Next.js app in one terminal and then run the electron app in another terminal. ### Dependencies diff --git a/docs/development_de.md b/docs/development_de.md index bb762027b..0dd20f820 100644 --- a/docs/development_de.md +++ b/docs/development_de.md @@ -2,7 +2,7 @@ ## Entwicklung -Bruno wird als Desktop-Anwendung entwickelt. Um die App zu starten, musst Du zuerst die NextJs-App in einem Terminal ausführen und anschließend in einem anderen Terminal die Electron-App. +Bruno wird als Desktop-Anwendung entwickelt. Um die App zu starten, musst Du zuerst die Next.js App in einem Terminal ausführen und anschließend in einem anderen Terminal die Electron-App. ### Abhängigkeiten diff --git a/docs/development_ru.md b/docs/development_ru.md index 9ec11e84e..1e30b7be3 100644 --- a/docs/development_ru.md +++ b/docs/development_ru.md @@ -2,7 +2,7 @@ ## Разработка -Bruno разрабатывается как десктопное приложение. Необходимо загрузить приложение, запустив приложение nextjs в одном терминале, а затем запустить приложение electron в другом терминале. +Bruno разрабатывается как десктопное приложение. Необходимо загрузить приложение, запустив приложение Next.js в одном терминале, а затем запустить приложение electron в другом терминале. ### Зависимости diff --git a/docs/development_ua.md b/docs/development_ua.md index d3cfdc5e8..44debdf03 100644 --- a/docs/development_ua.md +++ b/docs/development_ua.md @@ -2,7 +2,7 @@ ## Розробка -Bruno розробляється як декстопний застосунок. Вам потрібно запустити nextjs в одній сесії терміналу, та запустити застосунок Electron в іншій сесії терміналу. +Bruno розробляється як декстопний застосунок. Вам потрібно запустити Next.js в одній сесії терміналу, та запустити застосунок Electron в іншій сесії терміналу. ### Залежності diff --git a/packages/bruno-tauri/src/next-server.js b/packages/bruno-tauri/src/next-server.js index 317dd91b9..410f3080f 100644 --- a/packages/bruno-tauri/src/next-server.js +++ b/packages/bruno-tauri/src/next-server.js @@ -7,7 +7,7 @@ const devServer = async (dir, port) => { // Build the renderer code and watch the files await next.prepare(); - // NextJS Server + // Next.js Server const server = createServer(requestHandler); server.listen(port || 8000, () => { diff --git a/publishing.md b/publishing.md index f7db8a328..b8ea04b99 100644 --- a/publishing.md +++ b/publishing.md @@ -1,6 +1,6 @@ ### Publishing Bruno to a new package manager -While our code is open source and available for everyone to use, we kindly request that you reach out to us before considering publication on new package managers. As the creator of Bruno, I hold the trademark `Bruno` for this project and would like to manage its distribution. If you'd like to see Bruno on a new package manager, please raise a Github issue. +While our code is open source and available for everyone to use, we kindly request that you reach out to us before considering publication on new package managers. As the creator of Bruno, I hold the trademark `Bruno` for this project and would like to manage its distribution. If you'd like to see Bruno on a new package manager, please raise a GitHub issue. -While, majority of our features are free and open source (which covers REST and GraphQL Apis) +While, the majority of our features are free and open source (which covers REST and GraphQL Apis) We strive to strike a harmonious balance between open-source principles and sustainability - https://github.com/usebruno/bruno/discussions/269 From 3687594cc4e61e3dc433fb3aa1d0e91a8192a05a Mon Sep 17 00:00:00 2001 From: Jonathan Gruber Date: Tue, 24 Oct 2023 13:17:47 +0200 Subject: [PATCH 04/28] feat(#762): Add menu entry for preferences and add shortcut fora it --- packages/bruno-app/src/components/Sidebar/index.js | 8 ++++---- packages/bruno-app/src/providers/App/useIpcEvents.js | 7 ++++++- packages/bruno-app/src/providers/ReduxStore/slices/app.js | 5 +++++ packages/bruno-electron/src/app/menu-template.js | 8 ++++++++ packages/bruno-electron/src/ipc/preferences.js | 4 ++++ 5 files changed, 27 insertions(+), 5 deletions(-) diff --git a/packages/bruno-app/src/components/Sidebar/index.js b/packages/bruno-app/src/components/Sidebar/index.js index 890761971..a6df7141c 100644 --- a/packages/bruno-app/src/components/Sidebar/index.js +++ b/packages/bruno-app/src/components/Sidebar/index.js @@ -7,7 +7,7 @@ import Preferences from 'components/Preferences'; import { useState, useEffect } from 'react'; import { useSelector, useDispatch } from 'react-redux'; import { IconSettings } from '@tabler/icons'; -import { updateLeftSidebarWidth, updateIsDragging } from 'providers/ReduxStore/slices/app'; +import { updateLeftSidebarWidth, updateIsDragging, showPreferences } from 'providers/ReduxStore/slices/app'; import { useTheme } from 'providers/Theme'; const MIN_LEFT_SIDEBAR_WIDTH = 222; @@ -15,7 +15,7 @@ const MAX_LEFT_SIDEBAR_WIDTH = 600; const Sidebar = () => { const leftSidebarWidth = useSelector((state) => state.app.leftSidebarWidth); - const [preferencesOpen, setPreferencesOpen] = useState(false); + const preferencesOpen = useSelector((state) => state.app.showPreferences); const [asideWidth, setAsideWidth] = useState(leftSidebarWidth); @@ -78,7 +78,7 @@ const Sidebar = () => {