Switch from koin to micronaut-inject
This commit is contained in:
@@ -2,13 +2,16 @@ import be.simplenotes.Libs
|
||||
|
||||
plugins {
|
||||
id("be.simplenotes.base")
|
||||
kotlin("kapt")
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation(project(":simplenotes-types"))
|
||||
|
||||
implementation(Libs.koinCore)
|
||||
implementation(Libs.konform)
|
||||
implementation(Libs.kotlinxHtml)
|
||||
implementation(Libs.prettytime)
|
||||
|
||||
implementation(Libs.micronaut)
|
||||
kapt(Libs.micronautProcessor)
|
||||
}
|
||||
|
||||
@@ -3,8 +3,11 @@ package be.simplenotes.views
|
||||
import be.simplenotes.types.LoggedInUser
|
||||
import kotlinx.html.*
|
||||
import kotlinx.html.ThScope.col
|
||||
import javax.inject.Named
|
||||
import javax.inject.Singleton
|
||||
|
||||
class BaseView(styles: String) : View(styles) {
|
||||
@Singleton
|
||||
class BaseView(@Named("styles") styles: String) : View(styles) {
|
||||
fun renderHome(loggedInUser: LoggedInUser?) = renderPage(
|
||||
title = "Home",
|
||||
description = "A fast and simple note taking website",
|
||||
|
||||
@@ -4,8 +4,11 @@ import be.simplenotes.views.components.Alert
|
||||
import be.simplenotes.views.components.alert
|
||||
import kotlinx.html.a
|
||||
import kotlinx.html.div
|
||||
import javax.inject.Named
|
||||
import javax.inject.Singleton
|
||||
|
||||
class ErrorView(styles: String) : View(styles) {
|
||||
@Singleton
|
||||
class ErrorView(@Named("styles") styles: String) : View(styles) {
|
||||
|
||||
enum class Type(val title: String) {
|
||||
SqlTransientError("Database unavailable"),
|
||||
|
||||
@@ -6,8 +6,11 @@ import be.simplenotes.types.PersistedNoteMetadata
|
||||
import be.simplenotes.views.components.*
|
||||
import io.konform.validation.ValidationError
|
||||
import kotlinx.html.*
|
||||
import javax.inject.Named
|
||||
import javax.inject.Singleton
|
||||
|
||||
class NoteView(styles: String) : View(styles) {
|
||||
@Singleton
|
||||
class NoteView(@Named("styles") styles: String) : View(styles) {
|
||||
|
||||
fun noteEditor(
|
||||
loggedInUser: LoggedInUser,
|
||||
|
||||
@@ -8,8 +8,11 @@ import be.simplenotes.views.extensions.summary
|
||||
import io.konform.validation.ValidationError
|
||||
import kotlinx.html.*
|
||||
import kotlinx.html.ButtonType.submit
|
||||
import javax.inject.Named
|
||||
import javax.inject.Singleton
|
||||
|
||||
class SettingView(styles: String) : View(styles) {
|
||||
@Singleton
|
||||
class SettingView(@Named("styles") styles: String) : View(styles) {
|
||||
|
||||
fun settings(
|
||||
loggedInUser: LoggedInUser,
|
||||
|
||||
@@ -7,8 +7,11 @@ import be.simplenotes.views.components.input
|
||||
import be.simplenotes.views.components.submitButton
|
||||
import io.konform.validation.ValidationError
|
||||
import kotlinx.html.*
|
||||
import javax.inject.Named
|
||||
import javax.inject.Singleton
|
||||
|
||||
class UserView(styles: String) : View(styles) {
|
||||
@Singleton
|
||||
class UserView(@Named("styles") styles: String) : View(styles) {
|
||||
fun register(
|
||||
loggedInUser: LoggedInUser?,
|
||||
error: String? = null,
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
package be.simplenotes.views
|
||||
|
||||
import org.koin.core.qualifier.named
|
||||
import org.koin.dsl.module
|
||||
|
||||
val viewModule = module {
|
||||
single { ErrorView(get(named("styles"))) }
|
||||
single { UserView(get(named("styles"))) }
|
||||
single { BaseView(get(named("styles"))) }
|
||||
single { SettingView(get(named("styles"))) }
|
||||
single { NoteView(get(named("styles"))) }
|
||||
}
|
||||
Reference in New Issue
Block a user