From dd35f9dfee06e01c2dfd4a93cf7843ddc7e75160 Mon Sep 17 00:00:00 2001 From: numtel Date: Fri, 30 Aug 2024 11:53:27 -0400 Subject: [PATCH 1/2] feat(web): include compiler version and commit hash in circuit repo link --- web/src/pages/ProjectPage.tsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/web/src/pages/ProjectPage.tsx b/web/src/pages/ProjectPage.tsx index ab2accb..4524308 100644 --- a/web/src/pages/ProjectPage.tsx +++ b/web/src/pages/ProjectPage.tsx @@ -83,6 +83,7 @@ const ProjectPage: React.FC = () => { const circuitsClean = validatedProjectData.circuits?.map((circuit) => ({ template: circuit.data.template, + compiler: circuit.data.compiler, name: circuit.data.name, description: circuit.data.description, constraints: circuit.data.metadata?.constraints, @@ -495,11 +496,17 @@ const ProjectPage: React.FC = () => { Template Link - + {truncateString(circuit.template.source, 16)} + + Compiler Version + + {circuit.compiler.version} + + ))} From 2306398a345ff04f0f455697d8c5bf156e284fc8 Mon Sep 17 00:00:00 2001 From: numtel Date: Fri, 30 Aug 2024 12:25:39 -0400 Subject: [PATCH 2/2] chore: commit-specific link goes to repo root --- web/src/helpers/utils.ts | 7 ++++++- web/src/pages/ProjectPage.tsx | 9 ++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/web/src/helpers/utils.ts b/web/src/helpers/utils.ts index 436aa4f..03b7ac9 100644 --- a/web/src/helpers/utils.ts +++ b/web/src/helpers/utils.ts @@ -15,6 +15,11 @@ export function truncateString(str: string, numCharacters = 5): string { return `${firstPart}...${lastPart}`; } + +export function parseRepoRoot(templateSource: string): string | null { + const match = templateSource.match(/^(https:\/\/github\.com\/[^\/]+\/[^\/]+)(?:\/|$)/); + return match ? match[1] : null; +} export function parseDate(dateString: number): string { const parsedDate = new Date(dateString); @@ -860,4 +865,4 @@ export const checkGitHubReputation = async (): Promise => { if (data.following < minFollowing) return false return true -} \ No newline at end of file +} diff --git a/web/src/pages/ProjectPage.tsx b/web/src/pages/ProjectPage.tsx index 4524308..ec40cb9 100644 --- a/web/src/pages/ProjectPage.tsx +++ b/web/src/pages/ProjectPage.tsx @@ -50,7 +50,8 @@ import { getTimeDifference, parseDate, singleProjectPageSteps, - truncateString + truncateString, + parseRepoRoot } from "../helpers/utils"; import Joyride, { STATUS } from "react-joyride"; import ScrollingAvatars from "../components/Avatars"; @@ -490,13 +491,15 @@ const ProjectPage: React.FC = () => { Commit Hash - {truncateString(circuit.template.commitHash, 6)} + + {truncateString(circuit.template.commitHash, 6)} + Template Link - + {truncateString(circuit.template.source, 16)}