From dc6039dc147636377f44f7578eb2eba7feb81867 Mon Sep 17 00:00:00 2001 From: yann300 Date: Wed, 10 Jul 2024 13:55:08 +0200 Subject: [PATCH 01/39] show log in github from FE --- .../src/app/tabs/locales/en/filePanel.json | 2 + .../git/src/components/github/devicecode.tsx | 5 +- libs/remix-ui/git/src/components/gitui.tsx | 48 ++++++------- .../components/panels/githubcredentials.tsx | 5 +- .../git/src/components/panels/setup.tsx | 9 +-- libs/remix-ui/git/src/types/index.ts | 7 ++ .../workspace/src/lib/css/file-explorer.css | 4 ++ .../workspace/src/lib/remix-ui-workspace.tsx | 68 ++++++++++++++++++- .../remix-ui/workspace/src/lib/types/index.ts | 4 +- 9 files changed, 114 insertions(+), 38 deletions(-) diff --git a/apps/remix-ide/src/app/tabs/locales/en/filePanel.json b/apps/remix-ide/src/app/tabs/locales/en/filePanel.json index 6932ae3e04..98f4cd70e5 100644 --- a/apps/remix-ide/src/app/tabs/locales/en/filePanel.json +++ b/apps/remix-ide/src/app/tabs/locales/en/filePanel.json @@ -142,5 +142,7 @@ "filePanel.movingFolderFailedMsg": "Unexpected error while moving folder: {src}", "filePanel.workspaceActions": "Workspace actions", "filePanel.saveCodeSample": "This code-sample workspace will not be persisted. Click here to save it.", + "filePanel.logInGithub": "Log in to GitHub.", + "filePanel.gitHubLoggedAs": "Logged as {githubuser}", "filePanel.updateSubmodules": "Update all submodules of repository. Click to pull dependencies." } diff --git a/libs/remix-ui/git/src/components/github/devicecode.tsx b/libs/remix-ui/git/src/components/github/devicecode.tsx index cd611efe4d..583aeb98c0 100644 --- a/libs/remix-ui/git/src/components/github/devicecode.tsx +++ b/libs/remix-ui/git/src/components/github/devicecode.tsx @@ -4,8 +4,9 @@ import { gitPluginContext } from "../gitui"; import axios from "axios"; import { CopyToClipboard } from "@remix-ui/clipboard"; import { Card } from "react-bootstrap"; +import { IGitUi } from '../../types' -export const GetDeviceCode = () => { +export const GetDeviceCode = (props: IGitUi) => { const context = React.useContext(gitPluginContext) const actions = React.useContext(gitActionsContext) const pluginActions = React.useContext(pluginActionsContext) @@ -59,7 +60,6 @@ export const GetDeviceCode = () => { await pluginActions.saveToken(response.access_token) await actions.loadGitHubUserFromToken() } - } const disconnect = async () => { @@ -67,6 +67,7 @@ export const GetDeviceCode = () => { setGitHubResponse(null) await pluginActions.saveToken(null) await actions.loadGitHubUserFromToken() + props.plugin.emit('disconnectFromGithub') } return ( diff --git a/libs/remix-ui/git/src/components/gitui.tsx b/libs/remix-ui/git/src/components/gitui.tsx index 7bfbc661cf..65058f8533 100644 --- a/libs/remix-ui/git/src/components/gitui.tsx +++ b/libs/remix-ui/git/src/components/gitui.tsx @@ -31,17 +31,11 @@ import { SourceControl } from './panels/sourcontrol' import { GitHubCredentials } from './panels/githubcredentials' import { Setup } from './panels/setup' import { Init } from './panels/init' -import { CustomRemixApi } from "@remix-api"; -import { Plugin } from "@remixproject/engine"; import { Disabled } from './disabled' - +import { IGitUi } from '../types' export const gitPluginContext = React.createContext(defaultGitState) export const loaderContext = React.createContext(defaultLoaderState) -interface IGitUi { - plugin: Plugin -} - export const GitUI = (props: IGitUi) => { const plugin = props.plugin const [gitState, gitDispatch] = useReducer(gitReducer, defaultGitState) @@ -59,6 +53,7 @@ export const GitUI = (props: IGitUi) => { }) setTimeout(() => { setAppLoaded(true) + plugin.on('filePanel', 'requestGitHubSignIn' as any, () => setActivePanel('0')) }, 2000) }, []) @@ -171,21 +166,29 @@ export const GitUI = (props: IGitUi) => { - {setup && !needsInit ? : null} + {setup && !needsInit ? : null} {needsInit ? : null} {!setup && !needsInit ? - - - + + + <> + +
+ + +
+
+ + <>
- - + + <> @@ -198,8 +201,8 @@ export const GitUI = (props: IGitUi) => {
- - + + <> @@ -211,23 +214,14 @@ export const GitUI = (props: IGitUi) => {
- - + + <>
- + - <> - -
- - -
-
- - <> diff --git a/libs/remix-ui/git/src/components/panels/githubcredentials.tsx b/libs/remix-ui/git/src/components/panels/githubcredentials.tsx index 300e6797f0..7c8c6cf127 100644 --- a/libs/remix-ui/git/src/components/panels/githubcredentials.tsx +++ b/libs/remix-ui/git/src/components/panels/githubcredentials.tsx @@ -5,8 +5,9 @@ import { CustomTooltip } from "@remix-ui/helper"; import { useIntl, FormattedMessage } from "react-intl"; import { CopyToClipboard } from "@remix-ui/clipboard"; +import { IGitUi } from '../../types' -export const GitHubCredentials = () => { +export const GitHubCredentials = (props: IGitUi) => { const context = React.useContext(gitPluginContext) const pluginactions = React.useContext(pluginActionsContext) const loader = React.useContext(loaderContext) @@ -52,6 +53,7 @@ export const GitHubCredentials = () => { setGithubToken(credentials.token || '') setGithubUsername(credentials.username || '') setGithubEmail(credentials.email || '') + props.plugin.emit('loggedInGithubChanged') } function removeToken(): void { @@ -63,6 +65,7 @@ export const GitHubCredentials = () => { email: '', token: '' }) + props.plugin.emit('disconnectFromGithub') } return ( diff --git a/libs/remix-ui/git/src/components/panels/setup.tsx b/libs/remix-ui/git/src/components/panels/setup.tsx index 42a68014ae..6c3a08f438 100644 --- a/libs/remix-ui/git/src/components/panels/setup.tsx +++ b/libs/remix-ui/git/src/components/panels/setup.tsx @@ -1,8 +1,9 @@ import React, { useEffect, useState } from 'react' import { GetDeviceCode } from '../github/devicecode' import { GitHubCredentials } from './githubcredentials' +import { IGitUi } from '../../types' -export const Setup = () => { +export const Setup = (props: IGitUi) => { const [screen, setScreen] = useState(0) @@ -15,9 +16,9 @@ export const Setup = () => { To ensure that your commits are properly attributed in Git, you need to configure a username and email address. These will be used to identify the author of the commit. - +
- + ) @@ -28,7 +29,7 @@ export const Setup = () => {
Step 2
To ensure that your commits are properly attributed in Git, you need to configure your username and email address. - +
) diff --git a/libs/remix-ui/git/src/types/index.ts b/libs/remix-ui/git/src/types/index.ts index 9ed9a292ed..03e28a9bb2 100644 --- a/libs/remix-ui/git/src/types/index.ts +++ b/libs/remix-ui/git/src/types/index.ts @@ -2,9 +2,16 @@ import { Endpoints } from "@octokit/types" import { IRemixApi } from "@remixproject/plugin-api" import { LibraryProfile, StatusEvents } from "@remixproject/plugin-utils" import { CommitObject, ReadBlobResult, ReadCommitResult, StatusRow } from "isomorphic-git" +import { CustomRemixApi } from "@remix-api"; +import { Plugin } from "@remixproject/engine"; + export type GitHubUser = Partial export type userEmails = Endpoints["GET /user/emails"]["response"]["data"] +export interface IGitUi { + plugin: Plugin +} + export interface IGitApi { events: { "checkout": () => void diff --git a/libs/remix-ui/workspace/src/lib/css/file-explorer.css b/libs/remix-ui/workspace/src/lib/css/file-explorer.css index 16f0ffca51..aff221c205 100644 --- a/libs/remix-ui/workspace/src/lib/css/file-explorer.css +++ b/libs/remix-ui/workspace/src/lib/css/file-explorer.css @@ -69,3 +69,7 @@ ul { .remixui_icons:hover { color: var(--text); } + +.remixui_avatar_user { + border-radius: 50% !important; +} diff --git a/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx b/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx index 03d807808a..e0df989650 100644 --- a/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx +++ b/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx @@ -17,7 +17,7 @@ import { customAction } from '@remixproject/plugin-api' import { appPlatformTypes, platformContext } from '@remix-ui/app' import { ElectronMenu } from './components/electron-menu' import { ElectronWorkspaceName } from './components/electron-workspace-name' -import { branch } from '@remix-ui/git' +import { branch, GitHubUser, userEmails } from '@remix-ui/git' const _paq = (window._paq = window._paq || []) @@ -72,9 +72,37 @@ export function Workspace() { showContextMenu: false, reservedKeywords: [ROOT_PATH], copyElement: [], - dragStatus: false + dragStatus: false, + loggedInGithub: false, + githubUser: null }) + useEffect(() => { + const run = async () => { + const token = await global.plugin.call('config' as any, 'getAppParameter' as any, 'settings/gist-access-token') + const data: { + user: GitHubUser, + scopes: string[] + emails: userEmails + } = await global.plugin.call('dgitApi' as any, 'getGitHubUser', { token }); + + if (data.user) { + setState((prevState) => { + return { ...prevState, loggedInGithub: true, githubUser: data.user } + }) + } + } + global.plugin.on('dgit', 'disconnectFromGithub', () => { + setState((prevState) => { + return { ...prevState, loggedInGithub: false, githubUser: null } + }) + }) + global.plugin.on('dgit', 'loggedInGithubChanged', () => { + run() + }) + run() + }, []) + useEffect(() => { if (canPaste) { addMenuItems([ @@ -1053,6 +1081,14 @@ export function Workspace() { ) } + + const logInGithub = async () => { + await global.plugin.call('manager', 'activatePlugin', 'dgit') + await global.plugin.call('menuicons', 'select', 'dgit'); + await global.plugin.emit('requestGitHubSignIn'); + _paq.push(['trackEvent', 'Workspace', 'GIT', 'login']) + } + return (
{(platform !== appPlatformTypes.desktop) ? ( diff --git a/libs/remix-ui/workspace/src/lib/types/index.ts b/libs/remix-ui/workspace/src/lib/types/index.ts index aff1b70bd8..34f9df189d 100644 --- a/libs/remix-ui/workspace/src/lib/types/index.ts +++ b/libs/remix-ui/workspace/src/lib/types/index.ts @@ -6,7 +6,7 @@ import { RemixAppManager } from 'libs/remix-ui/plugin-manager/src/types' import { ViewPlugin } from '@remixproject/engine-web' import { appPlatformTypes } from '@remix-ui/app' import { Placement } from 'react-bootstrap/esm/Overlay' -import { branch } from '@remix-ui/git' +import { branch, GitHubUser } from '@remix-ui/git' export type action = { name: string, type?: Array, path?: string[], extension?: string[], pattern?: string[], id: string, multiselect: boolean, label: string, sticky?: boolean, group: number, platform?: appPlatformTypes } export interface JSONStandardInput { @@ -225,6 +225,8 @@ export interface WorkSpaceState { reservedKeywords: string[] copyElement: CopyElementType[] dragStatus: boolean + loggedInGithub: boolean + githubUser: GitHubUser } export type FileFocusContextType = { From 6c35e7904e5d61ca6b69e2fa583621255d15fe2b Mon Sep 17 00:00:00 2001 From: lianahus Date: Thu, 11 Jul 2024 16:33:01 +0200 Subject: [PATCH 02/39] alignment of sign in --- .../workspace/src/lib/remix-ui-workspace.tsx | 82 +++++++++---------- 1 file changed, 41 insertions(+), 41 deletions(-) diff --git a/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx b/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx index e0df989650..4df07c0634 100644 --- a/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx +++ b/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx @@ -1142,53 +1142,53 @@ export function Workspace() { ) : null} - - - {selectedWorkspace && selectedWorkspace.name === 'code-sample' && } - > - saveSampleCodeWorkspace()} className="far fa-exclamation-triangle text-warning ml-2 align-self-center" aria-hidden="true"> - } - - {selectedWorkspace && selectedWorkspace.isGist && selectedWorkspace.isGist} direction="bottom" icon="far fa-copy"> - - - } - - - { - !state.loggedInGithub && + + + {selectedWorkspace && selectedWorkspace.name === 'code-sample' && } + tooltipText={} > - logInGithub() } className="fa-brands fa-github-alt text-success ml-2 align-self-center" style={{ fontSize: '1.1rem' }} aria-hidden="true"> - - } - - { - !state.loggedInGithub && logInGithub() } className="ml-1 text-success"> Sign in - } + saveSampleCodeWorkspace()} className="far fa-exclamation-triangle text-warning ml-2 align-self-center" aria-hidden="true"> + } - { - state.loggedInGithub && - - + {selectedWorkspace && selectedWorkspace.isGist && selectedWorkspace.isGist} direction="bottom" icon="far fa-copy"> + + } + + { + !state.loggedInGithub && } + > +
+ logInGithub() } className="fa-brands fa-github-alt text-success ml-2 align-self-center" style={{ fontSize: '1.1rem' }} aria-hidden="true"> + logInGithub() } className="ml-1 text-success"> Sign in +
+
+ } + { + state.loggedInGithub && + + + } +
+
{(platform !== appPlatformTypes.desktop) ? ( From 8b946df1867da2228f4373a5648a6c43a18524d5 Mon Sep 17 00:00:00 2001 From: lianahus Date: Thu, 11 Jul 2024 16:34:24 +0200 Subject: [PATCH 03/39] tooltip rename --- apps/remix-ide/src/app/tabs/locales/en/filePanel.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/remix-ide/src/app/tabs/locales/en/filePanel.json b/apps/remix-ide/src/app/tabs/locales/en/filePanel.json index 98f4cd70e5..affee6c134 100644 --- a/apps/remix-ide/src/app/tabs/locales/en/filePanel.json +++ b/apps/remix-ide/src/app/tabs/locales/en/filePanel.json @@ -142,7 +142,7 @@ "filePanel.movingFolderFailedMsg": "Unexpected error while moving folder: {src}", "filePanel.workspaceActions": "Workspace actions", "filePanel.saveCodeSample": "This code-sample workspace will not be persisted. Click here to save it.", - "filePanel.logInGithub": "Log in to GitHub.", - "filePanel.gitHubLoggedAs": "Logged as {githubuser}", + "filePanel.logInGithub": "Sign in to GitHub.", + "filePanel.gitHubLoggedAs": "Signed in as {githubuser}", "filePanel.updateSubmodules": "Update all submodules of repository. Click to pull dependencies." } From 3672ec06963ee8cdbc2bfc8f44559bd51e4c9ff8 Mon Sep 17 00:00:00 2001 From: lianahus Date: Thu, 11 Jul 2024 17:06:53 +0200 Subject: [PATCH 04/39] lint --- .../workspace/src/lib/remix-ui-workspace.tsx | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx b/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx index 4df07c0634..723061b395 100644 --- a/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx +++ b/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx @@ -90,16 +90,16 @@ export function Workspace() { setState((prevState) => { return { ...prevState, loggedInGithub: true, githubUser: data.user } }) - } + } } - global.plugin.on('dgit', 'disconnectFromGithub', () => { + global.plugin.on('dgit', 'disconnectFromGithub', () => { setState((prevState) => { return { ...prevState, loggedInGithub: false, githubUser: null } }) }) - global.plugin.on('dgit', 'loggedInGithubChanged', () => { + global.plugin.on('dgit', 'loggedInGithubChanged', () => { run() - }) + }) run() }, []) @@ -1164,8 +1164,8 @@ export function Workspace() { } - { - !state.loggedInGithub && logInGithub() } className="ml-1 text-success"> Sign in
- } - { - state.loggedInGithub && - } - + } +
From 2371ab037c1a9cfa8d6af6602e013d714d8e6c70 Mon Sep 17 00:00:00 2001 From: yann300 Date: Thu, 11 Jul 2024 17:40:11 +0200 Subject: [PATCH 05/39] order of priority --- libs/remix-ui/git/src/components/gitui.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/remix-ui/git/src/components/gitui.tsx b/libs/remix-ui/git/src/components/gitui.tsx index 65058f8533..5e0692d882 100644 --- a/libs/remix-ui/git/src/components/gitui.tsx +++ b/libs/remix-ui/git/src/components/gitui.tsx @@ -166,8 +166,8 @@ export const GitUI = (props: IGitUi) => { - {setup && !needsInit ? : null} - {needsInit ? : null} + {setup ? : null} + {!setup && needsInit ? : null} {!setup && !needsInit ? From 27b4ac3a909d00d3ebc76d716849a56da3b2af83 Mon Sep 17 00:00:00 2001 From: yann300 Date: Fri, 12 Jul 2024 17:13:10 +0200 Subject: [PATCH 06/39] use plugin actions --- .../git/src/components/github/devicecode.tsx | 5 ++--- libs/remix-ui/git/src/components/gitui.tsx | 12 +++++++----- .../git/src/components/panels/githubcredentials.tsx | 7 +++---- libs/remix-ui/git/src/components/panels/setup.tsx | 8 ++++---- libs/remix-ui/git/src/lib/pluginActions.ts | 8 ++++++++ libs/remix-ui/git/src/state/context.tsx | 2 ++ .../workspace/src/lib/remix-ui-workspace.tsx | 2 +- 7 files changed, 27 insertions(+), 17 deletions(-) diff --git a/libs/remix-ui/git/src/components/github/devicecode.tsx b/libs/remix-ui/git/src/components/github/devicecode.tsx index 583aeb98c0..352a5e0760 100644 --- a/libs/remix-ui/git/src/components/github/devicecode.tsx +++ b/libs/remix-ui/git/src/components/github/devicecode.tsx @@ -4,9 +4,8 @@ import { gitPluginContext } from "../gitui"; import axios from "axios"; import { CopyToClipboard } from "@remix-ui/clipboard"; import { Card } from "react-bootstrap"; -import { IGitUi } from '../../types' -export const GetDeviceCode = (props: IGitUi) => { +export const GetDeviceCode = () => { const context = React.useContext(gitPluginContext) const actions = React.useContext(gitActionsContext) const pluginActions = React.useContext(pluginActionsContext) @@ -67,7 +66,7 @@ export const GetDeviceCode = (props: IGitUi) => { setGitHubResponse(null) await pluginActions.saveToken(null) await actions.loadGitHubUserFromToken() - props.plugin.emit('disconnectFromGithub') + pluginActions.disconnectFromGithub() } return ( diff --git a/libs/remix-ui/git/src/components/gitui.tsx b/libs/remix-ui/git/src/components/gitui.tsx index 5e0692d882..ceb4d0afb2 100644 --- a/libs/remix-ui/git/src/components/gitui.tsx +++ b/libs/remix-ui/git/src/components/gitui.tsx @@ -1,7 +1,7 @@ import React, { useEffect, useReducer, useState } from 'react' import { add, addall, checkout, checkoutfile, clone, commit, createBranch, remoteBranches, repositories, rm, getCommitChanges, diff, resolveRef, getBranchCommits, setUpstreamRemote, loadGitHubUserFromToken, getBranches, getRemotes, remoteCommits, saveGitHubCredentials, getGitHubCredentialsFromLocalStorage, fetch, pull, push, setDefaultRemote, addRemote, removeRemote, sendToGitLog, clearGitLog, getBranchDifferences, getFileStatusMatrix, init, showAlert, gitlog } from '../lib/gitactions' import { loadFiles, setCallBacks } from '../lib/listeners' -import { openDiff, openFile, saveToken, setModifiedDecorator, setPlugin, setUntrackedDecorator, statusChanged } from '../lib/pluginActions' +import { openDiff, openFile, saveToken, setModifiedDecorator, setPlugin, setUntrackedDecorator, statusChanged, disconnectFromGithub, logInGitHub } from '../lib/pluginActions' import { gitActionsContext, pluginActionsContext } from '../state/context' import { gitReducer } from '../state/gitreducer' import { defaultGitState, defaultLoaderState, gitState, loaderState } from '../types' @@ -154,7 +154,9 @@ export const GitUI = (props: IGitUi) => { saveToken, saveGitHubCredentials, getGitHubCredentialsFromLocalStorage, - showAlert + showAlert, + disconnectFromGithub, + logInGitHub } return ( @@ -166,16 +168,16 @@ export const GitUI = (props: IGitUi) => { - {setup ? : null} + {setup ? : null} {!setup && needsInit ? : null} {!setup && !needsInit ? <> - +
- +

diff --git a/libs/remix-ui/git/src/components/panels/githubcredentials.tsx b/libs/remix-ui/git/src/components/panels/githubcredentials.tsx index 7c8c6cf127..59b6974f93 100644 --- a/libs/remix-ui/git/src/components/panels/githubcredentials.tsx +++ b/libs/remix-ui/git/src/components/panels/githubcredentials.tsx @@ -5,9 +5,8 @@ import { CustomTooltip } from "@remix-ui/helper"; import { useIntl, FormattedMessage } from "react-intl"; import { CopyToClipboard } from "@remix-ui/clipboard"; -import { IGitUi } from '../../types' -export const GitHubCredentials = (props: IGitUi) => { +export const GitHubCredentials = () => { const context = React.useContext(gitPluginContext) const pluginactions = React.useContext(pluginActionsContext) const loader = React.useContext(loaderContext) @@ -53,7 +52,7 @@ export const GitHubCredentials = (props: IGitUi) => { setGithubToken(credentials.token || '') setGithubUsername(credentials.username || '') setGithubEmail(credentials.email || '') - props.plugin.emit('loggedInGithubChanged') + pluginactions.logInGitHub() } function removeToken(): void { @@ -65,7 +64,7 @@ export const GitHubCredentials = (props: IGitUi) => { email: '', token: '' }) - props.plugin.emit('disconnectFromGithub') + pluginactions.disconnectFromGithub() } return ( diff --git a/libs/remix-ui/git/src/components/panels/setup.tsx b/libs/remix-ui/git/src/components/panels/setup.tsx index 6c3a08f438..e3ac0e1f12 100644 --- a/libs/remix-ui/git/src/components/panels/setup.tsx +++ b/libs/remix-ui/git/src/components/panels/setup.tsx @@ -3,7 +3,7 @@ import { GetDeviceCode } from '../github/devicecode' import { GitHubCredentials } from './githubcredentials' import { IGitUi } from '../../types' -export const Setup = (props: IGitUi) => { +export const Setup = () => { const [screen, setScreen] = useState(0) @@ -16,9 +16,9 @@ export const Setup = (props: IGitUi) => { To ensure that your commits are properly attributed in Git, you need to configure a username and email address. These will be used to identify the author of the commit.
- +
- + ) @@ -29,7 +29,7 @@ export const Setup = (props: IGitUi) => {
Step 2
To ensure that your commits are properly attributed in Git, you need to configure your username and email address. - +
) diff --git a/libs/remix-ui/git/src/lib/pluginActions.ts b/libs/remix-ui/git/src/lib/pluginActions.ts index ece2b3953a..075043aba5 100644 --- a/libs/remix-ui/git/src/lib/pluginActions.ts +++ b/libs/remix-ui/git/src/lib/pluginActions.ts @@ -14,6 +14,14 @@ export const setPlugin = (p: Plugin, gitDispatcher: React.D loaderDispatch = loaderDispatcher } +export const disconnectFromGithub = () => { + plugin.emit('disconnectFromGithub') +} + +export const logInGitHub = () => { + plugin.emit('loggedInGithubChanged') +} + export const statusChanged = (badges: number) => { if (!plugin) return plugin.emit('statusChanged', { diff --git a/libs/remix-ui/git/src/state/context.tsx b/libs/remix-ui/git/src/state/context.tsx index 4608406a7f..47d42f3439 100644 --- a/libs/remix-ui/git/src/state/context.tsx +++ b/libs/remix-ui/git/src/state/context.tsx @@ -54,6 +54,8 @@ export interface pluginActions { token: string }> showAlert({ title, message }:{title: string, message: string}): Promise + logInGitHub(): void + disconnectFromGithub(): void } export const pluginActionsContext = React.createContext(null) \ No newline at end of file diff --git a/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx b/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx index 723061b395..7c5319ce7a 100644 --- a/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx +++ b/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx @@ -92,7 +92,7 @@ export function Workspace() { }) } } - global.plugin.on('dgit', 'disconnectFromGithub', () => { + global.plugin.on('dgit', 'disconnectFromGithubRequest', () => { setState((prevState) => { return { ...prevState, loggedInGithub: false, githubUser: null } }) From 97157e64f328b60f89429711d74a9feb40ff62ab Mon Sep 17 00:00:00 2001 From: yann300 Date: Wed, 21 Aug 2024 13:38:03 +0200 Subject: [PATCH 07/39] linting --- libs/remix-ui/git/src/components/gitui.tsx | 2 +- libs/remix-ui/git/src/types/index.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/remix-ui/git/src/components/gitui.tsx b/libs/remix-ui/git/src/components/gitui.tsx index abe0f3286c..11462b01ec 100644 --- a/libs/remix-ui/git/src/components/gitui.tsx +++ b/libs/remix-ui/git/src/components/gitui.tsx @@ -186,7 +186,7 @@ export const GitUI = (props: IGitUi) => {
-
+
diff --git a/libs/remix-ui/git/src/types/index.ts b/libs/remix-ui/git/src/types/index.ts index 3095615cb6..4f304850e4 100644 --- a/libs/remix-ui/git/src/types/index.ts +++ b/libs/remix-ui/git/src/types/index.ts @@ -388,7 +388,7 @@ export enum gitUIPanels { BRANCHES = '3', COMMITS = '4', CLONE = '5', - REMOTES = '6', + REMOTES = '6', LOG = '7' } From 1ed9a0be72be483e0b546116ef393a8a3c1c602c Mon Sep 17 00:00:00 2001 From: yann300 Date: Wed, 21 Aug 2024 13:50:51 +0200 Subject: [PATCH 08/39] fix tests --- apps/remix-ide-e2e/src/tests/dgit_github.test.ts | 5 +++-- apps/remix-ide-e2e/src/tests/dgit_local.test.ts | 5 +++-- apps/remix-ide-e2e/src/tests/workspace_git.test.ts | 5 +++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/apps/remix-ide-e2e/src/tests/dgit_github.test.ts b/apps/remix-ide-e2e/src/tests/dgit_github.test.ts index da38485359..445bae9231 100644 --- a/apps/remix-ide-e2e/src/tests/dgit_github.test.ts +++ b/apps/remix-ide-e2e/src/tests/dgit_github.test.ts @@ -16,8 +16,9 @@ module.exports = { 'Update settings for git #group1 #group2': function (browser: NightwatchBrowser) { browser. clickLaunchIcon('dgit') - .waitForElementVisible('*[data-id="initgit-btn"]') - .click('*[data-id="initgit-btn"]') + // .waitForElementVisible('*[data-id="initgit-btn"]') + // .click('*[data-id="initgit-btn"]') + .waitForElementVisible('*[data-id="githubToken"]') .setValue('*[data-id="githubToken"]', process.env.dgit_token) .setValue('*[data-id="gitubUsername"]', 'git') .setValue('*[data-id="githubEmail"]', 'git@example.com') diff --git a/apps/remix-ide-e2e/src/tests/dgit_local.test.ts b/apps/remix-ide-e2e/src/tests/dgit_local.test.ts index fc0ec93f98..9e79bf3920 100644 --- a/apps/remix-ide-e2e/src/tests/dgit_local.test.ts +++ b/apps/remix-ide-e2e/src/tests/dgit_local.test.ts @@ -34,8 +34,9 @@ module.exports = { 'Update settings for git #group1 #group2 #group3 #group4': function (browser: NightwatchBrowser) { browser. clickLaunchIcon('dgit') - .waitForElementVisible('*[data-id="initgit-btn"]') - .click('*[data-id="initgit-btn"]') + // .waitForElementVisible('*[data-id="initgit-btn"]') + // .click('*[data-id="initgit-btn"]') + .waitForElementVisible('*[data-id="gitubUsername"]') .setValue('*[data-id="gitubUsername"]', 'git') .setValue('*[data-id="githubEmail"]', 'git@example.com') .click('*[data-id="saveGitHubCredentials"]') diff --git a/apps/remix-ide-e2e/src/tests/workspace_git.test.ts b/apps/remix-ide-e2e/src/tests/workspace_git.test.ts index 0661eb31ee..c25da43ef7 100644 --- a/apps/remix-ide-e2e/src/tests/workspace_git.test.ts +++ b/apps/remix-ide-e2e/src/tests/workspace_git.test.ts @@ -421,8 +421,9 @@ module.exports = { 'Update settings for git #group5': function (browser: NightwatchBrowser) { browser. clickLaunchIcon('dgit') - .waitForElementVisible('*[data-id="initgit-btn"]') - .click('*[data-id="initgit-btn"]') + // .waitForElementVisible('*[data-id="initgit-btn"]') + // .click('*[data-id="initgit-btn"]') + .waitForElementVisible('*[data-id="gitubUsername"]') .setValue('*[data-id="gitubUsername"]', 'git') .setValue('*[data-id="githubEmail"]', 'git@example.com') .click('*[data-id="saveGitHubCredentials"]') From 7508a1d9765fc1fd0a4605f3643e992e96ec48d3 Mon Sep 17 00:00:00 2001 From: yann300 Date: Wed, 21 Aug 2024 14:05:09 +0200 Subject: [PATCH 09/39] fix test --- apps/remix-ide-e2e/src/tests/dgit_github.test.ts | 5 ++--- apps/remix-ide-e2e/src/tests/dgit_local.test.ts | 5 ++--- apps/remix-ide-e2e/src/tests/workspace_git.test.ts | 5 ++--- libs/remix-ui/git/src/components/gitui.tsx | 4 ++-- 4 files changed, 8 insertions(+), 11 deletions(-) diff --git a/apps/remix-ide-e2e/src/tests/dgit_github.test.ts b/apps/remix-ide-e2e/src/tests/dgit_github.test.ts index 445bae9231..da38485359 100644 --- a/apps/remix-ide-e2e/src/tests/dgit_github.test.ts +++ b/apps/remix-ide-e2e/src/tests/dgit_github.test.ts @@ -16,9 +16,8 @@ module.exports = { 'Update settings for git #group1 #group2': function (browser: NightwatchBrowser) { browser. clickLaunchIcon('dgit') - // .waitForElementVisible('*[data-id="initgit-btn"]') - // .click('*[data-id="initgit-btn"]') - .waitForElementVisible('*[data-id="githubToken"]') + .waitForElementVisible('*[data-id="initgit-btn"]') + .click('*[data-id="initgit-btn"]') .setValue('*[data-id="githubToken"]', process.env.dgit_token) .setValue('*[data-id="gitubUsername"]', 'git') .setValue('*[data-id="githubEmail"]', 'git@example.com') diff --git a/apps/remix-ide-e2e/src/tests/dgit_local.test.ts b/apps/remix-ide-e2e/src/tests/dgit_local.test.ts index 9e79bf3920..fc0ec93f98 100644 --- a/apps/remix-ide-e2e/src/tests/dgit_local.test.ts +++ b/apps/remix-ide-e2e/src/tests/dgit_local.test.ts @@ -34,9 +34,8 @@ module.exports = { 'Update settings for git #group1 #group2 #group3 #group4': function (browser: NightwatchBrowser) { browser. clickLaunchIcon('dgit') - // .waitForElementVisible('*[data-id="initgit-btn"]') - // .click('*[data-id="initgit-btn"]') - .waitForElementVisible('*[data-id="gitubUsername"]') + .waitForElementVisible('*[data-id="initgit-btn"]') + .click('*[data-id="initgit-btn"]') .setValue('*[data-id="gitubUsername"]', 'git') .setValue('*[data-id="githubEmail"]', 'git@example.com') .click('*[data-id="saveGitHubCredentials"]') diff --git a/apps/remix-ide-e2e/src/tests/workspace_git.test.ts b/apps/remix-ide-e2e/src/tests/workspace_git.test.ts index c25da43ef7..0661eb31ee 100644 --- a/apps/remix-ide-e2e/src/tests/workspace_git.test.ts +++ b/apps/remix-ide-e2e/src/tests/workspace_git.test.ts @@ -421,9 +421,8 @@ module.exports = { 'Update settings for git #group5': function (browser: NightwatchBrowser) { browser. clickLaunchIcon('dgit') - // .waitForElementVisible('*[data-id="initgit-btn"]') - // .click('*[data-id="initgit-btn"]') - .waitForElementVisible('*[data-id="gitubUsername"]') + .waitForElementVisible('*[data-id="initgit-btn"]') + .click('*[data-id="initgit-btn"]') .setValue('*[data-id="gitubUsername"]', 'git') .setValue('*[data-id="githubEmail"]', 'git@example.com') .click('*[data-id="saveGitHubCredentials"]') diff --git a/libs/remix-ui/git/src/components/gitui.tsx b/libs/remix-ui/git/src/components/gitui.tsx index 11462b01ec..6ee3808f71 100644 --- a/libs/remix-ui/git/src/components/gitui.tsx +++ b/libs/remix-ui/git/src/components/gitui.tsx @@ -174,8 +174,8 @@ export const GitUI = (props: IGitUi) => { - {setup ? : null} - {!setup && needsInit ? : null} + {setup && !needsInit ? : null} + {needsInit ? : null} {!setup && !needsInit ? From d1613318c39baacfcfb7569e642d02d9ec206a01 Mon Sep 17 00:00:00 2001 From: yann300 Date: Wed, 21 Aug 2024 14:36:28 +0200 Subject: [PATCH 10/39] fix tests --- libs/remix-ui/git/src/components/gitui.tsx | 20 ++++++++++---------- libs/remix-ui/git/src/types/index.ts | 16 ++++++++-------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/libs/remix-ui/git/src/components/gitui.tsx b/libs/remix-ui/git/src/components/gitui.tsx index 6ee3808f71..381327e32d 100644 --- a/libs/remix-ui/git/src/components/gitui.tsx +++ b/libs/remix-ui/git/src/components/gitui.tsx @@ -52,7 +52,7 @@ export const GitUI = (props: IGitUi) => { }) setTimeout(() => { setAppLoaded(true) - plugin.on('filePanel', 'requestGitHubSignIn' as any, () => setActivePanel('0')) + plugin.on('filePanel', 'requestGitHubSignIn' as any, () => setActivePanel('7')) }, 2000) }, []) @@ -178,15 +178,6 @@ export const GitUI = (props: IGitUi) => { {needsInit ? : null} {!setup && !needsInit ? - - -
- -
- -
-
-
@@ -229,6 +220,15 @@ export const GitUI = (props: IGitUi) => {

+ + +
+ +
+ +
+
+
diff --git a/libs/remix-ui/git/src/types/index.ts b/libs/remix-ui/git/src/types/index.ts index 4f304850e4..3f70103838 100644 --- a/libs/remix-ui/git/src/types/index.ts +++ b/libs/remix-ui/git/src/types/index.ts @@ -382,14 +382,14 @@ export enum gitMatomoEventTypes { } export enum gitUIPanels { - GITHUB = '0', - SOURCECONTROL = '1', - COMMANDS = '2', - BRANCHES = '3', - COMMITS = '4', - CLONE = '5', - REMOTES = '6', - LOG = '7' + SOURCECONTROL = '0', + COMMANDS = '1', + BRANCHES = '2', + COMMITS = '3', + CLONE = '4', + REMOTES = '5', + GITHUB = '7', + LOG = '6' } export interface fileStatusAction { From 19a7a78f995ca238a7014242fa69c31152e0b663 Mon Sep 17 00:00:00 2001 From: yann300 Date: Wed, 21 Aug 2024 16:36:25 +0200 Subject: [PATCH 11/39] update init form --- libs/remix-ui/git/src/components/gitui.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/remix-ui/git/src/components/gitui.tsx b/libs/remix-ui/git/src/components/gitui.tsx index 381327e32d..cd2439fa7b 100644 --- a/libs/remix-ui/git/src/components/gitui.tsx +++ b/libs/remix-ui/git/src/components/gitui.tsx @@ -174,8 +174,8 @@ export const GitUI = (props: IGitUi) => { - {setup && !needsInit ? : null} - {needsInit ? : null} + {setup ? : null} + {setup && needsInit ? : null} {!setup && !needsInit ? From 55c15edb52b61df66158589d21a296b920db82dd Mon Sep 17 00:00:00 2001 From: yann300 Date: Thu, 22 Aug 2024 09:10:05 +0200 Subject: [PATCH 12/39] fix test --- libs/remix-ui/git/src/components/gitui.tsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libs/remix-ui/git/src/components/gitui.tsx b/libs/remix-ui/git/src/components/gitui.tsx index cd2439fa7b..eb992e60c4 100644 --- a/libs/remix-ui/git/src/components/gitui.tsx +++ b/libs/remix-ui/git/src/components/gitui.tsx @@ -173,9 +173,8 @@ export const GitUI = (props: IGitUi) => { - {setup ? : null} - {setup && needsInit ? : null} + {needsInit ? : null} {!setup && !needsInit ? From 8c218e28c381deff61d38d03c4b8dd0c2e0fbfd7 Mon Sep 17 00:00:00 2001 From: yann300 Date: Thu, 22 Aug 2024 13:09:13 +0200 Subject: [PATCH 13/39] show disconnect if connect fails --- libs/remix-ui/git/src/components/github/devicecode.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/libs/remix-ui/git/src/components/github/devicecode.tsx b/libs/remix-ui/git/src/components/github/devicecode.tsx index 5b521c1118..20281da15e 100644 --- a/libs/remix-ui/git/src/components/github/devicecode.tsx +++ b/libs/remix-ui/git/src/components/github/devicecode.tsx @@ -64,6 +64,7 @@ export const GetDeviceCode = () => { await actions.loadGitHubUserFromToken() } else { await sendToMatomo(gitMatomoEventTypes.CONNECTTOGITHUBFAIL) + pluginActions.disconnectFromGithub() } } From 00dc873319f764c04d3a61e73edd82467c90a88c Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Thu, 22 Aug 2024 16:32:00 +0200 Subject: [PATCH 14/39] fix init --- libs/remix-ui/git/src/components/gitui.tsx | 2 ++ libs/remix-ui/git/src/components/panels/init.tsx | 3 --- libs/remix-ui/git/src/components/panels/setup.tsx | 2 -- 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/libs/remix-ui/git/src/components/gitui.tsx b/libs/remix-ui/git/src/components/gitui.tsx index eb992e60c4..b177d069b7 100644 --- a/libs/remix-ui/git/src/components/gitui.tsx +++ b/libs/remix-ui/git/src/components/gitui.tsx @@ -175,6 +175,8 @@ export const GitUI = (props: IGitUi) => { {setup ? : null} {needsInit ? : null} + {setup || needsInit ? <>
CLONE
+ : null} {!setup && !needsInit ? diff --git a/libs/remix-ui/git/src/components/panels/init.tsx b/libs/remix-ui/git/src/components/panels/init.tsx index 37969cfb0b..37996deddd 100644 --- a/libs/remix-ui/git/src/components/panels/init.tsx +++ b/libs/remix-ui/git/src/components/panels/init.tsx @@ -27,9 +27,6 @@ export const Init = () => { >
-
-
CLONE
- ) } \ No newline at end of file diff --git a/libs/remix-ui/git/src/components/panels/setup.tsx b/libs/remix-ui/git/src/components/panels/setup.tsx index 71b35f1499..981b0926c4 100644 --- a/libs/remix-ui/git/src/components/panels/setup.tsx +++ b/libs/remix-ui/git/src/components/panels/setup.tsx @@ -20,8 +20,6 @@ export const Setup = () => {
-
CLONE
- ) } else if (screen === 1) { From 5524b5e4122e28545f4b59c343969ff80885df40 Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Sat, 24 Aug 2024 11:16:01 +0200 Subject: [PATCH 15/39] refactor --- .../app/src/lib/remix-app/actions/app.ts | 25 +++++++++++ .../app/src/lib/remix-app/context/context.tsx | 5 ++- .../app/src/lib/remix-app/interface/index.ts | 5 +++ .../app/src/lib/remix-app/reducer/app.ts | 13 ++++++ .../app/src/lib/remix-app/remix-app.tsx | 11 ++++- .../app/src/lib/remix-app/state/app.ts | 6 +++ libs/remix-ui/git/src/components/gitui.tsx | 10 ++--- libs/remix-ui/git/src/lib/gitactions.ts | 11 ++++- libs/remix-ui/git/src/lib/listeners.ts | 5 ++- .../workspace/src/lib/remix-ui-workspace.tsx | 43 +++++-------------- .../remix-ui/workspace/src/lib/types/index.ts | 2 - 11 files changed, 88 insertions(+), 48 deletions(-) create mode 100644 libs/remix-ui/app/src/lib/remix-app/actions/app.ts create mode 100644 libs/remix-ui/app/src/lib/remix-app/reducer/app.ts create mode 100644 libs/remix-ui/app/src/lib/remix-app/state/app.ts diff --git a/libs/remix-ui/app/src/lib/remix-app/actions/app.ts b/libs/remix-ui/app/src/lib/remix-app/actions/app.ts new file mode 100644 index 0000000000..20932eef6c --- /dev/null +++ b/libs/remix-ui/app/src/lib/remix-app/actions/app.ts @@ -0,0 +1,25 @@ +import { GitHubUser } from '@remix-ui/git'; +import { AppModal } from '../interface' + +type ActionMap = { + [Key in keyof M]: M[Key] extends undefined + ? { + type: Key; + } + : { + type: Key; + payload: M[Key]; + } +} + +export const enum appActionTypes { + setGitHubUser = 'SET_GITHUB_USER', +} + +type AppPayload = { + [appActionTypes.setGitHubUser]: GitHubUser +} + +export type AppAction = ActionMap[keyof ActionMap< + AppPayload +>] diff --git a/libs/remix-ui/app/src/lib/remix-app/context/context.tsx b/libs/remix-ui/app/src/lib/remix-app/context/context.tsx index 9fcf53d4a7..8f3fd119ed 100644 --- a/libs/remix-ui/app/src/lib/remix-app/context/context.tsx +++ b/libs/remix-ui/app/src/lib/remix-app/context/context.tsx @@ -1,6 +1,7 @@ import React from 'react' -import { AlertModal, AppModal } from '../interface' +import { AlertModal, AppModal, AppState } from '../interface' import { ModalInitialState } from '../state/modals' +import { AppAction } from '../actions/app' export type appProviderContextType = { settings: any, @@ -8,6 +9,8 @@ export type appProviderContextType = { showEnter: boolean, appManager: any modal: any + appState: AppState + appStateDispatch: React.Dispatch } export enum appPlatformTypes { diff --git a/libs/remix-ui/app/src/lib/remix-app/interface/index.ts b/libs/remix-ui/app/src/lib/remix-app/interface/index.ts index 5dacecdf4d..dc6e453edc 100644 --- a/libs/remix-ui/app/src/lib/remix-app/interface/index.ts +++ b/libs/remix-ui/app/src/lib/remix-app/interface/index.ts @@ -1,3 +1,4 @@ +import { GitHubUser } from '@remix-ui/git' import { ModalTypes } from '../types' export type ValidationResult = { @@ -45,3 +46,7 @@ export interface forceChoiceModal { message: string | JSX.Element, } +export interface AppState { + gitHubUser: GitHubUser +} + diff --git a/libs/remix-ui/app/src/lib/remix-app/reducer/app.ts b/libs/remix-ui/app/src/lib/remix-app/reducer/app.ts new file mode 100644 index 0000000000..4bd804885f --- /dev/null +++ b/libs/remix-ui/app/src/lib/remix-app/reducer/app.ts @@ -0,0 +1,13 @@ +import { AppAction, appActionTypes } from "../actions/app"; +import { AppState } from "../interface"; + +export const appReducer = (state: AppState, action: AppAction): AppState => { + switch (action.type) { + case appActionTypes.setGitHubUser:{ + return { + ...state, + gitHubUser: action.payload + } + } + } +} \ No newline at end of file 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 24c42a4318..07e57d5051 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 @@ -1,4 +1,4 @@ -import React, { useEffect, useRef, useState } from 'react' +import React, { useEffect, useReducer, useRef, useState } from 'react' import './style/remix-app.css' import { RemixUIMainPanel } from '@remix-ui/panel' import MatomoDialog from './components/modals/matomo' @@ -12,6 +12,9 @@ import { appProviderContextType, onLineContext, platformContext } from './contex import { FormattedMessage, IntlProvider } from 'react-intl' import { CustomTooltip } from '@remix-ui/helper' import { UsageTypes } from './types' +import { AppState } from './interface' +import { appReducer } from './reducer/app' +import { appInitialState } from './state/app' declare global { interface Window { @@ -40,6 +43,8 @@ const RemixApp = (props: IRemixAppUi) => { const sidePanelRef = useRef(null) const pinnedPanelRef = useRef(null) + const [appState, appStateDispatch] = useReducer(appReducer, appInitialState) + useEffect(() => { async function activateApp() { props.app.themeModule.initTheme(() => { @@ -133,7 +138,9 @@ const RemixApp = (props: IRemixAppUi) => { showMatamo: props.app.showMatamo, appManager: props.app.appManager, showEnter: props.app.showEnter, - modal: props.app.notification + modal: props.app.notification, + appState: appState, + appStateDispatch: appStateDispatch } const handleUserChosenType = async (type) => { diff --git a/libs/remix-ui/app/src/lib/remix-app/state/app.ts b/libs/remix-ui/app/src/lib/remix-app/state/app.ts new file mode 100644 index 0000000000..60e763a76c --- /dev/null +++ b/libs/remix-ui/app/src/lib/remix-app/state/app.ts @@ -0,0 +1,6 @@ +import { GitHubUser } from "@remix-ui/git"; +import { AppState } from "../interface"; + +export const appInitialState: AppState = { + gitHubUser: {} as GitHubUser, +} \ No newline at end of file diff --git a/libs/remix-ui/git/src/components/gitui.tsx b/libs/remix-ui/git/src/components/gitui.tsx index b177d069b7..a9173e6504 100644 --- a/libs/remix-ui/git/src/components/gitui.tsx +++ b/libs/remix-ui/git/src/components/gitui.tsx @@ -1,4 +1,4 @@ -import React, { useEffect, useReducer, useState } from 'react' +import React, { useContext, useEffect, useReducer, useState } from 'react' import { add, addall, checkout, checkoutfile, clone, commit, createBranch, remoteBranches, repositories, rm, getCommitChanges, diff, resolveRef, getBranchCommits, setUpstreamRemote, loadGitHubUserFromToken, getBranches, getRemotes, remoteCommits, saveGitHubCredentials, getGitHubCredentialsFromLocalStorage, fetch, pull, push, setDefaultRemote, addRemote, removeRemote, sendToGitLog, clearGitLog, getBranchDifferences, getFileStatusMatrix, init, showAlert, gitlog } from '../lib/gitactions' import { loadFiles, setCallBacks } from '../lib/listeners' import { openDiff, openFile, saveToken, sendToMatomo, setModifiedDecorator, setPlugin, setUntrackedDecorator, statusChanged, disconnectFromGithub, logInGitHub } from '../lib/pluginActions' @@ -32,6 +32,7 @@ import { Setup } from './panels/setup' import { Init } from './panels/init' import { Disabled } from './disabled' import { IGitUi } from '../types' +import { AppContext } from '@remix-ui/app' export const gitPluginContext = React.createContext(defaultGitState) export const loaderContext = React.createContext(defaultLoaderState) @@ -43,6 +44,7 @@ export const GitUI = (props: IGitUi) => { const [setup, setSetup] = useState(false) const [needsInit, setNeedsInit] = useState(true) const [appLoaded, setAppLoaded] = useState(false) + const appContext = useContext(AppContext) useEffect(() => { plugin.emit('statusChanged', { @@ -50,15 +52,11 @@ export const GitUI = (props: IGitUi) => { type: 'info', title: 'Loading Git Plugin' }) - setTimeout(() => { - setAppLoaded(true) - plugin.on('filePanel', 'requestGitHubSignIn' as any, () => setActivePanel('7')) - }, 2000) }, []) useEffect(() => { if (!appLoaded) return - setCallBacks(plugin, gitDispatch, loaderDispatch, setActivePanel) + setCallBacks(plugin, gitDispatch, appContext.appStateDispatch, loaderDispatch, setActivePanel) setPlugin(plugin, gitDispatch, loaderDispatch) loaderDispatch({ type: 'plugin', payload: true }) diff --git a/libs/remix-ui/git/src/lib/gitactions.ts b/libs/remix-ui/git/src/lib/gitactions.ts index 1805289dfc..a4a6317adc 100644 --- a/libs/remix-ui/git/src/lib/gitactions.ts +++ b/libs/remix-ui/git/src/lib/gitactions.ts @@ -8,6 +8,8 @@ import { ModalTypes } from "@remix-ui/app"; import { sendToMatomo, setFileDecorators } from "./pluginActions"; import { Plugin } from "@remixproject/engine"; import { CustomRemixApi } from "@remix-api"; +import { AppAction, appActionTypes } from "libs/remix-ui/app/src/lib/remix-app/actions/app"; +import { app } from "electron"; export const fileStatuses = [ ["new,untracked", 0, 2, 0], // new, untracked @@ -31,11 +33,12 @@ const statusmatrix: statusMatrixType[] = fileStatuses.map((x: any) => { }; }); -let plugin: Plugin, dispatch: React.Dispatch +let plugin: Plugin, dispatch: React.Dispatch, appDispatcher: React.Dispatch -export const setPlugin = (p: Plugin, dispatcher: React.Dispatch) => { +export const setPlugin = (p: Plugin, dispatcher: React.Dispatch, appDispatch: React.Dispatch) => { plugin = p dispatch = dispatcher + appDispatcher = appDispatch } export const init = async () => { @@ -572,6 +575,7 @@ export const saveGitHubCredentials = async (credentials: { username: string, ema dispatch(setGitHubUser({ login: credentials.username, })) + appDispatcher({ type: appActionTypes.setGitHubUser, payload: { login: credentials.username } }) dispatch(setUserEmails([{ email: credentials.email, primary: true, @@ -631,6 +635,7 @@ export const loadGitHubUserFromToken = async () => { if (data.user && data.user.login && (storedUsername !== data.user.login)) await plugin.call('config', 'setAppParameter', 'settings/github-user-name', data.user.login) dispatch(setGitHubUser(data.user)) + appDispatcher({ type: appActionTypes.setGitHubUser, payload: data.user }) dispatch(setScopes(data.scopes)) dispatch(setUserEmails(data.emails)) sendToGitLog({ @@ -646,6 +651,7 @@ export const loadGitHubUserFromToken = async () => { message: `Please check your GitHub token in the GitHub settings.` }) dispatch(setGitHubUser(null)) + appDispatcher({ type: appActionTypes.setGitHubUser, payload: null }) return false } } else { @@ -654,6 +660,7 @@ export const loadGitHubUserFromToken = async () => { message: `Please check your GitHub token in the GitHub settings.` }) dispatch(setGitHubUser(null)) + appDispatcher({ type: appActionTypes.setGitHubUser, payload: null }) return false } } catch (e) { diff --git a/libs/remix-ui/git/src/lib/listeners.ts b/libs/remix-ui/git/src/lib/listeners.ts index a873b303f7..c18274c9d7 100644 --- a/libs/remix-ui/git/src/lib/listeners.ts +++ b/libs/remix-ui/git/src/lib/listeners.ts @@ -7,6 +7,7 @@ import { getBranches, getFileStatusMatrix, loadGitHubUserFromToken, getRemotes, import { Profile } from "@remixproject/plugin-utils"; import { CustomRemixApi } from "@remix-api"; import { statusChanged } from "./pluginActions"; +import { AppAction } from "libs/remix-ui/app/src/lib/remix-app/actions/app"; let plugin: Plugin, gitDispatch: React.Dispatch, loaderDispatch: React.Dispatch, loadFileQueue: AsyncDebouncedQueue let callBackEnabled: boolean = false @@ -34,13 +35,13 @@ class AsyncDebouncedQueue { } } -export const setCallBacks = (viewPlugin: Plugin, gitDispatcher: React.Dispatch, loaderDispatcher: React.Dispatch, setAtivePanel: React.Dispatch>) => { +export const setCallBacks = (viewPlugin: Plugin, gitDispatcher: React.Dispatch, appDispatcher: React.Dispatch, loaderDispatcher: React.Dispatch, setAtivePanel: React.Dispatch>) => { plugin = viewPlugin gitDispatch = gitDispatcher loaderDispatch = loaderDispatcher loadFileQueue = new AsyncDebouncedQueue() - setPlugin(viewPlugin, gitDispatcher) + setPlugin(viewPlugin, gitDispatcher, appDispatcher) plugin.on("fileManager", "fileSaved", async (file: string) => { loadFileQueue.enqueue(async () => { diff --git a/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx b/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx index e2829f5e25..ad10b7a0b8 100644 --- a/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx +++ b/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx @@ -14,10 +14,10 @@ import { MenuItems, WorkSpaceState, WorkspaceMetadata } from './types' import { contextMenuActions } from './utils' import FileExplorerContextMenu from './components/file-explorer-context-menu' import { customAction } from '@remixproject/plugin-api' -import { appPlatformTypes, platformContext } from '@remix-ui/app' +import { AppContext, appPlatformTypes, platformContext } from '@remix-ui/app' import { ElectronMenu } from './components/electron-menu' import { ElectronWorkspaceName } from './components/electron-workspace-name' -import { branch, GitHubUser, userEmails } from '@remix-ui/git' +import { branch, GitHubUser, gitUIPanels, userEmails } from '@remix-ui/git' const _paq = (window._paq = window._paq || []) @@ -49,6 +49,8 @@ export function Workspace() { const [canPaste, setCanPaste] = useState(false) + const appContext = useContext(AppContext) + const [state, setState] = useState({ ctrlKey: false, cutShortcut: false, @@ -73,34 +75,10 @@ export function Workspace() { reservedKeywords: [ROOT_PATH], copyElement: [], dragStatus: false, - loggedInGithub: false, - githubUser: null }) useEffect(() => { - const run = async () => { - const token = await global.plugin.call('config' as any, 'getAppParameter' as any, 'settings/gist-access-token') - const data: { - user: GitHubUser, - scopes: string[] - emails: userEmails - } = await global.plugin.call('dgitApi' as any, 'getGitHubUser', { token }); - - if (data.user) { - setState((prevState) => { - return { ...prevState, loggedInGithub: true, githubUser: data.user } - }) - } - } - global.plugin.on('dgit', 'disconnectFromGithubRequest', () => { - setState((prevState) => { - return { ...prevState, loggedInGithub: false, githubUser: null } - }) - }) - global.plugin.on('dgit', 'loggedInGithubChanged', () => { - run() - }) - run() + }, []) useEffect(() => { @@ -916,9 +894,8 @@ export function Workspace() { } const logInGithub = async () => { - await global.plugin.call('manager', 'activatePlugin', 'dgit') await global.plugin.call('menuicons', 'select', 'dgit'); - await global.plugin.emit('requestGitHubSignIn'); + await global.plugin.call('dgit', 'open', gitUIPanels.GITHUB) _paq.push(['trackEvent', 'Workspace', 'GIT', 'login']) } @@ -994,7 +971,7 @@ export function Workspace() { { - !state.loggedInGithub && } { - state.loggedInGithub && - + } diff --git a/libs/remix-ui/workspace/src/lib/types/index.ts b/libs/remix-ui/workspace/src/lib/types/index.ts index 58276a5def..32e4d05d98 100644 --- a/libs/remix-ui/workspace/src/lib/types/index.ts +++ b/libs/remix-ui/workspace/src/lib/types/index.ts @@ -241,8 +241,6 @@ export interface WorkSpaceState { reservedKeywords: string[] copyElement: CopyElementType[] dragStatus: boolean - loggedInGithub: boolean - githubUser: GitHubUser } export type FileFocusContextType = { From 14af8f4b00a2221faa4c3c960847bce79e1cc6e1 Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Sat, 24 Aug 2024 11:34:08 +0200 Subject: [PATCH 16/39] add event --- libs/remix-ui/git/src/components/gitui.tsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libs/remix-ui/git/src/components/gitui.tsx b/libs/remix-ui/git/src/components/gitui.tsx index a9173e6504..a0067a2b6a 100644 --- a/libs/remix-ui/git/src/components/gitui.tsx +++ b/libs/remix-ui/git/src/components/gitui.tsx @@ -52,6 +52,9 @@ export const GitUI = (props: IGitUi) => { type: 'info', title: 'Loading Git Plugin' }) + setTimeout(() => { + setAppLoaded(true) + }, 2000) }, []) useEffect(() => { From f3c0b80e3e5b33734fa5e42574b9ab1c20a8a28c Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Sat, 24 Aug 2024 12:13:50 +0200 Subject: [PATCH 17/39] refactor --- libs/remix-ui/git/src/components/gitui.tsx | 65 +++++++++++----------- 1 file changed, 32 insertions(+), 33 deletions(-) diff --git a/libs/remix-ui/git/src/components/gitui.tsx b/libs/remix-ui/git/src/components/gitui.tsx index a0067a2b6a..98fa99616f 100644 --- a/libs/remix-ui/git/src/components/gitui.tsx +++ b/libs/remix-ui/git/src/components/gitui.tsx @@ -5,7 +5,7 @@ import { openDiff, openFile, saveToken, sendToMatomo, setModifiedDecorator, setP import { gitActionsContext, pluginActionsContext } from '../state/context' import { gitReducer } from '../state/gitreducer' import { defaultGitState, defaultLoaderState, gitMatomoEventTypes, gitState, gitUIPanels, loaderState } from '../types' -import { Accordion } from "react-bootstrap"; +import { Accordion, Button } from "react-bootstrap"; import { CommitMessage } from './buttons/commitmessage' import { Commits } from './panels/commits' import { Branches } from './panels/branches' @@ -52,8 +52,8 @@ export const GitUI = (props: IGitUi) => { type: 'info', title: 'Loading Git Plugin' }) - setTimeout(() => { - setAppLoaded(true) + setTimeout(() => { + setAppLoaded(true) }, 2000) }, []) @@ -72,6 +72,7 @@ export const GitUI = (props: IGitUi) => { const username = await plugin.call('settings', 'get', 'settings/github-user-name') const email = await plugin.call('settings', 'get', 'settings/github-email') const token = await plugin.call('settings', 'get', 'settings/gist-access-token') + console.log('token', token, username, email) setSetup(!(username && email)) } @@ -174,12 +175,8 @@ export const GitUI = (props: IGitUi) => { - {setup ? : null} - {needsInit ? : null} - {setup || needsInit ? <>
CLONE
- : null} - {!setup && !needsInit ? - + + {!setup && !needsInit ? <>
@@ -216,30 +213,32 @@ export const GitUI = (props: IGitUi) => {

- - -
-
-
-
- - -
- -
- -
-
-
- - -
- -
-
- -
- : null} + : null} + {needsInit ? <> + : null} + + +
+
+
+
+ + + +
+ +
+ +
+
+
+ + +
+ +
+
+
From 3eb7555bde42e3473e531f81a2c8b98ca4c4d7bd Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Sat, 24 Aug 2024 12:38:51 +0200 Subject: [PATCH 18/39] update test --- apps/remix-ide-e2e/src/tests/dgit_github.test.ts | 3 +++ apps/remix-ide-e2e/src/tests/dgit_local.test.ts | 3 +++ apps/remix-ide-e2e/src/tests/workspace_git.test.ts | 3 +++ 3 files changed, 9 insertions(+) diff --git a/apps/remix-ide-e2e/src/tests/dgit_github.test.ts b/apps/remix-ide-e2e/src/tests/dgit_github.test.ts index da38485359..a85269c572 100644 --- a/apps/remix-ide-e2e/src/tests/dgit_github.test.ts +++ b/apps/remix-ide-e2e/src/tests/dgit_github.test.ts @@ -18,6 +18,9 @@ module.exports = { clickLaunchIcon('dgit') .waitForElementVisible('*[data-id="initgit-btn"]') .click('*[data-id="initgit-btn"]') + .waitForElementVisible('*[data-id="github-panel"]') + .click('*[data-id="github-panel"]') + .waitForElementVisible('*[data-id="gitubUsername"]') .setValue('*[data-id="githubToken"]', process.env.dgit_token) .setValue('*[data-id="gitubUsername"]', 'git') .setValue('*[data-id="githubEmail"]', 'git@example.com') diff --git a/apps/remix-ide-e2e/src/tests/dgit_local.test.ts b/apps/remix-ide-e2e/src/tests/dgit_local.test.ts index fc0ec93f98..961070c893 100644 --- a/apps/remix-ide-e2e/src/tests/dgit_local.test.ts +++ b/apps/remix-ide-e2e/src/tests/dgit_local.test.ts @@ -36,6 +36,9 @@ module.exports = { clickLaunchIcon('dgit') .waitForElementVisible('*[data-id="initgit-btn"]') .click('*[data-id="initgit-btn"]') + .waitForElementVisible('*[data-id="github-panel"]') + .click('*[data-id="github-panel"]') + .waitForElementVisible('*[data-id="gitubUsername"]') .setValue('*[data-id="gitubUsername"]', 'git') .setValue('*[data-id="githubEmail"]', 'git@example.com') .click('*[data-id="saveGitHubCredentials"]') diff --git a/apps/remix-ide-e2e/src/tests/workspace_git.test.ts b/apps/remix-ide-e2e/src/tests/workspace_git.test.ts index 0661eb31ee..028551bba5 100644 --- a/apps/remix-ide-e2e/src/tests/workspace_git.test.ts +++ b/apps/remix-ide-e2e/src/tests/workspace_git.test.ts @@ -423,6 +423,9 @@ module.exports = { clickLaunchIcon('dgit') .waitForElementVisible('*[data-id="initgit-btn"]') .click('*[data-id="initgit-btn"]') + .waitForElementVisible('*[data-id="github-panel"]') + .click('*[data-id="github-panel"]') + .waitForElementVisible('*[data-id="gitubUsername"]') .setValue('*[data-id="gitubUsername"]', 'git') .setValue('*[data-id="githubEmail"]', 'git@example.com') .click('*[data-id="saveGitHubCredentials"]') From 4ba33316fdb3db420a4dde49e58a7fb1d9bee669 Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Sat, 24 Aug 2024 14:22:40 +0200 Subject: [PATCH 19/39] refactor --- apps/remix-ide/src/app/files/dgitProvider.ts | 11 +++- .../src/app/tabs/locales/en/git.json | 3 +- libs/remix-ui/git/src/components/gitui.tsx | 1 + .../components/panels/githubcredentials.tsx | 2 +- .../git/src/components/panels/setup.tsx | 54 ++++++++----------- libs/remix-ui/git/src/lib/gitactions.ts | 3 +- libs/remix-ui/git/src/types/index.ts | 5 +- .../workspace/src/lib/remix-ui-workspace.tsx | 4 +- 8 files changed, 45 insertions(+), 38 deletions(-) diff --git a/apps/remix-ide/src/app/files/dgitProvider.ts b/apps/remix-ide/src/app/files/dgitProvider.ts index 87cb4c3c8c..f81d80859b 100644 --- a/apps/remix-ide/src/app/files/dgitProvider.ts +++ b/apps/remix-ide/src/app/files/dgitProvider.ts @@ -1060,9 +1060,18 @@ class DGitProvider extends Plugin { const emails = await octokit.request('GET /user/emails') const scopes = user.headers['x-oauth-scopes'] || '' + console.log(scopes) + + const scopesArr = scopes.split(',').map(scope => scope.trim()) return { - user: user.data, + user: {...user.data, isConnected: + scopes + && scopesArr.includes('repo') + && scopesArr.includes('read:user') + && scopesArr.includes('user:email') + && scopesArr.includes('gist') + }, emails: emails.data, scopes: scopes && scopes.split(',') } diff --git a/apps/remix-ide/src/app/tabs/locales/en/git.json b/apps/remix-ide/src/app/tabs/locales/en/git.json index c5f4fa6a09..ea64a5b02d 100644 --- a/apps/remix-ide/src/app/tabs/locales/en/git.json +++ b/apps/remix-ide/src/app/tabs/locales/en/git.json @@ -16,5 +16,6 @@ "git.unstageall": "unstage all", "git.stageall": "stage all", "git.noremote": "this repo has no remotes", - "git.init": "Initialize repository" + "git.init": "Initialize repository", + "git.setup": "Setup git" } \ No newline at end of file diff --git a/libs/remix-ui/git/src/components/gitui.tsx b/libs/remix-ui/git/src/components/gitui.tsx index 98fa99616f..0fd8afc0e4 100644 --- a/libs/remix-ui/git/src/components/gitui.tsx +++ b/libs/remix-ui/git/src/components/gitui.tsx @@ -175,6 +175,7 @@ export const GitUI = (props: IGitUi) => { + {setup ? : null} {!setup && !needsInit ? <> diff --git a/libs/remix-ui/git/src/components/panels/githubcredentials.tsx b/libs/remix-ui/git/src/components/panels/githubcredentials.tsx index a81420e28b..e6b8da65d8 100644 --- a/libs/remix-ui/git/src/components/panels/githubcredentials.tsx +++ b/libs/remix-ui/git/src/components/panels/githubcredentials.tsx @@ -22,7 +22,7 @@ export const GitHubCredentials = () => { useEffect(() => { refresh() if (context.gitHubUser) { - setScopeWarning(!(context.gitHubScopes && context.gitHubScopes.length > 0)) + setScopeWarning(!context.gitHubUser.isConnected) } else { setScopeWarning(false) } diff --git a/libs/remix-ui/git/src/components/panels/setup.tsx b/libs/remix-ui/git/src/components/panels/setup.tsx index 981b0926c4..38e7953f3d 100644 --- a/libs/remix-ui/git/src/components/panels/setup.tsx +++ b/libs/remix-ui/git/src/components/panels/setup.tsx @@ -1,37 +1,29 @@ import React, { useEffect, useState } from 'react' -import { GetDeviceCode } from '../github/devicecode' -import { GitHubCredentials } from './githubcredentials' -import { Clone } from './clone' +import { gitUIPanels } from '../../types' +import GitUIButton from '../buttons/gituibutton' +import { FormattedMessage } from 'react-intl' -export const Setup = () => { +export const Setup = ({ callback }) => { - const [screen, setScreen] = useState(0) - if (screen === 0) { - return ( - <> -
SETUP
-
-
- To ensure that your commits are properly attributed in Git, you need to configure a username and email address. - These will be used to identify the author of the commit. -
- -
- -
- - ) - } else if (screen === 1) { - return ( - <> -
SETUP
-
Step 2
-
- To ensure that your commits are properly attributed in Git, you need to configure your username and email address. - -
- - ) + const startSetingUp = () => { + callback(gitUIPanels.GITHUB) } + + return ( + <> +
SETUP REQUIRED
+
+
+ To ensure that your commits are properly attributed in Git, you need to configure a username and email address or connect to GitHub. + These credentials will be used to identify the author of the commit. + + + +
+
+
+ + ) + } \ No newline at end of file diff --git a/libs/remix-ui/git/src/lib/gitactions.ts b/libs/remix-ui/git/src/lib/gitactions.ts index a4a6317adc..3c43d72903 100644 --- a/libs/remix-ui/git/src/lib/gitactions.ts +++ b/libs/remix-ui/git/src/lib/gitactions.ts @@ -574,8 +574,9 @@ export const saveGitHubCredentials = async (credentials: { username: string, ema } dispatch(setGitHubUser({ login: credentials.username, + isConnected: false })) - appDispatcher({ type: appActionTypes.setGitHubUser, payload: { login: credentials.username } }) + appDispatcher({ type: appActionTypes.setGitHubUser, payload: { login: credentials.username, isConnected: false } }) dispatch(setUserEmails([{ email: credentials.email, primary: true, diff --git a/libs/remix-ui/git/src/types/index.ts b/libs/remix-ui/git/src/types/index.ts index 3f70103838..4c24c1a450 100644 --- a/libs/remix-ui/git/src/types/index.ts +++ b/libs/remix-ui/git/src/types/index.ts @@ -5,7 +5,10 @@ import { CommitObject, ReadBlobResult, ReadCommitResult, StatusRow } from "isomo import { CustomRemixApi } from "@remix-api"; import { Plugin } from "@remixproject/engine"; -export type GitHubUser = Partial +export type GitHubUser = Partial & { + isConnected: boolean +} + export type userEmails = Endpoints["GET /user/emails"]["response"]["data"] export interface IGitUi { diff --git a/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx b/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx index ad10b7a0b8..f4725ca88e 100644 --- a/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx +++ b/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx @@ -971,7 +971,7 @@ export function Workspace() { { - !appContext.appState.gitHubUser && } { - appContext.appState.gitHubUser && Date: Sat, 24 Aug 2024 14:26:08 +0200 Subject: [PATCH 20/39] rm unused events --- libs/remix-ui/git/src/components/github/devicecode.tsx | 2 -- libs/remix-ui/git/src/components/gitui.tsx | 6 ++---- .../git/src/components/panels/githubcredentials.tsx | 2 -- libs/remix-ui/git/src/lib/pluginActions.ts | 8 -------- libs/remix-ui/git/src/state/context.tsx | 2 -- 5 files changed, 2 insertions(+), 18 deletions(-) diff --git a/libs/remix-ui/git/src/components/github/devicecode.tsx b/libs/remix-ui/git/src/components/github/devicecode.tsx index 20281da15e..9ce3e5ec02 100644 --- a/libs/remix-ui/git/src/components/github/devicecode.tsx +++ b/libs/remix-ui/git/src/components/github/devicecode.tsx @@ -64,7 +64,6 @@ export const GetDeviceCode = () => { await actions.loadGitHubUserFromToken() } else { await sendToMatomo(gitMatomoEventTypes.CONNECTTOGITHUBFAIL) - pluginActions.disconnectFromGithub() } } @@ -74,7 +73,6 @@ export const GetDeviceCode = () => { setGitHubResponse(null) await pluginActions.saveToken(null) await actions.loadGitHubUserFromToken() - pluginActions.disconnectFromGithub() } return ( diff --git a/libs/remix-ui/git/src/components/gitui.tsx b/libs/remix-ui/git/src/components/gitui.tsx index 0fd8afc0e4..370f4d8d24 100644 --- a/libs/remix-ui/git/src/components/gitui.tsx +++ b/libs/remix-ui/git/src/components/gitui.tsx @@ -1,7 +1,7 @@ import React, { useContext, useEffect, useReducer, useState } from 'react' import { add, addall, checkout, checkoutfile, clone, commit, createBranch, remoteBranches, repositories, rm, getCommitChanges, diff, resolveRef, getBranchCommits, setUpstreamRemote, loadGitHubUserFromToken, getBranches, getRemotes, remoteCommits, saveGitHubCredentials, getGitHubCredentialsFromLocalStorage, fetch, pull, push, setDefaultRemote, addRemote, removeRemote, sendToGitLog, clearGitLog, getBranchDifferences, getFileStatusMatrix, init, showAlert, gitlog } from '../lib/gitactions' import { loadFiles, setCallBacks } from '../lib/listeners' -import { openDiff, openFile, saveToken, sendToMatomo, setModifiedDecorator, setPlugin, setUntrackedDecorator, statusChanged, disconnectFromGithub, logInGitHub } from '../lib/pluginActions' +import { openDiff, openFile, saveToken, sendToMatomo, setModifiedDecorator, setPlugin, setUntrackedDecorator, statusChanged } from '../lib/pluginActions' import { gitActionsContext, pluginActionsContext } from '../state/context' import { gitReducer } from '../state/gitreducer' import { defaultGitState, defaultLoaderState, gitMatomoEventTypes, gitState, gitUIPanels, loaderState } from '../types' @@ -162,9 +162,7 @@ export const GitUI = (props: IGitUi) => { saveToken, saveGitHubCredentials, getGitHubCredentialsFromLocalStorage, - showAlert, - disconnectFromGithub, - logInGitHub + showAlert } return ( diff --git a/libs/remix-ui/git/src/components/panels/githubcredentials.tsx b/libs/remix-ui/git/src/components/panels/githubcredentials.tsx index e6b8da65d8..65abc1797c 100644 --- a/libs/remix-ui/git/src/components/panels/githubcredentials.tsx +++ b/libs/remix-ui/git/src/components/panels/githubcredentials.tsx @@ -55,7 +55,6 @@ export const GitHubCredentials = () => { setGithubToken(credentials.token || '') setGithubUsername(credentials.username || '') setGithubEmail(credentials.email || '') - pluginactions.logInGitHub() } function removeToken(): void { @@ -67,7 +66,6 @@ export const GitHubCredentials = () => { email: '', token: '' }) - pluginactions.disconnectFromGithub() } return ( diff --git a/libs/remix-ui/git/src/lib/pluginActions.ts b/libs/remix-ui/git/src/lib/pluginActions.ts index d5bb0ada31..7d9e81ee7a 100644 --- a/libs/remix-ui/git/src/lib/pluginActions.ts +++ b/libs/remix-ui/git/src/lib/pluginActions.ts @@ -14,14 +14,6 @@ export const setPlugin = (p: Plugin, gitDispatcher: React.D loaderDispatch = loaderDispatcher } -export const disconnectFromGithub = () => { - plugin.emit('disconnectFromGithub') -} - -export const logInGitHub = () => { - plugin.emit('loggedInGithubChanged') -} - export const statusChanged = (badges: number) => { if (!plugin) return plugin.emit('statusChanged', { diff --git a/libs/remix-ui/git/src/state/context.tsx b/libs/remix-ui/git/src/state/context.tsx index 47d42f3439..4608406a7f 100644 --- a/libs/remix-ui/git/src/state/context.tsx +++ b/libs/remix-ui/git/src/state/context.tsx @@ -54,8 +54,6 @@ export interface pluginActions { token: string }> showAlert({ title, message }:{title: string, message: string}): Promise - logInGitHub(): void - disconnectFromGithub(): void } export const pluginActionsContext = React.createContext(null) \ No newline at end of file From 31a0f7e2ec2617746c54811354bec58637ae31e4 Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Sat, 24 Aug 2024 14:27:25 +0200 Subject: [PATCH 21/39] fix test --- apps/remix-ide-e2e/src/tests/dgit_github.test.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/apps/remix-ide-e2e/src/tests/dgit_github.test.ts b/apps/remix-ide-e2e/src/tests/dgit_github.test.ts index a85269c572..f9c638ebe9 100644 --- a/apps/remix-ide-e2e/src/tests/dgit_github.test.ts +++ b/apps/remix-ide-e2e/src/tests/dgit_github.test.ts @@ -27,8 +27,7 @@ module.exports = { .click('*[data-id="saveGitHubCredentials"]') }, 'check if the settings are loaded #group1 #group2': function (browser: NightwatchBrowser) { - browser. - click('*[data-id="github-panel"]') + browser .waitForElementVisible('*[data-id="connected-as-bunsenstraat"]') .waitForElementVisible('*[data-id="connected-img-bunsenstraat"]') .waitForElementVisible('*[data-id="connected-link-bunsenstraat"]') From 6088ce978a05d2b802063ed3060568b9043ce221 Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Sat, 24 Aug 2024 14:28:14 +0200 Subject: [PATCH 22/39] lint --- libs/remix-ui/app/src/lib/remix-app/reducer/app.ts | 14 +++++++------- libs/remix-ui/app/src/lib/remix-app/state/app.ts | 2 +- libs/remix-ui/git/src/components/panels/setup.tsx | 1 - 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/libs/remix-ui/app/src/lib/remix-app/reducer/app.ts b/libs/remix-ui/app/src/lib/remix-app/reducer/app.ts index 4bd804885f..2fce1a56cf 100644 --- a/libs/remix-ui/app/src/lib/remix-app/reducer/app.ts +++ b/libs/remix-ui/app/src/lib/remix-app/reducer/app.ts @@ -2,12 +2,12 @@ import { AppAction, appActionTypes } from "../actions/app"; import { AppState } from "../interface"; export const appReducer = (state: AppState, action: AppAction): AppState => { - switch (action.type) { - case appActionTypes.setGitHubUser:{ - return { - ...state, - gitHubUser: action.payload - } - } + switch (action.type) { + case appActionTypes.setGitHubUser:{ + return { + ...state, + gitHubUser: action.payload } + } + } } \ No newline at end of file diff --git a/libs/remix-ui/app/src/lib/remix-app/state/app.ts b/libs/remix-ui/app/src/lib/remix-app/state/app.ts index 60e763a76c..417911ae0c 100644 --- a/libs/remix-ui/app/src/lib/remix-app/state/app.ts +++ b/libs/remix-ui/app/src/lib/remix-app/state/app.ts @@ -2,5 +2,5 @@ import { GitHubUser } from "@remix-ui/git"; import { AppState } from "../interface"; export const appInitialState: AppState = { - gitHubUser: {} as GitHubUser, + gitHubUser: {} as GitHubUser, } \ No newline at end of file diff --git a/libs/remix-ui/git/src/components/panels/setup.tsx b/libs/remix-ui/git/src/components/panels/setup.tsx index 38e7953f3d..184a46eadf 100644 --- a/libs/remix-ui/git/src/components/panels/setup.tsx +++ b/libs/remix-ui/git/src/components/panels/setup.tsx @@ -5,7 +5,6 @@ import { FormattedMessage } from 'react-intl' export const Setup = ({ callback }) => { - const startSetingUp = () => { callback(gitUIPanels.GITHUB) } From 495917811728e2f9666aff2cb4d4f5b805d03655 Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Sat, 24 Aug 2024 14:42:02 +0200 Subject: [PATCH 23/39] fix lint --- libs/remix-ui/app/src/index.ts | 1 + libs/remix-ui/git/src/lib/gitactions.ts | 3 +-- libs/remix-ui/git/src/lib/listeners.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libs/remix-ui/app/src/index.ts b/libs/remix-ui/app/src/index.ts index e686172a78..b18c36cb9a 100644 --- a/libs/remix-ui/app/src/index.ts +++ b/libs/remix-ui/app/src/index.ts @@ -4,3 +4,4 @@ export { ModalProvider, useDialogDispatchers } from './lib/remix-app/context/pro export { AppModal } from './lib/remix-app/interface/index' export { AlertModal } from './lib/remix-app/interface/index' export { ModalTypes } from './lib/remix-app/types/index' +export { AppAction, appActionTypes } from './lib/remix-app/actions/app' diff --git a/libs/remix-ui/git/src/lib/gitactions.ts b/libs/remix-ui/git/src/lib/gitactions.ts index 3c43d72903..90faf29a92 100644 --- a/libs/remix-ui/git/src/lib/gitactions.ts +++ b/libs/remix-ui/git/src/lib/gitactions.ts @@ -4,11 +4,10 @@ import { fileStatus, fileStatusMerge, setRemoteBranchCommits, resetRemoteBranchC import { GitHubUser, branch, commitChange, gitActionDispatch, statusMatrixType, gitState, branchDifference, remote, gitLog, fileStatusResult, customGitApi, IGitApi, cloneInputType, fetchInputType, pullInputType, pushInputType, checkoutInput, rmInput, addInput, repository, userEmails, storage, gitMatomoEventTypes } from '../types'; import { removeSlash } from "../utils"; import { disableCallBacks, enableCallBacks } from "./listeners"; -import { ModalTypes } from "@remix-ui/app"; +import { ModalTypes, appActionTypes, AppAction } from "@remix-ui/app"; import { sendToMatomo, setFileDecorators } from "./pluginActions"; import { Plugin } from "@remixproject/engine"; import { CustomRemixApi } from "@remix-api"; -import { AppAction, appActionTypes } from "libs/remix-ui/app/src/lib/remix-app/actions/app"; import { app } from "electron"; export const fileStatuses = [ diff --git a/libs/remix-ui/git/src/lib/listeners.ts b/libs/remix-ui/git/src/lib/listeners.ts index c18274c9d7..c4dfe0b11e 100644 --- a/libs/remix-ui/git/src/lib/listeners.ts +++ b/libs/remix-ui/git/src/lib/listeners.ts @@ -7,7 +7,7 @@ import { getBranches, getFileStatusMatrix, loadGitHubUserFromToken, getRemotes, import { Profile } from "@remixproject/plugin-utils"; import { CustomRemixApi } from "@remix-api"; import { statusChanged } from "./pluginActions"; -import { AppAction } from "libs/remix-ui/app/src/lib/remix-app/actions/app"; +import { AppAction } from "@remix-ui/app"; let plugin: Plugin, gitDispatch: React.Dispatch, loaderDispatch: React.Dispatch, loadFileQueue: AsyncDebouncedQueue let callBackEnabled: boolean = false From a397005407d3c861eb41a24968b31b9ce0d55f58 Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Sat, 24 Aug 2024 14:50:24 +0200 Subject: [PATCH 24/39] lint --- apps/remix-ide/src/app/files/dgitProvider.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/remix-ide/src/app/files/dgitProvider.ts b/apps/remix-ide/src/app/files/dgitProvider.ts index f81d80859b..39c40e4073 100644 --- a/apps/remix-ide/src/app/files/dgitProvider.ts +++ b/apps/remix-ide/src/app/files/dgitProvider.ts @@ -1065,8 +1065,8 @@ class DGitProvider extends Plugin { const scopesArr = scopes.split(',').map(scope => scope.trim()) return { - user: {...user.data, isConnected: - scopes + user: { ...user.data, isConnected: + scopes && scopesArr.includes('repo') && scopesArr.includes('read:user') && scopesArr.includes('user:email') From a58927ad639e62b00a0b93f13f3a02ae64c6d77b Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Sat, 24 Aug 2024 14:56:20 +0200 Subject: [PATCH 25/39] fix test --- apps/remix-ide-e2e/src/tests/workspace_git.test.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/apps/remix-ide-e2e/src/tests/workspace_git.test.ts b/apps/remix-ide-e2e/src/tests/workspace_git.test.ts index 028551bba5..467d97e620 100644 --- a/apps/remix-ide-e2e/src/tests/workspace_git.test.ts +++ b/apps/remix-ide-e2e/src/tests/workspace_git.test.ts @@ -433,6 +433,8 @@ module.exports = { }, 'check source controle panel #group5': function (browser: NightwatchBrowser) { browser + .waitForElementVisible('*[data-id="sourcecontrol-panel"]') + .click('*[data-id="sourcecontrol-panel"]') .waitForElementVisible({ selector: "//*[@data-status='new-untracked' and @data-file='/tests/MyToken_test.sol']", locateStrategy: 'xpath' From 7d3300c6f0badb3b7ad014b8ecf3323ae2684bee Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Sat, 24 Aug 2024 15:00:29 +0200 Subject: [PATCH 26/39] fix views --- libs/remix-ui/git/src/components/github/devicecode.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libs/remix-ui/git/src/components/github/devicecode.tsx b/libs/remix-ui/git/src/components/github/devicecode.tsx index 9ce3e5ec02..9c74245bb0 100644 --- a/libs/remix-ui/git/src/components/github/devicecode.tsx +++ b/libs/remix-ui/git/src/components/github/devicecode.tsx @@ -77,7 +77,7 @@ export const GetDeviceCode = () => { return ( <> - {(context.gitHubUser && context.gitHubUser.login) ? null : <> + {(context.gitHubUser && context.gitHubUser.isConnected) ? null : <> {scopeWarning ? -
Your GitHub token may not have the correct permissions. Please use the login with GitHub feature.
: null} +
Your GitHub token may or may not have the correct permissions. Remix can't verify the permissions when using your own token. Please use the login with GitHub feature.
: null}
); From cefc6645190b2bf631f2ea448dbd2bbe249bb71b Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Sat, 24 Aug 2024 16:28:04 +0200 Subject: [PATCH 28/39] update tests --- apps/remix-ide-e2e/src/tests/dgit_github.test.ts | 15 +++++++++++++++ .../workspace/src/lib/remix-ui-workspace.tsx | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/apps/remix-ide-e2e/src/tests/dgit_github.test.ts b/apps/remix-ide-e2e/src/tests/dgit_github.test.ts index f9c638ebe9..80e4326620 100644 --- a/apps/remix-ide-e2e/src/tests/dgit_github.test.ts +++ b/apps/remix-ide-e2e/src/tests/dgit_github.test.ts @@ -18,6 +18,15 @@ module.exports = { clickLaunchIcon('dgit') .waitForElementVisible('*[data-id="initgit-btn"]') .click('*[data-id="initgit-btn"]') + }, + 'launch github login via FE #group1 #group2': function (browser: NightwatchBrowser) { + browser + .clickLaunchIcon('filePanel') + .waitForElementVisible('*[data-id="filepanel-login-github"]') + .click('*[data-id="filepanel-login-github"]') + }, + 'login to github #group1 #group2': function (browser: NightwatchBrowser) { + browser .waitForElementVisible('*[data-id="github-panel"]') .click('*[data-id="github-panel"]') .waitForElementVisible('*[data-id="gitubUsername"]') @@ -32,8 +41,14 @@ module.exports = { .waitForElementVisible('*[data-id="connected-img-bunsenstraat"]') .waitForElementVisible('*[data-id="connected-link-bunsenstraat"]') }, + 'check the FE for the auth user #group1 #group2': function (browser: NightwatchBrowser) { + browser + .clickLaunchIcon('filePanel') + .waitForElementVisible('*[data-id="connected-img-bunsenstraat"]') + }, 'clone a repository #group1': function (browser: NightwatchBrowser) { browser + .clickLaunchIcon('dgit') .click('*[data-id="clone-panel"]') .click({ selector: '//*[@data-id="clone-panel-content"]//*[@data-id="fetch-repositories"]', diff --git a/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx b/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx index f4725ca88e..3efe40088e 100644 --- a/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx +++ b/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx @@ -977,7 +977,7 @@ export function Workspace() { tooltipClasses="text-nowrap" tooltipText={} > -
+
logInGithub() } className="fa-brands fa-github-alt text-success ml-2 align-self-center" style={{ fontSize: '1.1rem' }} aria-hidden="true"> logInGithub() } className="ml-1 text-success"> Sign in
From da2b2a184e8c40b2132329ea28306acc3b8ef93c Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Sat, 24 Aug 2024 16:31:21 +0200 Subject: [PATCH 29/39] fix test --- apps/remix-ide-e2e/src/tests/dgit_github.test.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/apps/remix-ide-e2e/src/tests/dgit_github.test.ts b/apps/remix-ide-e2e/src/tests/dgit_github.test.ts index 80e4326620..1a7c3d73d1 100644 --- a/apps/remix-ide-e2e/src/tests/dgit_github.test.ts +++ b/apps/remix-ide-e2e/src/tests/dgit_github.test.ts @@ -28,7 +28,6 @@ module.exports = { 'login to github #group1 #group2': function (browser: NightwatchBrowser) { browser .waitForElementVisible('*[data-id="github-panel"]') - .click('*[data-id="github-panel"]') .waitForElementVisible('*[data-id="gitubUsername"]') .setValue('*[data-id="githubToken"]', process.env.dgit_token) .setValue('*[data-id="gitubUsername"]', 'git') From 10e18960a3323b12882310dd466d8e004860d3e3 Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Sat, 24 Aug 2024 16:36:27 +0200 Subject: [PATCH 30/39] cleanup --- libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx b/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx index 3efe40088e..6cb9969980 100644 --- a/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx +++ b/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx @@ -74,13 +74,9 @@ export function Workspace() { showContextMenu: false, reservedKeywords: [ROOT_PATH], copyElement: [], - dragStatus: false, + dragStatus: false }) - useEffect(() => { - - }, []) - useEffect(() => { if (canPaste) { addMenuItems([ From 24c6bba6dee930f7c1cac8271931b8ff392b5588 Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Sat, 24 Aug 2024 16:41:04 +0200 Subject: [PATCH 31/39] fix test --- apps/remix-ide-e2e/src/tests/dgit_github.test.ts | 2 +- apps/remix-ide/src/app/files/dgitProvider.ts | 3 --- libs/remix-ui/git/src/components/gitui.tsx | 1 - libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx | 2 +- 4 files changed, 2 insertions(+), 6 deletions(-) diff --git a/apps/remix-ide-e2e/src/tests/dgit_github.test.ts b/apps/remix-ide-e2e/src/tests/dgit_github.test.ts index 1a7c3d73d1..46b94b986c 100644 --- a/apps/remix-ide-e2e/src/tests/dgit_github.test.ts +++ b/apps/remix-ide-e2e/src/tests/dgit_github.test.ts @@ -43,7 +43,7 @@ module.exports = { 'check the FE for the auth user #group1 #group2': function (browser: NightwatchBrowser) { browser .clickLaunchIcon('filePanel') - .waitForElementVisible('*[data-id="connected-img-bunsenstraat"]') + .waitForElementVisible('*[data-id="filepanel-connected-img-bunsenstraat"]') }, 'clone a repository #group1': function (browser: NightwatchBrowser) { browser diff --git a/apps/remix-ide/src/app/files/dgitProvider.ts b/apps/remix-ide/src/app/files/dgitProvider.ts index d46ca957af..9d4b01091c 100644 --- a/apps/remix-ide/src/app/files/dgitProvider.ts +++ b/apps/remix-ide/src/app/files/dgitProvider.ts @@ -1064,10 +1064,7 @@ class DGitProvider extends Plugin { const emails = await octokit.request('GET /user/emails') const scopes = user.headers['x-oauth-scopes'] || '' - console.log(scopes) - const scopesArr = scopes.split(',').map(scope => scope.trim()) - console.log(scopesArr) return { user: { ...user.data, isConnected: diff --git a/libs/remix-ui/git/src/components/gitui.tsx b/libs/remix-ui/git/src/components/gitui.tsx index 370f4d8d24..aaa29c5a84 100644 --- a/libs/remix-ui/git/src/components/gitui.tsx +++ b/libs/remix-ui/git/src/components/gitui.tsx @@ -72,7 +72,6 @@ export const GitUI = (props: IGitUi) => { const username = await plugin.call('settings', 'get', 'settings/github-user-name') const email = await plugin.call('settings', 'get', 'settings/github-email') const token = await plugin.call('settings', 'get', 'settings/gist-access-token') - console.log('token', token, username, email) setSetup(!(username && email)) } diff --git a/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx b/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx index 6cb9969980..19285b9f2b 100644 --- a/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx +++ b/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx @@ -986,7 +986,7 @@ export function Workspace() { tooltipClasses="text-nowrap" tooltipText={appContext.appState.gitHubUser && intl.formatMessage({ id: 'filePanel.gitHubLoggedAs' }, { githubuser: appContext.appState.gitHubUser.login }) || ''} > - + } From e41dd7a336764e474c598cd9fdf1178a25985677 Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Sat, 24 Aug 2024 18:34:22 +0200 Subject: [PATCH 32/39] fix test --- apps/remix-ide-e2e/src/tests/dgit_github.test.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/apps/remix-ide-e2e/src/tests/dgit_github.test.ts b/apps/remix-ide-e2e/src/tests/dgit_github.test.ts index 46b94b986c..a3003b6ab1 100644 --- a/apps/remix-ide-e2e/src/tests/dgit_github.test.ts +++ b/apps/remix-ide-e2e/src/tests/dgit_github.test.ts @@ -211,6 +211,8 @@ module.exports = { 'add a remote #group2': function (browser: NightwatchBrowser) { browser .pause(1000) + .clickLaunchIcon('dgit') + .waitForElementVisible('*[data-id="remotes-panel"]') .click('*[data-id="remotes-panel"]') .click({ selector: '//*[@data-id="remotes-panel-content"]//*[@data-id="fetch-repositories"]', From 91185e963360c0c53b3cc25ee8160f7107fa25bc Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Sat, 24 Aug 2024 19:55:32 +0200 Subject: [PATCH 33/39] test disconnect --- apps/remix-ide-e2e/src/tests/dgit_github.test.ts | 15 ++++++++++++++- .../git/src/components/github/devicecode.tsx | 2 +- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/apps/remix-ide-e2e/src/tests/dgit_github.test.ts b/apps/remix-ide-e2e/src/tests/dgit_github.test.ts index a3003b6ab1..30714c3fc1 100644 --- a/apps/remix-ide-e2e/src/tests/dgit_github.test.ts +++ b/apps/remix-ide-e2e/src/tests/dgit_github.test.ts @@ -207,7 +207,20 @@ module.exports = { locateStrategy: 'xpath' }) }, - + 'disconnect github #group1': function (browser: NightwatchBrowser) { + browser + .waitForElementVisible('*[data-id="github-panel"]') + .click('*[data-id="github-panel"]') + .waitForElementVisible('*[data-id="disconnect-github"]') + .click('*[data-id="disconnect-github"]') + .waitForElementNotPresent('*[data-id="connected-as-bunsenstraat"]') + }, + 'check the FE for the disconnected auth user #group1': function (browser: NightwatchBrowser) { + browser + .clickLaunchIcon('filePanel') + .waitForElementNotPresent('*[data-id="filepanel-connected-img-bunsenstraat"]') + .waitForElementVisible('*[data-id="filepanel-login-github"]') + }, 'add a remote #group2': function (browser: NightwatchBrowser) { browser .pause(1000) diff --git a/libs/remix-ui/git/src/components/github/devicecode.tsx b/libs/remix-ui/git/src/components/github/devicecode.tsx index 9c74245bb0..e18a24856d 100644 --- a/libs/remix-ui/git/src/components/github/devicecode.tsx +++ b/libs/remix-ui/git/src/components/github/devicecode.tsx @@ -106,7 +106,7 @@ export const GetDeviceCode = () => { { (context.gitHubUser && context.gitHubUser.isConnected) ?
-
: null From 18117f7b11f81e619339ef6bd207ac7eaebb5b6b Mon Sep 17 00:00:00 2001 From: yann300 Date: Mon, 26 Aug 2024 09:17:39 +0200 Subject: [PATCH 34/39] remove css --- libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx b/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx index 19285b9f2b..2e5a72fd1e 100644 --- a/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx +++ b/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx @@ -974,8 +974,8 @@ export function Workspace() { tooltipText={} >
- logInGithub() } className="fa-brands fa-github-alt text-success ml-2 align-self-center" style={{ fontSize: '1.1rem' }} aria-hidden="true"> - logInGithub() } className="ml-1 text-success"> Sign in + logInGithub() } className="fa-brands fa-github-alt ml-2 align-self-center" style={{ fontSize: '1.1rem' }} aria-hidden="true"> + logInGithub() } className="ml-1"> Sign in
} From e510e308d31b25c277ee51e70b7c06a87e12759c Mon Sep 17 00:00:00 2001 From: yann300 Date: Mon, 26 Aug 2024 09:26:32 +0200 Subject: [PATCH 35/39] Update remix-ui-workspace.tsx --- libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx b/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx index 2e5a72fd1e..c6368e86fd 100644 --- a/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx +++ b/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx @@ -974,8 +974,8 @@ export function Workspace() { tooltipText={} >
- logInGithub() } className="fa-brands fa-github-alt ml-2 align-self-center" style={{ fontSize: '1.1rem' }} aria-hidden="true"> - logInGithub() } className="ml-1"> Sign in + logInGithub() } className="fa-brands fa-github-alt ml-2 align-self-center" style={{ fontSize: '1.1rem' }} style={{ cursor: 'pointer' }} aria-hidden="true"> + logInGithub() } className="ml-1 style={{ cursor: 'pointer' }} "> Sign in
} From 85c8b03c41e21eafa45ca20f8d13fb813281a791 Mon Sep 17 00:00:00 2001 From: yann300 Date: Mon, 26 Aug 2024 09:31:24 +0200 Subject: [PATCH 36/39] Update remix-ui-workspace.tsx --- libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx b/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx index c6368e86fd..f6bf6d4184 100644 --- a/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx +++ b/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx @@ -974,7 +974,7 @@ export function Workspace() { tooltipText={} >
- logInGithub() } className="fa-brands fa-github-alt ml-2 align-self-center" style={{ fontSize: '1.1rem' }} style={{ cursor: 'pointer' }} aria-hidden="true"> + logInGithub() } className="fa-brands fa-github-alt ml-2 align-self-center" style={{ fontSize: '1.1rem', cursor: 'pointer' }} aria-hidden="true"> logInGithub() } className="ml-1 style={{ cursor: 'pointer' }} "> Sign in
From 728c9f73344c4131ab2ed7ac5c7b48e89e64052b Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Tue, 27 Aug 2024 08:11:39 +0200 Subject: [PATCH 37/39] fix test --- apps/remix-ide-e2e/src/tests/dgit_github.test.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/apps/remix-ide-e2e/src/tests/dgit_github.test.ts b/apps/remix-ide-e2e/src/tests/dgit_github.test.ts index 2514b4823b..bfb3591900 100644 --- a/apps/remix-ide-e2e/src/tests/dgit_github.test.ts +++ b/apps/remix-ide-e2e/src/tests/dgit_github.test.ts @@ -343,8 +343,9 @@ module.exports = { }, // pagination test 'clone repo #group3': function (browser: NightwatchBrowser) { - browser. - clickLaunchIcon('dgit') + browser + .waitForElementVisible('*[data-id="clone-panel"]') + .click('*[data-id="clone-panel"]') .waitForElementVisible('*[data-id="clone-url"]') .setValue('*[data-id="clone-url"]', 'https://github.com/ethereum/awesome-remix') .waitForElementVisible('*[data-id="clone-branch"]') @@ -357,6 +358,8 @@ module.exports = { 'Update settings for git #group3': function (browser: NightwatchBrowser) { browser. clickLaunchIcon('dgit') + .waitForElementVisible('*[data-id="github-panel"]') + .click('*[data-id="github-panel"]') .setValue('*[data-id="githubToken"]', 'invalidtoken') .setValue('*[data-id="gitubUsername"]', 'git') .setValue('*[data-id="githubEmail"]', 'git@example.com') From 61cf0d200b3a170c2bde6ebed6a515a55994731c Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Tue, 27 Aug 2024 08:27:26 +0200 Subject: [PATCH 38/39] fix --- apps/remix-ide-e2e/src/tests/dgit_github.test.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/remix-ide-e2e/src/tests/dgit_github.test.ts b/apps/remix-ide-e2e/src/tests/dgit_github.test.ts index bfb3591900..daa7d17baa 100644 --- a/apps/remix-ide-e2e/src/tests/dgit_github.test.ts +++ b/apps/remix-ide-e2e/src/tests/dgit_github.test.ts @@ -344,6 +344,7 @@ module.exports = { // pagination test 'clone repo #group3': function (browser: NightwatchBrowser) { browser + .clickLaunchIcon('dgit') .waitForElementVisible('*[data-id="clone-panel"]') .click('*[data-id="clone-panel"]') .waitForElementVisible('*[data-id="clone-url"]') From 08813a49420c239eef218203014bc0d00636f70d Mon Sep 17 00:00:00 2001 From: yann300 Date: Wed, 28 Aug 2024 11:00:31 +0200 Subject: [PATCH 39/39] update lavel --- libs/remix-ui/git/src/components/github/devicecode.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/remix-ui/git/src/components/github/devicecode.tsx b/libs/remix-ui/git/src/components/github/devicecode.tsx index e18a24856d..3af8ab06df 100644 --- a/libs/remix-ui/git/src/components/github/devicecode.tsx +++ b/libs/remix-ui/git/src/components/github/devicecode.tsx @@ -81,7 +81,7 @@ export const GetDeviceCode = () => { + }}>Login with GitHub } {gitHubResponse && !authorized &&