Skip to content

Commit a1c61e4

Browse files
authored
Merge branch 'master' into desktope2e-remixai
2 parents 3761967 + bc83435 commit a1c61e4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+5782
-26
lines changed

CONTRIBUTING.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Then you can replace the string with a intl component. The `id` prop will be the
2727
+ <FormattedMessage id="home.learn" />
2828
</label>
2929
```
30-
In some cases, jsx maybe not acceptable, you can use `intl.formatMessage` .
30+
In some cases, jsx maybe not be acceptable, you can use `intl.formatMessage` .
3131
```jsx
3232
<input
3333
ref={searchInputRef}
@@ -77,7 +77,7 @@ const locales = [
7777
]
7878
```
7979
You can find the language's `code, name, localeName` in this link
80-
https://github.com/ethereum/ethereum-org-website/blob/dev/i18n/config.json
80+
https://github.com/ethereum/ethereum-org-website/blob/dev/i18n.config.json
8181

8282
### Whether or not to use `defaultMessage`?
8383
If you search `FormattedMessage` or `intl.formatMessage` in this project, you will notice that most of them only have a `id` prop, but a few of them have a `defaultMessage` prop.
@@ -92,7 +92,7 @@ But in some cases, the `id` prop may not be static. For example,
9292
<FormattedMessage id={plugin?.profile.name + '.displayName'} defaultMessage={plugin?.profile.displayName || plugin?.profile.name} />
9393
</h6>
9494
```
95-
You can't be sure there is a match key in locale file or not. So it will be better to provide a `defaultMessage` prop.
95+
You can't be sure whether there is a match key in locale file or not. So it will be better to provide a `defaultMessage` prop.
9696
9797
### Should I update the non-english locale json files?
9898
You probably will have this question when you are updating the english locale json files.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ git clone https://github.com/ethereum/remix-project.git
6868
2. Install dependencies: `yarn install` or simply run `yarn`
6969
3. Build Remix libraries: `yarn run build:libs`
7070
4. Build Remix project: `yarn build`
71-
5. Build and run project server: `yarn serve`. Optionally, run `yarn serve:hot` to enable hot module reload for frontend updates.
71+
5. Build and run project server: `yarn serve`. Optionally, run `yarn serve:hot` to enable hot module to reload for frontend updates.
7272

7373
Open `http://127.0.0.1:8080` in your browser to load Remix IDE locally.
7474

apps/quick-dapp/src/actions/index.ts

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ const { encodeFunctionId } = execution.txHelper;
1010

1111
const surgeClient = new SurgeClient({
1212
// surge backend doesn't support cross-domain, that's why the proxy goes
13-
// here is the codebase of proxy: https://github.com/drafish/vercel-proxy
14-
proxy: 'https://vercel-proxy-bice-six.vercel.app',
13+
// here is the codebase of proxy: https://github.com/remix-project-org/remix-wildcard/blob/master/src/hosts/common-corsproxy.ts
14+
proxy: 'https://common-corsproxy.remixproject.org/',
1515
onError: (err: Error) => {
1616
console.log(err);
1717
},
@@ -160,19 +160,10 @@ export const deploy = async (payload: any, callback: any) => {
160160
const { data } = await axios.get(
161161
// It's the json file contains all the static files paths of dapp-template.
162162
// It's generated through the build process automatically.
163-
'https://dev.remix-dapp.pages.dev/manifest.json'
163+
`${window.origin}/plugins/remix-dapp/manifest.json`
164164
);
165165

166-
let paths: any = [];
167-
168-
Object.keys(data).forEach((key) => {
169-
if (data[key].src === 'index.html') {
170-
const { src, file, css, assets } = data[key];
171-
paths = paths.concat([src, file, ...css, ...assets]);
172-
} else {
173-
paths.push(data[key].file);
174-
}
175-
});
166+
const paths = Object.keys(data);
176167

177168
const { logo, ...instance } = state.instance;
178169

@@ -183,7 +174,7 @@ export const deploy = async (payload: any, callback: any) => {
183174
})
184175

185176
const files: Record<string, string> = {
186-
'dir/instance.json': instanceJson,
177+
'dir/assets/instance.json': instanceJson,
187178
};
188179

189180
// console.log(
@@ -197,11 +188,11 @@ export const deploy = async (payload: any, callback: any) => {
197188
const path = paths[index];
198189
// download all the static files from the dapp-template domain.
199190
// here is the codebase of dapp-template: https://github.com/drafish/remix-dapp
200-
const resp = await axios.get(`https://dev.remix-dapp.pages.dev/${path}`);
191+
const resp = await axios.get(`${window.origin}/plugins/remix-dapp/${path}`);
201192
files[`dir/${path}`] = resp.data;
202193
}
203194

204-
files['dir/logo.png'] = logo
195+
files['dir/assets/logo.png'] = logo
205196
files['dir/CORS'] = '*'
206197
files['dir/index.html'] = files['dir/index.html'].replace(
207198
'assets/css/themes/remix-dark_tvx1s2.css',
@@ -236,7 +227,7 @@ export const deploy = async (payload: any, callback: any) => {
236227

237228
try {
238229
// some times deployment might fail even if it says successfully, that's why we need to do the double check.
239-
const instanceResp = await axios.get(`https://${payload.subdomain}.surge.sh/instance.json`);
230+
const instanceResp = await axios.get(`https://${payload.subdomain}.surge.sh/assets/instance.json`);
240231
if (instanceResp.status === 200 && JSON.stringify(instanceResp.data) === instanceJson) {
241232
callback({ code: 'SUCCESS', error: '' });
242233
return;

apps/remix-dapp/.eslintrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"extends": "../../.eslintrc.json",
3+
}

apps/remix-dapp/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Remix Dapp

apps/remix-dapp/package.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"name": "remix-dapp",
3+
"version": "1.0.0",
4+
"main": "index.js",
5+
"license": "MIT",
6+
"dependencies": {
7+
"webpack-manifest-plugin": "^5.0.0"
8+
}
9+
}

apps/remix-dapp/project.json

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
{
2+
"name": "remix-dapp",
3+
"$schema": "../../node_modules/nx/schemas/project-schema.json",
4+
"sourceRoot": "apps/remix-dapp/src",
5+
"projectType": "application",
6+
"implicitDependencies": [],
7+
"targets": {
8+
"build": {
9+
"executor": "@nrwl/webpack:webpack",
10+
"outputs": ["{options.outputPath}"],
11+
"defaultConfiguration": "development",
12+
"dependsOn": ["install"],
13+
"options": {
14+
"compiler": "babel",
15+
"outputPath": "dist/apps/remix-dapp",
16+
"index": "apps/remix-dapp/src/index.html",
17+
"baseHref": "./",
18+
"main": "apps/remix-dapp/src/main.tsx",
19+
"tsConfig": "apps/remix-dapp/tsconfig.app.json",
20+
"assets": ["apps/remix-dapp/src/assets/instance.json", "apps/remix-dapp/src/assets/logo.png"],
21+
"styles": ["apps/remix-dapp/src/App.css"],
22+
"scripts": [],
23+
"webpackConfig": "apps/remix-dapp/webpack.config.js"
24+
},
25+
"configurations": {
26+
"development": {
27+
},
28+
"production": {
29+
}
30+
}
31+
},
32+
"lint": {
33+
"executor": "@nrwl/linter:eslint",
34+
"outputs": ["{options.outputFile}"],
35+
"options": {
36+
"lintFilePatterns": ["apps/remix-dapp/**/*.ts"],
37+
"eslintConfig": "apps/remix-dapp/.eslintrc"
38+
}
39+
},
40+
"install": {
41+
"executor": "nx:run-commands",
42+
"options": {
43+
"commands": [
44+
"cd apps/remix-dapp && yarn"
45+
],
46+
"parallel": false
47+
}
48+
},
49+
"serve": {
50+
"executor": "@nrwl/webpack:dev-server",
51+
"defaultConfiguration": "development",
52+
"options": {
53+
"buildTarget": "remix-dapp:build",
54+
"hmr": true,
55+
"baseHref": "/"
56+
},
57+
"configurations": {
58+
"development": {
59+
"buildTarget": "remix-dapp:build:development",
60+
"port": 2026
61+
},
62+
"production": {
63+
"buildTarget": "remix-dapp:build:production"
64+
}
65+
}
66+
}
67+
},
68+
"tags": []
69+
}

apps/remix-dapp/src/App.css

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
.dragbar_terminal {
2+
left: 0px;
3+
top: 0px;
4+
height: 0.3em;
5+
}
6+
7+
.dragbar_terminal:hover,
8+
.dragbar_terminal.ondrag {
9+
background-color: var(--secondary);
10+
cursor: row-resize;
11+
}
12+
13+
.label_item {
14+
word-break: break-all;
15+
max-width: 90%;
16+
}
17+
.label_key {
18+
max-width: 65%;
19+
min-width: fit-content;
20+
}
21+
.label_value {
22+
min-width: 10%;
23+
}
24+
25+

apps/remix-dapp/src/App.tsx

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
import React, { useEffect, useReducer } from 'react';
2+
import { IntlProvider } from 'react-intl';
3+
import { ToastContainer } from 'react-toastify';
4+
import 'react-toastify/dist/ReactToastify.css';
5+
import { AppContext } from './contexts';
6+
import { appInitialState, appReducer } from './reducers/state';
7+
import { initDispatch, initInstance, updateState } from './actions';
8+
import enJson from './locales/en';
9+
import zhJson from './locales/zh';
10+
import esJson from './locales/es';
11+
import frJson from './locales/fr';
12+
import itJson from './locales/it';
13+
import './App.css';
14+
import { isMobile } from './utils/tools';
15+
import MobilePage from './components/Home/mobile';
16+
import PCPage from './components/Home/pc';
17+
18+
const localeMap: Record<string, any> = {
19+
zh: zhJson,
20+
en: enJson,
21+
fr: frJson,
22+
it: itJson,
23+
es: esJson,
24+
};
25+
26+
function App(): JSX.Element {
27+
const [appState, dispatch] = useReducer(appReducer, appInitialState);
28+
const selectedLocaleCode = appState.settings.selectedLocaleCode;
29+
useEffect(() => {
30+
updateState(appState);
31+
}, [appState]);
32+
useEffect(() => {
33+
initDispatch(dispatch);
34+
updateState(appState);
35+
initInstance();
36+
}, []);
37+
38+
return (
39+
<AppContext.Provider
40+
value={{
41+
dispatch,
42+
appState,
43+
}}
44+
>
45+
<IntlProvider
46+
locale={selectedLocaleCode}
47+
messages={localeMap[selectedLocaleCode]}
48+
>
49+
{isMobile() ? <MobilePage /> : <PCPage />}
50+
<ToastContainer
51+
position="bottom-right"
52+
newestOnTop
53+
closeOnClick
54+
rtl={false}
55+
pauseOnFocusLoss
56+
draggable
57+
pauseOnHover
58+
theme="colored"
59+
/>
60+
</IntlProvider>
61+
</AppContext.Provider>
62+
);
63+
}
64+
65+
export default App;

0 commit comments

Comments
 (0)