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 update #42

Merged
merged 109 commits into from
Sep 13, 2024
Merged
Show file tree
Hide file tree
Changes from 86 commits
Commits
Show all changes
109 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
5a51e2c
chore: update layout style
0xExp-po Sep 10, 2024
ba732d7
chore: update style set project page
0xExp-po Sep 10, 2024
ec978e4
chore: responsive padding
0xExp-po Sep 10, 2024
cabb609
chore: update style in navbar and footer
0xExp-po Sep 10, 2024
1bd7336
chore: submit by enter key down
0xExp-po Sep 10, 2024
431da61
feat: create primary button
0xExp-po Sep 10, 2024
d8ddb8a
chore: change button with pimary button
0xExp-po Sep 10, 2024
3755145
chore: change padding of primary button
0xExp-po Sep 10, 2024
e83b5d3
chore: exchange with primary button
0xExp-po Sep 10, 2024
876ef22
chore: change modal button with primary button
0xExp-po Sep 10, 2024
2c39acf
chore: update connect wallet button style
0xExp-po Sep 10, 2024
ceb6820
chore: connect wallet after set project
0xExp-po Sep 10, 2024
a59e673
chore: format code style in projectinfo
0xExp-po Sep 10, 2024
ea49f41
fix: scroll bar style
0xExp-po Sep 10, 2024
0f0ee28
chore: create modal Input box
0xExp-po Sep 10, 2024
80b09a3
chore: update components style
0xExp-po Sep 10, 2024
7623435
chore: update project info section style
0xExp-po Sep 10, 2024
ca41604
chore: update commit record style
0xExp-po Sep 10, 2024
bb7198a
chore: update get commit section style
0xExp-po Sep 10, 2024
6f37499
chore: update commit section style
0xExp-po Sep 10, 2024
aebfddf
Merge branch 'tupui:main' into dapp-update
0xExp-po Sep 10, 2024
f608901
Merge branch 'dapp-update' of https://github.com/0xExp-po/soroban-ver…
0xExp-po Sep 10, 2024
f9a6fb3
chore: commit record has popup updating
0xExp-po Sep 10, 2024
41b13be
fix: set hash length 64
0xExp-po Sep 10, 2024
2eaf2de
chore: change input to modalinput in register project section
0xExp-po Sep 10, 2024
1c20809
chore: remove console in commit history
0xExp-po Sep 11, 2024
3b9580c
chore: update style of modal
0xExp-po Sep 11, 2024
97b618d
feat: add config data variable in state service
0xExp-po Sep 11, 2024
fb718bd
chore: change project name to lowercase
0xExp-po Sep 11, 2024
c2ee164
feat: create fetch config function
0xExp-po Sep 11, 2024
9670ffa
feat: get config data in set project page
0xExp-po Sep 11, 2024
7714f4b
feat: add config data modal in project info section
0xExp-po Sep 11, 2024
3a58df5
chore: add maintainer badge to commit record
0xExp-po Sep 11, 2024
b2b56d2
chore: change the badge name
0xExp-po Sep 12, 2024
cf994bf
chore:remove verion from config data
0xExp-po Sep 12, 2024
03ce656
feat: add refresh state variable function
0xExp-po Sep 12, 2024
ceea420
chore: error alert when config data is empty
0xExp-po Sep 12, 2024
ecfea36
chore: ellipsis middle of publick key
0xExp-po Sep 12, 2024
1c38a5c
chore: add more icons in project info modal
0xExp-po Sep 12, 2024
e59c7fa
feat: add project list section
0xExp-po Sep 12, 2024
c7e3cf8
fix: life cycle error and add nanostore
0xExp-po Sep 12, 2024
f5b1d76
chore: add click function in project card
0xExp-po Sep 12, 2024
651d7c3
chore: separate to read and write contract services
0xExp-po Sep 12, 2024
d2b46fd
chore: remove unnecessary logs
0xExp-po Sep 12, 2024
f83159d
chore: remove button and show hash
0xExp-po Sep 12, 2024
6b79544
chore: set the latest sha as initial value of commit input
0xExp-po Sep 12, 2024
6f49841
fix: add nanostores in package
0xExp-po Sep 12, 2024
374f4be
chore: remove logo in project info modal
0xExp-po Sep 12, 2024
b91c621
fix: undefined error fix
0xExp-po Sep 13, 2024
3d2c91a
chore: update demo config data
0xExp-po Sep 13, 2024
f205696
fix: get latest sha error
0xExp-po Sep 13, 2024
25e2e2a
feat: add convert logo link function
0xExp-po Sep 13, 2024
b3da47e
chore: update demo config data
0xExp-po Sep 13, 2024
8675746
refactor: rebase utils functions structure
0xExp-po Sep 13, 2024
a719f09
fix: remove toast
0xExp-po Sep 13, 2024
08a32f3
feat: add dropdown, search box and register button
0xExp-po Sep 13, 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
Binary file added dapp/public/fallback-image.jpg
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good enough for now 👍 At some point hopefully we can make some art for stuff like these 😄 Curious here, is this something you know how to do?

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
74 changes: 39 additions & 35 deletions dapp/src/components/Commit.astro
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
import Topic from "./utils/Topic.astro";
import Loading from "./utils/Loading.astro";
import PrimaryButton from "./utils/PrimaryButton.astro";
---

<div id="update-commit-section" class="hidden">
Expand All @@ -9,9 +10,9 @@ import Loading from "./utils/Loading.astro";
</div>

<div
class="relative flex flex-col items-center md:flex-row my-6 bg-zinc-100 rounded-[45px]"
class="relative flex flex-col items-center md:flex-row my-6 bg-zinc-100 rounded-3xl sm:rounded-[45px]"
>
<div class="row items-center py-12 px-4 md:px-20 md:w-8/12 md:py-10">
<div class="row items-center py-8 sm:py-12 px-6 sm:px-12 md:px-20 w-full md:w-8/12 md:py-10">
<div class="space-y-8 md:w-full">
<label class="block mb-2 text-base font-medium text-black">
Commit hash
Expand All @@ -22,21 +23,16 @@ import Loading from "./utils/Loading.astro";
class="block p-3 w-full text-base text-black bg-white rounded-lg border shadow-sm focus:ring-black focus:border-black"
placeholder="Last commit hash"
required
minlength="40"
maxlength="40"
minlength="64"
maxlength="64"
/>
</label>
<div id="wrap-commit-button">
<button
data-commit-hash
aria-controls="commit-hash"
class="w-full py-5 bg-zinc-900 rounded-[14px] justify-center gap-2.5 inline-flex"
>
<span class="text-center text-white text-xl font-normal leading-7"
>Commit on-chain</span
>
</button>
</div>
<PrimaryButton
wrapId="wrap-commit-button"
dataAttr="data-commit-hash"
ariaControls="commit-hash"
buttonText="Commit on-chain"
/>
</div>
<div id="wrap-commit-loader" class="hidden">
<Loading />
Expand All @@ -51,17 +47,22 @@ import Loading from "./utils/Loading.astro";
import { loadedPublicKey } from "./stellar-wallets-kit";

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

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);
function updateCommitSectionVisibility() {
const projectInfo = loadProjectInfo();

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);
}
}
}

// Call the function when the page loads
updateCommitSectionVisibility();

const commit_hash = document.getElementById(
"commit_hash",
) as HTMLInputElement;
Expand All @@ -83,16 +84,19 @@ import Loading from "./utils/Loading.astro";
try {
const commit_status = await commitHash(commit_hash.value);

wrap_loader.style.display = "none";
wrap_button.style.display = "block";
if (!commit_status) {
alert("Hash could not be committed! Please retry.");
} else {
wrap_button.innerHTML = "Hash committed!";
wrap_loader.style.display = "none";
wrap_button.style.display = "block";
if (!commit_status) {
alert("Hash could not be committed! Please retry.");
} else {
wrap_button.innerHTML = "Hash committed!";
}
} catch (e) {
console.error(e);
}
} catch (e) {
console.error(e);
}
});
}});
})};

// Add event listener for wallet connection
window.addEventListener('walletConnected', updateCommitSectionVisibility);
});
</script>
22 changes: 18 additions & 4 deletions dapp/src/components/CommitHistory.jsx
Original file line number Diff line number Diff line change
@@ -1,22 +1,35 @@
import React from 'react';
import { useState, useEffect } from 'react';
import { getCommitHistory } from '../service/GithubService';
import CommitRecord from './CommitRecord.jsx';
import { formatDate } from '../service/utils';
import { loadProjectRepoInfo } from '../service/StateService';
import { loadProjectRepoInfo, loadConfigData } from '../service/StateService';

const CommitHistory = () => {
const [commitHistory, setCommitHistory] = React.useState([]);
const [commitHistory, setCommitHistory] = useState([]);
const [authors, setAuthors] = useState([]);

React.useEffect(() => {
useEffect(() => {
const fetchCommitHistory = async () => {
const projectRepoInfo = loadProjectRepoInfo();
if (projectRepoInfo?.author && projectRepoInfo?.repository) {
const history = await getCommitHistory(projectRepoInfo.author, projectRepoInfo.repository);
console.log("history:", history);
setCommitHistory(history);
}
};

const addMaintainerBadge = () => {
const configData = loadConfigData();
if (configData) {
const authors = configData.authorGithubNames.map(name => name.toLowerCase());
setAuthors(authors);
} else {
console.log("Can not read config data.");
}
}

fetchCommitHistory();
addMaintainerBadge();
}, []);

return (
Expand All @@ -37,6 +50,7 @@ const CommitHistory = () => {
authorGithubLink={commit.author.html_url}
sha={commit.sha}
commitLink={commit.html_url}
isMaintainer={authors ? authors.includes(commit.author.name.toLowerCase()) : false}
/>
</div>
))}
Expand Down
35 changes: 27 additions & 8 deletions dapp/src/components/CommitRecord.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { useState, useEffect } from 'react';
import { formatTime } from '../service/utils';
import { loadProjectLatestSha } from '../service/StateService';

const CommitRecord = ({ message, date, authorName, authorGithubLink, sha, commitLink }) => {
const CommitRecord = ({ message, date, authorName, authorGithubLink, sha, commitLink, isMaintainer }) => {
const [isCopied, setIsCopied] = useState(false);
const [isLatestCommit, setIsLatestCommit] = useState(false);
const formattedMessage = message.split(/\r?\n/).map(line => line.trim()).filter(Boolean);
Expand All @@ -28,10 +28,19 @@ const CommitRecord = ({ message, date, authorName, authorGithubLink, sha, commit
};

return (
<div className={`commit-record relative bg-white p-4 rounded-lg border border-gray-200 shadow-sm flex justify-between items-start ${isLatestCommit ? 'border-2 border-blue-300 bg-zinc-300' : ''}`} data-sha={sha} id={isLatestCommit ? 'latest-commit-record' : undefined}>
{isLatestCommit && (
<div className="absolute top-0.5 left-1 text-xs font-bold tracking-tighter leading-3 bg-lime rounded-sm p-0.5">
latest commit
<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' : ''}`} data-sha={sha} id={isLatestCommit ? 'latest-commit-record' : undefined}>
{(isLatestCommit || isMaintainer) && (
<div className="absolute top-0.5 left-1 flex space-x-1">
{isLatestCommit && (
<div className="text-xs font-bold tracking-tighter leading-3 bg-lime rounded-sm p-0.5">
latest commit
tupui marked this conversation as resolved.
Show resolved Hide resolved
</div>
)}
{isMaintainer && (
<div className="text-xs font-bold tracking-tighter leading-3 bg-blue-200 rounded-sm p-0.5">
by maintainer
tupui marked this conversation as resolved.
Show resolved Hide resolved
</div>
)}
</div>
)}
<div className="commit-info flex-grow overflow-hidden mr-4">
Expand All @@ -48,12 +57,22 @@ const CommitRecord = ({ message, date, authorName, authorGithubLink, sha, commit
)}
<div className="commit-details text-sm text-gray-600 mt-1">
<a href={authorGithubLink} target="_blank" rel="noopener noreferrer" className="author-name font-semibold hover:underline hover:text-blue-500">{authorName}</a>
<span className="mx-1">committed on</span>
<span className="commit-date">{formatTime(date)}</span>
<span className="ml-1 hidden sm:inline"> committed on</span>
<span className="commit-date ml-1"> {formatTime(date)}</span>
</div>
</div>
<div className="commit-sha flex items-center space-x-2 flex-shrink-0">
<a href={commitLink} target="_blank" rel="noopener noreferrer" className="sha text-sm font-mono text-gray-500 hover:bg-zinc-400 transition-colors duration-200 px-2 py-1 rounded">{sha.substring(0, 7)}</a>
<div className="relative group">
<a href={commitLink} target="_blank" rel="noopener noreferrer" className="sha text-sm font-mono text-gray-500 hover:bg-zinc-400 transition-colors duration-200 px-2 py-1 rounded">
{sha.substring(0, 7)}
</a>
<div className="absolute -left-1/4 sm:-left-full bottom-full mb-2 -translate-x-1/2 hidden group-hover:block">
<div className="bg-black text-white text-xs py-1 px-2 rounded shadow-lg max-w-[54vw] sm:max-w-[90vw] break-words">
{sha}
<div className="absolute left-2/3 sm:left-3/4 top-full border-4 border-transparent border-t-black"></div>
</div>
</div>
</div>
<button className="copy-button hover:bg-zinc-400 transition-colors duration-200 p-1 rounded" onClick={handleCopy}>
{isCopied ? (
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" strokeWidth="1.5" stroke="currentColor" className="w-5 h-5 text-green-500">
Expand Down
16 changes: 3 additions & 13 deletions dapp/src/components/ConnectWallet.astro
Original file line number Diff line number Diff line change
@@ -1,17 +1,7 @@
<div id="connect-wrap" class="wrap" aria-live="polite">
<button data-connect aria-controls="connect-wrap">Connect</button>
<div id="connect-wrap" aria-live="polite">
<button data-connect aria-controls="connect-wrap" class="text-center text-sm sm:text-base max-w-28 sm:max-w-36 md:max-w-44 truncate">Connect</button>
</div>

<style>
.wrap {
text-align: center;
max-width: 12rem;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
</style>

<script>
import { kit, loadedPublicKey, setPublicKey } from "./stellar-wallets-kit";

Expand All @@ -21,7 +11,7 @@
) as HTMLButtonElement;

async function setLoggedIn(publicKey: string) {
button.textContent = `Signed in as ${publicKey}`;
button.textContent = `${publicKey}`;
}
tupui marked this conversation as resolved.
Show resolved Hide resolved

const connectedPublicKey = loadedPublicKey();
Expand Down
66 changes: 52 additions & 14 deletions dapp/src/components/GetCommit.astro
Original file line number Diff line number Diff line change
@@ -1,27 +1,23 @@
---
import Topic from "./utils/Topic.astro";
import Loading from "./utils/Loading.astro";
import PrimaryButton from "./utils/PrimaryButton.astro";
---

<div class="relative flex flex-col items-center md:flex-row">
<Topic title="Latest hash" description="Get the latest hash on-chain" />
</div>

<div
class="relative flex flex-col items-center md:flex-row my-6 bg-zinc-100 rounded-[45px]"
class="relative flex flex-col items-center md:flex-row my-6 bg-zinc-100 rounded-3xl sm:rounded-[45px]"
>
<div class="row items-center py-12 px-4 md:px-20 md:w-8/12 md:py-10">
<div id="wrap-get-hash-button" class="space-y-8 md:w-full">
<button
data-project-get-hash
aria-controls="get-hash"
class="w-full py-5 bg-zinc-900 rounded-[14px] justify-center gap-2.5 inline-flex"
>
<span class="text-center text-white text-xl font-normal leading-7"
>Latest hash</span
>
</button>
</div>
<div class="row items-center py-8 sm:py-10 md:py-12 px-6 sm:px-10 md:px-20 w-full md:w-8/12">
<PrimaryButton
wrapId="wrap-get-hash-button"
dataAttr="data-project-get-hash"
ariaControls="get-hash"
buttonText="Latest hash"
/>
<div id="wrap-get-hash-loader" class="hidden">
<Loading />
</div>
Expand Down Expand Up @@ -51,7 +47,49 @@ import Loading from "./utils/Loading.astro";

wrap_loader.style.display = "none";
wrap_button.style.display = "block";
wrap_button.innerHTML = `${project_hash}`;

if (project_hash) {
const hashDisplay = document.createElement('div');
hashDisplay.className = 'max-w-[90%] relative group';
const content = document.createElement("p");
content.className = 'truncate';
content.textContent = project_hash;

hashDisplay.appendChild(content)

const popup = document.createElement('div');
popup.textContent = project_hash;
popup.className = 'absolute left-1/2 -translate-x-1/2 bottom-full mb-2 hidden group-hover:block bg-zinc-800 text-white text-center text-sm px-2 py-1 rounded-md max-w-[90vw] break-all whitespace-normal';
popup.style.width = 'max-content';

const triangle = document.createElement('div');
triangle.className = 'absolute left-1/2 -translate-x-1/2 -bottom-1 w-0 h-0 border-l-8 border-r-8 border-t-8 border-l-transparent border-r-transparent border-t-zinc-800';

popup.appendChild(triangle);
hashDisplay.appendChild(popup);

const copyIcon = document.createElement('button');
copyIcon.innerHTML = '<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 ml-2" viewBox="0 0 20 20" fill="white" stroke="currentColor"><path d="M8 3a1 1 0 011-1h2a1 1 0 110 2H9a1 1 0 01-1-1z"/><path d="M6 3a2 2 0 00-2 2v11a2 2 0 002 2h8a2 2 0 002-2V5a2 2 0 00-2-2 3 3 0 01-3 3H9a3 3 0 01-3-3z"/></svg>';
copyIcon.className = 'text-gray-600 hover:text-gray-800 focus:outline-none';
copyIcon.addEventListener('click', () => {
navigator.clipboard.writeText(project_hash).then(() => {
copyIcon.innerHTML = '<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 ml-2" viewBox="0 0 20 20" fill="green"><path fill-rule="evenodd" d="M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z" clip-rule="evenodd"/></svg>';
setTimeout(() => {
copyIcon.innerHTML = '<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 ml-2" viewBox="0 0 20 20" fill="white" stroke="currentColor"><path d="M8 3a1 1 0 011-1h2a1 1 0 110 2H9a1 1 0 01-1-1z"/><path d="M6 3a2 2 0 00-2 2v11a2 2 0 002 2h8a2 2 0 002-2V5a2 2 0 00-2-2 3 3 0 01-3 3H9a3 3 0 01-3-3z"/></svg>';
}, 2000);
});
});

const container = document.createElement('div');
container.className = 'flex items-center justify-around w-full max-w-[450px] rounded-md border border-zinc-400';
container.appendChild(hashDisplay);
container.appendChild(copyIcon);

wrap_button.innerHTML = '';
wrap_button.appendChild(container);
} else {
wrap_button.innerHTML = '';
}
} catch (e) {
console.error(e);
}
Expand Down
Loading
Loading