From 6a0d8e67b691e251d7c3a6cf7f3b6a251c094cc5 Mon Sep 17 00:00:00 2001 From: 0xExp-po Date: Mon, 16 Sep 2024 09:35:33 +0900 Subject: [PATCH 1/9] feat: add function to get commit info from sha --- dapp/src/service/GithubService.ts | 33 +++++++++++++++++++++++++------ dapp/src/types/github.ts | 8 ++++++++ 2 files changed, 35 insertions(+), 6 deletions(-) diff --git a/dapp/src/service/GithubService.ts b/dapp/src/service/GithubService.ts index 1258e1c..d4734d3 100644 --- a/dapp/src/service/GithubService.ts +++ b/dapp/src/service/GithubService.ts @@ -1,11 +1,8 @@ import axios from "axios"; import toml from "toml"; -import type { FormattedCommit } from "../types/github"; -import { - getGithubContentUrl, - getGithubContentUrlFromConfigUrl, -} from "../utils/editLinkFunctions"; +import type { CommitData, FormattedCommit } from '../types/github'; +import { getGithubContentUrl, getGithubContentUrlFromConfigUrl } from '../utils/editLinkFunctions'; async function getCommitHistory( username: string, @@ -141,4 +138,28 @@ async function getTOMLFileHash(configUrl: string) { } } -export { getCommitHistory, fetchTOML, fetchTOMLFromConfigUrl, getTOMLFileHash }; +async function getCommitDataFromSha(owner: string, repo: string, sha: string): Promise { + const url = `https://api.github.com/repos/${owner}/${repo}/commits/${sha}`; + const response = await fetch(url); + + if (!response.ok) { + throw new Error(`GitHub API request failed: ${response.statusText}`); + } + + const data = await response.json(); + return { + sha: data.sha, + message: data.commit.message, + author: data.commit.author.name, + date: new Date(data.commit.author.date), + url: data.html_url + }; +} + +export { + getCommitHistory, + fetchTOML, + fetchTOMLFromConfigUrl, + getTOMLFileHash, + getCommitDataFromSha, +}; diff --git a/dapp/src/types/github.ts b/dapp/src/types/github.ts index d0a2af3..7bcbdd9 100644 --- a/dapp/src/types/github.ts +++ b/dapp/src/types/github.ts @@ -5,3 +5,11 @@ export interface FormattedCommit { html_url: string; sha: string; } + +export interface CommitData { + sha: string; + message: string; + author: string; + date: Date; + url: string; +} From 13903451a68a1b5326754d0d4d7be4b36adbcf52 Mon Sep 17 00:00:00 2001 From: 0xExp-po Date: Mon, 16 Sep 2024 09:47:01 +0900 Subject: [PATCH 2/9] chore: change name class to classname --- dapp/src/components/ProjectList.jsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dapp/src/components/ProjectList.jsx b/dapp/src/components/ProjectList.jsx index 3c8a3b9..12d763c 100644 --- a/dapp/src/components/ProjectList.jsx +++ b/dapp/src/components/ProjectList.jsx @@ -190,12 +190,12 @@ const ProjectList = () => {
{filteredProjects.map((project, index) => ( From 519c573112384b4143fbe7e5613200865e91e771 Mon Sep 17 00:00:00 2001 From: 0xExp-po Date: Mon, 16 Sep 2024 14:17:26 +0900 Subject: [PATCH 3/9] chore: add check and failed icons --- dapp/public/icons/check.svg | 4 ++++ dapp/public/icons/failed.svg | 4 ++++ 2 files changed, 8 insertions(+) create mode 100644 dapp/public/icons/check.svg create mode 100644 dapp/public/icons/failed.svg diff --git a/dapp/public/icons/check.svg b/dapp/public/icons/check.svg new file mode 100644 index 0000000..0e82c45 --- /dev/null +++ b/dapp/public/icons/check.svg @@ -0,0 +1,4 @@ + + + + diff --git a/dapp/public/icons/failed.svg b/dapp/public/icons/failed.svg new file mode 100644 index 0000000..d339de3 --- /dev/null +++ b/dapp/public/icons/failed.svg @@ -0,0 +1,4 @@ + + + + From 9ee6454033ada346abe336ef717dd694cacc93db Mon Sep 17 00:00:00 2001 From: 0xExp-po Date: Mon, 16 Sep 2024 15:41:58 +0900 Subject: [PATCH 4/9] feat: update project info UI --- dapp/src/components/ProjectInfo.astro | 604 +++++++++++++++----------- dapp/src/service/GithubService.ts | 24 +- 2 files changed, 374 insertions(+), 254 deletions(-) diff --git a/dapp/src/components/ProjectInfo.astro b/dapp/src/components/ProjectInfo.astro index c56a6a2..723d9ac 100644 --- a/dapp/src/components/ProjectInfo.astro +++ b/dapp/src/components/ProjectInfo.astro @@ -31,95 +31,99 @@ import ModalInput from "./utils/ModalInput.astro"; >
-

- Project Name: -

-

+

-
-

Maintainers:

-
    + +
    + Project Thumbnail +
    +

    description

    +
    -
    -