-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
289 additions
and
440 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 0 additions & 1 deletion
1
app/src/commonMain/kotlin/io/github/xxfast/nytimes/models/ApiModels.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
app/src/wasmJsMain/kotlin/io/github/xxfast/nytimes/data/Storage.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package io.github.xxfast.nytimes.data | ||
|
||
import io.github.xxfast.kstore.KStore | ||
import io.github.xxfast.kstore.storage.storeOf | ||
import io.github.xxfast.nytimes.models.SavedArticles | ||
|
||
actual val store: KStore<SavedArticles> by lazy { | ||
storeOf("saved", emptySet()) | ||
} |
13 changes: 13 additions & 0 deletions
13
app/src/wasmJsMain/kotlin/io/github/xxfast/nytimes/navigation/ViewModel.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package io.github.xxfast.nytimes.navigation | ||
|
||
import com.arkivanov.essenty.instancekeeper.InstanceKeeper | ||
import kotlinx.coroutines.CoroutineScope | ||
import kotlinx.coroutines.Dispatchers | ||
import kotlinx.coroutines.SupervisorJob | ||
import kotlinx.coroutines.cancel | ||
import kotlin.coroutines.CoroutineContext | ||
|
||
actual open class ViewModel : InstanceKeeper.Instance, CoroutineScope { | ||
actual override val coroutineContext: CoroutineContext = Dispatchers.Unconfined + SupervisorJob() | ||
override fun onDestroy() { coroutineContext.cancel() } | ||
} |
10 changes: 10 additions & 0 deletions
10
app/src/wasmJsMain/kotlin/io/github/xxfast/nytimes/utils/WindowInsets.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package io.github.xxfast.nytimes.utils | ||
|
||
import androidx.compose.foundation.layout.WindowInsets | ||
import androidx.compose.ui.unit.dp | ||
|
||
actual val WindowInsets.Companion.statusBarPadding: WindowInsets get() = WindowInsets(0.dp) | ||
|
||
actual val WindowInsets.Companion.navigationBarPadding: WindowInsets get() = WindowInsets(0.dp) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
app/web/src/wasmJsMain/kotlin/io/github/xxfast/nytimes/web/Application.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package io.github.xxfast.nytimes.web | ||
|
||
import androidx.compose.foundation.layout.BoxWithConstraints | ||
import androidx.compose.material3.MaterialTheme | ||
import androidx.compose.material3.windowsizeclass.ExperimentalMaterial3WindowSizeClassApi | ||
import androidx.compose.material3.windowsizeclass.WindowSizeClass | ||
import androidx.compose.material3.windowsizeclass.calculateWindowSizeClass | ||
import androidx.compose.runtime.CompositionLocalProvider | ||
import androidx.compose.ui.ExperimentalComposeUiApi | ||
import androidx.compose.ui.window.ComposeViewport | ||
import io.github.xxfast.androidx.compose.material3.windowsizeclass.LocalWindowSizeClass | ||
import io.github.xxfast.decompose.router.LocalRouterContext | ||
import io.github.xxfast.decompose.router.RouterContext | ||
import io.github.xxfast.decompose.router.defaultRouterContext | ||
import io.github.xxfast.nytimes.screens.home.HomeScreen | ||
import kotlinx.browser.document | ||
|
||
@OptIn(ExperimentalComposeUiApi::class, ExperimentalMaterial3WindowSizeClassApi::class) | ||
fun main() { | ||
val rootRouterContext: RouterContext = defaultRouterContext() | ||
|
||
ComposeViewport(document.body!!) { | ||
BoxWithConstraints { | ||
val windowSizeClass: WindowSizeClass = calculateWindowSizeClass() | ||
CompositionLocalProvider( | ||
LocalRouterContext provides rootRouterContext, | ||
LocalWindowSizeClass provides windowSizeClass, | ||
) { | ||
MaterialTheme { | ||
HomeScreen() | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.