Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dApp commit history #38

Merged
merged 54 commits into from
Sep 10, 2024
Merged
Changes from 1 commit
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
e4e0f1a
feat: add getProject function in project.ts
0xExp-po Sep 4, 2024
c39cd48
chore: add check project/select path function in set project page
0xExp-po Sep 4, 2024
80b8ab7
feat: add project info component commit page
0xExp-po Sep 4, 2024
600acac
refactor: update components file structure
0xExp-po Sep 4, 2024
e88e57c
feat: create modal component
0xExp-po Sep 4, 2024
0eed507
feat: add update config function
0xExp-po Sep 4, 2024
b4ca722
feat: add update config function in commit page
0xExp-po Sep 4, 2024
3c94b9e
chore: keep displaying connected wallet
0xExp-po Sep 4, 2024
6f472cd
Update dapp/src/components/ProjectInfo.astro
0xExp-po Sep 4, 2024
570f912
chore: update project link and remove console
0xExp-po Sep 4, 2024
3f7e912
Merge branch 'dapp-dev' of https://github.com/0xExp-po/soroban-versio…
0xExp-po Sep 4, 2024
3b05c21
Linter
tupui Sep 4, 2024
d599bef
chore: update project info component ui
0xExp-po Sep 5, 2024
23ad649
chore: update 'update config' button function
0xExp-po Sep 5, 2024
38309b6
chore: add theme props to loading component
0xExp-po Sep 5, 2024
78c9978
refactor: rename the file of project.ts and restruct
0xExp-po Sep 5, 2024
86283b9
chore: add commit history view in project info
0xExp-po Sep 5, 2024
812f952
Merge branch 'tupui:main' into dapp-dev
0xExp-po Sep 5, 2024
2340066
Merge branch 'dapp-dev' of https://github.com/0xExp-po/soroban-versio…
0xExp-po Sep 5, 2024
b3f26ac
style: set color theme as extend in tailwindconfig
0xExp-po Sep 5, 2024
b026f26
feat: create formatTime and Date function
0xExp-po Sep 5, 2024
a8a5153
feat: add commit history section
0xExp-po Sep 5, 2024
7d1b143
feat: create get commit function
0xExp-po Sep 5, 2024
2453634
chore: update github service
0xExp-po Sep 5, 2024
d482522
chore: update commit history table
0xExp-po Sep 5, 2024
6809121
chore: remove change project name function
0xExp-po Sep 6, 2024
4989e60
chore: highlight latest commit in history
0xExp-po Sep 6, 2024
a4c866b
chore: fix type script error
0xExp-po Sep 6, 2024
461eccd
chore: change scroll bar style
0xExp-po Sep 6, 2024
3731700
refactor: divide project service to state service
0xExp-po Sep 6, 2024
152fbbf
feat: create project repo info state variable
0xExp-po Sep 6, 2024
98cad04
feat: initialize state variables by local storage
0xExp-po Sep 6, 2024
2d7ab70
feat: divide project service to state service (2)
0xExp-po Sep 6, 2024
7e6b48c
chore: update ui of project info view
0xExp-po Sep 6, 2024
dda12e5
feat: fix bug wallet connection after set project
0xExp-po Sep 6, 2024
3069ad7
feat: create utils functions related get link
0xExp-po Sep 7, 2024
042a38f
chore: jump to latest commit
0xExp-po Sep 7, 2024
e27177d
chore: fix scroll bar error and jump delay time
0xExp-po Sep 9, 2024
f743a74
feat: add astro/react
0xExp-po Sep 9, 2024
4755873
feat: display real commit history
0xExp-po Sep 9, 2024
4c2010c
chore: delete commit history demo data
0xExp-po Sep 9, 2024
5dc8193
Merge branch 'tupui:main' into dapp-dev
0xExp-po Sep 9, 2024
2845f8f
chore: display update commit section only for maintainer
0xExp-po Sep 9, 2024
62ba7f0
Fix button handlers and re-registration, missing loadedProjectInfo an…
tupui Sep 9, 2024
91384c1
Merge branch 'dapp-dev' of https://github.com/0xExp-po/soroban-versio…
0xExp-po Sep 10, 2024
43ba04e
Fix button handlers, re-registration, missing loadedProjectInfo and h…
tupui Sep 9, 2024
e65bba2
Merge branch 'dapp-dev' of https://github.com/0xExp-po/soroban-versio…
0xExp-po Sep 10, 2024
323be3b
Fix buttons
tupui Sep 10, 2024
37f4293
fix:change registerProject function
0xExp-po Sep 10, 2024
8da7530
chore: create package-lock
0xExp-po Sep 10, 2024
ff704dd
Merge from origin/dapp-dev
0xExp-po Sep 10, 2024
deb7f0e
chore: change loadedProjectInfo name to loadProjectInfo
0xExp-po Sep 10, 2024
d35d037
fix: load project latestsha function invoking
0xExp-po Sep 10, 2024
e736ac1
Merge branch 'tupui:main' into dapp-dev
0xExp-po Sep 10, 2024
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
Prev Previous commit
Next Next commit
Merge from origin/dapp-dev
  • Loading branch information
0xExp-po committed Sep 10, 2024
commit ff704dd1a9d80bac19973a891daa6cacb5116151
Binary file modified dapp/bun.lockb
Binary file not shown.
26 changes: 7 additions & 19 deletions dapp/src/components/Commit.astro
Original file line number Diff line number Diff line change
@@ -76,11 +76,12 @@ import Loading from "./utils/Loading.astro";
"[data-commit-hash]",
) as HTMLButtonElement;

button.addEventListener("click", async () => {
wrap_loader.style.display = "block";
wrap_button.style.display = "none";
try {
const commit_status = await commitHash(commit_hash.value);
if (button) {
button.addEventListener("click", async () => {
wrap_loader.style.display = "block";
wrap_button.style.display = "none";
try {
const commit_status = await commitHash(commit_hash.value);

wrap_loader.style.display = "none";
wrap_button.style.display = "block";
@@ -93,18 +94,5 @@ import Loading from "./utils/Loading.astro";
console.error(e);
}
});

window.addEventListener('walletConnected', (_event: Event) => {
const projectInfo = loadedProjectInfo();

if (projectInfo) {
const connectedPublicKey = loadedPublicKey();
const isMaintainer = connectedPublicKey ? projectInfo.maintainers.includes(connectedPublicKey) : false;
const updateCommitSection = document.getElementById("update-commit-section");
if (updateCommitSection) {
updateCommitSection.classList.toggle("hidden", !isMaintainer);
}
}
});
});
}});
</script>
3 changes: 1 addition & 2 deletions dapp/src/components/CommitRecord.jsx
Original file line number Diff line number Diff line change
@@ -12,8 +12,7 @@ const CommitRecord = ({ message, date, authorName, authorGithubLink, sha, commit

useEffect(() => {
const highlightLatestCommit = () => {
const latestSha = 'cb2e487eb72e836d5ef9f00b52997416a56173dd';
setIsLatestCommit(sha === latestSha);
setIsLatestCommit(sha === loadProjectLatestSha);
};
highlightLatestCommit();
}, [sha]);
58 changes: 23 additions & 35 deletions dapp/src/components/ConnectWallet.astro
Original file line number Diff line number Diff line change
@@ -1,19 +1,13 @@
<div id="connect-wrap" class="wrap" aria-live="polite">
<div class="ellipsis">
<button data-connect aria-controls="connect-wrap">Connect</button>
</div>
<button data-connect aria-controls="connect-wrap">Connect</button>
</div>

<style>
.wrap {
text-align: center;
}

.ellipsis {
max-width: 12rem;
overflow: hidden;
text-overflow: ellipsis;
text-align: center;
white-space: nowrap;
}
</style>
@@ -22,45 +16,39 @@
import { kit, loadedPublicKey, setPublicKey } from "./stellar-wallets-kit";

document.addEventListener("astro:page-load", () => {
const ellipsis = document.querySelector(
"#connect-wrap .ellipsis",
) as HTMLDivElement;
const button = document.querySelector(
"[data-connect]",
) as HTMLButtonElement;

async function setLoggedIn(publicKey: string) {
ellipsis.innerHTML = `Signed in as ${publicKey}`;
ellipsis.title = publicKey;
button.textContent = `Signed in as ${publicKey}`;
}

const connectedPublicKey = loadedPublicKey();
if (connectedPublicKey) {
setLoggedIn(connectedPublicKey);
}

button.addEventListener("click", async () => {
button.disabled = true;

try {
await kit.openModal({
onWalletSelected: async (option: { id: string }) => {
try {
kit.setWallet(option.id);
const { address } = await kit.getAddress();
setPublicKey(address);
await setLoggedIn(address);
button.disabled = false;

window.dispatchEvent(new CustomEvent('walletConnected', { detail: address }));
} catch (e) {
console.error(e);
}
},
});
} catch (e) {
console.error(e);
}
});
if (button) {
button.addEventListener("click", async () => {
try {
await kit.openModal({
onWalletSelected: async (option: { id: string }) => {
try {
kit.setWallet(option.id);
const { address } = await kit.getAddress();
setPublicKey(address);
await setLoggedIn(address);
window.dispatchEvent(new CustomEvent('walletConnected', { detail: address }));
} catch (e) {
console.error(e);
}
},
});
} catch (e) {
console.error(e);
}
});
}
});
</script>
26 changes: 14 additions & 12 deletions dapp/src/components/GetCommit.astro
Original file line number Diff line number Diff line change
@@ -42,18 +42,20 @@ import Loading from "./utils/Loading.astro";
"[data-project-get-hash]",
) as HTMLButtonElement;

button.addEventListener("click", async () => {
wrap_loader.style.display = "block";
wrap_button.style.display = "none";
try {
const project_hash = await getProjectHash();
if (button) {
button.addEventListener("click", async () => {
wrap_loader.style.display = "block";
wrap_button.style.display = "none";
try {
const project_hash = await getProjectHash();

wrap_loader.style.display = "none";
wrap_button.style.display = "block";
wrap_button.innerHTML = `${project_hash}`;
} catch (e) {
console.error(e);
}
});
wrap_loader.style.display = "none";
wrap_button.style.display = "block";
wrap_button.innerHTML = `${project_hash}`;
} catch (e) {
console.error(e);
}
});
}
});
</script>
4 changes: 2 additions & 2 deletions dapp/src/components/ProjectInfo.astro
Original file line number Diff line number Diff line change
@@ -71,12 +71,12 @@ import CommitHistory from "./CommitHistory.jsx";
</label>

<label class="block mb-2 text-base font-medium text-black">
URL
GitHub repository URL
<input
type="text"
id="modal-config-url"
class="block p-3 w-full text-base text-black bg-white rounded-lg border shadow-sm focus:ring-black focus:border-black"
placeholder="Information file URL"
placeholder="GitHub repository URL"
required
/>
</label>
40 changes: 21 additions & 19 deletions dapp/src/components/RegisterProject.astro
Original file line number Diff line number Diff line change
@@ -25,13 +25,13 @@ import Loading from "./utils/Loading.astro";
</label>

<label class="block mb-2 text-base font-medium text-black">
URL
GitHub repository URL
<input
type="text"
id="config_url"
name="config_hash"
class="block p-3 w-full text-base text-black bg-white rounded-lg border shadow-sm focus:ring-black focus:border-black"
placeholder="Information file URL"
placeholder="GitHub repository URL"
required
/>
</label>
@@ -95,24 +95,26 @@ import Loading from "./utils/Loading.astro";
"[data-register-project]",
) as HTMLButtonElement;

button.addEventListener("click", async () => {
wrap_loader.style.display = "block";
wrap_button.style.display = "none";
if (button) {
button.addEventListener("click", async () => {
wrap_loader.style.display = "block";
wrap_button.style.display = "none";

const register_status = await registerProject(
maintainers.value,
config_url.value,
config_hash.value,
SOROBAN_DOMAIN_CONTRACT_ID,
);
const register_status = await registerProject(
maintainers.value,
config_url.value,
config_hash.value,
SOROBAN_DOMAIN_CONTRACT_ID,
);

wrap_loader.style.display = "none";
wrap_button.style.display = "block";
if (!register_status) {
alert("Project could not be registered! Please retry.");
} else {
navigate("/commit");
}
});
wrap_loader.style.display = "none";
wrap_button.style.display = "block";
if (!register_status) {
alert("Project could not be registered! Please retry.");
} else {
navigate("/commit");
}
});
}
});
</script>