diff --git a/libs/remix-ui/tooltip-popup/.babelrc b/libs/remix-ui/tooltip-popup/.babelrc new file mode 100644 index 0000000000..ccae900be4 --- /dev/null +++ b/libs/remix-ui/tooltip-popup/.babelrc @@ -0,0 +1,12 @@ +{ + "presets": [ + [ + "@nrwl/react/babel", + { + "runtime": "automatic", + "useBuiltIns": "usage" + } + ] + ], + "plugins": [] +} diff --git a/libs/remix-ui/tooltip-popup/.eslintrc.json b/libs/remix-ui/tooltip-popup/.eslintrc.json new file mode 100644 index 0000000000..50e59482cf --- /dev/null +++ b/libs/remix-ui/tooltip-popup/.eslintrc.json @@ -0,0 +1,18 @@ +{ + "extends": ["plugin:@nrwl/nx/react", "../../../.eslintrc.json"], + "ignorePatterns": ["!**/*"], + "overrides": [ + { + "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], + "rules": {} + }, + { + "files": ["*.ts", "*.tsx"], + "rules": {} + }, + { + "files": ["*.js", "*.jsx"], + "rules": {} + } + ] +} diff --git a/libs/remix-ui/tooltip-popup/README.md b/libs/remix-ui/tooltip-popup/README.md new file mode 100644 index 0000000000..91bf0a3a7d --- /dev/null +++ b/libs/remix-ui/tooltip-popup/README.md @@ -0,0 +1,7 @@ +# remix-ui-tooltip-popup + +This library was generated with [Nx](https://nx.dev). + +## Running unit tests + +Run `nx test remix-ui-tooltip-popup` to execute the unit tests via [Jest](https://jestjs.io). diff --git a/libs/remix-ui/tooltip-popup/src/index.ts b/libs/remix-ui/tooltip-popup/src/index.ts new file mode 100644 index 0000000000..cad02e8853 --- /dev/null +++ b/libs/remix-ui/tooltip-popup/src/index.ts @@ -0,0 +1 @@ +export * from './lib/tooltip-popup' diff --git a/libs/remix-ui/tooltip-popup/src/lib/tooltip-popup.module.css b/libs/remix-ui/tooltip-popup/src/lib/tooltip-popup.module.css new file mode 100644 index 0000000000..e69de29bb2 diff --git a/libs/remix-ui/tooltip-popup/src/lib/tooltip-popup.tsx b/libs/remix-ui/tooltip-popup/src/lib/tooltip-popup.tsx new file mode 100644 index 0000000000..b1a22b5726 --- /dev/null +++ b/libs/remix-ui/tooltip-popup/src/lib/tooltip-popup.tsx @@ -0,0 +1,23 @@ +import React from 'react' +import { OverlayTrigger, Popover } from 'react-bootstrap' +import { TooltipPopupProps } from '../types' +import './tooltip-popup.module.css' + +const popover = (title?: string, content?: string | React.ReactNode) => ( + + { title || 'Tooltip' } + + { content } + + +) + +export function TooltipPopup(props: TooltipPopupProps) { + return ( + + + + ) +} + +export default TooltipPopup diff --git a/libs/remix-ui/tooltip-popup/src/types/index.ts b/libs/remix-ui/tooltip-popup/src/types/index.ts new file mode 100644 index 0000000000..747c392c4c --- /dev/null +++ b/libs/remix-ui/tooltip-popup/src/types/index.ts @@ -0,0 +1,6 @@ +export interface TooltipPopupProps { + children?: React.ReactNode, + title?: string, + content?: string, + icon: string +} diff --git a/libs/remix-ui/tooltip-popup/tsconfig.json b/libs/remix-ui/tooltip-popup/tsconfig.json new file mode 100644 index 0000000000..8bd701c578 --- /dev/null +++ b/libs/remix-ui/tooltip-popup/tsconfig.json @@ -0,0 +1,20 @@ +{ + "extends": "../../../tsconfig.base.json", + "compilerOptions": { + "jsx": "react-jsx", + "allowJs": true, + "esModuleInterop": true, + "allowSyntheticDefaultImports": true, + "forceConsistentCasingInFileNames": true, + "strict": true, + "noImplicitReturns": true, + "noFallthroughCasesInSwitch": true + }, + "files": [], + "include": [], + "references": [ + { + "path": "./tsconfig.lib.json" + } + ] +} diff --git a/libs/remix-ui/tooltip-popup/tsconfig.lib.json b/libs/remix-ui/tooltip-popup/tsconfig.lib.json new file mode 100644 index 0000000000..b560bc4dec --- /dev/null +++ b/libs/remix-ui/tooltip-popup/tsconfig.lib.json @@ -0,0 +1,13 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "../../../dist/out-tsc", + "types": ["node"] + }, + "files": [ + "../../../node_modules/@nrwl/react/typings/cssmodule.d.ts", + "../../../node_modules/@nrwl/react/typings/image.d.ts" + ], + "exclude": ["**/*.spec.ts", "**/*.spec.tsx"], + "include": ["**/*.js", "**/*.jsx", "**/*.ts", "**/*.tsx"] +} diff --git a/libs/remix-ui/workspace/src/lib/actions/workspace.ts b/libs/remix-ui/workspace/src/lib/actions/workspace.ts index 154a9e9968..ea1da26338 100644 --- a/libs/remix-ui/workspace/src/lib/actions/workspace.ts +++ b/libs/remix-ui/workspace/src/lib/actions/workspace.ts @@ -323,5 +323,9 @@ export const getWorkspaces = async (): Promise | undefined => { } export const cloneRepository = async (url: string) => { - console.log('url: ', url) + const config = plugin.registry.get('config').api + const token = config.get('currentFile') + const repoConfig = { url, token } + + plugin.call('dGitProvider', 'clone', repoConfig) } diff --git a/libs/remix-ui/workspace/src/lib/components/clone.tsx b/libs/remix-ui/workspace/src/lib/components/clone.tsx deleted file mode 100644 index 95ec9c6d88..0000000000 --- a/libs/remix-ui/workspace/src/lib/components/clone.tsx +++ /dev/null @@ -1,23 +0,0 @@ -import React from 'react' -import { OverlayTrigger, Popover } from 'react-bootstrap'; - -const popover = ( - - Clone Repository - -
- -
-
-
-) - -export const CloneRepository = () => ( - - - -) 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 0cf5b93feb..f70bf31612 100644 --- a/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx +++ b/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx @@ -1,8 +1,8 @@ import React, { useState, useEffect, useRef, useContext } from 'react' // eslint-disable-line import { FileExplorer } from './components/file-explorer' // eslint-disable-line -import './css/remix-ui-workspace.css' import { FileSystemContext } from './contexts' -import { CloneRepository } from './components/clone' +import { TooltipPopup } from '@remix-ui/tooltip-popup' +import './css/remix-ui-workspace.css' const canUpload = window.File || window.FileReader || window.FileList || window.Blob @@ -14,6 +14,7 @@ export function Workspace () { const workspaceRenameInput = useRef() const workspaceCreateInput = useRef() const workspaceCreateTemplateInput = useRef() + const cloneUrlRef = useRef() useEffect(() => { resetFocus() @@ -125,6 +126,18 @@ export function Workspace () { workspaceCreateInput.current.value = `${workspaceCreateTemplateInput.current.value || 'remixDefault'}_${Date.now()}` } + const handleTypingUrl = (event: React.KeyboardEvent) => { + if (event.key === 'Enter') { + const url = cloneUrlRef.current.value + + if (url) { + global.dispatchCloneRepository() + } else { + console.log('Please provide a valid github repository url.') + } + } + } + const createModalMessage = () => { return ( <> @@ -215,8 +228,17 @@ export function Workspace () { className='far fa-upload remixui_menuicon' title='Restore Workspaces Backup'> - - + +
+ +
+