diff --git a/packages/bruno-app/src/components/RequestPane/GraphQLSchemaActions/index.js b/packages/bruno-app/src/components/RequestPane/GraphQLSchemaActions/index.js index 2b4f0136f5..1937dc4700 100644 --- a/packages/bruno-app/src/components/RequestPane/GraphQLSchemaActions/index.js +++ b/packages/bruno-app/src/components/RequestPane/GraphQLSchemaActions/index.js @@ -1,10 +1,9 @@ -import React, { useEffect, useRef, forwardRef } from 'react'; +import { useEffect, useMemo } from 'react'; import useGraphqlSchema from './useGraphqlSchema'; import { IconBook, IconDownload, IconLoader2, IconRefresh } from '@tabler/icons-react'; import get from 'lodash/get'; import { findEnvironmentInCollection } from 'utils/collections'; -import Dropdown from '../../Dropdown'; -import { Group } from '@mantine/core'; +import { Button, Group, Menu, rem } from '@mantine/core'; const GraphQLSchemaActions = ({ item, collection, onSchemaLoad, toggleDocs }) => { const url = item.draft ? get(item, 'draft.request.url', '') : get(item, 'request.url', ''); @@ -24,46 +23,40 @@ const GraphQLSchemaActions = ({ item, collection, onSchemaLoad, toggleDocs }) => } }, [schema]); - const schemaDropdownTippyRef = useRef(); - const onSchemaDropdownCreate = (ref) => (schemaDropdownTippyRef.current = ref); - - const MenuIcon = forwardRef((props, ref) => { - return ( -
- {isSchemaLoading && } - {!isSchemaLoading && schema && } - {!isSchemaLoading && !schema && } - Schema -
- ); - }); + const schemaIcon = useMemo(() => { + if (isSchemaLoading) { + return ; + } else if (schema) { + return ; + } + return ; + }, [isSchemaLoading, 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 -
-
+ + + + + + + + + + loadSchema('introspection')}> + {schema ? 'Refresh from Introspection' : 'Load from Introspection'} + + loadSchema('file')}>Load from File + + ); }; diff --git a/packages/bruno-app/src/feature/main-view/components/panes/PaneWrapper.tsx b/packages/bruno-app/src/feature/main-view/components/panes/PaneWrapper.tsx index 4fcc6c88f2..e6ced7865d 100644 --- a/packages/bruno-app/src/feature/main-view/components/panes/PaneWrapper.tsx +++ b/packages/bruno-app/src/feature/main-view/components/panes/PaneWrapper.tsx @@ -13,7 +13,7 @@ type PaneWrapperProps = { export const PaneWrapper: React.FC = ({ aboveTabs, tabs, content, activeTab, onTabChange }) => { return ( - + {aboveTabs} diff --git a/packages/bruno-app/src/feature/main-view/index.ts b/packages/bruno-app/src/feature/main-view/index.ts index e69de29bb2..26562a4b32 100644 --- a/packages/bruno-app/src/feature/main-view/index.ts +++ b/packages/bruno-app/src/feature/main-view/index.ts @@ -0,0 +1 @@ +export * from './components/MainView'; diff --git a/packages/bruno-app/src/pages/index.js b/packages/bruno-app/src/pages/index.js index 4693241c45..4cdda00465 100644 --- a/packages/bruno-app/src/pages/index.js +++ b/packages/bruno-app/src/pages/index.js @@ -2,7 +2,7 @@ import { useSelector } from 'react-redux'; import { Sidebar } from 'src/feature/sidebar'; import classes from './Main.module.scss'; import { Homepage } from 'src/feature/homepage'; -import { MainView } from 'src/feature/main-view/components/MainView'; +import { MainView } from 'src/feature/main-view'; export function Main() { const showHomePage = useSelector((state) => state.app.showHomePage);