Added timeago
This commit is contained in:
parent
125fcb51b3
commit
0dc4e09960
@ -8,6 +8,7 @@ mainClass := Some("wow.doge.chatto.Application")
|
||||
|
||||
resolvers += "sfxcode-maven" at "https://bintray.com/sfxcode/maven/"
|
||||
resolvers += "javafx-markdown-renderer" at "https://sandec.bintray.com/repo"
|
||||
resolvers += "marlonlon-timeago" at "https://dl.bintray.com/marlonlom/timeago"
|
||||
|
||||
libraryDependencies += "org.specs2" %% "specs2-core" % "4.7.1" % Test
|
||||
|
||||
@ -70,6 +71,9 @@ libraryDependencies += "org.json4s" %% "json4s-ext" % "3.6.8"
|
||||
// https://mvnrepository.com/artifact/org.jsoup/jsoup
|
||||
libraryDependencies += "org.jsoup" % "jsoup" % "1.13.1"
|
||||
|
||||
// https://mvnrepository.com/artifact/com.github.marlonlom/timeago
|
||||
libraryDependencies += "com.github.marlonlom" % "timeago" % "3.0.2"
|
||||
|
||||
enablePlugins(BuildInfoPlugin)
|
||||
|
||||
buildInfoPackage := "wow.doge.chatto"
|
||||
|
@ -63,6 +63,7 @@ import javafx.scene.control.SelectionMode
|
||||
import scalafx.beans.property.BooleanProperty
|
||||
import javafx.scene.control.ListCell
|
||||
import java.time.Instant
|
||||
import com.github.marlonlom.utilities.timeago.TimeAgo
|
||||
|
||||
class ChatController @Inject() (
|
||||
userService: UserService,
|
||||
@ -218,39 +219,18 @@ class ChatController @Inject() (
|
||||
|
||||
logger.debug(s"Received Users: $maybeActiveUsers")
|
||||
|
||||
val maybeUserBoxes = maybeActiveUsers.map(users => {
|
||||
users.map(user => {
|
||||
maybeActiveUsers.foreach(users => {
|
||||
users.foreach(user => {
|
||||
val chatData =
|
||||
ChatData(user.userName, user, ObservableBuffer.empty[Message])
|
||||
chatDataStore.put(user.userName, new ChatDataProperty(chatData))
|
||||
new UserBox2(user.userName, chatData) {
|
||||
this.styleClass ++= Seq("text-white")
|
||||
}
|
||||
})
|
||||
})
|
||||
// val messageBox = ChatDataProperty.createMdMessageBox2(
|
||||
// """**Hello world qefwew yeeehay bwergqwevqcqe**
|
||||
// |**Hello world qefwew yeeehay bwergqwevqcqe**
|
||||
// |
|
||||
// | Hello World
|
||||
// """.stripMargin
|
||||
// )
|
||||
|
||||
onFX {
|
||||
// maybeUserBoxes.foreach(userBoxes => {
|
||||
// usersBuffer ++= userBoxes
|
||||
// })
|
||||
maybeActiveUsers.foreach(users => usersBuffer ++= users)
|
||||
chatListView.items() ++= Seq(
|
||||
// messageBox,
|
||||
// ChatDataProperty.createMdMessageBox2("hello"),
|
||||
// ChatDataProperty.createMdMessageBox2(
|
||||
// """ 1. Hello world qefwew yeeehay bwergqwevqcqe
|
||||
// |1. Hello world qefwew yeeehay bwergqwevqcqe
|
||||
// |1. Hello world qefwew yeeehay bwergqwevqcqe
|
||||
// |1. Hello world qefwew yeeehay bwergqwevqcqe""".stripMargin
|
||||
// )
|
||||
)
|
||||
}
|
||||
|
||||
chatDataStore
|
||||
.map { case (key, value) => value }
|
||||
.foreach(cdp => {
|
||||
@ -293,7 +273,7 @@ final case class ChatData(
|
||||
) {
|
||||
lazy val lastActiveString =
|
||||
activeUser.lastActive
|
||||
.map(_.toString())
|
||||
.map(time => TimeAgo.using(time.toInstant().toEpochMilli()))
|
||||
.getOrElse("User has not logged in yet")
|
||||
lazy val onlineString = activeUser.online.toString()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user