Skip to content

Commit

Permalink
Merge pull request #189 from AelfScanProject/feature/optimized-162
Browse files Browse the repository at this point in the history
fix 1.6.2 Problem optimization
  • Loading branch information
simon-bai authored Aug 2, 2024
2 parents 3ded1c4 + e659af5 commit 829cdf1
Show file tree
Hide file tree
Showing 39 changed files with 2,275 additions and 493 deletions.
22 changes: 15 additions & 7 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,18 @@ const nextConfig = {
destination: '/',
// permanent: false,
},
// {
// source: '/api/:path*',
// destination: 'https://aelfscan.io/api/:path*',
// // permanent: false,
// // basePath: false,
// },
{
source: '/api/:path*',
destination: 'https://testnet.aelfscan.io/api/:path*',
destination: 'https://aelfscan.io/api/:path*',
// permanent: false,
// basePath: false,
},
// {
// source: '/api/:path*',
// destination: 'https://testnet.aelfscan.io/api/:path*',
// // permanent: false,
// // basePath: false,
// },
{
source: '/chain/:path*',
destination: 'http://localhost:3001/chain/:path*',
Expand Down Expand Up @@ -89,6 +89,14 @@ const nextConfig = {
},
],
},
webpack(config, options) {
config.module.rules.push({
test: /\.proto$/,
use: 'protobufjs-loader',
});

return config;
},
output: 'standalone',
};

Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
"next-runtime-env": "^2.0.1",
"opentelemetry-launcher": "^0.0.3",
"papaparse": "^5.4.1",
"protobufjs-loader": "^3.0.0",
"qrcode.react": "^3.1.0",
"rc-menu": "^9.11.1",
"react": "18.2.0",
Expand Down
Binary file added public/favicon.test.ico
Binary file not shown.
4 changes: 4 additions & 0 deletions public/image/discord.test.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions public/image/telegram.test.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions public/image/twitter.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions public/image/twitter.test.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions public/image/youtube.test.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ export default function FormItem({
<>
<Divider dashed />
<div>Response Body</div>
<div>
<div className="overflow-x-auto">
<ReactJson src={res} />
</div>
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export default function DynamicForm({
}
};
const handleCopy = (value) => {
message.destroy();
try {
copy(value);
message.success('Copied Successfully');
Expand Down
2 changes: 1 addition & 1 deletion src/_components/AddressDetail/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ export default function AddressDetail({ SSRData }: { SSRData: IAddressResponse }
<Copy className="!ml-4" value={address} />
<EPTooltip
placement="bottom"
mode="dark"
mode="light"
getPopupContainer={(node) => node}
trigger="click"
title={<QrCode value={address} />}>
Expand Down
7 changes: 5 additions & 2 deletions src/_components/ContractToken/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ export default function ContractToken({
</EPTooltip>
)}
<EPTooltip pointAtCenter={false} title={addressFormat(address || '', chainId)} mode="dark">
<Link className="text-link" href={`/${chainId}/address/${addressFormat(address || '', chainId)}/${type}`}>
<Link
prefetch={false}
className="text-link"
href={`/${chainId}/address/${addressFormat(address || '', chainId)}/${type}`}>
{addressFormat(hiddenAddress(address || '', count, count), chainId)}
</Link>
</EPTooltip>
Expand All @@ -55,7 +58,7 @@ export default function ContractToken({
}
mode="dark"
pointAtCenter={false}>
<Link className="" href={`/${chainId}/address/${addressFormat(address, chainId)}/${type}`}>
<Link prefetch={false} className="" href={`/${chainId}/address/${addressFormat(address, chainId)}/${type}`}>
{name}
</Link>
</EPTooltip>
Expand Down
1 change: 1 addition & 0 deletions src/_components/Copy/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { message } from 'antd';
import clsx from 'clsx';
export default function Copy({ value, className }: { value: string; className?: string }) {
const handleCopy = () => {
message.destroy();
try {
copy(value);
message.success('Copied Successfully');
Expand Down
1 change: 1 addition & 0 deletions src/_components/Download/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export default function Download({ files, fileName, fileType = '.zip', ...parmas

saveAs(blob, `${fileName}${fileType}`);
} catch (e) {
console.log(e, 'eee');
message.error('Download failed');
} finally {
setIsLoading(false);
Expand Down
9 changes: 8 additions & 1 deletion src/_components/Footer/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,19 @@
@apply absolute bottom-6 w-full text-center text-[#858585] text-[12px] font-[400];
}
.footer-container-link {
@apply absolute left-5 top-6 cursor-pointer;
@apply absolute flex items-center left-5 top-6 cursor-pointer;
.anticon {
svg {
@apply w-8 h-8 mr-2;
}
}
a {
@apply w-8 h-8 mr-2;
img {
@apply w-full h-full;
}
}

}
}
.footer-container-mobile {
Expand Down
38 changes: 27 additions & 11 deletions src/_components/Footer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,17 +67,33 @@ export default function Footer({ footerMenuList }: IProps) {
<div className="right">{rightLinkCom}</div>
</div>
<BackToTopButton isDark={isMainNet}></BackToTopButton>
<div className={`${clsPrefix}-link`}>
<IconFont type="telegram" onClick={() => window.open('https://t.me/aelfblockchain', '_blank')}></IconFont>
<IconFont type="medium" onClick={() => window.open('https://medium.com/aelfblockchain', '_blank')}></IconFont>
<IconFont
type="twitter"
onClick={() => window.open('https://twitter.com/aelfblockchain', '_blank')}></IconFont>
<IconFont
type="youtube"
onClick={() => window.open('http://www.youtube.com/c/aelfblockchain', '_blank')}></IconFont>
<IconFont type="discord" onClick={() => window.open('https://discord.gg/bgysa9xjvD', '_blank')}></IconFont>
</div>
{isMainNet ? (
<div className={`${clsPrefix}-link`}>
<a href="https://x.com/aelfblockchain" target="_blank" rel="noopener noreferrer">
<Image width={32} height={32} src="/image/twitter.svg" alt="twitter"></Image>
</a>
<IconFont type="telegram" onClick={() => window.open('https://t.me/aelfblockchain', '_blank')}></IconFont>
<IconFont
type="youtube"
onClick={() => window.open('http://www.youtube.com/c/aelfblockchain', '_blank')}></IconFont>
<IconFont type="discord" onClick={() => window.open('https://discord.gg/bgysa9xjvD', '_blank')}></IconFont>
</div>
) : (
<div className={`${clsPrefix}-link`}>
<a href="https://x.com/aelfblockchain" target="_blank" rel="noopener noreferrer">
<Image width={32} height={32} src="/image/twitter.test.svg" alt="twitter"></Image>
</a>
<a href="https://t.me/aelfblockchain" target="_blank" rel="noopener noreferrer">
<Image width={32} height={32} src="/image/telegram.test.svg" alt="telegram"></Image>
</a>
<a href="http://www.youtube.com/c/aelfblockchain" target="_blank" rel="noopener noreferrer">
<Image width={32} height={32} src="/image/youtube.test.svg" alt="youtube"></Image>
</a>
<a href="https://discord.gg/bgysa9xjvD" target="_blank" rel="noopener noreferrer">
<Image width={32} height={32} src="/image/discord.test.svg" alt="discord"></Image>
</a>
</div>
)}
</div>
<div className="copywrite">AELF © {new Date().getFullYear()}</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/_components/HeaderTop/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
@apply py-1 pl-1 pr-2 mr-auto;
.title,
.price {
@apply text-[16px] leading-[22px] text-black mr-2 font-[400] font-['Roboto'];
@apply text-[16px] leading-[22px] text-black mr-2 font-[400];
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/_components/HeaderTop/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export default function HeaderTop({ setCurrent, selectedKey, networkList, header
const isMobile = usePad();
const { defaultChain } = useAppSelector((state) => state.getChainId);
const pathname = usePathname();
const isHideSearch = ['/', '/tDVW', 'tDVV'].includes(pathname) || pathname.includes('search-');
const isHideSearch = ['/', '/tDVW', '/tDVV'].includes(pathname) || pathname.includes('search-');
const { NEXT_PUBLIC_NETWORK_TYPE } = useEnvContext();
const items: MenuProps['items'] = useMemo(() => {
return networkList.map((item) => {
Expand Down
4 changes: 3 additions & 1 deletion src/_components/LogsContainer/logItems.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,16 @@ function LogItems({ data }: { data: ILogsProps }) {
function decodeData() {
deserializeLog(originData, config['rpcUrl' + chain])
.then((res) => {
console.log(res, 'res');
if (Object.keys(res).length === 0) {
throw new Error('Decode failed');
}
setResult(res);
setLoading(false);
setHasDecoded(true);
})
.catch(() => {
.catch((e) => {
console.log(e, 'errrrrr');
message.error('Decode failed');
setLoading(false);
});
Expand Down
2 changes: 1 addition & 1 deletion src/_components/Search/Item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ const Item = ({ index, item, searchType }: { index: number; searchType: TType; i
/>
</span>
<EPTooltip mode="dark" title={item.name}>
<span>{item.name?.slice(0, 10)}</span>
<span>{item.name && item.name?.length > 10 ? item.name?.slice(0, 10) + '...' : item.name}</span>
</EPTooltip>
<span className="search-result-ul-item-gray">({item.symbol})</span>
<span className="search-result-ul-item-button">
Expand Down
2 changes: 1 addition & 1 deletion src/_plugins/nft/_inventory/CardList.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ function NftCardList(props) {
className: "text-base-100"
}, "N/A") : /*#__PURE__*/React.createElement(EPTooltip, {
mode: "dark",
title: "Click to see transaction with last sale price of $".concat(itemObj.lastSalePriceInUsd, " (").concat(itemObj.lastSalePrice, " ").concat(itemObj.lastSaleAmountSymbol, ")")
title: "Click to see transaction with last sale price of $".concat(itemObj.lastSalePriceInUsd, " (").concat(itemObj.lastSalePrice, " ").concat(itemObj.lastSaleAmountSymbol || '', ")")
}, /*#__PURE__*/React.createElement(Link, {
className: "inline-block truncate",
href: "/".concat(chain, "/tx/").concat(itemObj.lastTransactionId, "?blockHeight=").concat(itemObj.blockHeight)
Expand Down
2 changes: 1 addition & 1 deletion src/_style/not-found.css
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
}
}
.not-found-btn{
@apply mt-3 bg-link rounded text-xs text-white w-[104px] h-8 text-center leading-8 cursor-pointer;
@apply mt-3 bg-link rounded text-xs !text-white w-[104px] h-8 text-center leading-8 cursor-pointer;
&:hover{
@apply bg-32;
}
Expand Down
1 change: 1 addition & 0 deletions src/_utils/copy.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { message } from 'antd';
import copy from 'copy-to-clipboard';
export function handelCopy(value) {
message.destroy();
try {
copy(value);
message.success('Copied Successfully');
Expand Down
18 changes: 17 additions & 1 deletion src/_utils/deserializeLog.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import AElf from 'aelf-sdk';
import Root from 'src/protobuf/virtual_transaction.proto';

const CONTRACT_PROTOS = {};

Expand Down Expand Up @@ -36,7 +37,22 @@ export async function deserializeLog(log, rpc) {
if (NonIndexed) {
serializedData.push(NonIndexed);
}
const dataType = proto.lookupType(Name);
let dataType;

if (Name === 'VirtualTransactionCreated') {
// VirtualTransactionCreated is system-default
try {
const root = Root as any;
dataType = root.VirtualTransactionCreated;
console.log(Root, dataType, 'Root');
} catch (e) {
// if normal contract has a method called VirtualTransactionCreated
dataType = proto.lookupType(Name);
}
} else {
dataType = proto.lookupType(Name);
}

let deserializeLogResult = serializedData.reduce((acc, v) => {
let deserialize = dataType.decode(decodeBase64(v));
deserialize = dataType.toObject(deserialize, {
Expand Down
2 changes: 1 addition & 1 deletion src/_utils/file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ function addFileOrFolder(zip, files) {
if (Array.isArray(file.files) && file.files.length > 0) {
addFileOrFolder(zip.folder(name), file.files);
} else {
const content = window.atob(file.content);
const content = window.atob(file.content || '');
zip.file(name, content);
}
});
Expand Down
3 changes: 0 additions & 3 deletions src/app/[chain]/chart/produce/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,6 @@ const getOption = (list: any[]): Highcharts.Options => {
title: {
align: 'left',
text: title,
style: {
color: '#FFF',
},
},
pane: {
size: '90%',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ const TokenDetail = (chain): IOverviewItem[] => {
{
key: 'token',
label: 'DECIMAL',
render: (token) => (token.decimals && token.decimals !== 0 ? token.decimals : '--'),
render: (token) => (token.decimals || token.decimals === 0 ? token.decimals : '--'),
},
];
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export interface ITransfersRef {
setSearchStr: (val: string) => void;
}

const TAB_NAME = 'transfers';
const TAB_NAME = '';

const Transfers = ({ search, searchText, searchType, onSearchChange, onSearchInputChange }: ITransfersProps, ref) => {
const isMobile = useMobileAll();
Expand Down
2 changes: 1 addition & 1 deletion src/app/[chain]/tx/[hash]/_components/baseInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ export default function BaseInfo({ data }: { data: ITransactionDetailData }) {
'nft-transferred mb-4 flex items-center',
)}>
<NFTImage
className={clsx('rounded-lg bg-slate-200')}
className={clsx('mr-1 rounded-lg bg-slate-200')}
src={nftsTransfer.imageUrl}
alt=""
width={40}
Expand Down
Loading

0 comments on commit 829cdf1

Please sign in to comment.