Skip to content

Commit

Permalink
Generate tooltip library
Browse files Browse the repository at this point in the history
  • Loading branch information
ioedeveloper committed Jul 6, 2022
1 parent 0aa21b2 commit 59d8478
Show file tree
Hide file tree
Showing 15 changed files with 180 additions and 66 deletions.
12 changes: 12 additions & 0 deletions libs/remix-ui/tooltip-popup/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"presets": [
[
"@nrwl/react/babel",
{
"runtime": "automatic",
"useBuiltIns": "usage"
}
]
],
"plugins": []
}
18 changes: 18 additions & 0 deletions libs/remix-ui/tooltip-popup/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -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": {}
}
]
}
7 changes: 7 additions & 0 deletions libs/remix-ui/tooltip-popup/README.md
Original file line number Diff line number Diff line change
@@ -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).
1 change: 1 addition & 0 deletions libs/remix-ui/tooltip-popup/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './lib/tooltip-popup'
Empty file.
23 changes: 23 additions & 0 deletions libs/remix-ui/tooltip-popup/src/lib/tooltip-popup.tsx
Original file line number Diff line number Diff line change
@@ -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) => (
<Popover id="popover-basic" className='bg-light border-secondary'>
<Popover.Title as="h3" className='bg-dark border-0'>{ title || 'Tooltip' }</Popover.Title>
<Popover.Content>
{ content }
</Popover.Content>
</Popover>
)

export function TooltipPopup(props: TooltipPopupProps) {
return (
<OverlayTrigger trigger="click" placement={"bottom"} overlay={popover(props.title, props.children || props.content)}>
<i className={`${props.icon} remixui_menuicon pr-0 mr-2`}></i>
</OverlayTrigger>
)
}

export default TooltipPopup
6 changes: 6 additions & 0 deletions libs/remix-ui/tooltip-popup/src/types/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export interface TooltipPopupProps {
children?: React.ReactNode,
title?: string,
content?: string,
icon: string
}
20 changes: 20 additions & 0 deletions libs/remix-ui/tooltip-popup/tsconfig.json
Original file line number Diff line number Diff line change
@@ -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"
}
]
}
13 changes: 13 additions & 0 deletions libs/remix-ui/tooltip-popup/tsconfig.lib.json
Original file line number Diff line number Diff line change
@@ -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"]
}
6 changes: 5 additions & 1 deletion libs/remix-ui/workspace/src/lib/actions/workspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -323,5 +323,9 @@ export const getWorkspaces = async (): Promise<string[]> | 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)
}
23 changes: 0 additions & 23 deletions libs/remix-ui/workspace/src/lib/components/clone.tsx

This file was deleted.

30 changes: 26 additions & 4 deletions libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -14,6 +14,7 @@ export function Workspace () {
const workspaceRenameInput = useRef()
const workspaceCreateInput = useRef()
const workspaceCreateTemplateInput = useRef()
const cloneUrlRef = useRef<HTMLInputElement>()

useEffect(() => {
resetFocus()
Expand Down Expand Up @@ -125,6 +126,18 @@ export function Workspace () {
workspaceCreateInput.current.value = `${workspaceCreateTemplateInput.current.value || 'remixDefault'}_${Date.now()}`
}

const handleTypingUrl = (event: React.KeyboardEvent<HTMLInputElement>) => {
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 (
<>
Expand Down Expand Up @@ -215,8 +228,17 @@ export function Workspace () {
className='far fa-upload remixui_menuicon'
title='Restore Workspaces Backup'>
</span>
<CloneRepository>
</CloneRepository>
<TooltipPopup icon='fas fa-cloud-download' title='Clone Repository'>
<div className="remixui_cloneContainer">
<input
ref={cloneUrlRef}
className="form-control"
placeholder="Enter github repository url"
title="Enter github repository url"
onKeyDown={handleTypingUrl}
/>
</div>
</TooltipPopup>
</span>
<select id="workspacesSelect" value={currentWorkspace} data-id="workspacesSelect" onChange={(e) => switchWorkspace(e.target.value)} className="form-control custom-select">
{
Expand Down
11 changes: 3 additions & 8 deletions nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -169,14 +169,9 @@
},
"remix-ui-permission-handler": {
"tags": []
},
"remix-ui-tooltip-popup": {
"tags": []
}
},
"targetDependencies": {
"build": [
{
"target": "build",
"projects": "dependencies"
}
]
}
}
3 changes: 2 additions & 1 deletion tsconfig.base.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@
"@remix-ui/run-tab": ["libs/remix-ui/run-tab/src/index.ts"],
"@remix-ui/permission-handler": [
"libs/remix-ui/permission-handler/src/index.ts"
]
],
"@remix-ui/tooltip-popup": ["libs/remix-ui/tooltip-popup/src/index.ts"]
}
},
"exclude": ["node_modules", "tmp"]
Expand Down
73 changes: 44 additions & 29 deletions workspace.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,35 @@
{
"version": 1,
"cli": {
"defaultCollection": "@nrwl/react"
},
"defaultProject": "remix-ide",
"schematics": {
"@nrwl/workspace": {
"library": {
"linter": "eslint"
}
},
"@nrwl/react": {
"application": {
"style": "css",
"linter": "eslint",
"babel": true
},
"component": {
"style": "css"
},
"library": {
"style": "css",
"linter": "eslint"
}
},
"@nrwl/nx-plugin": {
"plugin": {
"linter": "eslint"
}
}
},
"projects": {
"remix-ide": {
"root": "apps/remix-ide",
Expand Down Expand Up @@ -1253,36 +1283,21 @@
}
}
}
}
},
"cli": {
"defaultCollection": "@nrwl/react"
},
"schematics": {
"@nrwl/workspace": {
"library": {
"linter": "eslint"
}
},
"@nrwl/react": {
"application": {
"style": "css",
"linter": "eslint",
"babel": true
},
"component": {
"style": "css"
},
"library": {
"style": "css",
"linter": "eslint"
}
},
"@nrwl/nx-plugin": {
"plugin": {
"linter": "eslint"
"remix-ui-tooltip-popup": {
"root": "libs/remix-ui/tooltip-popup",
"sourceRoot": "libs/remix-ui/tooltip-popup/src",
"projectType": "library",
"architect": {
"lint": {
"builder": "@nrwl/linter:eslint",
"options": {
"lintFilePatterns": [
"libs/remix-ui/tooltip-popup/**/*.{ts,tsx,js,jsx}"
]
}
}
}
}
},
"defaultProject": "remix-ide"
}
}

0 comments on commit 59d8478

Please sign in to comment.