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

View File

@@ -3,7 +3,8 @@ extend templates/layout.pug
block content block content
.container .container
.center .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... //- TODO: Show previous...
form.row(action=`/translate/${chunk.chapter.entryVersion.translationEntryVersions[0].id}/chapter/${chunk.chapter.id}/t/${chunk.index}`, method="post") form.row(action=`/translate/${chunk.chapter.entryVersion.translationEntryVersions[0].id}/chapter/${chunk.chapter.id}/t/${chunk.index}`, method="post")