Skip to content

Commit

Permalink
fix: bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
ybgbob committed Nov 15, 2023
1 parent 052505f commit 12439de
Show file tree
Hide file tree
Showing 24 changed files with 511 additions and 298 deletions.
3 changes: 2 additions & 1 deletion config/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -410,8 +410,9 @@ module.exports = function (webpackEnv) {
},
},
{
loader: require.resolve('file-loader'),
loader: require.resolve('url-loader'),
options: {
limit: 300000,
name: 'static/media/[name].[hash].[ext]',
},
},
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"private": true,
"dependencies": {
"@babel/core": "^7.22.1",
"@bnb-chain/greenfield-js-sdk": "1.0.2",
"@bnb-chain/greenfield-js-sdk": "1.0.3",
"@dopex-io/web3-multicall": "^0.1.9",
"@emotion/react": "^11.11.0",
"@emotion/styled": "^11.11.0",
Expand Down Expand Up @@ -91,7 +91,7 @@
"scripts": {
"start": "node scripts/start.js",
"build": "node scripts/build.js",
"build:gf": "export INLINE_RUNTIME_CHUNK=true && export GENERATE_SOURCEMAP=false && IMAGE_INLINE_SIZE_LIMIT=10000000 && node scripts/build.js",
"build:gf": "export INLINE_RUNTIME_CHUNK=true && export GENERATE_SOURCEMAP=false && IMAGE_INLINE_SIZE_LIMIT=1000000000 && node scripts/build.js",
"test": "node scripts/test.js",
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix"
},
Expand Down Expand Up @@ -128,6 +128,7 @@
"prettier": "^2.8.8",
"react-dev-utils": "^12.0.1",
"tslint": "^6.1.3",
"url-loader": "^4.1.1",
"webpack-bundle-analyzer": "^4.9.0"
},
"jest": {
Expand Down
33 changes: 24 additions & 9 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import RouteGuard from './router/index';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { ReactQueryDevtools } from '@tanstack/react-query-devtools';
import React from 'react';
import { Detail } from './pages/Detail';

export interface IRoute {
children?: Array<IRoute>;
Expand Down Expand Up @@ -52,6 +53,10 @@ const routes: Array<IRoute> = [
path: '/resource',
element: <Resource></Resource>,
},
{
path: '/detail',
element: <Detail></Detail>,
},
{
path: '/folder',
element: <Folder></Folder>,
Expand Down
2 changes: 1 addition & 1 deletion src/components/home/Ad.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export const Ad = () => {

<AdList>
<AdItem>
<MovieIcon /> Moive
<MovieIcon /> Movie
</AdItem>
<AdItem>
<PhotoIcon /> Photos
Expand Down
2 changes: 1 addition & 1 deletion src/components/home/All.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ const AllList = () => {
onClick={() => {
reportEvent({ name: 'dm.main.list.item_name.click' });

navigator(`/resource?id=${data.id}`);
navigator(`/resource?id=${data.id}&path=/`);

const item = {
path: '/',
Expand Down
16 changes: 8 additions & 8 deletions src/components/home/Links.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,7 @@ export const Links = () => {
<Box
onClick={() => {
reportEvent({ name: 'dm.main.body.gnfd_github.click' });
window.open(
'https://docs.bnbchain.org/greenfield-docs/docs/guide/home',
'_blank',
);
window.open('https://github.com/bnb-chain/greenfield', '_blank');
}}
>
<CardItem alignItems={'center'} gap={16} flexDirection={'column'}>
Expand All @@ -69,7 +66,7 @@ export const Links = () => {
<Box
onClick={() => {
reportEvent({ name: 'dm.main.body.gnfd_discord.click' });
window.open('https://greenfieldscan.com/', '_blank');
window.open('https://discord.com/invite/QRTQvfhADQ', '_blank');
}}
>
<CardItem alignItems={'center'} gap={16} flexDirection={'column'}>
Expand All @@ -82,7 +79,7 @@ export const Links = () => {
<Box
onClick={() => {
reportEvent({ name: 'dm.main.body.contract_me.click' });
window.open('', '_blank');
window.open('https://www.bnbchain.org/en/contact', '_blank');
}}
>
<CardItem alignItems={'center'} gap={16} flexDirection={'column'}>
Expand All @@ -93,7 +90,7 @@ export const Links = () => {
<Box
onClick={() => {
reportEvent({ name: 'dm.main.body.twitter.click' });
window.open('', '_blank');
window.open('https://twitter.com/Mindpress_io', '_blank');
}}
>
<CardItem alignItems={'center'} gap={16} flexDirection={'column'}>
Expand All @@ -104,7 +101,10 @@ export const Links = () => {
<Box
onClick={() => {
reportEvent({ name: 'dm.main.body.blog.click' });
window.open('', '_blank');
window.open(
'https://mindpress-lab.gitbook.io/get-started/ ',
'_blank',
);
}}
>
<CardItem alignItems={'center'} gap={16} flexDirection={'column'}>
Expand Down
8 changes: 4 additions & 4 deletions src/components/layout/Index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,19 @@ export default function Layout({ children }: { children: ReactNode }) {

const handleListOpen = useCallback(() => {
modalData.modalDispatch({ type: 'CLOSE_LIST' });
}, []);
}, [modalData]);

const handleListProcessOpen = useCallback(() => {
modalData.modalDispatch({ type: 'CLOSE_LIST_PROCESS' });
}, []);
}, [modalData]);

const handleDelistOpen = useCallback(() => {
modalData.modalDispatch({ type: 'CLOSE_DELIST' });
}, []);
}, [modalData]);

const handleResultOpen = useCallback(() => {
modalData.modalDispatch({ type: 'CLOSE_RESULT' });
}, []);
}, [modalData]);

return (
<>
Expand Down
1 change: 1 addition & 0 deletions src/components/modal/DelistModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ export const DelistModal = (props: any) => {
type: 'OPEN_RESULT',
result: tmp,
});
setLoading(false);
}}
disabled={!BSC_FEE_SUFF || loading}
isLoading={loading}
Expand Down
4 changes: 2 additions & 2 deletions src/components/modal/EditModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import { roundFun } from '../../utils';
import { Item } from '../../utils/apis/types';
import { QueryHeadGroupResponse } from '../../utils/gfSDK';
import { useGetItemById } from '../../hooks/useGetItemById';
import { useGetGroup } from '../../hooks/useGetBucketOrObj';
import { useGetGroupByName } from '../../hooks/useGetBucketOrObj';
import {
useGetCategory,
useGetCatoriesMap,
Expand All @@ -54,7 +54,7 @@ export const EditModal = (props: ListModalProps) => {

// const { name, type, desc: _desc, url, groupName, extra } = detail;

const { data: groupData } = useGetGroup(
const { data: groupData } = useGetGroupByName(
itemInfo.groupName,
itemInfo.ownerAddress,
);
Expand Down
11 changes: 9 additions & 2 deletions src/components/profile/MyCollectionList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,24 @@ const MyCollectionList = (props: ICollectionList) => {
const { handlePageChange, page } = usePagination();
const { setShowButton } = props;
const { address } = useAccount();
const { list, loading, total } = useCollectionList(page, pageSize);
const modalData = useModal();
// const { list, loading, total } = useCollectionList(page, pageSize, modalData.modalState.result);
const { list, loading, total } = useCollectionList(
page,
pageSize,
modalData.modalState.result,
);
const { switchNetwork } = useSwitchNetwork();
const navigator = useNavigate();
const state = useGlobal();
const [p] = useSearchParams();

console.log('modalData', modalData);

const [selectBucketId, setSelectBucketId] = useState<string>('');
const { data: selectItem } = useGetItemByBucketId(selectBucketId);
// TODO: if selectItem is null, the bucket is not listed, should go to bid or oid page
console.log('selectItem', selectItem);
// console.log('selectItem', selectItem);

useEffect(() => {
if (!selectItem) return;
Expand Down
49 changes: 25 additions & 24 deletions src/components/profile/PurchaseList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,31 +49,32 @@ const PurchaseList = () => {
justifyContent={'flex-start'}
gap={6}
onClick={() => {
let from = '';
if (breadInfo) {
const list = state.globalState.breadList;
const item = {
path: (breadInfo as any).path,
name: (breadInfo as any).name,
query: p.toString(),
};
state.globalDispatch({
type: 'ADD_BREAD',
item,
});
navigator(`/resource?id=${id}`);
// let from = '';
// if (breadInfo) {
// const list = state.globalState.breadList;
// const item = {
// path: (breadInfo as any).path,
// name: (breadInfo as any).name,
// query: p.toString(),
// };
// state.globalDispatch({
// type: 'ADD_BREAD',
// item,
// });

from = encodeURIComponent(JSON.stringify(list.concat([item])));
}
const _from = from ? `&from=${from}` : '';
if (groupName) {
navigator(
`/resource?gid=${id}&gn=${groupName}&address=${ownerAddress}&type=collection&tab=dataList${_from}`,
);
} else {
navigator(
`/resource?oid=${oid}&address=${ownerAddress}&type=collection&tab=dataList${_from}`,
);
}
// from = encodeURIComponent(JSON.stringify(list.concat([item])));
// }
// const _from = from ? `&from=${from}` : '';
// if (groupName) {
// navigator(
// `/resource?gid=${id}&gn=${groupName}&address=${ownerAddress}&type=collection&tab=dataList${_from}`,
// );
// } else {
// navigator(
// `/resource?oid=${oid}&address=${ownerAddress}&type=collection&tab=dataList${_from}`,
// );
// }
}}
>
<ImgCon src={url || defaultImg(name, 40)}></ImgCon>
Expand Down
Loading

0 comments on commit 12439de

Please sign in to comment.