Skip to content

Commit

Permalink
Fix Issue #1
Browse files Browse the repository at this point in the history
- Get max project id from project list regardless of sorting
- Make sure core contract address is lower case for the query to work properly
- Fix live view links
  • Loading branch information
rubentd committed Jul 30, 2022
1 parent bdd86f0 commit 37518b9
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
7 changes: 4 additions & 3 deletions src/components/ProjectList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,10 @@ const ProjectList = () => {

useEffect(() => {
if (data?.projects?.length) {
const { projectId } = data.projects[data.projects.length - 1];
if (projectId > highestProjectId) {
setHighestProjectId(projectId);
const projectIds = data.projects.map((project: Project) => Number(project.projectId));
const maxProjectId = Math.max(...projectIds);
if (maxProjectId > highestProjectId) {
setHighestProjectId(maxProjectId);
}
}
}, [data, data?.projects, highestProjectId]);
Expand Down
2 changes: 1 addition & 1 deletion src/components/TokenPreview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ const TokenPreview = ({
padding: [0, 0, 'default']
}}
onClick={() => {
window.open(`${generatorUrl}/${tokenId}`);
window.open(`${generatorUrl}/${coreContractAddress?.toLowerCase()}/${tokenId}`);
}}
>
<Typography fontSize="14px" display={['none', 'none', 'block']}>
Expand Down
2 changes: 1 addition & 1 deletion src/components/pages/ProjectPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const ProjectPage = () => {
<Page>
{
projectId ? (
<ProjectDetails id={coreContractAddress + '-' + projectId} />
<ProjectDetails id={coreContractAddress?.toLowerCase() + '-' + projectId} />
) : (
<Alert severity="info">
Project not found
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/useProject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
const projectQuery = (id: string) => `
query GetProject {
project(
id: "${id}"
id: "${id.toLowerCase()}"
) {
id
projectId
Expand Down

0 comments on commit 37518b9

Please sign in to comment.