Some UX rework...

This commit is contained in:
2021-12-27 00:14:48 +02:00
parent 4a016ac16a
commit 3141d8ed48
2 changed files with 15 additions and 9 deletions

View File

@@ -130,13 +130,18 @@ module.exports = function (options) {
}).then(chunks => {
if (chunks.length > 0) {
const chunk = chunks.find(chunk => chunk.index == Number(request.params.chunkIndex))
response.display("translate-chunk", {
user: request.user,
pageTitle: `Translate ${chunk.chapter.entryVersion.entry.name}`,
chunk: chunk,
previousChunk: chunks.find(chunk => chunk.index == previousIndex),
nextChunk: chunks.find(chunk => chunk.index == nextIndex)
})
if (chunk) {
response.display("translate-chunk", {
user: request.user,
pageTitle: `Translate ${chunk.chapter.entryVersion.entry.name}`,
chunk: chunk,
previousChunk: chunks.find(chunk => chunk.index == previousIndex),
nextChunk: chunks.find(chunk => chunk.index == nextIndex)
})
} else {
response.redirect(`/translate/${request.params.id}/chapter/${request.params.chapterId}`)
}
} else {
next()
}
@@ -194,7 +199,7 @@ module.exports = function (options) {
translationEntryVersionId: request.params.id
})
}
response.redirect(`/translate/${request.params.id}/chapter/${request.params.chapterId}/t/${request.params.chunkIndex}`)
response.redirect(`/translate/${request.params.id}/chapter/${request.params.chapterId}/t/${Number(request.params.chunkIndex)+1}`)
} else {
next()
}

View File

@@ -3,7 +3,8 @@ extend templates/layout.pug
block content
.container
.center
h1 Translate into #{chunk.chapter.entryVersion.translationEntryVersions[0].name}
h1 Translate into
a(href=`/translate/${chunk.chapter.entryVersion.translationEntryVersions[0].id}/chapter/${chunk.chapter.id}`) #{chunk.chapter.entryVersion.translationEntryVersions[0].name}
//- TODO: Show previous...
form.row(action=`/translate/${chunk.chapter.entryVersion.translationEntryVersions[0].id}/chapter/${chunk.chapter.id}/t/${chunk.index}`, method="post")