Save settings

pull/2554/head
David Disu 2 years ago
parent 0d7e25a972
commit af290ed9a7
  1. 4
      libs/remix-ui/settings/src/lib/github-settings.tsx
  2. 12
      libs/remix-ui/settings/src/lib/remix-ui-settings.tsx
  3. 2
      libs/remix-ui/settings/src/types/index.ts
  4. 12
      libs/remix-ui/workspace/src/lib/components/clone.tsx
  5. 8
      libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx

@ -21,7 +21,7 @@ export function GithubSettings (props: GithubSettingsProps) {
// api key settings
const saveGithubToken = () => {
props.saveTokenToast(githubToken)
props.saveTokenToast(githubToken, githubUserName, githubEmail)
}
const removeToken = () => {
@ -41,7 +41,7 @@ export function GithubSettings (props: GithubSettingsProps) {
<div className="input-group text-secondary mb-0 h6">
<input id="gistaccesstoken" data-id="settingsTabGistAccessToken" type="password" className="form-control" onChange={(e) => handleChangeTokenState(e)} value={ githubToken } />
<div className="input-group-append">
<CopyToClipboard content={githubToken} data-id='copyToClipboardCopyIcon' className='input-group-text far fa-copy ml-1 p-2 h-100' direction={"top"} />
<CopyToClipboard content={githubToken} data-id='copyToClipboardCopyIcon' className='far fa-copy ml-1 p-2 mt-1' direction={"top"} />
</div>
</div>
</div>

@ -349,8 +349,16 @@ export const RemixUiSettings = (props: RemixUiSettingsProps) => {
{state.message ? <Toaster message= {state.message}/> : null}
{generalConfig()}
<GithubSettings
saveTokenToast={(githubToken: string) => { saveTokenToast(props.config, dispatchToast, githubToken, "gist-access-token") }}
removeTokenToast={() => { removeTokenToast(props.config, dispatchToast, "gist-access-token") }}
saveTokenToast={(githubToken: string, githubUserName: string, githubEmail: string) => {
saveTokenToast(props.config, dispatchToast, githubToken, "gist-access-token")
saveTokenToast(props.config, dispatchToast, githubUserName, "github-user-name")
saveTokenToast(props.config, dispatchToast, githubEmail, "github-email")
}}
removeTokenToast={() => {
removeTokenToast(props.config, dispatchToast, "gist-access-token")
removeTokenToast(props.config, dispatchToast, "github-user-name")
removeTokenToast(props.config, dispatchToast, "github-email")
}}
/>
{token('etherscan')}
{swarmSettings()}

@ -1,4 +1,4 @@
export interface GithubSettingsProps {
saveTokenToast: (githubToken: string) => void,
saveTokenToast: (githubToken: string, githubUserName: string, githubEmail: string) => void,
removeTokenToast: () => void
}

@ -3,21 +3,21 @@ import { OverlayTrigger, Popover } from 'react-bootstrap';
const popover = (
<Popover id="popover-basic" className='bg-light border-secondary'>
<Popover.Title as="h3" className='bg-dark border-0'>Clone workspace</Popover.Title>
<Popover.Title as="h3" className='bg-dark border-0'>Clone Repository</Popover.Title>
<Popover.Content>
<div className="remixui_cloneContainer">
<input
className="form-control"
placeholder="Enter clone url"
title="Enter clone url"
placeholder="Enter github repository url"
title="Enter github repository url"
/>
</div>
</Popover.Content>
</Popover>
)
export const CloneWorkspace = () => (
<OverlayTrigger trigger="click" placement={"bottom-end"} overlay={popover}>
<i className="fas fa-cloud-download remixui_menuicon pr-0"></i>
export const CloneRepository = () => (
<OverlayTrigger trigger="click" placement={"bottom"} overlay={popover}>
<i className="fas fa-cloud-download remixui_menuicon"></i>
</OverlayTrigger>
)

@ -2,7 +2,7 @@ import React, { useState, useEffect, useRef, useContext } from 'react' // eslint
import { FileExplorer } from './components/file-explorer' // eslint-disable-line
import './css/remix-ui-workspace.css'
import { FileSystemContext } from './contexts'
import { CloneWorkspace } from './components/clone'
import { CloneRepository } from './components/clone'
const canUpload = window.File || window.FileReader || window.FileList || window.Blob
@ -159,7 +159,6 @@ export function Workspace () {
<label className="form-check-label" htmlFor="workspacesSelect">
Workspaces
</label>
<div className="d-flex justify-content-between">
<span className="remixui_menu">
<span
hidden={currentWorkspace === LOCALHOST}
@ -216,11 +215,8 @@ export function Workspace () {
className='far fa-upload remixui_menuicon'
title='Restore Workspaces Backup'>
</span>
<CloneRepository />
</span>
<span className="remixui_menu">
<CloneWorkspace />
</span>
</div>
<select id="workspacesSelect" value={currentWorkspace} data-id="workspacesSelect" onChange={(e) => switchWorkspace(e.target.value)} className="form-control custom-select">
{
global.fs.browser.workspaces

Loading…
Cancel
Save