format the views page correctly

This commit is contained in:
Arya 2024-05-22 11:28:12 +05:30
parent d3f8a0d2eb
commit 41c6ec9712
Signed by: arya
GPG Key ID: 842D12BDA50DF120

View File

@ -12,12 +12,11 @@
{{ end }}
</ul>
</div>
<br /><br />
<form action="/" method="POST" id="translation-form">
<br />
<br />
<form action="/" method="post" id="translation-form">
<!-- This hidden input is so that the engine gets sent in the request even though its not declared here -->
<input name="engine" value="{{.Engine}}" type="hidden" />
<div class="wrap languages center-area">
<div class="language">
<select name="from" aria-label="Source language" id="sourceLanguage">
@ -32,18 +31,20 @@
{{ end }} {{ end }}
</select>
</div>
<div class="switch_languages">
<button id="switchbutton" aria-label="Switch languages" formaction="/switchlanguages?engine={{ .Engine }}"
<button id="switchbutton"
aria-label="Switch languages"
formaction="/switchlanguages?engine={{ .Engine }}"
type="submit">
<!-- https://icon-sets.iconify.design/ci/arrow-left-right/ -->
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
<path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
d="m16 13l3 3m0 0l-3 3m3-3H5m3-5L5 8m0 0l3-3M5 8h14" />
<svg xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24">
<path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m16 13l3 3m0 0l-3 3m3-3H5m3-5L5 8m0 0l3-3M5 8h14" />
</svg>
</button>
</div>
<div class="language">
<select name="to" aria-label="Target language" id="targetLanguage">
{{ range $key, $value := .TargetLanguages }} {{ if $.To }}
@ -58,13 +59,13 @@
</select>
</div>
</div>
<div class="center-area2 item-wrapper">
Source Text:
<textarea autofocus class="item" id="input" name="text" dir="auto" placeholder="Enter Text Here">
{{ .OriginalText }}</textarea>
{{ if .Translation.SourceTransliteration }}
<br>Transliteration: {{newlinetobr .Translation.SourceTransliteration}}{{end}}
<br>
Transliteration: {{ newlinetobr .Translation.SourceTransliteration }}{{ end }}
{{ if .TtsFrom }}
<br>
<audio controls>
@ -73,7 +74,6 @@
{{ end }}
<br>
</div>
{{ if .TranslateAll }}
{{ range $key, $value := .TranslateAll }}
<div class="item-wrapper center-area2">
@ -81,9 +81,11 @@
<textarea class="translation item" dir="auto" placeholder="Translation" id="output" readonly>
{{.OutputText}}</textarea>
{{ if .AutoDetect }}
<br>Detected Language: {{.AutoDetect}}{{end}}
<br>
Detected Language: {{.AutoDetect}}{{ end }}
{{ if .TargetTransliteration }}
<br>Transliteration: {{newlinetobr .TargetTransliteration}}{{end}}
<br>
Transliteration: {{ newlinetobr .TargetTransliteration }}{{ end }}
{{ if $.TtsTo }}
<br>
<audio controls>
@ -98,9 +100,11 @@
<textarea class="translation item" dir="auto" placeholder="Translation" id="output" readonly>
{{.Translation.OutputText}}</textarea>
{{ if .Translation.AutoDetect }}
<br>Detected Language: {{.Translation.AutoDetect}}{{end}}
<br>
Detected Language: {{.Translation.AutoDetect}}{{ end }}
{{ if .Translation.TargetTransliteration }}
<br>Transliteration: {{newlinetobr .Translation.TargetTransliteration}}{{end}}
<br>
Transliteration: {{ newlinetobr .Translation.TargetTransliteration }}{{ end }}
{{ if .TtsTo }}
<br>
<audio controls>
@ -110,22 +114,31 @@
<br>
{{ end }}
{{ end }}
<div style="display:flex; justify-content:space-around; align-items:center;">
<div style="display:flex;
justify-content:space-around;
align-items:center">
{{ if .TranslationExists }}
<button class="wrap" type="button" onclick="copyToClipboard()">
Copy the translation
</button>
<button class="wrap" type="button" onclick="copyToClipboard()">Copy the translation</button>
{{ end }}
{{ if and .Engine .From .To .OriginalText }}<p><a id="url" class="button" onclick="copyLinkToClipboard(event)"
href="/?engine={{.Engine}}&from={{.From}}&to={{.To}}&text={{.OriginalText}}">Copy translation link</a></p>
{{ if and .Engine .From .To .OriginalText }}
<p>
<a id="url"
class="button"
onclick="copyLinkToClipboard(event)"
href="/?engine={{.Engine}}&from={{.From}}&to={{.To}}&text={{.OriginalText}}">Copy translation link</a>
</p>
{{ end }}
{{ if .TranslationExists }}
<button class="wrap" type="submit">
<button class="wrap" type="submit">Translate!</button>
{{ else }}
<button class="wrap" style="margin-left:auto; position:relative; left:-10%;margin-top: 1%;" type="submit">
<button class="wrap"
style="margin-left:auto;
position:relative;
left:-10%;
margin-top: 1%"
type="submit">Translate!</button>
{{ end }}
Translate!
</button>
</div>
</div>
</form>
<script>