From cf6b7bfe478a1cd6730e729fd4de0e63b2b23329 Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Tue, 5 Nov 2024 07:30:39 +0100 Subject: [PATCH] show and hide panel --- apps/remix-ide-e2e/src/helpers/init.ts | 9 +++++++++ libs/remix-api/src/lib/remix-api.ts | 2 -- libs/remix-ui/app/src/lib/remix-app/remix-app.tsx | 15 +++++++++++---- 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/apps/remix-ide-e2e/src/helpers/init.ts b/apps/remix-ide-e2e/src/helpers/init.ts index 67e8f1a8fc..a98c0b6ac6 100644 --- a/apps/remix-ide-e2e/src/helpers/init.ts +++ b/apps/remix-ide-e2e/src/helpers/init.ts @@ -14,6 +14,15 @@ export default function (browser: NightwatchBrowser, callback: VoidFunction, url .url(url || 'http://127.0.0.1:8080') .pause(5000) .switchBrowserTab(0) + // get value from local storage + .execute(function () { + return localStorage.getItem('did_show_popup_panel') + }, [], function (result) { + if (!result.value) { + browser.waitForElementVisible('*[data-id="aiStatusButton"]') + .click('*[data-id="aiStatusButton"]') + } + }) .perform((done) => { if (!loadPlugin) return done() browser diff --git a/libs/remix-api/src/lib/remix-api.ts b/libs/remix-api/src/lib/remix-api.ts index 7df4dc7104..36d7fbf6a0 100644 --- a/libs/remix-api/src/lib/remix-api.ts +++ b/libs/remix-api/src/lib/remix-api.ts @@ -17,10 +17,8 @@ import { IRemixAI } from "./plugins/remixai-api" import { IRemixAID } from "./plugins/remixAIDesktop-api" import { IMenuIconsApi } from "./plugins/menuicons-api" import { IDgitPlugin } from "./plugins/dgitplugin-api" -import { Api } from "@remixproject/plugin-utils"; import { IPopupPanelAPI } from "./plugins/popuppanel-api" - export interface ICustomRemixApi extends IRemixApi { popupPanel: IPopupPanelAPI dgitApi: IGitApi diff --git a/libs/remix-ui/app/src/lib/remix-app/remix-app.tsx b/libs/remix-ui/app/src/lib/remix-app/remix-app.tsx index dd8a672525..5ab14a7811 100644 --- a/libs/remix-ui/app/src/lib/remix-app/remix-app.tsx +++ b/libs/remix-ui/app/src/lib/remix-app/remix-app.tsx @@ -9,10 +9,8 @@ import { AppProvider } from './context/provider' import AppDialogs from './components/modals/dialogs' import DialogViewPlugin from './components/modals/dialogViewPlugin' import { appProviderContextType, onLineContext, platformContext } from './context/context' -import { FormattedMessage, IntlProvider } from 'react-intl' -import { CustomTooltip } from '@remix-ui/helper' +import { IntlProvider } from 'react-intl' import { UsageTypes } from './types' -import { AppState } from './interface' import { appReducer } from './reducer/app' import { appInitialState } from './state/app' @@ -45,7 +43,10 @@ const RemixApp = (props: IRemixAppUi) => { const sidePanelRef = useRef(null) const pinnedPanelRef = useRef(null) - const [appState, appStateDispatch] = useReducer(appReducer, appInitialState) + const [appState, appStateDispatch] = useReducer(appReducer, { + ...appInitialState, + showPopupPanel: !window.localStorage.getItem('did_show_popup_panel') + }) useEffect(() => { async function activateApp() { @@ -77,6 +78,12 @@ const RemixApp = (props: IRemixAppUi) => { } }, []) + useEffect(() => { + if(!appState.showPopupPanel) { + window.localStorage.setItem('did_show_popup_panel', 'true') + } + },[appState.showPopupPanel]) + function setListeners() { props.app.sidePanel.events.on('toggle', () => { setHideSidePanel((prev) => {