From 0f72048b116bea756939e07b2042fe73ccebd242 Mon Sep 17 00:00:00 2001 From: Arya Kiran Date: Fri, 27 Dec 2024 14:40:02 +0530 Subject: [PATCH] move translate buttons up for better mobile usability (closes #16) --- pages/index.go | 2 ++ views/index.html | 50 ++++++++++++++++++++++++------------------------ 2 files changed, 27 insertions(+), 25 deletions(-) diff --git a/pages/index.go b/pages/index.go index 0319b88..31824a2 100644 --- a/pages/index.go +++ b/pages/index.go @@ -97,9 +97,11 @@ func HandleIndex(c *fiber.Ctx) error { if engine != "" && originalText != "" && from != "" && to != "" { if engine == "all" { transmany = libmozhi.TranslateAll(to, from, originalText) + translationExists = true } else if engine == "some" { // The error doesn't really matter since it just checks if the engines are valid, which is already checked in the code at the beginning of the func transmany, _ = libmozhi.TranslateSome(enginesSome.Engines, to, from, originalText) + translationExists = true } else { translation, tlerr = libmozhi.Translate(engine, to, from, originalText) if tlerr != nil { diff --git a/views/index.html b/views/index.html index 7562a00..b87496a 100644 --- a/views/index.html +++ b/views/index.html @@ -73,6 +73,22 @@ + {{ if .TranslationExists }} +
+ + {{ if and .Engine .From .To .OriginalText }} +

+ Copy translation link +

+ {{ end }} + +
+ {{ end }}
Source Text: