Skip to content

Commit

Permalink
Merge branch 'main' into andri/cache-icons
Browse files Browse the repository at this point in the history
  • Loading branch information
LXIF authored Nov 22, 2024
2 parents cdbc540 + f31d049 commit 0f7b998
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 16 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ Use the Internet Identity canister in your local dfx project by adding the follo
"canisters": {
"internet_identity": {
"type": "custom",
"candid": "https://github.com/dfinity/internet-identity/releases/download/release-2024-11-15/internet_identity.did",
"wasm": "https://github.com/dfinity/internet-identity/releases/download/release-2024-11-15/internet_identity_dev.wasm.gz",
"candid": "https://github.com/dfinity/internet-identity/releases/download/release-2024-11-22/internet_identity.did",
"wasm": "https://github.com/dfinity/internet-identity/releases/download/release-2024-11-22/internet_identity_dev.wasm.gz",
"init_arg": "(opt record { captcha_config = opt record { max_unsolved_captchas= 50:nat64; captcha_trigger = variant {Static = variant {CaptchaDisabled}}}})",
"remote": {
"id": {
Expand Down
8 changes: 8 additions & 0 deletions src/frontend/src/components/displayError.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { ERROR_SUPPORT_URL } from "$src/config";
import { TemplateElement } from "$src/utils/lit-html";
import { nonNullish } from "@dfinity/utils";
import { html, render } from "lit-html";
Expand Down Expand Up @@ -40,6 +41,13 @@ ${options.detail}</pre
>
${options.primaryButton}
</button>
<a
href="${ERROR_SUPPORT_URL}"
target="_blank"
class="c-button c-button--secondary"
>
Go to support
</a>
</div>`,
});

Expand Down
34 changes: 26 additions & 8 deletions src/frontend/src/components/loader.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,40 @@
import { ERROR_SUPPORT_URL } from "$src/config";
import { html, render } from "lit-html";
import loaderUrl from "./loader.svg";

const loader = () => html` <div id="loader" class="c-loader">
<img class="c-loader__image" src=${loaderUrl} alt="loading" />
</div>`;
// Duration in milliseconds a user considers as taking forever
const TAKING_FOREVER = 10000;

const loader = (takingForever = false) =>
html` <div id="loader" class="c-loader">
<img class="c-loader__image" src=${loaderUrl} alt="loading" />
${takingForever &&
html`<a
href="${ERROR_SUPPORT_URL}"
target="_blank"
rel="noopener noreferrer"
class="c-loader__link"
>Check ongoing issues</a
>`}
</div>`;

const startLoader = () => {
const container = document.getElementById("loaderContainer") as HTMLElement;
render(loader(), container);
};

const endLoader = () => {
const container = document.getElementById("loaderContainer") as HTMLElement;
render(html``, container);
const takingForeverTimeout = setTimeout(
() => render(loader(true), container),
TAKING_FOREVER
);

return () => {
clearTimeout(takingForeverTimeout);
render(html``, container);
};
};

export const withLoader = async <A>(action: () => Promise<A>): Promise<A> => {
startLoader();
const endLoader = startLoader();
try {
return await action();
} finally {
Expand Down
4 changes: 4 additions & 0 deletions src/frontend/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,7 @@ export const OFFICIAL_II_URL = "https://" + OFFICIAL_II_URL_NO_PROTOCOL;
export const LEGACY_II_URL = "https://identity.ic0.app";

export const PORTAL_II_URL = "https://internetcomputer.org/internet-identity";

// Default support page URL for when error is shown to user
export const ERROR_SUPPORT_URL =
"https://identitysupport.dfinity.org/hc/en-us/articles/32301362727188";
33 changes: 27 additions & 6 deletions src/frontend/src/styles/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -1718,12 +1718,6 @@ by all browsers (FF is missing) */
fill: currentColor;
}

.c-button--secondary {
background: var(--rc-button-secondary);
color: var(--rc-onButton-secondary);
border: var(--rs-line) solid var(--rc-line-interaction);
}

.c-button--textOnly {
background: transparent;
color: var(--rc-interaction-text);
Expand All @@ -1737,10 +1731,23 @@ by all browsers (FF is missing) */

.c-button:not([disabled]):focus,
.c-button:not([disabled]):hover {
color: var(--rc-onButton);
opacity: 0.9;
box-shadow: 0 0 0 2px #ffffff, 0 0 3px 5px var(--rc-interaction);
outline: 2px dotted transparent;
outline-offset: 2px;
text-decoration: none;
}

.c-button--secondary {
background: var(--rc-button-secondary);
color: var(--rc-onButton-secondary);
border: var(--rs-line) solid var(--rc-line-interaction);
}

.c-button--secondary:not([disabled]):hover,
.c-button--secondary:not([disabled]):focus {
color: var(--rc-onButton-secondary);
}

/* Copy pasted from the focus and hover, but with different opacity to show action */
Expand Down Expand Up @@ -3144,6 +3151,20 @@ input[type="checkbox"] {
animation-timing-function: ease-in-out;
}

.c-loader__link {
color: var(--rc-surface);
display: block;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, 72px);
}

.c-loader__link:hover,
.c-loader__link:focus {
color: var(--rc-surface);
}

/* Wrap QR codes in a white square (for legibility) and prettify a bit */
.c-qrcode canvas {
display: block;
Expand Down

0 comments on commit 0f7b998

Please sign in to comment.