Skip to content

Commit

Permalink
add polkadex-parachain and get polkadot-js new version
Browse files Browse the repository at this point in the history
  • Loading branch information
jiajing.chen committed Dec 4, 2023
1 parent 3add0de commit 5b5f022
Show file tree
Hide file tree
Showing 4,000 changed files with 236,583 additions and 49,098 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
2,931 changes: 2,698 additions & 233 deletions CHANGELOG.md

Large diffs are not rendered by default.

477 changes: 477 additions & 0 deletions CONTRIBUTORS

Large diffs are not rendered by default.

34 changes: 0 additions & 34 deletions Dockerfile

This file was deleted.

2 changes: 2 additions & 0 deletions I18N.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

The apps UI allows all strings to be translated. Additionally it has a basic UI that allows for the creation of the required translation files, which will give an overview on the progress for a specific language.


## Updating translations

To update translations, the following process is required.
Expand All @@ -15,6 +16,7 @@ Here you will find a dropdown of all the available languages and all the modules
- once completed with the changes, click the `Generate translation.json` button to download the translation file
- this file can now be added to the repo with a PR to https://github.com/polkadot-js/apps/tree/master/packages/apps/public/locales


## Adding a new language (if not in dropdown above)

The process is similar for the above, but does require a new folder with the language identifier to be added. Create [packages/apps/public/locales/<id>](https://github.com/polkadot-js/apps/tree/master/packages/apps/public/locales) folder with an empty `translation.json` (containing only `{}`). After addition of the folder, run `yarn build:i18n` and then the new language will be available for update as per the process in the previous section.
Expand Down
33 changes: 6 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
[![polkadotjs](https://img.shields.io/badge/polkadot-js-orange?style=flat-square)](https://polkadot.js.org)
![license](https://img.shields.io/badge/License-Apache%202.0-blue?logo=apache&style=flat-square)
[![maintainability](https://img.shields.io/codeclimate/maintainability-percentage/polkadot-js/apps?logo=code-climate&style=flat-square)](https://codeclimate.com/github/polkadot-js/apps)

# @polkadot/apps

A Portal into the Polkadot and Substrate networks. Provides a view and interaction layer from a browser.
Expand All @@ -12,29 +8,11 @@ If you run one or more IPFS node(s), pinning the UI (which only gets updated on

**Important** If you are a chain developer and would like to add support for your chain to the UI, all the local configuration (API types, settings, logos) can be customized in [the apps-config package](packages/apps-config#README.md), complete with instructions of what goes where.

## overview

The repo is split into a number of packages, each representing an application. These are -

- [apps](packages/apps/) This is the main entry point. It handles the selection sidebar and routing to the specific application being displayed.
- [apps-electron](packages/apps-electron/) Desktop app running [apps](packages/apps/).
- [page-accounts](packages/page-accounts/) A basic account management app.
- [page-address-book](packages/page-address-book/) A basic address management app.
- [page-democracy](packages/page-democracy/) A basic voting app, allowing votes on activate proposals and referenda.
- [page-explorer](packages/page-explorer/) A simple block explorer. It only shows the most recent blocks, updating as they become available.
- [page-extrinsics](packages/page-extrinsics/) Submission of extrinsics to a node.
- [page-js](packages/page-js/) An online code editor with [@polkadot-js/api](https://github.com/polkadot-js/api/tree/master/packages/api) access to the currently connected node.
- [page-settings](packages/page-settings/) A basic settings management app, allowing choice of language, node to connect to, and theme
- [page-staking](packages/page-staking/) A basic staking management app, allowing staking and nominations.
- [page-storage](packages/page-storage/) A simple node storage query application. Multiple queries can be queued and updates as new values become available.
- [page-toolbox](packages/page-toolbox/) Submission of raw data to RPC endpoints and utility hashing functions.
- [page-transfer](packages/page-transfer/) A basic account management app, allowing transfer of Units/DOTs between accounts.
## Overview

In addition the following libraries are also included in the repo. These are to be moved to the [@polkadot/ui](https://github.com/polkadot-js/ui/) repository once it reaches a base level of stability and usability. (At this point with the framework being tested on the apps above, it makes development easier having it close)
The repo is split into a number of packages, each representing an application.

- [react-components](packages/react-components/) A reactive (using RxJS) application framework with a number of useful shared components.
- [react-signer](packages/react-signer/) Signer implementation for apps.
- [react-query](packages/react-query) Base components that use the RxJS Observable APIs

## Development

Expand All @@ -45,12 +23,13 @@ To start off, this repo (along with others in the [@polkadot](https://github.com
To get started -

1. Clone the repo locally, via `git clone https://github.com/polkadot-js/apps <optional local path>`
2. Ensure that you have a recent LTS version of Node.js, for development purposes [Node >=10.13.0](https://nodejs.org/en/) is recommended.
3. Ensure that you have a recent version of Yarn, for development purposes [Yarn >=1.10.1](https://yarnpkg.com/docs/install) is required.
2. Ensure that you have a recent LTS version of Node.js, for development purposes [Node >= 16](https://nodejs.org/en/) is recommended.
3. Ensure that you have a recent version of Yarn, for development purposes [Yarn >= 1.22](https://yarnpkg.com/docs/install) is required.
4. Install the dependencies by running `yarn`
5. Ready! Now you can launch the UI (assuming you have a local Polkadot Node running), via `yarn run start`
6. Access the UI via [http://localhost:3000](http://localhost:3000)


## Docker

You can run a docker container via -
Expand All @@ -62,7 +41,7 @@ docker run --rm -it --name polkadot-ui -e WS_URL=ws://someip:9944 -p 80:80 jacog
To build a docker container containing local changes -

```
docker build -t jacogr/polkadot-js-apps .
docker build -t jacogr/polkadot-js-apps -f docker/Dockerfile .
```

When using these Docker commands, you can access the UI via http://localhost:80 (or just http://localhost)
Expand Down
5 changes: 0 additions & 5 deletions __mocks__/fileMock.js

This file was deleted.

4 changes: 0 additions & 4 deletions babel.config.js

This file was deleted.

36 changes: 36 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
FROM ubuntu:latest as builder

# Install any needed packages
RUN apt-get update && \
apt-get install --no-install-recommends -y build-essential curl git gnupg ca-certificates

# install nodejs
RUN curl -sL https://deb.nodesource.com/setup_lts.x | bash -
RUN apt-get install --no-install-recommends -y nodejs && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
RUN npm install yarn -g

WORKDIR /apps
COPY . .

RUN yarn && NODE_ENV=production yarn build:www

# ===========================================================
FROM nginx:stable-alpine

# The following is mainly for doc purpose to show which ENV is supported
ENV WS_URL=

WORKDIR /usr/share/nginx/html

COPY docker/env.sh .

RUN apk add --no-cache bash; chmod +x env.sh

COPY docker/nginx.conf /etc/nginx/nginx.conf
COPY --from=builder /apps/packages/apps/build /usr/share/nginx/html

EXPOSE 80

CMD ["/bin/bash", "-c", "/usr/share/nginx/html/env.sh && nginx -g \"daemon off;\""]
33 changes: 33 additions & 0 deletions docker/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/usr/bin/env bash
# Copyright 2017-2023 @polkadot/apps authors & contributors
# This software may be modified and distributed under the terms
# of the Apache-2.0 license. See the LICENSE file for details.

# fail fast on any non-zero exits
set -e

# the docker image name and dockerhub repo
NAME="polkadot-js-apps"
REPO="jacogr"

# extract the current npm version from package.json
VERSION=$(cat package.json \
| grep version \
| head -1 \
| awk -F: '{ print $2 }' \
| sed 's/[",]//g' \
| sed 's/ //g')

echo "*** Building $NAME"
docker build -t $NAME -f docker/Dockerfile .

docker login -u $REPO -p $DOCKER_PASS

echo "*** Tagging $REPO/$NAME"
if [[ $VERSION != *"beta"* ]]; then
docker tag $NAME $REPO/$NAME:$VERSION
fi
docker tag $NAME $REPO/$NAME

echo "*** Publishing $NAME"
docker push $REPO/$NAME
2 changes: 1 addition & 1 deletion env.sh → docker/env.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
# Copyright 2017-2020 @polkadot/apps authors & contributors
# Copyright 2017-2023 @polkadot/apps authors & contributors
# SPDX-License-Identifier: Apache-2.0

# This script is used when the docker container starts and does the magic to
Expand Down
17 changes: 0 additions & 17 deletions electron-builder.yml

This file was deleted.

16 changes: 16 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Copyright 2017-2023 @polkadot/apps authors & contributors
// SPDX-License-Identifier: Apache-2.0

import baseConfig from '@polkadot/dev/config/eslint';

export default [
...baseConfig,
{
rules: {
// add override for any (a metric ton of them, initial conversion)
'@typescript-eslint/no-explicit-any': 'off',
// we generally use this in isFunction, not via calling
'@typescript-eslint/unbound-method': 'off'
}
}
];
66 changes: 66 additions & 0 deletions i18next-scanner.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
// Copyright 2017-2023 @polkadot/apps authors & contributors
// SPDX-License-Identifier: Apache-2.0

const fs = require('fs');
const path = require('path');
const typescript = require('typescript');

const findPackages = require('./scripts/findPackages.cjs');

function transform (file, enc, done) {
const { ext } = path.parse(file.path);

if (ext === '.tsx') {
const { outputText } = typescript.transpileModule(fs.readFileSync(file.path, enc), {
compilerOptions: { target: 'es2018' },
fileName: path.basename(file.path)
});

this.parser.parseFuncFromString(outputText, (key, options) => {
options.defaultValue = key;

if (process.platform !== 'win32') {
options.ns = /packages\/(.*?)\/src/g.exec(file.path)[1].replace('page-', 'app-');
} else {
options.ns = /packages\\(.*?)\\src/g.exec(file.path)[1].replace('page-', 'app-');
}

this.parser.set(key, options);
});
}

done();
}

module.exports = {
input: [
'packages/*/src/**/*.{ts,tsx}',
// Use ! to filter out files or directories
'!packages/*/src/**/*.spec.{ts,tsx}',
'!packages/*/src/i18n/**',
'!**/node_modules/**'
],
options: {
debug: false, // true to print config
defaultLng: 'en',
func: {
extensions: ['.tsx', '.ts'],
list: ['t', 'i18next.t', 'i18n.t']
},
keySeparator: false, // key separator
lngs: ['en'],
ns: findPackages().map(({ dir }) => dir.replace('page-', 'app-')),
nsSeparator: false, // namespace separator
resource: {
jsonIndent: 2,
lineEnding: '\n',
loadPath: 'packages/apps/public/locales/{{lng}}/{{ns}}.json',
savePath: 'packages/apps/public/locales/{{lng}}/{{ns}}.json'
},
trans: {
component: 'Trans'
}
},
output: './',
transform
};
66 changes: 0 additions & 66 deletions i18next-scanner.config.js

This file was deleted.

Loading

0 comments on commit 5b5f022

Please sign in to comment.