Skip to content
This repository was archived by the owner on Mar 9, 2026. It is now read-only.
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions dapp/src/components/page/dashboard/CreateProjectModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { loadedPublicKey } from "@service/walletService";
import {
setConfigData,
setProject,
setProjectRepoInfo,
setProjectRepoUrl,
} from "@service/StateService";
import { navigate } from "astro:transitions/client";
import Button from "components/utils/Button.tsx";
Expand All @@ -13,7 +13,6 @@ import FlowProgressModal from "components/utils/FlowProgressModal.tsx";
import Step from "components/utils/Step.tsx";
import Title from "components/utils/Title.tsx";
import { useState, type FC, useCallback, useEffect } from "react";
import { getAuthorRepo } from "utils/editLinkFunctions";
import { extractConfigData, toast } from "utils/utils";
import {
validateProjectName as validateProjectNameUtil,
Expand Down Expand Up @@ -345,9 +344,8 @@ ${maintainerGithubs.map((gh) => `[[PRINCIPALS]]\ngithub="${gh}"`).join("\n\n")}
if (project && project.name && project.config && project.maintainers) {
setProject(project);

const { username, repoName } = getAuthorRepo(project.config.url);
if (username && repoName) {
setProjectRepoInfo(username, repoName);
if (project.config.url) {
setProjectRepoUrl(project.config.url);
}

const tomlData = await fetchTomlFromCid(project.config.ipfs);
Expand Down
12 changes: 4 additions & 8 deletions dapp/src/components/page/dashboard/ProjectCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,9 @@ import {
setProject,
setProjectId,
setProjectLatestSha,
setProjectRepoInfo,
setProjectRepoUrl,
} from "../../../service/StateService";
import {
convertGitHubLink,
getAuthorRepo,
} from "../../../utils/editLinkFunctions";
import { convertGitHubLink } from "../../../utils/editLinkFunctions";
import { projectCardModalOpen } from "../../../utils/store";
import { extractConfigData, toast } from "../../../utils/utils";

Expand All @@ -38,9 +35,8 @@ const ProjectCard = ({ config }: { config: ProjectConfig }) => {
const project = await getProjectFromName(config.projectName);
if (project && project.name && project.config && project.maintainers) {
setProject(project);
const { username, repoName } = getAuthorRepo(project.config.url);
if (username && repoName) {
setProjectRepoInfo(username, repoName);
if (project.config.url) {
setProjectRepoUrl(project.config.url);
}
const tomlData = await fetchTomlFromCid(project.config.ipfs);
if (tomlData) {
Expand Down
12 changes: 4 additions & 8 deletions dapp/src/components/page/project/CommitHistory.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useEffect, useState } from "react";
import { getCommitHistory } from "../../../service/GithubService.ts";
import {
loadConfigData,
loadProjectRepoInfo,
loadProjectRepoUrl,
} from "../../../service/StateService.ts";
import { formatDate } from "../../../utils/formatTimeFunctions.ts";
import { latestCommit, projectInfoLoaded } from "../../../utils/store.ts";
Expand All @@ -17,13 +17,9 @@ const CommitHistory = () => {
const [currentPage, setCurrentPage] = useState(1);

const fetchCommitHistory = async (page = 1) => {
const projectRepoInfo = loadProjectRepoInfo();
if (projectRepoInfo?.author && projectRepoInfo?.repository) {
const history = await getCommitHistory(
projectRepoInfo.author,
projectRepoInfo.repository,
page,
);
const repoUrl = loadProjectRepoUrl();
if (repoUrl) {
const history = await getCommitHistory(repoUrl, page);

if (history) {
setCommitHistory(history);
Expand Down
19 changes: 7 additions & 12 deletions dapp/src/components/page/project/ContributionMetrics.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useEffect, useState } from "react";
import type { ContributionMetrics as ContributionMetricsType } from "../../../types/contributionMetrics";
import type { ContributionMetrics as ContributionMetricsData } from "../../../types/contributionMetrics";
import { ContributionMetricsService } from "../../../service/ContributionMetricsService";
import { loadConfigData } from "../../../service/StateService";
import PonyFactorCard from "./PonyFactorCard";
Expand All @@ -8,16 +8,14 @@ import MonthlyActivityChart from "./MonthlyActivityChart";

interface ContributionMetricsProps {
projectName: string;
owner: string;
repo: string;
repoUrl: string;
}

const ContributionMetrics = ({
projectName,
owner,
repo,
repoUrl,
}: ContributionMetricsProps) => {
const [metrics, setMetrics] = useState<ContributionMetricsType | null>(null);
const [metrics, setMetrics] = useState<ContributionMetricsData | null>(null);
const [loading, setLoading] = useState(true);
const [error, setError] = useState<string | null>(null);
const [maintainers, setMaintainers] = useState<string[]>([]);
Expand All @@ -28,10 +26,7 @@ const ContributionMetrics = ({
setLoading(true);
setError(null);

const metrics = await ContributionMetricsService.fetchMetrics(
owner,
repo,
);
const metrics = await ContributionMetricsService.fetchMetrics(repoUrl);
setMetrics(metrics);

const configData = loadConfigData();
Expand All @@ -54,10 +49,10 @@ const ContributionMetrics = ({
}
};

if (projectName && owner && repo) {
if (projectName && repoUrl) {
fetchMetrics();
}
}, [projectName, owner, repo]);
}, [projectName, repoUrl]);

if (loading) {
return (
Expand Down
23 changes: 14 additions & 9 deletions dapp/src/components/page/project/LatestCommit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,20 @@ const LatestCommit = () => {
{commitData?.sha.slice(0, 9)}
</p>
<div className="flex gap-2">
<CopyButton textToCopy={commitData?.html_url || ""} size="sm" />
<a
href={commitData?.html_url}
target="_blank"
rel="noopener noreferrer"
className="hover:bg-gray-100 p-1 rounded transition-colors duration-200"
>
<img src="/icons/link.svg" alt="Open link" />
</a>
<CopyButton
textToCopy={commitData?.html_url || commitData?.sha || ""}
size="sm"
/>
{commitData?.html_url ? (
<a
href={commitData.html_url}
target="_blank"
rel="noopener noreferrer"
className="hover:bg-gray-100 p-1 rounded transition-colors duration-200"
>
<img src="/icons/link.svg" alt="Open link" />
</a>
) : null}
</div>
</div>
)}
Expand Down
21 changes: 7 additions & 14 deletions dapp/src/components/page/project/ProjectInfo.astro
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,7 @@ import Button from "components/utils/Button";
loadProjectLatestSha,
loadProjectName,
} from "../../../service/StateService";
import {
convertGitHubLink,
getAuthorRepo,
} from "../../../utils/editLinkFunctions";
import { convertGitHubLink } from "../../../utils/editLinkFunctions";
import { projectInfoLoaded } from "../../../utils/store";
import { getBadges, getMember } from "@service/ReadContractService";

Expand Down Expand Up @@ -579,16 +576,12 @@ import Button from "components/utils/Button";
}

if (projectInfo?.name && projectInfo?.config?.url) {
const { username, repoName } = getAuthorRepo(projectInfo.config.url);
if (username && repoName) {
contributionMetricsRoot.render(
React.createElement(ContributionMetrics, {
projectName: projectInfo.name,
owner: username,
repo: repoName,
}),
);
}
contributionMetricsRoot.render(
React.createElement(ContributionMetrics, {
projectName: projectInfo.name,
repoUrl: projectInfo.config.url,
}),
);
}

// Re-render modals with the updated data
Expand Down
14 changes: 14 additions & 0 deletions dapp/src/env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,20 @@ interface ImportMetaEnv {
readonly PUBLIC_DEFAULT_FEE: string;
readonly PUBLIC_DEFAULT_TIMEOUT: number;
readonly PUBLIC_DELEGATION_API_URL: string;
/**
* Optional URL for the Git proxy Cloudflare Worker.
* When set, git operations will use this proxy instead of the local /api/git endpoint.
* Examples:
* - "https://git.tansu.dev" (production)
* - "https://git-testnet.tansu.dev" (testnet)
*/
readonly PUBLIC_GIT_PROXY_URL?: string;
/**
* Additional allowed Git hosts (comma-separated).
* Used by the local /api/git endpoint to allow custom self-hosted Git servers.
* Example: "gitlab.mycompany.com,git.example.org"
*/
readonly GIT_ALLOWED_HOSTS?: string;
}

interface ImportMeta {
Expand Down
Loading
Loading