Compare commits
4 commits
node-ai-sl
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 430eb90796 | |||
| 0dcd2cead7 | |||
| b942799298 | |||
| 6d029efeaf |
6 changed files with 4901 additions and 11 deletions
6
.github/workflows/pages.yml
vendored
6
.github/workflows/pages.yml
vendored
|
|
@ -54,7 +54,11 @@ jobs:
|
||||||
node-version: latest
|
node-version: latest
|
||||||
cache: npm
|
cache: npm
|
||||||
- name: Install npm deps
|
- name: Install npm deps
|
||||||
run: npm install
|
run: |
|
||||||
|
npm install
|
||||||
|
cd core
|
||||||
|
npm install
|
||||||
|
cd ..
|
||||||
- name: Build with vite
|
- name: Build with vite
|
||||||
run: npm run deploy
|
run: npm run deploy
|
||||||
env:
|
env:
|
||||||
|
|
|
||||||
84
build.sbt
84
build.sbt
|
|
@ -1,16 +1,85 @@
|
||||||
import org.scalajs.linker.interface.ModuleSplitStyle
|
import org.scalajs.linker.interface.ModuleSplitStyle
|
||||||
|
|
||||||
lazy val fahrtenbuch = project
|
ThisBuild / version := "0.1.0-SNAPSHOT"
|
||||||
.in(file("."))
|
ThisBuild / scalaVersion := "3.7.1"
|
||||||
|
ThisBuild / scalacOptions ++= Seq("-Xfatal-warnings", "-Wunused:imports")
|
||||||
|
|
||||||
|
lazy val commonDependencies = Seq(
|
||||||
|
libraryDependencies += "org.scala-js" %%% "scalajs-dom" % "2.8.0",
|
||||||
|
libraryDependencies += "com.raquo" %%% "laminar" % "17.2.1",
|
||||||
|
libraryDependencies += "de.tu-darmstadt.stg" %%% "rdts" % "0.37.0",
|
||||||
|
libraryDependencies += "org.getshaka" %%% "native-converter" % "0.9.0"
|
||||||
|
)
|
||||||
|
|
||||||
|
lazy val core = project
|
||||||
|
.in(file("core"))
|
||||||
.enablePlugins(
|
.enablePlugins(
|
||||||
ScalaJSPlugin,
|
ScalaJSPlugin,
|
||||||
ScalablyTypedConverterExternalNpmPlugin
|
ScalablyTypedConverterExternalNpmPlugin
|
||||||
)
|
)
|
||||||
.settings(
|
.settings(
|
||||||
scalaVersion := "3.7.1",
|
// Tell Scala.js that this is an application with a main method
|
||||||
scalacOptions += "-Xfatal-warnings",
|
scalaJSUseMainModuleInitializer := true,
|
||||||
scalacOptions += "-Wunused:imports",
|
scalaJSLinkerConfig ~= {
|
||||||
|
_.withModuleKind(ModuleKind.ESModule)
|
||||||
|
.withModuleSplitStyle(
|
||||||
|
ModuleSplitStyle.SmallModulesFor(List("fahrtenbuch"))
|
||||||
|
)
|
||||||
|
},
|
||||||
|
|
||||||
|
// scalably typed config
|
||||||
|
// Ignore several Trystero dependencies in ScalablyTyped to avoid `stImport` errors
|
||||||
|
stIgnore := List(
|
||||||
|
"libp2p",
|
||||||
|
"firebase",
|
||||||
|
"@supabase/supabase-js",
|
||||||
|
"@mdi/font",
|
||||||
|
"bulma",
|
||||||
|
"@types/node"
|
||||||
|
),
|
||||||
|
externalNpm := baseDirectory.value,
|
||||||
|
commonDependencies
|
||||||
|
)
|
||||||
|
|
||||||
|
lazy val node = project
|
||||||
|
.in(file("node"))
|
||||||
|
.dependsOn(core)
|
||||||
|
.enablePlugins(
|
||||||
|
ScalaJSPlugin,
|
||||||
|
ScalablyTypedConverterExternalNpmPlugin
|
||||||
|
)
|
||||||
|
.settings(
|
||||||
|
// Tell Scala.js that this is an application with a main method
|
||||||
|
scalaJSUseMainModuleInitializer := true,
|
||||||
|
scalaJSLinkerConfig ~= {
|
||||||
|
_.withModuleKind(ModuleKind.ESModule)
|
||||||
|
.withModuleSplitStyle(
|
||||||
|
ModuleSplitStyle.SmallModulesFor(List("fahrtenbuch"))
|
||||||
|
)
|
||||||
|
},
|
||||||
|
|
||||||
|
// scalably typed config
|
||||||
|
// Ignore several Trystero dependencies in ScalablyTyped to avoid `stImport` errors
|
||||||
|
stIgnore := List(
|
||||||
|
"libp2p",
|
||||||
|
"firebase",
|
||||||
|
"@supabase/supabase-js",
|
||||||
|
"@mdi/font",
|
||||||
|
"bulma",
|
||||||
|
"@types/node"
|
||||||
|
),
|
||||||
|
externalNpm := baseDirectory.value,
|
||||||
|
commonDependencies
|
||||||
|
)
|
||||||
|
|
||||||
|
lazy val fahrtenbuch = project
|
||||||
|
.in(file("."))
|
||||||
|
.dependsOn(core)
|
||||||
|
.enablePlugins(
|
||||||
|
ScalaJSPlugin,
|
||||||
|
ScalablyTypedConverterExternalNpmPlugin
|
||||||
|
)
|
||||||
|
.settings(
|
||||||
// Tell Scala.js that this is an application with a main method
|
// Tell Scala.js that this is an application with a main method
|
||||||
scalaJSUseMainModuleInitializer := true,
|
scalaJSUseMainModuleInitializer := true,
|
||||||
|
|
||||||
|
|
@ -42,8 +111,5 @@ lazy val fahrtenbuch = project
|
||||||
/* Depend on the scalajs-dom library.
|
/* Depend on the scalajs-dom library.
|
||||||
* It provides static types for the browser DOM APIs.
|
* It provides static types for the browser DOM APIs.
|
||||||
*/
|
*/
|
||||||
libraryDependencies += "org.scala-js" %%% "scalajs-dom" % "2.8.0",
|
commonDependencies
|
||||||
libraryDependencies += "com.raquo" %%% "laminar" % "17.2.1",
|
|
||||||
libraryDependencies += "de.tu-darmstadt.stg" %%% "rdts" % "0.37.0",
|
|
||||||
libraryDependencies += "org.getshaka" %%% "native-converter" % "0.9.0"
|
|
||||||
)
|
)
|
||||||
|
|
|
||||||
4789
core/package-lock.json
generated
Normal file
4789
core/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load diff
20
core/package.json
Normal file
20
core/package.json
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
{
|
||||||
|
"name": "fahrtenbuch-core",
|
||||||
|
"private": true,
|
||||||
|
"version": "0.0.0",
|
||||||
|
"type": "module",
|
||||||
|
"scripts": {
|
||||||
|
"dev": "vite --host",
|
||||||
|
"build": "vite build",
|
||||||
|
"deploy": "vite build --base=$BASE_PATH",
|
||||||
|
"preview": "vite preview"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@scala-js/vite-plugin-scalajs": "^1.0.0",
|
||||||
|
"typescript": "^4.9.5",
|
||||||
|
"vite": "^6.2.3"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"trystero": "^0.22.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -15,6 +15,12 @@ class EntryComponent(
|
||||||
):
|
):
|
||||||
def render: ReactiveHtmlElement[HTMLTableRowElement] = {
|
def render: ReactiveHtmlElement[HTMLTableRowElement] = {
|
||||||
if editMode then
|
if editMode then
|
||||||
|
val dateInput =
|
||||||
|
input(
|
||||||
|
cls := "input",
|
||||||
|
value := new Date(entry.date.payload).toDateString()
|
||||||
|
)
|
||||||
|
|
||||||
val driverInput = input(cls := "input", value := entry.driver.payload)
|
val driverInput = input(cls := "input", value := entry.driver.payload)
|
||||||
|
|
||||||
val startKmInput =
|
val startKmInput =
|
||||||
|
|
@ -78,7 +84,7 @@ class EntryComponent(
|
||||||
val paidCheckbox =
|
val paidCheckbox =
|
||||||
input(`type` := "checkbox", checked := entry.paid.payload)
|
input(`type` := "checkbox", checked := entry.paid.payload)
|
||||||
tr(
|
tr(
|
||||||
td(),
|
td(dateInput),
|
||||||
td(driverInput),
|
td(driverInput),
|
||||||
td(startKmInput),
|
td(startKmInput),
|
||||||
td(endKmInput),
|
td(endKmInput),
|
||||||
|
|
@ -90,6 +96,10 @@ class EntryComponent(
|
||||||
button(
|
button(
|
||||||
cls := "button is-success",
|
cls := "button is-success",
|
||||||
onClick --> {
|
onClick --> {
|
||||||
|
val newDate =
|
||||||
|
val parsed = Date.parse(dateInput.ref.value)
|
||||||
|
if parsed != entry.date.payload then entry.date.write(parsed)
|
||||||
|
else entry.date
|
||||||
val newDriver =
|
val newDriver =
|
||||||
if driverInput.ref.value != entry.driver.payload then
|
if driverInput.ref.value != entry.driver.payload then
|
||||||
entry.driver.write(driverInput.ref.value)
|
entry.driver.write(driverInput.ref.value)
|
||||||
|
|
@ -112,6 +122,7 @@ class EntryComponent(
|
||||||
else entry.paid
|
else entry.paid
|
||||||
entryEditBus.emit(
|
entryEditBus.emit(
|
||||||
entry.copy(
|
entry.copy(
|
||||||
|
date = newDate,
|
||||||
driver = newDriver,
|
driver = newDriver,
|
||||||
startKm = newStartKm,
|
startKm = newStartKm,
|
||||||
endKm = newEndKm,
|
endKm = newEndKm,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue