trixnity-messenger-playground

A playground for trixnity-messenger based on jetbrains compose-html
git clone git://archive.git.mtrnord.blog/MTRNord/trixnity-messenger-playground.git
Log | Files | Refs | README

commit c0439c4075218bde66dcd6021b79bbaa9a67208e
parent dbcb39072ff4afd3b232be0ed9e2351c9381c4a9
Author: MTRNord <mtrnord1@gmail.com>
Date:   Tue, 26 Sep 2023 18:01:03 +0200

Feat: Add silk and make sure the right folder is packaged

Diffstat:
M.github/workflows/deploy.yaml | 2+-
M.idea/workspace.xml | 25+++++++++++++++----------
Mbuild.gradle.kts | 1+
Mgradle/libs.versions.toml | 2++
Msrc/main/kotlin/main.kt | 14++++++++++++++
5 files changed, 33 insertions(+), 11 deletions(-)

diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml @@ -28,7 +28,7 @@ jobs: uses: actions/upload-artifact@v3 with: name: github-pages - path: build/dist + path: build/dist/js/productionExecutable if-no-files-found: error retention-days: 1 # Deploy job diff --git a/.idea/workspace.xml b/.idea/workspace.xml @@ -4,16 +4,12 @@ <option name="autoReloadType" value="SELECTIVE" /> </component> <component name="ChangeListManager"> - <list default="true" id="fc5af14b-7484-46dc-b4cb-0394f9dc3dda" name="Changes" comment="Fix: Fix typo in workflow file"> - <change afterPath="$PROJECT_DIR$/gradle/libs.versions.toml" afterDir="false" /> - <change afterPath="/var/home/marcel/IdeaProjects/MagicMatrix/gradle/libs.versions.toml" afterDir="false" /> + <list default="true" id="fc5af14b-7484-46dc-b4cb-0394f9dc3dda" name="Changes" comment="Fix: Make sure the artifact has the right name and also ensure we properly load the right things and use recent webpack"> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> - <change beforePath="$PROJECT_DIR$/src/main/kotlin/main.kt" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/kotlin/main.kt" afterDir="false" /> + <change beforePath="/var/home/marcel/IdeaProjects/MagicMatrix/.github/workflows/deploy.yaml" beforeDir="false" afterPath="/var/home/marcel/IdeaProjects/MagicMatrix/.github/workflows/deploy.yaml" afterDir="false" /> <change beforePath="/var/home/marcel/IdeaProjects/MagicMatrix/.idea/workspace.xml" beforeDir="false" afterPath="/var/home/marcel/IdeaProjects/MagicMatrix/.idea/workspace.xml" afterDir="false" /> <change beforePath="/var/home/marcel/IdeaProjects/MagicMatrix/build.gradle.kts" beforeDir="false" afterPath="/var/home/marcel/IdeaProjects/MagicMatrix/build.gradle.kts" afterDir="false" /> - <change beforePath="/var/home/marcel/IdeaProjects/MagicMatrix/gradle.properties" beforeDir="false" afterPath="/var/home/marcel/IdeaProjects/MagicMatrix/gradle.properties" afterDir="false" /> - <change beforePath="/var/home/marcel/IdeaProjects/MagicMatrix/kotlin-js-store/yarn.lock" beforeDir="false" afterPath="/var/home/marcel/IdeaProjects/MagicMatrix/kotlin-js-store/yarn.lock" afterDir="false" /> - <change beforePath="/var/home/marcel/IdeaProjects/MagicMatrix/settings.gradle.kts" beforeDir="false" afterPath="/var/home/marcel/IdeaProjects/MagicMatrix/settings.gradle.kts" afterDir="false" /> + <change beforePath="/var/home/marcel/IdeaProjects/MagicMatrix/gradle/libs.versions.toml" beforeDir="false" afterPath="/var/home/marcel/IdeaProjects/MagicMatrix/gradle/libs.versions.toml" afterDir="false" /> <change beforePath="/var/home/marcel/IdeaProjects/MagicMatrix/src/main/kotlin/main.kt" beforeDir="false" afterPath="/var/home/marcel/IdeaProjects/MagicMatrix/src/main/kotlin/main.kt" afterDir="false" /> </list> <option name="SHOW_DIALOG" value="false" /> @@ -124,7 +120,7 @@ <option name="number" value="Default" /> <option name="presentableId" value="Default" /> <updated>1695740188018</updated> - <workItem from="1695740189223" duration="2666000" /> + <workItem from="1695740189223" duration="3203000" /> </task> <task id="LOCAL-00001" summary="Fix: Fix typo in workflow file"> <option name="closed" value="true" /> @@ -134,7 +130,15 @@ <option name="project" value="LOCAL" /> <updated>1695742610836</updated> </task> - <option name="localTasksCounter" value="2" /> + <task id="LOCAL-00002" summary="Fix: Make sure the artifact has the right name and also ensure we properly load the right things and use recent webpack"> + <option name="closed" value="true" /> + <created>1695743685586</created> + <option name="number" value="00002" /> + <option name="presentableId" value="LOCAL-00002" /> + <option name="project" value="LOCAL" /> + <updated>1695743685586</updated> + </task> + <option name="localTasksCounter" value="3" /> <servers /> </component> <component name="TypeScriptGeneratedFilesManager"> @@ -155,6 +159,7 @@ <MESSAGE value="Initial Commit" /> <MESSAGE value="Feat: Readd Github deployment" /> <MESSAGE value="Fix: Fix typo in workflow file" /> - <option name="LAST_COMMIT_MESSAGE" value="Fix: Fix typo in workflow file" /> + <MESSAGE value="Fix: Make sure the artifact has the right name and also ensure we properly load the right things and use recent webpack" /> + <option name="LAST_COMMIT_MESSAGE" value="Fix: Make sure the artifact has the right name and also ensure we properly load the right things and use recent webpack" /> </component> </project> \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts @@ -28,6 +28,7 @@ kotlin { implementation(compose.runtime) implementation(libs.trixnity.messenger) implementation(libs.koin.compose) + implementation(libs.kobweb.silk) } } } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml @@ -3,10 +3,12 @@ jetbrains-compose = "1.5.1" kotlin = "1.9.10" trixnity = "1.0.5" koin = "1.1.0" +kobweb = "0.14.0" [libraries] trixnity-messenger = { module = "de.connect2x:trixnity-messenger", version.ref = "trixnity" } koin-compose = { module = "io.insert-koin:koin-compose", version.ref = "koin" } +kobweb-silk = { module = "com.varabyte.kobweb:kobweb-silk", version.ref = "kobweb" } [plugins] jetbrains-compose = { id = "org.jetbrains.compose", version.ref = "jetbrains-compose" } diff --git a/src/main/kotlin/main.kt b/src/main/kotlin/main.kt @@ -1,18 +1,27 @@ import androidx.compose.runtime.* import com.arkivanov.decompose.DefaultComponentContext import com.arkivanov.essenty.lifecycle.LifecycleRegistry +import com.varabyte.kobweb.silk.SilkStyleSheet +import com.varabyte.kobweb.silk.init.initSilk +import com.varabyte.kobweb.silk.init.setSilkVariables import de.connect2x.trixnity.messenger.DefaultMatrixClientService import de.connect2x.trixnity.messenger.trixnityMessengerModule import de.connect2x.trixnity.messenger.viewmodel.RootRouter import de.connect2x.trixnity.messenger.viewmodel.RootViewModel import de.connect2x.trixnity.messenger.viewmodel.RootViewModelImpl import de.connect2x.trixnity.messenger.viewmodel.util.toFlow +import kotlinx.browser.document import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.mapLatest +import org.jetbrains.compose.web.css.Style import org.jetbrains.compose.web.renderComposable import org.koin.dsl.koinApplication +import org.w3c.dom.HTMLElement fun main() { + // Init Kobweb + initSilk() + val koinApplication = koinApplication { modules(trixnityMessengerModule()) } @@ -30,6 +39,11 @@ fun main() { renderComposable(rootElementId = "root") { + // Further Init for kobweb + val root = remember { document.getElementById("root") as HTMLElement } + root.setSilkVariables() + Style(SilkStyleSheet) + Base(rootViewModel) } }