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 27d5a7b832..605dcae501 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 @@ -8,6 +8,7 @@ import DragBar from './components/dragbar/dragbar' import { AppProvider } from './context/provider' import AppDialogs from './components/modals/dialogs' import DialogViewPlugin from './components/modals/dialogViewPlugin' +import { Permissionhandler } from '@remix-ui/permission-handler' interface IRemixAppUi { app: any @@ -104,6 +105,7 @@ const RemixApp = (props: IRemixAppUi) => { {components.hiddenPanel} + ) } diff --git a/libs/remix-ui/permission-handler/.babelrc b/libs/remix-ui/permission-handler/.babelrc new file mode 100644 index 0000000000..64a3748691 --- /dev/null +++ b/libs/remix-ui/permission-handler/.babelrc @@ -0,0 +1,4 @@ +{ + "presets": ["@nrwl/react/babel"], + "plugins": [] +} \ No newline at end of file diff --git a/libs/remix-ui/permission-handler/.eslintrc.json b/libs/remix-ui/permission-handler/.eslintrc.json new file mode 100644 index 0000000000..5a1c541d11 --- /dev/null +++ b/libs/remix-ui/permission-handler/.eslintrc.json @@ -0,0 +1,18 @@ +{ + "extends": ["plugin:@nrwl/nx/react", "../../../.eslintrc"], + "ignorePatterns": ["!**/*"], + "overrides": [ + { + "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], + "rules": {} + }, + { + "files": ["*.ts", "*.tsx"], + "rules": {} + }, + { + "files": ["*.js", "*.jsx"], + "rules": {} + } + ] +} \ No newline at end of file diff --git a/libs/remix-ui/permission-handler/src/index.ts b/libs/remix-ui/permission-handler/src/index.ts new file mode 100644 index 0000000000..6e662ed485 --- /dev/null +++ b/libs/remix-ui/permission-handler/src/index.ts @@ -0,0 +1 @@ +export { default as Permissionhandler } from './lib/permission-handler' diff --git a/libs/remix-ui/permission-handler/src/interface/index.ts b/libs/remix-ui/permission-handler/src/interface/index.ts new file mode 100644 index 0000000000..7fbbbaaa34 --- /dev/null +++ b/libs/remix-ui/permission-handler/src/interface/index.ts @@ -0,0 +1,13 @@ +import { IconProfile } from 'libs/remix-ui/vertical-icons-panel/src/lib/components/Icon' + +export interface PermissionHandlerValue { + from: IconProfile, + to: IconProfile, + remember: boolean, + method: string, + message: string +} + +export interface PermissionHandlerProps { + value: PermissionHandlerValue +} diff --git a/libs/remix-ui/permission-handler/src/lib/permission-dialog.tsx b/libs/remix-ui/permission-handler/src/lib/permission-dialog.tsx new file mode 100644 index 0000000000..4550064754 --- /dev/null +++ b/libs/remix-ui/permission-handler/src/lib/permission-dialog.tsx @@ -0,0 +1,63 @@ +import React, { useContext, useEffect, useRef, useState } from 'react' // eslint-disable-line +import { PermissionHandlerProps } from '../interface' +import './permission-dialog.css' + +const PermissionHandlerDialog = (props: PermissionHandlerProps) => { + const { from, to, remember, method, message } = props.value + + const switchMode = () => { + + } + + const rememberSwitch = () => { + return + } + const reset = () => { + + } + + const imgFrom = () => { return } + const imgTo = () => { return } + const pluginsImages = () => { + return ( +
+ {imgFrom} + + {imgTo} +
+ ) + } + + const text = () => { + return `"${from.displayName}" ${(remember ? 'has changed and' : '')} would like to access to "${method}" of "${to.displayName}"` + } + + const pluginMessage = () => { + return message + ?
+
Description
+

{message}

+
: null + } + + return (
+ {pluginsImages} +
+

{text} :

+
{from.displayName}
+

{from.description} || No description Provided

+
{to.displayName} :
+

{to.description} || No description Provided

+ {pluginMessage} +
+
+
+ {rememberSwitch} + +
+ +
+
) +} + +export default PermissionHandlerDialog diff --git a/libs/remix-ui/permission-handler/src/lib/permission-handler.tsx b/libs/remix-ui/permission-handler/src/lib/permission-handler.tsx new file mode 100644 index 0000000000..f6b06c23f4 --- /dev/null +++ b/libs/remix-ui/permission-handler/src/lib/permission-handler.tsx @@ -0,0 +1,25 @@ +import { useDialogDispatchers } from 'libs/remix-ui/app/src/lib/remix-app/context/provider' +import React, { useContext, useEffect, useRef, useState } from 'react' // eslint-disable-line +import { PermissionHandlerValue } from '../interface' +import PermissionHandlerDialog from './permission-dialog' + +const PermissionHandler = () => { + const { alert, toast, modal } = useDialogDispatchers() + const [value, setValue] = useState() + useEffect(() => { + if (value) { + modal({ + id: 'PermissionHandler', + title: 'permissions', + message: , + okFn: () => {}, + cancelFn: () => {}, + okLabel: 'sure', + cancelLabel: 'no' + }) + } + }, [value]) + return (<>) +} + +export default PermissionHandler diff --git a/libs/remix-ui/permission-handler/tsconfig.json b/libs/remix-ui/permission-handler/tsconfig.json new file mode 100644 index 0000000000..8bd701c578 --- /dev/null +++ b/libs/remix-ui/permission-handler/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/permission-handler/tsconfig.lib.json b/libs/remix-ui/permission-handler/tsconfig.lib.json new file mode 100644 index 0000000000..b560bc4dec --- /dev/null +++ b/libs/remix-ui/permission-handler/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/nx.json b/nx.json index 5f50461adc..7f7de57643 100644 --- a/nx.json +++ b/nx.json @@ -159,6 +159,9 @@ }, "remix-ui-run-tab": { "tags": [] + }, + "remix-ui-permission-handler": { + "tags": [] } }, "targetDependencies": { diff --git a/tsconfig.base.json b/tsconfig.base.json index c483b6f07e..8105a813ef 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -76,7 +76,8 @@ "@remix-ui/panel": ["libs/remix-ui/panel/src/index.ts"], "@remix-ui/editor-context-view": ["libs/remix-ui/editor-context-view/src/index.ts"], "@remix-ui/solidity-unit-testing": ["libs/remix-ui/solidity-unit-testing/src/index.ts"], - "@remix-ui/run-tab": ["libs/remix-ui/run-tab/src/index.ts"] + "@remix-ui/run-tab": ["libs/remix-ui/run-tab/src/index.ts"], + "@remix-ui/permission-handler": ["libs/remix-ui/permission-handler/src/index.ts"] } }, "exclude": ["node_modules", "tmp"] diff --git a/workspace.json b/workspace.json index fa7930463c..5ff3f1ca9f 100644 --- a/workspace.json +++ b/workspace.json @@ -1170,6 +1170,21 @@ } } } + }, + "remix-ui-permission-handler": { + "root": "libs/remix-ui/permission-handler", + "sourceRoot": "libs/remix-ui/permission-handler/src", + "projectType": "library", + "architect": { + "lint": { + "builder": "@nrwl/linter:lint", + "options": { + "linter": "eslint", + "tsConfig": ["libs/remix-ui/permission-handler/tsconfig.lib.json"], + "exclude": ["**/node_modules/**", "libs/remix-ui/permission-handler/**/*.d.ts", "!libs/remix-ui/permission-handler/**/*"] + } + } + } } }, "cli": {