Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add quick-dapp plugin #4844

Merged
merged 22 commits into from
Aug 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions apps/quick-dapp/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "../../.eslintrc.json",
}
1 change: 1 addition & 0 deletions apps/quick-dapp/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Remix QuickDapp Plugin
11 changes: 11 additions & 0 deletions apps/quick-dapp/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "quick-dapp",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"dependencies": {
"@dnd-kit/core": "^6.1.0",
"@dnd-kit/sortable": "^8.0.0",
"@drafish/surge-client": "^1.1.5"
}
}
70 changes: 70 additions & 0 deletions apps/quick-dapp/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
{
"name": "quick-dapp",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "apps/quick-dapp/src",
"projectType": "application",
"implicitDependencies": [],
"targets": {
"build": {
"executor": "@nrwl/webpack:webpack",
"outputs": ["{options.outputPath}"],
"defaultConfiguration": "development",
"dependsOn": ["install"],
"options": {
"compiler": "babel",
"outputPath": "dist/apps/quick-dapp",
"index": "apps/quick-dapp/src/index.html",
"baseHref": "./",
"main": "apps/quick-dapp/src/main.tsx",
"polyfills": "apps/quick-dapp/src/polyfills.ts",
"tsConfig": "apps/quick-dapp/tsconfig.app.json",
"assets": ["apps/quick-dapp/src/profile.json", "apps/quick-dapp/src/assets/edit-dapp.png"],
"styles": ["apps/quick-dapp/src/index.css"],
"scripts": [],
"webpackConfig": "apps/quick-dapp/webpack.config.js"
},
"configurations": {
"development": {
},
"production": {
}
}
},
"lint": {
"executor": "@nrwl/linter:eslint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": ["apps/quick-dapp/**/*.ts"],
"eslintConfig": "apps/quick-dapp/.eslintrc"
}
},
"install": {
"executor": "nx:run-commands",
"options": {
"commands": [
"cd apps/quick-dapp && yarn"
],
"parallel": false
}
},
"serve": {
"executor": "@nrwl/webpack:dev-server",
"defaultConfiguration": "development",
"options": {
"buildTarget": "quick-dapp:build",
"hmr": true,
"baseHref": "/"
},
"configurations": {
"development": {
"buildTarget": "quick-dapp:build:development",
"port": 2025
},
"production": {
"buildTarget": "quick-dapp:build:production"
}
}
}
},
"tags": []
}
127 changes: 127 additions & 0 deletions apps/quick-dapp/src/App.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
/* You can add global styles to this file, and also import other style files */
drafish marked this conversation as resolved.
Show resolved Hide resolved

.item-wrapper {
transform: translate3d(var(--translate-x, 0), var(--translate-y, 0), 0)
scaleX(var(--scale-x, 1)) scaleY(var(--scale-y, 1));
transform-origin: 0 0;
touch-action: manipulation;

&:hover {
.item-remove {
visibility: visible;
}
}
}

.item-remove {
visibility: hidden;
top: 5px;
right: 5px;
width: 20px;
height: 20px;
background-color: var(--gray-dark);

.fas {
color: var(--text-bg-mark);
}
}

.item-action {
touch-action: none;
outline: none !important;
appearance: none;
background-color: transparent;
-webkit-tap-highlight-color: transparent;

@media (hover: hover) {
&:hover {
background-color: var(--light);
}
}

.fas {
color: var(--text-bg-mark);
}
}

.bg-light {
.item-action {
@media (hover: hover) {
&:hover {
background-color: var(--dark);
}
}
}
}

.container {
flex-direction: column;

&.placeholder {
justify-content: center;
align-items: center;
cursor: pointer;
}
}


.container-header {
&:hover {
.container-actions > * {
opacity: 1 !important;
}
}
}

.container-actions {
> *:first-child:not(:last-child) {
opacity: 0;

&:focus-visible {
opacity: 1;
}
}
}

.instance-input {
background-color: var(--custom-select) !important;
font-size: 10px;
}
.has-args {
border-top-right-radius: 0;
border-bottom-right-radius: 0;
}

.udapp_intro {
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
white-space: pre-wrap;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
}
.udapp_intro:hover {
-webkit-line-clamp: inherit;
}
.cursor_pointer {
cursor: pointer;
}
.cursor_pointer:hover {
color: var(--secondary);
}
.custom-dropdown-items {
padding: 0.25rem 0.25rem;
border-radius: .25rem;
background: var(--custom-select);
}

.custom-dropdown-items a {
border-radius: .25rem;
text-transform: none;
text-decoration: none;
font-weight: normal;
font-size: 0.875rem;
padding: 0.25rem 0.25rem;
width: auto;
color: var(--text);
}
71 changes: 71 additions & 0 deletions apps/quick-dapp/src/App.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
import React, { useEffect, useReducer, useState } from 'react';
import { IntlProvider } from 'react-intl'
import CreateInstance from './components/CreateInstance';
import EditInstance from './components/EditInstance';
import DeployPanel from './components/DeployPanel';
import LoadingScreen from './components/LoadingScreen';
import { appInitialState, appReducer } from './reducers/state';
import {
connectRemix,
initDispatch,
updateState,
selectTheme,
} from './actions';
import { AppContext } from './contexts';
import remixClient from './remix-client';
import './App.css';

function App(): JSX.Element {
const [locale, setLocale] = useState<{code: string; messages: any}>({
code: 'en',
messages: null,
})
const [appState, dispatch] = useReducer(appReducer, appInitialState);
useEffect(() => {
updateState(appState);
}, [appState]);
useEffect(() => {
initDispatch(dispatch);
updateState(appState);
connectRemix().then(() => {
remixClient.call('theme', 'currentTheme').then((theme: any) => {
selectTheme(theme.name);
});
remixClient.on('theme', 'themeChanged', (theme: any) => {
selectTheme(theme.name);
});
// @ts-ignore
remixClient.call('locale', 'currentLocale').then((locale: any) => {
setLocale(locale)
})
// @ts-ignore
remixClient.on('locale', 'localeChanged', (locale: any) => {
setLocale(locale)
})
});
}, []);
return (
<AppContext.Provider
value={{
dispatch,
appState,
}}
>
<IntlProvider locale={locale.code} messages={locale.messages}>
{Object.keys(appState.instance.abi).length > 0 ? (
<div className="row m-0 pt-3">
<EditInstance />
<DeployPanel />
</div>
) : (
<div className="row m-0 pt-3">
<CreateInstance />
</div>
)}
<LoadingScreen />
</IntlProvider>
</AppContext.Provider>
);
}

export default App;
Loading