Skip to content

Commit

Permalink
Project page update (#53)
Browse files Browse the repository at this point in the history
* feat: add function to get commit info from sha

* chore: change name class to classname

* chore: add check and failed icons

* feat: update project info UI

* chore: add docs link to tansu.toml alert messate

* fix: fetch error handler in project info page

* chore: remove border from sync badges

* fix: commit section disable error

* chore: change border color to lime of latest commit record
  • Loading branch information
0xExp-po authored Sep 16, 2024
1 parent f71d6fe commit b230931
Show file tree
Hide file tree
Showing 8 changed files with 419 additions and 260 deletions.
4 changes: 4 additions & 0 deletions dapp/public/icons/check.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions dapp/public/icons/failed.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 10 additions & 6 deletions dapp/src/components/Commit.astro
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,17 @@ import PrimaryButton from "./utils/PrimaryButton.astro";
import { commitHash } from "../service/WriteContractService";
import { loadProjectInfo } from "../service/StateService";
import { loadedPublicKey } from "./stellar-wallets-kit";
import { latestCommit } from "../utils/store";
import { latestCommit, projectInfoLoaded } from "../utils/store";

document.addEventListener("astro:page-load", () => {
function updateCommitSectionVisibility() {
const projectInfo = loadProjectInfo();

if (projectInfo) {
const connectedPublicKey = loadedPublicKey();
const isMaintainer = connectedPublicKey
? projectInfo.maintainers.includes(connectedPublicKey)
: false;
? projectInfo.maintainers.includes(connectedPublicKey)
: false;
const updateCommitSection = document.getElementById(
"update-commit-section",
);
Expand All @@ -66,9 +66,13 @@ import PrimaryButton from "./utils/PrimaryButton.astro";
}
}
}

// Call the function when the page loads
updateCommitSectionVisibility();
projectInfoLoaded.subscribe((loaded) => {
if (loaded) {
updateCommitSectionVisibility();
}
});

const commit_hash = document.getElementById(
"commit_hash",
Expand Down
2 changes: 1 addition & 1 deletion dapp/src/components/CommitRecord.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const CommitRecord = ({

return (
<div
className={`commit-record relative bg-white pt-5 pb-3 px-4 rounded-lg border border-gray-200 shadow-sm flex justify-between items-start ${isLatestCommit ? "border-2 border-blue-300 bg-zinc-300" : ""}`}
className={`commit-record relative bg-white pt-5 pb-3 px-4 rounded-lg border border-gray-200 shadow-sm flex justify-between items-start ${isLatestCommit ? "border-2 border-lime bg-zinc-300" : ""}`}
data-sha={sha}
id={isLatestCommit ? "latest-commit-record" : undefined}
>
Expand Down
Loading

0 comments on commit b230931

Please sign in to comment.