Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/develop' into feat/moonbean-ne…
Browse files Browse the repository at this point in the history
…twork
  • Loading branch information
developerfred committed Mar 24, 2022
2 parents d3f1475 + b102233 commit 130c04e
Show file tree
Hide file tree
Showing 668 changed files with 11,779 additions and 7,825 deletions.
1 change: 0 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"ecmaVersion": 2020,
"sourceType": "module"
},
"extends": ["plugin:prettier/recommended"],
"env": {
"node": true
},
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/linters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,11 @@ jobs:
node-version: "16"
cache: "pnpm"
- run: pnpm install
- run: pnpm run lint:ci
- name: Run Eslint
run: |
# report to stdio and to file, it's cached, the second run should be fast
pnpm run lint:ci
pnpm run lint:ci-report
- name: Upload eslint report
uses: actions/upload-artifact@v2
with:
Expand Down
12 changes: 12 additions & 0 deletions .i18n-codegen.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,18 @@
"sourceMap": "inline"
}
},
{
"input": "./packages/shared-base-ui/src/locales/en-US.json",
"output": "./packages/shared-base-ui/src/locales/i18n_generated",
"parser": "i18next",
"generator": {
"type": "i18next/react-hooks",
"hooks": "useSharedBaseI18N",
"namespace": "shareBase",
"trans": "SharedBaseTrans",
"sourceMap": "inline"
}
},
{
"input": "./packages/dashboard/src/locales/en-US.json",
"output": "./packages/dashboard/src/locales/i18n_generated",
Expand Down
7 changes: 7 additions & 0 deletions cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
"elec",
"encryptedmsg",
"endregion",
"enhanceable",
"ethersphere",
"ethersproject",
"eustatius",
Expand Down Expand Up @@ -131,6 +132,7 @@
"linkedin",
"linkswap",
"locationchange",
"lockdown",
"maarten",
"macbinary",
"majeure",
Expand All @@ -144,6 +146,7 @@
"masktext",
"mastdon",
"mayen",
"mdex",
"merkel",
"merkle",
"metas",
Expand Down Expand Up @@ -269,6 +272,7 @@
"xlarge",
"xlink",
"zerion",
"zora",
"zubin"
],
"ignoreWords": [
Expand All @@ -291,8 +295,10 @@
"cotm",
"cryptoart",
"cryptoartai",
"csrftoken",
"cusd",
"defi",
"deletable",
"devnet",
"drawed",
"energi",
Expand Down Expand Up @@ -369,6 +375,7 @@
"switcher",
"testweb",
"tinycolor",
"tipable",
"treeshake",
"txreceipt",
"txts",
Expand Down
3 changes: 1 addition & 2 deletions docs/rfc/000-Payload-v37.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,7 @@ enum PublicKeyAlgorithmEnum {

This field represents the format version.

The first and the current binary version is `-37`.
The implementation MUST fail when the version is less than `-37` (e.g. `-38`).
The first and the current binary version is `0`.

#### `authorNetwork` field

Expand Down
50 changes: 25 additions & 25 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,40 +18,42 @@
"build": "build",
"build-ios": "build --preset iOS",
"lint": "eslint -c packages/.eslintrc.json packages --ext .ts,.tsx,.js --cache --fix",
"lint:ci": "eslint -c packages/.eslintrc.json packages --ext .ts,.tsx,.js --cache --format=junit --output-file=reports/junit/eslint-results.xml",
"lint:ci": "eslint -c packages/.eslintrc.json packages --ext .ts,.tsx,.js --cache",
"lint:ci-report": "pnpm lint:ci -- --format=junit --output-file=reports/junit/eslint-results.xml",
"postinstall": "patch-package",
"prepare": "husky install",
"test": "node --experimental-vm-modules ./node_modules/jest/bin/jest.js",
"test:update": "node --experimental-vm-modules ./node_modules/jest/bin/jest.js -u",
"spellcheck": "cspell lint --no-must-find-files"
},
"dependencies": {
"@dimensiondev/kit": "0.0.0-20220223101101-4e6f3b9",
"@emotion/cache": "^11.7.1",
"@emotion/react": "^11.8.1",
"@emotion/react": "^11.8.2",
"@emotion/serialize": "^1.0.2",
"@emotion/styled": "^11.8.1",
"@emotion/utils": "^1.1.0",
"@mui/icons-material": "5.4.4",
"@mui/lab": "5.0.0-alpha.71",
"@mui/material": "5.4.4",
"@mui/system": "5.4.4",
"@mui/icons-material": "5.5.1",
"@mui/lab": "5.0.0-alpha.74",
"@mui/material": "5.5.2",
"@mui/system": "5.5.2",
"@types/masknet__global-types": "workspace:*",
"@types/react": "^17.0.39",
"@types/react-dom": "17.0.11",
"@types/web": "^0.0.54",
"i18next": "^21.6.13",
"@types/react": "^17.0.42",
"@types/react-dom": "17.0.14",
"@types/web": "^0.0.59",
"i18next": "^21.6.14",
"lodash": "^4.17.21",
"lodash-es": "^4.17.21",
"lodash-unified": "1.0.2",
"react": "18.0.0-rc.0",
"react-dom": "18.0.0-rc.0",
"react-i18next": "^11.15.5",
"react": "18.0.0-rc.3",
"react-dom": "18.0.0-rc.3",
"react-i18next": "^11.16.1",
"ts-results": "3.3.0",
"web3-core": "1.5.2",
"web3-core-method": "1.5.2"
},
"devDependencies": {
"@commitlint/cli": "^16.2.1",
"@commitlint/cli": "^16.2.3",
"@commitlint/config-conventional": "^16.2.1",
"@dimensiondev/eslint-plugin": "^0.0.1-20220117062517-fd3cb01",
"@dimensiondev/patch-package": "^6.5.0",
Expand All @@ -62,28 +64,26 @@
"@nice-labs/git-rev": "^3.5.0",
"@swc/core": "^1.2.148",
"@types/lodash-es": "^4.17.6",
"@typescript-eslint/experimental-utils": "^5.13.0",
"cspell": "^5.18.5",
"eslint": "8.10.0",
"eslint-config-prettier": "^8.5.0",
"@typescript-eslint/experimental-utils": "^5.16.0",
"cspell": "^5.19.2",
"eslint": "8.11.0",
"eslint-plugin-import": "2.25.4",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-react": "^7.29.3",
"eslint-plugin-react": "^7.29.4",
"eslint-plugin-react-hooks": "^4.3.0",
"eslint-plugin-unicorn": "^41.0.0",
"eslint-plugin-unicorn": "^41.0.1",
"eslint-plugin-unused-imports": "^2.0.0",
"gulp": "^4.0.2",
"husky": "^7.0.4",
"jest": "^28.0.0-alpha.3",
"lint-staged": "^12.3.4",
"prettier": "^2.5.1",
"lint-staged": "^12.3.7",
"prettier": "^2.6.0",
"ts-jest": "^27.1.3",
"ts-node": "^10.6.0",
"ts-node": "^10.7.0",
"typescript": "4.6.2"
},
"pnpm": {
"overrides": {
"@types/node": "^17.0.17"
"@types/node": "^17.0.23"
},
"onlyBuiltDependencies": []
}
Expand Down
3 changes: 1 addition & 2 deletions packages/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"react/self-closing-comp": ["warn", { "component": true, "html": true }],
"react-hooks/exhaustive-deps": "off",
"react-hooks/rules-of-hooks": "error",
"import/no-deprecated": "error",
"import/no-deprecated": "off",
"import/no-duplicates": "error",
"unicorn/better-regex": "error",
"unicorn/catch-error-name": ["error", { "ignore": ["^err$"] }],
Expand All @@ -65,7 +65,6 @@
"unicorn/prefer-number-properties": "error",
"unicorn/relative-url-style": ["error", "always"],
"unicorn/throw-new-error": "error",
"unused-imports/no-unused-imports-ts": "error",
"@dimensiondev/no-jsx-template-literal": "error",
"@dimensiondev/no-locale-case": "error",
"@dimensiondev/no-number-constructor": "off",
Expand Down
18 changes: 9 additions & 9 deletions packages/dashboard/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,28 +20,28 @@
"@masknet/public-api": "workspace:*",
"@masknet/shared": "workspace:*",
"@masknet/shared-base": "workspace:*",
"@masknet/shared-base-ui": "workspace:*",
"@masknet/storybook-shared": "workspace:*",
"@masknet/theme": "workspace:*",
"@masknet/web3-providers": "workspace:*",
"@masknet/web3-shared-base": "workspace:*",
"@masknet/web3-shared-evm": "workspace:*",
"@msgpack/msgpack": "^2.7.2",
"@servie/events": "^3.0.0",
"@types/color": "^3.0.3",
"@types/react-avatar-editor": "^10.3.6",
"async-call-rpc": "^6.0.1",
"async-call-rpc": "^6.0.2",
"bignumber.js": "^9.0.2",
"classnames": "^2.3.1",
"color": "^4.2.1",
"date-fns": "2.28.0",
"history": "^5.2.0",
"html-to-image": "^1.9.0",
"i18next-browser-languagedetector": "^6.1.3",
"i18next-browser-languagedetector": "^6.1.4",
"json-stable-stringify": "^1.0.1",
"react-avatar-editor": "^12.0.0",
"react-hook-form": "^7.27.1",
"react-hook-form": "^7.28.1",
"react-qrcode-logo": "^2.5.0",
"react-router": "6.0.0-beta.0",
"react-router-dom": "6.0.0-beta.0",
"react-router-dom": "^6.2.2",
"react-to-print": "^2.14.4",
"react-use": "^17.3.2",
"unstated-next": "^1.1.0",
Expand All @@ -51,17 +51,17 @@
"wallet.ts": "^1.0.1",
"web3-core-helpers": "1.5.2",
"web3-utils": "^1.5.3",
"zod": "^3.13.4"
"zod": "^3.14.2"
},
"devDependencies": {
"@babel/core": "^7.17.5",
"@babel/core": "^7.17.8",
"@storybook/addon-actions": "^6.4.19",
"@storybook/addon-essentials": "^6.4.19",
"@storybook/addon-links": "^6.4.19",
"@storybook/builder-webpack5": "^6.4.19",
"@storybook/manager-webpack5": "^6.4.19",
"@storybook/react": "^6.4.19",
"babel-loader": "^8.2.3",
"babel-loader": "^8.2.4",
"buffer": "^6.0.3",
"path-browserify": "^1.0.1",
"stream-browserify": "^3.0.0"
Expand Down
13 changes: 5 additions & 8 deletions packages/dashboard/src/GuardRoute.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
import { PersonaContext } from './pages/Personas/hooks/usePersonaContext'
import { Navigate, Route } from 'react-router-dom'
import type { DashboardRoutes } from '@masknet/shared-base'
import { Navigate } from 'react-router-dom'

interface GuardRouteProps {
path: DashboardRoutes
element?: JSX.Element
redirectTo?: string
redirectTo: string
}

export default function NoPersonaGuardRoute(props: GuardRouteProps) {
const { redirectTo, ...rest } = props
export default function NoPersonaGuardRoute(props: React.PropsWithChildren<GuardRouteProps>) {
const { redirectTo } = props
const { currentPersona } = PersonaContext.useContainer()
return currentPersona ? <Navigate to={redirectTo ?? '/'} replace /> : <Route {...rest} />
return currentPersona ? <Navigate to={redirectTo} replace /> : <>{props.children}</>
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ import {
ListItemIcon,
Collapse,
Theme,
// see https://github.com/import-js/eslint-plugin-import/issues/2288
// eslint-disable-next-line import/no-deprecated
useMediaQuery,
styled,
listItemClasses,
Expand Down Expand Up @@ -122,8 +120,6 @@ export function Navigation({ onClose }: NavigationProps) {
const isWalletTransferPath = useMatch(DashboardRoutes.WalletsTransfer)
const isWalletHistoryPath = useMatch(DashboardRoutes.WalletsHistory)

// see https://github.com/import-js/eslint-plugin-import/issues/2288
// eslint-disable-next-line import/no-deprecated
const isLargeScreen = useMediaQuery<Theme>((theme) => theme.breakpoints.up('lg'))
const t = useDashboardI18N()
const mode = useTheme().palette.mode
Expand Down
6 changes: 1 addition & 5 deletions packages/dashboard/src/components/DashboardFrame/index.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import { memo, Suspense, useMemo, useState } from 'react'
// see https://github.com/import-js/eslint-plugin-import/issues/2288
// eslint-disable-next-line import/no-deprecated
import { Grid, styled, Theme, useMediaQuery } from '@mui/material'
import { MaskColorVar } from '@masknet/theme'
import { ErrorBoundary } from '@masknet/shared'
import { ErrorBoundary } from '@masknet/shared-base-ui'
import { DashboardContext } from './context'
import { Navigation } from './Navigation'
import { NavigationVersionFooter } from '../NavigationVersionFooter'
Expand All @@ -27,8 +25,6 @@ const LeftContainer = styled(Grid)(({ theme }) => ({
export interface DashboardFrameProps extends React.PropsWithChildren<{}> {}

export const DashboardFrame = memo((props: DashboardFrameProps) => {
// see https://github.com/import-js/eslint-plugin-import/issues/2288
// eslint-disable-next-line import/no-deprecated
const isLargeScreen = useMediaQuery<Theme>((theme) => theme.breakpoints.up('lg'))
const [navigationExpanded, setNavigationExpanded] = useState(true)
const [drawerOpen, setDrawerOpen] = useState(false)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { memo, useCallback, useMemo } from 'react'
import { useNavigate } from 'react-router-dom'
import { makeStyles } from '@masknet/theme'
import { useRemoteControlledDialog } from '@masknet/shared'
import { useRemoteControlledDialog } from '@masknet/shared-base-ui'
import { useAccount } from '@masknet/web3-shared-evm'
import { PluginMessages, Services } from '../../../API'
import { PersonaContext } from '../../../pages/Personas/hooks/usePersonaContext'
import { DashboardRoutes } from '@masknet/shared-base'
import { DashboardRoutes, EnhanceableSite } from '@masknet/shared-base'
import { PluginId } from '@masknet/plugin-infra'

const useStyles = makeStyles()((theme) => ({
Expand All @@ -28,9 +28,6 @@ const useStyles = makeStyles()((theme) => ({
},
}))

const TWITTER_NETWORK = 'twitter.com'
const TWITTER_ADDRESS = 'https://www.twitter.com'

export const FeaturePromotions = memo(() => {
const { classes } = useStyles()
const navigate = useNavigate()
Expand All @@ -45,7 +42,7 @@ export const FeaturePromotions = memo(() => {
const { linkedProfiles } = currentPersona
if (linkedProfiles.length === 0) return false

return !!linkedProfiles.find((profile) => profile.identifier.network === TWITTER_NETWORK)
return !!linkedProfiles.find((profile) => profile.identifier.network === EnhanceableSite.Twitter)
}, [currentPersona])

const openTransakDialog = useCallback(() => {
Expand All @@ -61,13 +58,13 @@ export const FeaturePromotions = memo(() => {
return
}
if (isConnectedTwitter) {
await Services.SocialNetwork.openSNSAndActivatePlugin(`${TWITTER_ADDRESS}/home`, pluginId)
await Services.SocialNetwork.openSNSAndActivatePlugin('https://twitter.com/home', pluginId)
return
}
connectPersona(currentPersona.identifier, TWITTER_NETWORK)
connectPersona(currentPersona.identifier, EnhanceableSite.Twitter)
}

const openMaskNetwork = () => window.open(`${TWITTER_ADDRESS}/realMaskNetwork`)
const openMaskNetwork = () => window.open('https://twitter.com/realMaskNetwork')

return (
<div className={classes.container}>
Expand Down
Loading

0 comments on commit 130c04e

Please sign in to comment.