From 27569ece12eff407de3fb53bf892c1814cfa2458 Mon Sep 17 00:00:00 2001 From: Nathan Seva Date: Wed, 21 Sep 2022 18:00:05 +0200 Subject: [PATCH] 107 bug UI not responsive for long website name (#112) adds UI responsivity for long website name. --- int/api/thyra.go | 4 ++++ pkg/front/common.go | 8 ++++++++ pkg/front/wallet/html.go | 30 +++++++++++++-------------- pkg/front/wallet/js.go | 22 ++++---------------- pkg/front/website/css.go | 5 +++-- pkg/front/website/html.go | 33 +++++++++++++++--------------- pkg/front/website/js.go | 6 +++--- resource/gen.go | 1 + resource/html/front/common.js | 35 ++++++++++++++++++++++++++++++++ resource/html/front/wallet.html | 26 ++++++++++++------------ resource/html/front/wallet.js | 18 ++-------------- resource/html/front/website.css | 1 + resource/html/front/website.html | 29 +++++++++++++------------- resource/html/front/website.js | 11 ++++------ 14 files changed, 123 insertions(+), 106 deletions(-) create mode 100644 pkg/front/common.go create mode 100644 resource/html/front/common.js diff --git a/int/api/thyra.go b/int/api/thyra.go index b77ce934e..5f57e52cf 100644 --- a/int/api/thyra.go +++ b/int/api/thyra.go @@ -27,6 +27,8 @@ func ThyraWalletHandler(params operations.ThyraWalletParams) middleware.Responde body = front.Logo case "errors.js": body = front.Errors + case "common.js": + body = front.Common } return NewCustomResponder([]byte(body), contentType(params.Resource), http.StatusOK) @@ -49,6 +51,8 @@ func ThyraWebsiteCreatorHandler(params operations.ThyraWebsiteCreatorParams) mid body = front.Logo case "errors.js": body = front.Errors + case "common.js": + body = front.Common } return NewCustomResponder([]byte(body), contentType(params.Resource), http.StatusOK) diff --git a/pkg/front/common.go b/pkg/front/common.go new file mode 100644 index 000000000..87bf1514b --- /dev/null +++ b/pkg/front/common.go @@ -0,0 +1,8 @@ +// GENERATED BY textFileToGoConst +// GitHub: github.com/logrusorgru/textFileToGoConst +// input file: html/front/common.js +// generated: Wed Sep 21 10:06:14 CEST 2022 + +package front + +const Common = "// utils\n\nfunction ellipsis(str) {\n\treturn str.substr(0, 5) + '...' + str.substr(str.length - 5, str.length);\n}\n\nconst copyToClipboard = (\n value,\n successfully = () => null,\n failure = () => null\n) => {\n const clipboard = navigator.clipboard;\n if (clipboard !== undefined && clipboard !== \"undefined\") {\n navigator.clipboard.writeText(value).then(successfully, failure);\n } else {\n if (document.execCommand) {\n const el = document.createElement(\"input\");\n el.value = value;\n document.body.append(el);\n\n el.select();\n el.setSelectionRange(0, value.length);\n\n if (document.execCommand(\"copy\")) {\n successfully();\n }\n\n el.remove();\n } else {\n failure();\n }\n }\n};\n\nconst addressInnerHTML = (address) => `${ellipsis(address)} `;\n" diff --git a/pkg/front/wallet/html.go b/pkg/front/wallet/html.go index e1fa6d52b..66bb041ac 100644 --- a/pkg/front/wallet/html.go +++ b/pkg/front/wallet/html.go @@ -1,7 +1,7 @@ // GENERATED BY textFileToGoConst // GitHub: github.com/logrusorgru/textFileToGoConst -// input file: html\front\wallet.html -// generated: Mon Sep 12 14:36:33 CEST 2022 +// input file: html/front/wallet.html +// generated: Wed Sep 21 10:06:14 CEST 2022 package wallet @@ -13,13 +13,12 @@ const HTML = ` integrity="sha384-0evHe/X+R7YkIZDRvuzKMRqM+OrBnVFBL6DOitfPri4tjfHxaWutUpFmBp4vmVor" crossorigin="anonymous" /> -