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

Refactor/nextjs others ssr #145

Open
wants to merge 114 commits into
base: refactor/nextjs-version
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
114 commits
Select commit Hold shift + click to select a range
41401da
feat: block unconfirmed ssr
Oct 14, 2022
0812ed1
feat: blockDetail
Oct 14, 2022
078f023
feat: reduce Script Evaluation
Oct 17, 2022
1407488
feat: fix accessibility
Oct 17, 2022
8ab1b98
feat: delete /static
Oct 17, 2022
6e21a49
feat: merge develop branch
Oct 17, 2022
4efd24d
feat: /txs
Oct 17, 2022
2952e72
feat: txs unconfirmedtxs
Oct 18, 2022
8e45f53
feat: fix types error
Oct 18, 2022
f5b818b
feat: fix router jump color
Oct 18, 2022
c6b1437
feat: fix BUILD_ENDPOINT_CHAIN
Oct 18, 2022
d222c73
feat: test
Oct 18, 2022
feab9bb
feat: delete and require antd less
Oct 18, 2022
b37669c
feat: bUILD_ENDPOINT_CHAIN
Oct 18, 2022
ab9ed3d
feat: update .gitignore
Oct 18, 2022
15f67bc
feat: back-btn
Oct 18, 2022
603c148
feat: tx
Oct 19, 2022
f46d8a6
feat: add suppressHydrationWarning in getFormattedDate
Oct 19, 2022
59b7372
feat: fix accessibility
Oct 19, 2022
2b8ec9a
Merge branch 'refactor/nextjs-version' of github.com:AElfProject/aelf…
Oct 19, 2022
c3759f9
feat: chainSelect tsx, add file in gitignore
Oct 19, 2022
112382b
feat: rm –cache
Oct 19, 2022
2db7e02
feat: component js -> tsx
Oct 19, 2022
b9ca7bd
feat: accounts
Oct 19, 2022
bea3dc0
feat: update addressDetail
Oct 20, 2022
b7dd9d0
feat: accounts ssr
Oct 20, 2022
41375e2
feat: addressDetail
Oct 20, 2022
fcf5f13
feat: txDetail
Oct 21, 2022
44ba00c
feat: addressDetail
Oct 21, 2022
ea68f44
feat: add price
Oct 21, 2022
d44e9ed
feat: blockDetail price
Oct 24, 2022
3166628
feat: contacts page
Oct 24, 2022
e6a11b6
feat: contract addressDetail
Oct 24, 2022
f1e9a44
feat: fix build ts bug
Oct 24, 2022
5d3fbd0
feat: faild invalid
Oct 24, 2022
9b6ffed
feat: tokens
Oct 25, 2022
ceec1a6
feat: tokenDetail
Oct 25, 2022
c41a998
feat: fix build error
Oct 25, 2022
d806f62
feat: js -> ts, add queryString
Oct 26, 2022
6515b2e
feat: block tx token request
Oct 26, 2022
32fb5b8
feat: queryConfig
Oct 26, 2022
fdb29e6
feat: queryConfig
Oct 26, 2022
6e7eb27
feat: delete path.resolve
Oct 26, 2022
e3f9f7f
feat: delete console
Oct 26, 2022
5f3f41f
feat: delete CHAIN_ID
Oct 26, 2022
d6e14c9
feat: fix ts error
Oct 26, 2022
ccb696f
feat: resource js -> ts
Oct 26, 2022
3c436af
feat: js -> ts
Oct 26, 2022
3b3066a
feat: redux js -> ts
Oct 27, 2022
bc4c899
feat: resource
Oct 27, 2022
9da3f4a
feat: handle error
Oct 27, 2022
b298b9b
feat: error handle
Oct 27, 2022
bc3f49a
feat: error handle
Oct 27, 2022
3b69327
feat: fix token error
Oct 27, 2022
fea056d
feat: delete description
Oct 27, 2022
f773d00
feat: add getContractNames
Oct 27, 2022
7ab3b19
feat: fix Image
Oct 27, 2022
6e6fd9e
feat: style mobile
Oct 28, 2022
35a347d
feat: delete console
Oct 28, 2022
ed593e8
feat: add description and delete useless file
Oct 28, 2022
da0666f
feat: add suppressHydrationWarning for time
Oct 28, 2022
483c0e8
feat: header ts
Oct 28, 2022
87c2495
feat: proposal og less
Nov 3, 2022
9bcd82f
feat: chache&nodeInfo
Nov 4, 2022
3603b32
feat: change socket url
Nov 4, 2022
74d8fbd
feat: delete console
Nov 4, 2022
263e343
feat: test
Nov 4, 2022
8abb125
feat: delete sourcemap
Nov 4, 2022
c33cd88
feat: test
Nov 4, 2022
466ebf1
feat: add console
Nov 4, 2022
876cbd3
feat: delete production
Nov 4, 2022
b91c9bc
feat: change production
Nov 4, 2022
87a6d50
feat: aelf prod rewrite
Nov 7, 2022
00c22d5
feat: aelf prod rewrite
Nov 7, 2022
608be76
feat: add log
Nov 7, 2022
92032a3
feat: add log
Nov 7, 2022
d08464a
feat: change prod rewrite
Nov 7, 2022
c3fe587
feat: change rewrite
Nov 7, 2022
5edf469
feat: add prod rewrite fc
Nov 7, 2022
7cdff33
feat: change queryConfig
Nov 7, 2022
978341e
feat: prod rewrite
Nov 7, 2022
5f92226
feat: prod
Nov 7, 2022
7e5f34d
feat: prod rewrites
Nov 7, 2022
24bab1d
feat: test
Nov 7, 2022
bdcbcd4
feat: hOST change
Nov 7, 2022
873ff34
feat: queryCOnfig
Nov 7, 2022
a7f8a56
feat: prod rewrites
Nov 7, 2022
1d3f1f8
feat: rewrites
Nov 7, 2022
7e36da0
feat: test
Nov 7, 2022
5c85d25
feat: test
Nov 7, 2022
ea94670
feat: pro rewrites
Nov 7, 2022
692a1c9
feat: add log
Nov 7, 2022
9f3f1f8
feat: delete socket
Nov 7, 2022
38195e5
feat: test
Nov 7, 2022
633b494
feat: socket timeout
Nov 7, 2022
c227c3d
feat: timeout
Nov 7, 2022
c154dbd
feat: add log
Nov 7, 2022
7ee872a
feat: socket error
Nov 7, 2022
b1eb3ce
feat: compatible with old url
Nov 10, 2022
ea147f7
feat: delete flag
Nov 11, 2022
dc43578
feat: add -nextjs
Nov 11, 2022
668d3bb
feat: change style
Nov 11, 2022
e10cce9
feat: sentry
Nov 11, 2022
a615f8d
feat: readme
Nov 11, 2022
cee790d
feat: fix blockheight
Nov 14, 2022
2ed41ce
feat: fix header style
Nov 14, 2022
cda8cc7
feat: conflict solve
Nov 14, 2022
5382fe9
Merge pull request #160 from AElfProject/refactor/nextjs-sentry
hzz780 Nov 14, 2022
dec71c8
feat: add console error
Nov 16, 2022
3a611f4
feat: add config lang
Nov 16, 2022
2d3622d
feat: clear redirectRes
Nov 17, 2022
fce9415
feat: fix wallet null
Nov 17, 2022
d4beb7b
feat: fix vote modal
Nov 17, 2022
16232f3
feat: add reset
Nov 21, 2022
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: 0 additions & 3 deletions .env.production

This file was deleted.

2 changes: 1 addition & 1 deletion .eslintcache

Large diffs are not rendered by default.

7 changes: 6 additions & 1 deletion build/common.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
const rewritesConfig = require('./rewrites/index');
module.exports = {
reactStrictMode: true,
// `Warning: findDOMNode is deprecated in StrictMode.` when use antd
reactStrictMode: false,
concurrentFeatures: true,
i18n: {
locales: ['en'],
defaultLocale: 'en',
},
async rewrites() {
return rewritesConfig;
},
Expand Down
2 changes: 2 additions & 0 deletions build/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ module.exports = [
'@app-prefix': NEXT_PUBLIC_CSS_EXAMPLE_PREFIX,
'@ant-prefix': NEXT_PUBLIC_CSS_APP_PREFIX,
}),
lessVarsFilePath: 'src/assets/theme/color.less', // optional
lessVarsFilePathAppendToEndOfContent: false, // optional
},
},
images: {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"aelf-bridge": "^0.0.9",
"aelf-sdk": "3.2.40",
"aelf-sdk-cross-chain": "^1.0.14",
"antd": "4.21.0",
"antd": "^4.23.6",
"apisauce": "^0.16.0",
"axios": "^0.19.0",
"axios-hooks": "^3.1.5",
Expand Down
Binary file removed public/favicon.ico
Binary file not shown.
Binary file added public/favicon_main.ico
Binary file not shown.
Binary file added public/favicon_test.ico
Binary file not shown.
Binary file removed public/font/Roboto-Bold.ttf
Binary file not shown.
Binary file removed public/font/Roboto-Medium.ttf
Binary file not shown.
Binary file removed public/font/Roboto-Regular.ttf
Binary file not shown.
3 changes: 2 additions & 1 deletion src/assets/theme/color.less
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
//@media (min-width: 1200px) { ... }#F7F8F9

// @import '~antd/lib/style/themes/default.less';
// @import '~antd/dist/antd.less';
// @import '~antd/dist/antd.css';

// New UI start ---

Expand Down Expand Up @@ -127,6 +127,7 @@
@fair-pink: #ffeded;
@wild-sand: #f5f5f5;
@athens-gray: #f7f8fa;
@manatee: #8b92a3;

//@borderColor: #d9d9d9;

Expand Down
12 changes: 0 additions & 12 deletions src/assets/theme/customize.less
Original file line number Diff line number Diff line change
@@ -1,15 +1,3 @@
@font-face {
font-family: Roboto-Bold;
src: url('/font/Roboto-Bold.ttf');
}
@font-face {
font-family: Roboto-Medium;
src: url('/font/Roboto-Medium.ttf');
}
@font-face {
font-family: Roboto-Regular;
src: url('/font/Roboto-Regular.ttf');
}
html {
--@{app-prefix}-primary-color: #4d6aec;
--@{app-prefix}-primary-color-hover: #506ef5;
Expand Down
28 changes: 16 additions & 12 deletions src/components/Breadcrumb/Breadcrumb.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ type PathSnippetDto =
| 'resourceDetail';

// if you want to hide the Breadcrumb
const NO_BREADCRUMB_PAGES = ['/vote', '/proposal', '/address', '/contract', '/token'];
const NO_BREADCRUMB_PAGES = ['/vote', '/proposal', '/address', '/contracts', '/token'];
const noBreadcrumb = (pathname: string) => {
const isMainPage = pathname === '/';
return NO_BREADCRUMB_PAGES.filter((item) => pathname.includes(item)).length === 0 && !isMainPage;
Expand Down Expand Up @@ -55,19 +55,18 @@ const BREADCRUMB_NAME_MAP: {
'/vote': 'Vote',
'/resource': 'Resource',
'/resourceDetail': 'Resource Detail List',
'/contract': 'Contract',
'/contracts': 'Contract',
'/proposal': 'Proposal',
'/token': 'Token',
myvote: 'My Vote',
'/search-invalid': '',
};

// I don't know why /new-socket can reach here
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const DO_NOT_DISPLAY_PATH = [
'new-socket',
'/_error',
'/transaction-list',
'/txs',
'/unconfirmedTxs',
'/tx/',
'/blocks',
'/unconfirmedBlocks',
];
Expand Down Expand Up @@ -109,6 +108,10 @@ const BREADCRUMB_NAMES_TATE = {
url: ['/txs', false],
name: [BREADCRUMB_NAME_MAP['/unconfirmedTxs'], BREADCRUMB_NAME_MAP['/unconfirmedTx']],
},
accounts: {
url: ['/txs', false],
name: [BREADCRUMB_NAME_MAP['/txs'], BREADCRUMB_NAME_MAP['/address']],
},
address: {
url: ['/txs', false],
name: [BREADCRUMB_NAME_MAP['/txs'], BREADCRUMB_NAME_MAP['/address']],
Expand All @@ -130,8 +133,8 @@ const BREADCRUMB_NAMES_TATE = {
name: [BREADCRUMB_NAME_MAP['/resource'], BREADCRUMB_NAME_MAP['/resourceDetail']],
},
contract: {
url: ['/contract'],
name: [BREADCRUMB_NAME_MAP['/contract']],
url: ['/contracts'],
name: [BREADCRUMB_NAME_MAP['/contracts']],
},
proposal: {
url: ['/proposal', false],
Expand Down Expand Up @@ -197,7 +200,6 @@ class BrowserBreadcrumb extends Component<PropsDto> {
}

const STATE = BREADCRUMB_NAMES_TATE.states[BREADCRUMB_NAMES_TATE.currentState as PathSnippetDto];

if (typeof window !== 'undefined' && !STATE) {
this.props.router.push('/');
return;
Expand Down Expand Up @@ -265,16 +267,19 @@ class BrowserBreadcrumb extends Component<PropsDto> {
}

render() {
const pathname = this.props.router.asPath;
// I don't know why /new-socket can reach here
const pathname = this.props.router.asPath.split('?')[0];
// if someone add path '/contract' to favourite
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤔???

if (
DO_NOT_DISPLAY_PATH.includes(pathname) ||
pathname.includes('/tx/') ||
pathname.includes('/txs') ||
pathname.includes('/block/') ||
pathname.includes('/search-invalid') ||
pathname.includes('/search-failed') ||
pathname.includes('new-socket')
pathname.includes('/accounts') ||
pathname.includes('/contracts') ||
pathname.includes('/contract') ||
pathname.includes('/token')
) {
return <></>;
}
Expand All @@ -285,7 +290,6 @@ class BrowserBreadcrumb extends Component<PropsDto> {

const className = noBreadcrumb(pathname) ? 'breadcrumb' : 'breadcrumb hide';
const pathSnippets: string[] = pathname.split('/').filter((i) => i);

const firstBreadcrumbItem = this.getFirstBreadcrumbItem();
const extraBreadcrumbItems = this.getExtraBreadcrumbItems(pathSnippets, reloadUrl);
const breadcrumbItems = ([] as JSX.Element[]).concat(firstBreadcrumbItem, extraBreadcrumbItems);
Expand Down
1 change: 1 addition & 0 deletions src/components/ChainSelect/ChainSelect.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export default class ChainSelect extends Component {
return (
<div className="chain-select-container">
<Select
aria-label="chain-select"
className="chain-select common-select-wrapper"
defaultValue={defaultValue}
onChange={(v) => this.changeChain(v)}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ import copy from 'copy-to-clipboard';
import { message } from 'antd';
import IconFont from '../IconFont';

export default function CopyButton({ value }) {
export default function CopyButton({ value = '', onClick = undefined }) {
const handleCopy = () => {
try {
copy(value);
message.success('Copied!');
message.success('Copied Successfully');
} catch (e) {
message.error('Copy failed, please copy by yourself.');
}
};
return <IconFont className="copy-btn" style={{ fontSize: 16 }} type="copy" onClick={handleCopy} />;
return <IconFont className="copy-btn" style={{ fontSize: 16 }} type="copy" onClick={onClick || handleCopy} />;
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import React from 'react';
import { Dropdown, Button, Menu } from 'antd';
import { If, Then, Else } from 'react-if';
import { DownOutlined } from '@ant-design/icons';
import { numberFormatter } from 'utils/formater';

const Dividends = (props) => {
const { dividends, defaultSymbol, useButton = true, ...rest } = props;
Expand Down Expand Up @@ -41,7 +42,7 @@ const Dividends = (props) => {
</Then>
<Else>
<div {...rest}>
{dividends[defaultKey] || 0}&nbsp;{defaultKey}
{numberFormatter(dividends[defaultKey]) || 0}&nbsp;{defaultKey}
</div>
</Else>
</If>
Expand Down
2 changes: 1 addition & 1 deletion src/components/Footer/Footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const BrowserFooter = ({ headers }: IProps) => {
<div className="footer-container">
<div className="left">
<div className="top">
<h4>AELF Explorer</h4>
<h1>AELF Explorer</h1>
<p className="description">Decentralized Cloud Computing Blockchain Network</p>
</div>
<div className="bottom">
Expand Down
6 changes: 3 additions & 3 deletions src/components/Footer/footer.styles.less
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
.footer-container {
.left {
.top {
h4 {
h1 {
color: @mine-shaft;
}
.description {
Expand Down Expand Up @@ -72,7 +72,7 @@
justify-content: flex-start;
align-items: flex-start;
gap: 4px;
h4 {
h1 {
color: white;
font-family: 'Roboto Medium', sans-serif;
font-weight: 400;
Expand Down Expand Up @@ -169,7 +169,7 @@
.footer-container {
.left {
.top {
h4 {
h1 {
color: @mine-shaft;
}
.description {
Expand Down
9 changes: 7 additions & 2 deletions src/components/TableLayer/TableLayer.styles.less
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@
width: 100%;
> .table-layer-block {
min-width: 16px;
height: 45px;
height: 41px;
border-bottom: @border-color2 1px solid !important;
}
.ant-table-wrapper {
min-width: calc(100% - 32px);
.ant-table-thead {
tr {
th {
font-family: 'Roboto-Medium';
font-family: 'Roboto-Medium', sans-serif;
background: @bgBlankWhite !important;
border-bottom: @border-color2 1px solid !important;
font-weight: 400;
Expand All @@ -42,4 +42,9 @@
background: white;
border-radius: 4px;
padding-bottom: 10px;
> .table-layer-block {
min-width: 8px;
height: 41px;
border-bottom: @border-color2 1px solid !important;
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import React from 'react';
import useMobile from 'hooks/useMobile';
import React, { useEffect } from 'react';
import { isPhoneCheck, isPhoneCheckSSR } from 'utils/deviceCheck';

require('./TableLayer.styles.less');
export default function TableLayer({ children, className = '', ...props }) {
const isMobile = useMobile();
let isMobile = !!isPhoneCheckSSR(props.headers);
useEffect(() => {
isMobile = !!isPhoneCheck();
}, []);
return (
<div className={'table-layer ' + (isMobile ? 'mobile ' : '') + className} {...props}>
<div className="table-layer-block" />
Expand Down
23 changes: 10 additions & 13 deletions src/components/TransactionTable/TransactionTable.styles.less
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
width: calc(100% - 32px);
thead {
th {
font-family: 'Roboto-Medium';
font-family: 'Roboto-Medium', sans-serif;
background: @bgBlankWhite !important;
border-bottom: @border-color2 1px solid !important;
font-weight: 400;
Expand Down Expand Up @@ -111,26 +111,23 @@
}
}
}
.mobile {
.transaction-table {
padding: 0 0 10px;
background: transparent !important;
overflow-x: scroll;
.ant-table-wrapper {
min-width: 968px;
}
.mobile.transaction-table {
padding: 0 0 10px;
overflow-x: scroll;
.ant-table-wrapper {
min-width: 968px;
}
}

.transaction-tooltip {
.ant-tooltip-content {
width: 337.5px;
box-shadow: 0px 2px 16px 0px rgba(0, 0, 0, 0.08), 0px 4px 8px 0px rgba(0, 0, 0, 0.08);
box-shadow: 0 2px 16px 0 rgb(0 0 0 / 8%), 0 4px 8px 0 rgb(0 0 0 / 8%);
.ant-tooltip-inner {
padding: 0 !important;
background-color: white;
}
.ant-tooltip-arrow:before {
.ant-tooltip-arrow::before {
background-color: white;
}
}
Expand All @@ -144,7 +141,7 @@
padding: 11px 20px 11px 22px;
border-bottom: 1px solid @border-color2;
font-size: 14px;
font-family: 'Roboto-Medium';
font-family: 'Roboto-Medium', sans-serif;
line-height: 22px;
color: @mine-shaft;
a {
Expand Down Expand Up @@ -213,6 +210,6 @@
}
.ant-tooltip-content {
width: 100%;
box-shadow: 0px 0px 100000px 100000px rgba(0, 0, 0, 0.6);
box-shadow: 0 0 100000px 100000px rgb(0 0 0 / 60%);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,25 @@ import { get } from 'utils/axios';
import TableLayer from '../TableLayer/TableLayer';
import ColumnConfig from './columnConfig';
require('./TransactionTable.styles.less');
export default function TransactionTable({ dataLoading, dataSource }) {
export default function TransactionTable({ dataLoading, dataSource, headers }) {
const [price, setPrice] = useState(0);
const [timeFormat, setTimeFormat] = useState('Age');

const columns = useMemo(
() =>
ColumnConfig(timeFormat, price, () => {
setTimeFormat(timeFormat === 'Age' ? 'Date Time' : 'Age');
}),
ColumnConfig(
timeFormat,
price,
() => {
setTimeFormat(timeFormat === 'Age' ? 'Date Time' : 'Age');
},
headers,
),
[timeFormat, price],
);

useEffectOnce(() => {
get(ELF_REALTIME_PRICE_URL, { fsym: 'ELF', tsyms: 'USD,BTC,CNY' }).then((price) => setPrice(price));
get(ELF_REALTIME_PRICE_URL, { fsym: 'ELF', tsyms: 'USD,BTC,CNY' }).then((res) => setPrice(res));
});
return (
<TableLayer className="transaction-table">
Expand Down
Loading