Skip to content

Commit

Permalink
fix(web-renderer): migrate to react v2025 (#4080)
Browse files Browse the repository at this point in the history
  • Loading branch information
AngeloFilaseta authored Jan 17, 2025
1 parent 72761a9 commit 49d745c
Show file tree
Hide file tree
Showing 13 changed files with 24 additions and 22 deletions.
1 change: 1 addition & 0 deletions alchemist-web-renderer/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ kotlin {
dependencies {
implementation(libs.bundles.ktor.client)
implementation(libs.bundles.kotlin.react)
implementation(libs.kotlinx.atomicfu.runtime)
implementation(npm("react-bootstrap", "2.5.0"))
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ package it.unibo.alchemist.boundary.webui.client

import it.unibo.alchemist.boundary.webui.client.components.AppContent
import it.unibo.alchemist.boundary.webui.client.components.AppNavbar
import kotlinx.browser.document
import react.FC
import react.Props
import react.create
import react.dom.client.createRoot
import web.dom.Element
import web.dom.document

/**
* The entry point of the Kotlin/JS application. Find the root element and render the App.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

package it.unibo.alchemist.boundary.webui.client.adapters.reactBootstrap.buttons

import react.ComponentClass
import react.FC
import react.PropsWithChildren

/**
Expand All @@ -22,7 +22,7 @@ import react.PropsWithChildren
*/

@JsName("default")
external val Button: ComponentClass<ButtonProps>
external val Button: FC<ButtonProps>

/**
* Props used to customize the Button.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

package it.unibo.alchemist.boundary.webui.client.adapters.reactBootstrap.buttons

import react.ComponentClass
import react.FC
import react.PropsWithChildren

/**
Expand All @@ -22,7 +22,7 @@ import react.PropsWithChildren
*/

@JsName("default")
external val ToggleButton: ComponentClass<ToggleButtonProps>
external val ToggleButton: FC<ToggleButtonProps>

/**
* Props used to customize the ToggleButton.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

package it.unibo.alchemist.boundary.webui.client.adapters.reactBootstrap.buttons

import react.ComponentClass
import react.FC
import react.PropsWithChildren

/**
Expand All @@ -22,7 +22,7 @@ import react.PropsWithChildren
*/

@JsName("default")
external val ToggleButtonGroup: ComponentClass<ToggleButtonGroupProps>
external val ToggleButtonGroup: FC<ToggleButtonGroupProps>

/**
* Props used to customize the ToggleButtonGroup.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

package it.unibo.alchemist.boundary.webui.client.adapters.reactBootstrap.modal

import react.ComponentClass
import react.FC
import react.PropsWithChildren

/**
Expand All @@ -22,7 +22,7 @@ import react.PropsWithChildren
*/

@JsName("default")
external val Modal: ComponentClass<ModalProps>
external val Modal: FC<ModalProps>

/**
* Props used to customize the Modal.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

package it.unibo.alchemist.boundary.webui.client.adapters.reactBootstrap.modal

import react.ComponentClass
import react.FC
import react.PropsWithChildren

/**
Expand All @@ -22,4 +22,4 @@ import react.PropsWithChildren
*/

@JsName("default")
external val ModalBody: ComponentClass<PropsWithChildren>
external val ModalBody: FC<PropsWithChildren>
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

package it.unibo.alchemist.boundary.webui.client.adapters.reactBootstrap.modal

import react.ComponentClass
import react.FC
import react.PropsWithChildren

/**
Expand All @@ -22,4 +22,4 @@ import react.PropsWithChildren
*/

@JsName("default")
external val ModalFooter: ComponentClass<PropsWithChildren>
external val ModalFooter: FC<PropsWithChildren>
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

package it.unibo.alchemist.boundary.webui.client.adapters.reactBootstrap.modal

import react.ComponentClass
import react.FC
import react.PropsWithChildren

/**
Expand All @@ -22,7 +22,7 @@ import react.PropsWithChildren
*/

@JsName("default")
external val ModalHeader: ComponentClass<ModalHeaderProps>
external val ModalHeader: FC<ModalHeaderProps>

/**
* Props used to customize the ModalHeader.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

package it.unibo.alchemist.boundary.webui.client.adapters.reactBootstrap.modal

import react.ComponentClass
import react.FC
import react.PropsWithChildren

/**
Expand All @@ -22,7 +22,7 @@ import react.PropsWithChildren
*/

@JsName("default")
external val ModalTitle: ComponentClass<ModalTitleProps>
external val ModalTitle: FC<ModalTitleProps>

/**
* Props used to customize the ModalHeader.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@

package it.unibo.alchemist.boundary.webui.client.adapters.reactBootstrap.navbar

import react.ComponentClass
import react.FC
import react.PropsWithChildren

/**
* React Bootstrap Navbar adapter.
* @see <a href="https://react-bootstrap.github.io/docs/components/navbar/">react-bootstrap - navbar</a>
*/
@JsName("default")
external val Navbar: ComponentClass<NavbarProps>
external val Navbar: FC<NavbarProps>

/**
* Props used to customize the Navbar.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@

package it.unibo.alchemist.boundary.webui.client.adapters.reactBootstrap.navbar

import react.ComponentClass
import react.FC
import react.PropsWithChildren

/**
* Navbar.Brand component.
* Note: an explicit cast is required here, as the original Javascript structure is dynamic.
*/
@Suppress("UNCHECKED_CAST_TO_EXTERNAL_INTERFACE")
val NavbarBrand: ComponentClass<PropsWithChildren> = Navbar.asDynamic().Brand as ComponentClass<PropsWithChildren>
val NavbarBrand: FC<PropsWithChildren> = Navbar.asDynamic().Brand as FC<PropsWithChildren>
3 changes: 2 additions & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ ktor = "2.3.13"
kotlin = "2.1.0"
mockito = "5.15.2"
protelis = "17.7.1"
react = "19.0.0-pre.854"
react = "2025.1.1-19.0.0"
scafi = "1.6.0"
scala = "2.13.16"
scalacache = "0.28.0"
Expand Down Expand Up @@ -79,6 +79,7 @@ kotlin-test-annotations = { module = "org.jetbrains.kotlin:kotlin-test-annotatio
kotlin-react = { module = "org.jetbrains.kotlin-wrappers:kotlin-react", version.ref = "react" }
kotlin-react-dom = { module = "org.jetbrains.kotlin-wrappers:kotlin-react-dom", version.ref = "react" }
kotlin-reflect = { module = "org.jetbrains.kotlin:kotlin-reflect", version.ref = "kotlin" }
kotlinx-atomicfu-runtime ="org.jetbrains.kotlin:kotlinx-atomicfu-runtime:2.1.0"
kotlinx-serialization-json = "org.jetbrains.kotlinx:kotlinx-serialization-json:1.8.0"
kotlin-stdlib = { module = "org.jetbrains.kotlin:kotlin-stdlib", version.ref = "kotlin" }
ktor-client-core = { module = "io.ktor:ktor-client-core", version.ref = "ktor" }
Expand Down

0 comments on commit 49d745c

Please sign in to comment.