Skip to content

Commit

Permalink
Merge pull request #605 from subquery/feat/rename.usdc
Browse files Browse the repository at this point in the history
feat: rename usdc to usdc.e
  • Loading branch information
HuberTRoy authored Nov 27, 2023
2 parents b5c53f0 + 0980b58 commit 91ab7e1
Show file tree
Hide file tree
Showing 13 changed files with 231 additions and 32 deletions.
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ VITE_TOP_100_INDEXERS=https://leaderboard-api.subquery.network/graphql
VITE_CONSUMER_HOST_ENDPOINT=https://kepler-chs.subquery.network
VITE_FORUM_DOMAIN=https://forum.subquery.network
VITE_TOKEN=kSQT
VITE_STABLE_TOKEN=USDC
VITE_STABLE_TOKEN=USDC.e
VITE_STABLE_TOKEN_ADDRESS=0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174
VITE_FLEXPLAN_ENABLED=true
VITE_STUDIO_ENABLED=false
Expand Down
2 changes: 1 addition & 1 deletion .env.staging
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ VITE_TOP_100_INDEXERS=https://leaderboard-api.subquery.network/graphql
VITE_CONSUMER_HOST_ENDPOINT=https://kepler-chs.subquery.network
VITE_FORUM_DOMAIN=https://forum.subquery.network
VITE_TOKEN=kSQT
VITE_STABLE_TOKEN=USDC
VITE_STABLE_TOKEN=USDC.e
VITE_STABLE_TOKEN_ADDRESS=0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174
VITE_FLEXPLAN_ENABLED=true
VITE_STUDIO_ENABLED=false
Expand Down
2 changes: 1 addition & 1 deletion .env.testnet
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ VITE_QUERY_SWAP_EXCHANGE_PROJECT=https://api.subquery.network/sq/subquery/kepler
VITE_TOP_100_INDEXERS=https://leaderboard-api.thechaindata.com/graphql
VITE_CONSUMER_HOST_ENDPOINT=https://kepler-consumer-host.thechaindata.com
VITE_TOKEN=kSQT
VITE_STABLE_TOKEN=USDC
VITE_STABLE_TOKEN=USDC.e
VITE_STABLE_TOKEN_ADDRESS=0x7E65A71046170A5b1AaB5C5cC64242EDF95CaBEA
VITE_NETWORK=testnet
VITE_FLEXPLAN_ENABLED=true
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"@polkadot/util": "^7.8.2",
"@rainbow-me/rainbowkit": "^1.2.0",
"@sentry/react": "^7.57.0",
"@subql/apollo-links": "1.2.2",
"@subql/apollo-links": "^1.2.3",
"@subql/components": "1.0.3-20",
"@subql/contract-sdk": "0.16.2",
"@subql/network-clients": "^0.3.17",
Expand Down
5 changes: 5 additions & 0 deletions src/components/TabButton/TabButton.module.less
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
display: flex;
margin: 0.5rem 0;
position: relative;
width: 100%;
}

.withUnderline {
&::after {
content: ' ';
position: absolute;
Expand All @@ -11,6 +15,7 @@
bottom: 0;
}
}

.whiteTabContainer {
background: white;
}
Expand Down
12 changes: 10 additions & 2 deletions src/components/TabButton/TabButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,19 @@ export const TabButton: React.FC<TabButtonProps> = ({ label, link, whiteTab, too
interface TabButtonsProps {
tabs: Array<TabButtonProps>;
whiteTab?: boolean;
withUnderline?: boolean;
}

export const TabButtons: React.FC<TabButtonsProps> = ({ tabs, whiteTab }) => {
export const TabButtons: React.FC<TabButtonsProps> = ({ tabs, whiteTab, withUnderline = false }) => {
return (
<div className={clsx(styles.tabContainer, whiteTab && styles.whiteTabContainer)}>
<div
className={clsx(
styles.tabContainer,
whiteTab && styles.whiteTabContainer,
withUnderline ? styles.withUnderline : '',
'tabButtons',
)}
>
{tabs.map((tab) => (
<TabButton key={tab.link} {...tab} whiteTab={whiteTab} />
))}
Expand Down
3 changes: 2 additions & 1 deletion src/containers/QueryApolloProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export const TOP_100_INDEXERS = 'top100Indexers';
const top100IndexersLink = getHttpLink(import.meta.env.VITE_TOP_100_INDEXERS);

const getDecentraliseLink = (deploymentId: string, fallbackServiceUrl?: string) => {
const httpOptions = { fetch, fetchOptions: { timeout: 5000 } };
const httpOptions = { fetchOptions: { timeout: 5000 } };

// this is just a test env varible set in your local env file.
if (import.meta.env.VITE_USE_FALLBACKURL) {
Expand All @@ -27,6 +27,7 @@ const getDecentraliseLink = (deploymentId: string, fallbackServiceUrl?: string)
authUrl: import.meta.env.VITE_AUTH_URL,
fallbackServiceUrl,
useImmediateFallbackOnError: true,
timeout: 5000,
}).link;
};

Expand Down
67 changes: 67 additions & 0 deletions src/pages/explorer/Home/Home.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
flex-wrap: wrap;
row-gap: 32px;
column-gap: 24px;
margin: 0 auto;
}

.header {
Expand All @@ -31,3 +32,69 @@
width: 48px;
height: 10px;
}

@media screen and (max-width: 4825px) {
.list {
width: 4412px;
}
}
@media screen and (max-width: 4565px) {
.list {
width: 4151px;
}
}
@media screen and (max-width: 4305px) {
.list {
width: 3890px;
}
}
@media screen and (max-width: 4045px) {
.list {
width: 3629px;
}
}
@media screen and (max-width: 3785px) {
.list {
width: 3368px;
}
}
@media screen and (max-width: 3525px) {
.list {
width: 3107px;
}
}
@media screen and (max-width: 3265px) {
.list {
width: 2846px;
}
}
@media screen and (max-width: 3005px) {
.list {
width: 2585px;
}
}
@media screen and (max-width: 2745px) {
.list {
width: 2324px;
}
}
@media screen and (max-width: 2485px) {
.list {
width: 2063px;
}
}
@media screen and (max-width: 2225px) {
.list {
width: 1802px;
}
}
@media screen and (max-width: 1965px) {
.list {
width: 1541px;
}
}
@media screen and (max-width: 1705px) {
.list {
width: 1280px;
}
}
16 changes: 10 additions & 6 deletions src/pages/explorer/Home/Home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ const Home: React.FC = () => {
const [searchKeywords, setSearchKeywords] = React.useState('');
const [topProject, setTopProject] = React.useState<Project>();
const [projects, setProjects] = React.useState<Project[]>([]);
// ref for fetch, state for render.
const fetchedProejcts = React.useRef<Project[]>([]);
// Note why don't use Apollo client's loading.
// Apollo client's loading seems have some delay.
// If use it would not update by project's update.
Expand Down Expand Up @@ -93,34 +95,36 @@ const Home: React.FC = () => {
} else {
setInSearchMode(false);
}
console.warn(options);
const api = searchKeywords.length ? getProjectBySearch : getProjects;

const params = searchKeywords.length
? {
offset: options?.refresh ? 0 : projects.length,
offset: options?.refresh ? 0 : fetchedProejcts.current.length,
keywords: searchKeywords,
}
: {
variables: {
offset: options?.refresh ? 0 : projects.length,
offset: options?.refresh ? 0 : fetchedProejcts.current.length,
orderBy: [ProjectsOrderBy.TOTAL_REWARD_DESC, ProjectsOrderBy.UPDATED_TIMESTAMP_DESC],
ids: ['0x06'],
},
defaultOptions: { fetchPolicy: 'network-only' },
};

// The type define at top.
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
const res = await api(params);

let updatedLength = projects.length;
let updatedLength = fetchedProejcts.current.length;
// implement a sorting for projects
if (res.data?.projects?.nodes) {
// it seems have something wrong with TypeScript
// filter once or twice is the same.
const nonEmptyProjects = res.data.projects?.nodes.filter(notEmpty).filter(notEmpty);
const mergered = options?.refresh ? [...nonEmptyProjects] : [...projects, ...nonEmptyProjects];
const mergered = options?.refresh ? [...nonEmptyProjects] : [...fetchedProejcts.current, ...nonEmptyProjects];
setProjects(mergered);
fetchedProejcts.current = mergered;
updatedLength = mergered.length;
setTotal(res.data?.projects?.totalCount);
}
Expand All @@ -137,7 +141,7 @@ const Home: React.FC = () => {
const { mutate } = useInfiniteScroll(() => loadMore(), {
target: document,
isNoMore: (d) => !!d?.isNoMore,
threshold: 300,
threshold: 500,
});

useMount(() => {
Expand Down
2 changes: 1 addition & 1 deletion src/pages/explorer/Project/Project.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ const ProjectInner: React.FC = () => {
isUnsafeDeployment={!!asyncDeploymentMetadata.data?.unsafe}
/>
</div>
<TabButtons tabs={sortedTabList} />
<TabButtons tabs={sortedTabList} withUnderline />
</div>
<div style={{ padding: '0 78px 24px 78px' }}>
{/* TODO: just render the components rather than routes. */}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@
display: flex;
justify-content: center;
align-items: center;

:global {
.tabButtons {
width: auto;
}
}
}

.dataUpdateText {
Expand Down
2 changes: 1 addition & 1 deletion src/pages/swap/Swap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import i18next, { TFunction } from 'i18next';

import { useWeb3Store } from 'src/stores';

import styles from './Swap.module.css';
import styles from './Swap.module.less';
import { SwapForm } from './SwapForm';

const { SWAP, SELL, BUY } = ROUTES;
Expand Down
Loading

0 comments on commit 91ab7e1

Please sign in to comment.