diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index be0abb7..f55a87c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -22,16 +22,16 @@ repos: language: rust pass_filenames: false entry: cargo fmt --all --check - - id: dapp - name: dApp prettier - language: node - pass_filenames: false - entry: cd dapp && bun prettier . --write - - id: website - name: website prettier - language: node - pass_filenames: false - entry: cd website && yarn format:mdx + # - id: dapp + # name: dApp prettier + # language: node + # pass_filenames: false + # entry: bun prettier . --write + # - id: website + # name: website prettier + # language: node + # pass_filenames: false + # entry: yarn format:mdx # our custom action - id: soroban-versioning diff --git a/dapp/package.json b/dapp/package.json index fbe4202..cd04780 100644 --- a/dapp/package.json +++ b/dapp/package.json @@ -22,7 +22,8 @@ "build": "astro check && astro build", "dev": "astro dev", "preview": "astro preview", - "start": "astro dev" + "start": "astro dev", + "linter": "prettier --write ." }, "type": "module", "version": "0.0.1", diff --git a/dapp/src/components/Commit.astro b/dapp/src/components/Commit.astro index 4fd86e6..5e6729c 100644 --- a/dapp/src/components/Commit.astro +++ b/dapp/src/components/Commit.astro @@ -46,35 +46,37 @@ import Loading from "./Loading.astro"; diff --git a/dapp/src/components/ConnectWallet.astro b/dapp/src/components/ConnectWallet.astro index f8e4dd4..d0f39bd 100644 --- a/dapp/src/components/ConnectWallet.astro +++ b/dapp/src/components/ConnectWallet.astro @@ -21,35 +21,39 @@ diff --git a/dapp/src/components/GetCommit.astro b/dapp/src/components/GetCommit.astro index a65057b..da41b92 100644 --- a/dapp/src/components/GetCommit.astro +++ b/dapp/src/components/GetCommit.astro @@ -31,27 +31,29 @@ import Loading from "./Loading.astro"; diff --git a/dapp/src/components/RegisterProject.astro b/dapp/src/components/RegisterProject.astro index 92c6004..012857d 100644 --- a/dapp/src/components/RegisterProject.astro +++ b/dapp/src/components/RegisterProject.astro @@ -73,42 +73,46 @@ import Loading from "./Loading.astro"; import { navigate } from "astro:transitions/client"; const SOROBAN_DOMAIN_CONTRACT_ID = `${import.meta.env.PUBLIC_SOROBAN_DOMAIN_CONTRACT_ID}`; - const maintainers = document.getElementById( - "maintainers", - ) as HTMLInputElement; + document.addEventListener("astro:page-load", () => { + const maintainers = document.getElementById( + "maintainers", + ) as HTMLInputElement; - const config_url = document.getElementById("config_url") as HTMLInputElement; - const config_hash = document.getElementById( - "config_hash", - ) as HTMLInputElement; + const config_url = document.getElementById( + "config_url", + ) as HTMLInputElement; + const config_hash = document.getElementById( + "config_hash", + ) as HTMLInputElement; - const wrap_loader = document.getElementById( - "wrap-register-loader", - ) as HTMLDivElement; - const wrap_button = document.getElementById( - "wrap-register-button", - ) as HTMLDivElement; - const button = document.querySelector( - "[data-register-project]", - ) as HTMLButtonElement; + const wrap_loader = document.getElementById( + "wrap-register-loader", + ) as HTMLDivElement; + const wrap_button = document.getElementById( + "wrap-register-button", + ) as HTMLDivElement; + const button = document.querySelector( + "[data-register-project]", + ) as HTMLButtonElement; - button.addEventListener("click", async () => { - wrap_loader.style.display = "block"; - wrap_button.style.display = "none"; + 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"); + } + }); }); diff --git a/dapp/src/components/SetProject.astro b/dapp/src/components/SetProject.astro index c24b038..68d705d 100644 --- a/dapp/src/components/SetProject.astro +++ b/dapp/src/components/SetProject.astro @@ -48,20 +48,22 @@ const TANSU_CONTRACT_ID = import.meta.env.PUBLIC_TANSU_CONTRACT_ID; import { setProjectId } from "./project"; import { navigate } from "astro:transitions/client"; - const project_name = document.getElementById( - "set-project", - ) as HTMLInputElement; - const button = document.querySelector( - "[data-set-project]", - ) as HTMLButtonElement; + document.addEventListener("astro:page-load", () => { + const project_name = document.getElementById( + "set-project", + ) as HTMLInputElement; + const button = document.querySelector( + "[data-set-project]", + ) as HTMLButtonElement; - button.addEventListener("click", async () => { - button.disabled = true; - try { - setProjectId(project_name.value); - navigate("/commit"); - } catch (e) { - console.error(e); - } + button.addEventListener("click", async () => { + button.disabled = true; + try { + setProjectId(project_name.value); + navigate("/commit"); + } catch (e) { + console.error(e); + } + }); });