Skip to content

Commit

Permalink
Adjust Candid UI login button (#535)
Browse files Browse the repository at this point in the history
* Adjust Candid UI login button tooltip

* Adjust hover animation

* Adjust wording
  • Loading branch information
rvanasa authored Mar 15, 2024
1 parent 6559b0d commit 8e6b8a7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
9 changes: 5 additions & 4 deletions tools/ui/src/auth/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ async function insertLoginForm() {
provider = "https://identity.internetcomputer.org";
}
if (!provider) {
throw new Error("Please provide internet identity url in ii parameter");
throw new Error("Please provide a URL to your local Internet Identity service using the `ii` query parameter");
}
if (provider && !is_valid_url(provider)) {
throw new Error("Please provide a valid internet identity url in ii parameter");
throw new Error("Please provide a URL to your local Internet Identity service using the `ii` query parameter");
}
const cid = Principal.fromText(params.get("id")!);
let origin = params.get("origin");
Expand All @@ -59,9 +59,9 @@ async function insertLoginForm() {
}
if (origin) {
if (!is_valid_url(origin)) {
throw new Error("Please provide a valid derivationOrigin url in origin parameter");
throw new Error("Please provide a valid URL in the `origin` query parameter");
}
buttonLogin.title = "derivationOrigin is enabled. Remember to disable alternative origin in the production canister.";
console.warn("`derivationOrigin` is enabled. Remember to disable alternative origins in the production canister.");
}

buttonLogin.addEventListener("click", async () => {
Expand All @@ -79,6 +79,7 @@ async function insertLoginForm() {
await authClient?.login(config);
});
} catch (err) {
console.error(err);
buttonLogin.disabled = true;
buttonLogin.classList.add("disabled");
buttonLogin.title = (err as any).toString();
Expand Down
5 changes: 3 additions & 2 deletions tools/ui/src/candid.css
Original file line number Diff line number Diff line change
Expand Up @@ -213,10 +213,11 @@ input[type='checkbox'] ~ .popup-form {
}
.btn-auth svg {
transition: transform ease-out .05s;
transform: scale(.8);
}
.btn-auth:not(:hover) svg {
.btn-auth:hover:not(.disabled) svg {
transition: transform ease-out .1s;
transform: scale(.8);
transform: scale(.9);
}
button {
padding: 0;
Expand Down

0 comments on commit 8e6b8a7

Please sign in to comment.