Skip to content

Commit d90f318

Browse files
authored
Merge pull request #129 from numtel/feat/circuit-details
feat(web): include compiler version and commit hash in circuit repo link
2 parents 55e2318 + 2306398 commit d90f318

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

web/src/helpers/utils.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ export function truncateString(str: string, numCharacters = 5): string {
1515

1616
return `${firstPart}...${lastPart}`;
1717
}
18+
19+
export function parseRepoRoot(templateSource: string): string | null {
20+
const match = templateSource.match(/^(https:\/\/github\.com\/[^\/]+\/[^\/]+)(?:\/|$)/);
21+
return match ? match[1] : null;
22+
}
1823

1924
export function parseDate(dateString: number): string {
2025
const parsedDate = new Date(dateString);
@@ -860,4 +865,4 @@ export const checkGitHubReputation = async (): Promise<boolean> => {
860865
if (data.following < minFollowing) return false
861866

862867
return true
863-
}
868+
}

web/src/pages/ProjectPage.tsx

+12-2
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ import {
5050
getTimeDifference,
5151
parseDate,
5252
singleProjectPageSteps,
53-
truncateString
53+
truncateString,
54+
parseRepoRoot
5455
} from "../helpers/utils";
5556
import Joyride, { STATUS } from "react-joyride";
5657
import ScrollingAvatars from "../components/Avatars";
@@ -83,6 +84,7 @@ const ProjectPage: React.FC = () => {
8384
const circuitsClean =
8485
validatedProjectData.circuits?.map((circuit) => ({
8586
template: circuit.data.template,
87+
compiler: circuit.data.compiler,
8688
name: circuit.data.name,
8789
description: circuit.data.description,
8890
constraints: circuit.data.metadata?.constraints,
@@ -489,7 +491,9 @@ const ProjectPage: React.FC = () => {
489491
<Stat>
490492
<StatLabel fontSize={12}>Commit Hash</StatLabel>
491493
<StatNumber fontSize={16}>
492-
{truncateString(circuit.template.commitHash, 6)}
494+
<a href={`${parseRepoRoot(circuit.template.source)}/tree/${circuit.template.commitHash}`} target="_blank">
495+
{truncateString(circuit.template.commitHash, 6)}
496+
</a>
493497
</StatNumber>
494498
</Stat>
495499
<Stat>
@@ -500,6 +504,12 @@ const ProjectPage: React.FC = () => {
500504
</a>
501505
</StatNumber>
502506
</Stat>
507+
<Stat>
508+
<StatLabel fontSize={12}>Compiler Version</StatLabel>
509+
<StatNumber fontSize={16}>
510+
{circuit.compiler.version}
511+
</StatNumber>
512+
</Stat>
503513
</SimpleGrid>
504514
</Box>
505515
))}

0 commit comments

Comments
 (0)