Skip to content

Commit

Permalink
Merge pull request #290 from mbakgun/feature/web-loading
Browse files Browse the repository at this point in the history
feature/web-loading
  • Loading branch information
mbakgun authored Oct 3, 2024
2 parents 627e22d + 21a2ffc commit 03fd7a1
Show file tree
Hide file tree
Showing 4 changed files with 94 additions and 0 deletions.
2 changes: 2 additions & 0 deletions wasmApp/src/wasmJsMain/kotlin/com/mbakgun/mj/Main.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import androidx.compose.ui.window.CanvasBasedWindow
import di.initKoin
import domain.usecase.MjImagesFetchUseCase
import domain.usecase.MjImagesUseCase
import kotlinx.browser.document
import ui.MjImagesApp
import ui.MjImagesViewModel

Expand All @@ -18,4 +19,5 @@ fun main() {
CanvasBasedWindow("MjImagesApp") {
MjImagesApp(viewModel)
}
document.getElementById("loader-container")?.remove()
}
45 changes: 45 additions & 0 deletions wasmApp/src/wasmJsMain/resources/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,54 @@
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>MjImagesApp</title>
<style>
body {
margin: 0;
padding: 0;
font-family: Arial, sans-serif;
background-color: #FFFBFF;
}
#loader-container {
position: fixed;
top: 10px;
left: 50%;
transform: translateX(-50%);
display: flex;
justify-content: center;
align-items: center;
z-index: 1000;
}
.spinner {
width: 40px;
height: 40px;
border-radius: 50%;
background-color: #825500;
display: flex;
justify-content: center;
align-items: center;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
.spinner::after {
content: '';
width: 20px;
height: 20px;
border-radius: 50%;
border: 2px solid transparent;
border-top-color: #FFFFFF;
animation: spin 1s linear infinite;
}
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
</style>
</head>
<body>
<div id="loader-container">
<div class="spinner"></div>
</div>
<canvas id="ComposeTarget"></canvas>
<script src="wasmApp.js"></script>
</body>
Expand Down
2 changes: 2 additions & 0 deletions webApp/src/jsMain/kotlin/com/mbakgun/mj/Main.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import androidx.compose.ui.window.CanvasBasedWindow
import di.initKoin
import domain.usecase.MjImagesFetchUseCase
import domain.usecase.MjImagesUseCase
import kotlinx.browser.document
import org.jetbrains.skiko.wasm.onWasmReady
import ui.MjImagesApp
import ui.MjImagesViewModel
Expand All @@ -20,5 +21,6 @@ fun main() {
CanvasBasedWindow("MjImagesApp") {
MjImagesApp(viewModel)
}
document.getElementById("loader-container")?.remove()
}
}
45 changes: 45 additions & 0 deletions webApp/src/jsMain/resources/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,55 @@
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>MjImagesApp</title>
<script src="skiko.js"></script>
<style>
body {
margin: 0;
padding: 0;
font-family: Arial, sans-serif;
background-color: #FFFBFF;
}
#loader-container {
position: fixed;
top: 10px;
left: 50%;
transform: translateX(-50%);
display: flex;
justify-content: center;
align-items: center;
z-index: 1000;
}
.spinner {
width: 40px;
height: 40px;
border-radius: 50%;
background-color: #825500;
display: flex;
justify-content: center;
align-items: center;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
.spinner::after {
content: '';
width: 20px;
height: 20px;
border-radius: 50%;
border: 2px solid transparent;
border-top-color: #FFFFFF;
animation: spin 1s linear infinite;
}
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
</style>
</head>
<body>
<div id="loader-container">
<div class="spinner"></div>
</div>
<div>
<canvas id="ComposeTarget"></canvas>
</div>
Expand Down

0 comments on commit 03fd7a1

Please sign in to comment.