Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 3 additions & 1 deletion apps/website/src/ids.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ export const IDS = {

loadingStatus: "loading-status",
loadingStep: "loading-step",
loadingBar: "loading-bar-fill",
loadingBar: "loading-bar",
loadingBarFill: "loading-bar-fill",

loaderAlert: "loader-alert",
loaderError: "loader-error",
loaderErrorMessage: "loader-error-message",
};
18 changes: 13 additions & 5 deletions apps/website/src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,28 @@
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="icon" href="assets/favicon.ico" />
<link rel="stylesheet" href="style.css" />
<title>Title</title>
<title>NanoForge</title>
</head>
<body>
<script type="module" src="index.ts"></script>
<div id="loader-alert" class="visually-hidden" role="alert"></div>
<div id="nanoforge-loader">
<img id="loader-logo" src="assets/logo.png" alt="logo" />
<img id="loader-logo" src="assets/logo.png" alt="NanoForge" />
<div>
<div id="loader-error" hidden="">
<div id="loader-error-message"></div>
<div id="loader-error-message" aria-hidden="true"></div>
<a id="back-home" href="/"> Back home </a>
</div>
<div id="loading-status">
<div id="loading-step"></div>
<div id="loading-bar">
<div id="loading-step" role="status"></div>
<div
id="loading-bar"
role="progressbar"
aria-label="Loading progress"
aria-valuemin="0"
aria-valuemax="100"
aria-valuenow="0"
>
<div id="loading-bar-fill"></div>
</div>
</div>
Expand Down
9 changes: 9 additions & 0 deletions apps/website/src/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,15 @@ body {
display: none !important;
}

.visually-hidden {
position: absolute;
width: 1px;
height: 1px;
overflow: hidden;
clip-path: inset(50%);
white-space: nowrap;
}

#back-home {
background-color: rgba(151, 63, 255, 0.8);
text-decoration: none;
Expand Down
8 changes: 6 additions & 2 deletions apps/website/src/window.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,15 @@ export const changeWindowToLoader = async () => {

export const setLoadingStatus = (filename: string, index?: number | null) => {
const loaderFilename = document.getElementById(IDS.loadingStep);
const loadingBarFill = document.getElementById(IDS.loadingBar);
const loadingBar = document.getElementById(IDS.loadingBar);
const loadingBarFill = document.getElementById(IDS.loadingBarFill);

if (loaderFilename) loaderFilename.innerText = filename;

if (loadingBarFill && index && totalFiles > 0) {
if (loadingBar && loadingBarFill && index != null && totalFiles > 0) {
const progress = ((index + 1) / totalFiles) * 100;
loadingBarFill.style.width = `${progress}%`;
loadingBar.setAttribute("aria-valuenow", String(progress));
}
};

Expand All @@ -51,6 +53,8 @@ export const setError = (error: string | Error | unknown) => {
if (!loaderErrorMessage) return;
const errorMessage = error instanceof Error ? error.message : String(error);
loaderErrorMessage.innerText = errorMessage;
const alert = document.getElementById(IDS.loaderAlert);
if (alert) alert.textContent = errorMessage;

showLoader();

Expand Down
Loading