Add time ago

This commit is contained in:
2020-08-21 20:59:49 +02:00
parent 2c967ebd8c
commit c367d5b613
4 changed files with 27 additions and 3 deletions
@@ -1,11 +1,11 @@
package be.simplenotes.app.views.components
import be.simplenotes.app.utils.toTimeAgo
import be.simplenotes.domain.model.PersistedNoteMetadata
import kotlinx.html.*
import kotlinx.html.ButtonType.submit
import kotlinx.html.FormMethod.post
import kotlinx.html.ThScope.col
import org.http4k.core.Method
fun FlowContent.deletedNoteTable(notes: List<PersistedNoteMetadata>) = div("overflow-x-auto") {
table {
@@ -22,7 +22,7 @@ fun FlowContent.deletedNoteTable(notes: List<PersistedNoteMetadata>) = div("over
notes.forEach { (title, tags, updatedAt, uuid) ->
tr {
td { +title }
td("text-center") { +updatedAt.toString() } // TODO: x time ago
td("text-center") { +updatedAt.toTimeAgo() }
td { tags(tags) }
td("text-center") {
form(classes = "inline", method = post, action = "/notes/deleted/$uuid") {