Save settings

pull/5370/head
David Disu 2 years ago
parent e5a75561f3
commit cb9ce41797
  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 // api key settings
const saveGithubToken = () => { const saveGithubToken = () => {
props.saveTokenToast(githubToken) props.saveTokenToast(githubToken, githubUserName, githubEmail)
} }
const removeToken = () => { const removeToken = () => {
@ -41,7 +41,7 @@ export function GithubSettings (props: GithubSettingsProps) {
<div className="input-group text-secondary mb-0 h6"> <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 } /> <input id="gistaccesstoken" data-id="settingsTabGistAccessToken" type="password" className="form-control" onChange={(e) => handleChangeTokenState(e)} value={ githubToken } />
<div className="input-group-append"> <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> </div>
</div> </div>

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

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

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

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

Loading…
Cancel
Save