diff --git a/routing.go b/routing.go index 455a485..fc66f54 100644 --- a/routing.go +++ b/routing.go @@ -281,6 +281,7 @@ func settingsHandler(w http.ResponseWriter, r *http.Request, uid string) { "TabBots": localizer.MustLocalize(&i18n.LocalizeConfig{MessageID: "tab_bots"}), "TableName": localizer.MustLocalize(&i18n.LocalizeConfig{MessageID: "table_name"}), "TableToken": localizer.MustLocalize(&i18n.LocalizeConfig{MessageID: "table_token"}), + "AddBot": localizer.MustLocalize(&i18n.LocalizeConfig{MessageID: "add_bot"}), "TableActivity": localizer.MustLocalize(&i18n.LocalizeConfig{MessageID: "table_activity"}), }, } @@ -358,13 +359,13 @@ func createHandler(w http.ResponseWriter, r *http.Request) { cr, status, errr := client.APICredentials() if errr.RuntimeErr != nil { http.Error(w, localizer.MustLocalize(&i18n.LocalizeConfig{MessageID: "incorrect_url_key"}), http.StatusBadRequest) - logger.Error(c.APIURL, status, err.Error(), cr) + logger.Error(c.APIURL, status, errr.RuntimeErr, cr) return } if !cr.Success { http.Error(w, localizer.MustLocalize(&i18n.LocalizeConfig{MessageID: "incorrect_url_key"}), http.StatusBadRequest) - logger.Error(c.APIURL, status, err.Error(), cr) + logger.Error(c.APIURL, status, errr.ApiErr, cr) return } @@ -372,8 +373,12 @@ func createHandler(w http.ResponseWriter, r *http.Request) { Code: transport, IntegrationCode: transport, Active: true, - Name: "MG Telegram", + Name: "Telegram", ClientID: c.ClientID, + Logo: fmt.Sprintf( + "https://%s/web/telegram_logo.svg", + config.HTTPServer.Host, + ), BaseURL: fmt.Sprintf( "https://%s", config.HTTPServer.Host, diff --git a/templates/form.html b/templates/form.html index d9a8e3d..02d5190 100644 --- a/templates/form.html +++ b/templates/form.html @@ -3,7 +3,7 @@
@@ -24,8 +24,8 @@
-
- @@ -39,12 +39,14 @@
-
+
-
-
+
+
+
@@ -63,9 +65,9 @@ {{.Name}} {{.Token}} - diff --git a/templates/home.html b/templates/home.html index 6f3d906..92f3fb5 100644 --- a/templates/home.html +++ b/templates/home.html @@ -16,8 +16,8 @@
-
- diff --git a/templates/layout.html b/templates/layout.html index 61ceade..297f802 100644 --- a/templates/layout.html +++ b/templates/layout.html @@ -11,7 +11,7 @@
- +
{{ end }} diff --git a/translate/translate.en.yml b/translate/translate.en.yml index a4f9573..fca8d73 100644 --- a/translate/translate.en.yml +++ b/translate/translate.en.yml @@ -7,7 +7,7 @@ table_activity: Activity api_key: API Key no_bot_token: Enter the bot token -incorrect_data: Incorrect data +wrong_data: Incorrect data set_method: Set POST method bot_already_created: Bot already created not_find_account: Could not find account, please contact technical support @@ -20,3 +20,4 @@ connection_already_created: Connection already created missing_url_key: Missing crm url or apiKey incorrect_url: Enter the correct CRM url incorrect_token: Set correct bot token +add_bot: Add bot diff --git a/translate/translate.ru.yml b/translate/translate.ru.yml index 242a20d..d77af7c 100644 --- a/translate/translate.ru.yml +++ b/translate/translate.ru.yml @@ -6,7 +6,6 @@ table_token: Токен table_activity: Активность api_key: API Ключ - no_bot_token: Введите токен wrong_data: Неверные данные set_method: Установить метод POST @@ -14,10 +13,11 @@ bot_already_created: Бот уже создан not_find_account: Не удалось найти учетную запись, обратитесь в службу технической поддержки error_activating_channel: Ошибка при активации канала error_deactivating_channel: Ошибка при отключении канала -correct_url_key: Введите корректный URL или apiKey +incorrect_url_key: Введите корректный URL или apiKey error_creating_integration: Ошибка при создании интеграции error_creating_connection: Ошибка при создании соединения connection_already_created: Соединение уже создано missing_url_key: Отсутствует URL или apiKey incorrect_url: Введите корректный URL CRM incorrect_token: Установите корректный токен +add_bot: Добавить бота diff --git a/web/script.js b/web/script.js index 91cfc6a..0a9a99f 100644 --- a/web/script.js +++ b/web/script.js @@ -48,7 +48,7 @@ $(document).on("click", ".activity-bot", function(e) { but.find('i').replaceWith('play_arrow'); but.attr("data-activity", "false") } else { - but.find('i').replaceWith('stop'); + but.find('i').replaceWith('pause'); but.attr("data-activity", "true") } } @@ -70,7 +70,8 @@ function send(url, data, callback) { ); } } else { - $('#msg').html(`

${res.responseText}

`); + //$('#msg').html(`

${res.responseText}

`); + M.toast({html: res.responseText}) } } }); @@ -83,9 +84,9 @@ function getBotTemplate(data) { ${bot.name} ${bot.token} - `; diff --git a/web/style.css b/web/style.css index d8942e2..cbda80d 100644 --- a/web/style.css +++ b/web/style.css @@ -9,6 +9,11 @@ #bots .activity-bot{ float: right; } + +#bots { + font-size: 12px; +} + #msg{ height: 23px; } @@ -19,6 +24,71 @@ } #logo{ - height: 80px; - border-bottom: 1px solid red; + height: 100px; + margin-bottom: 20px; +} + +/* label color */ +.input-field label { + color: #039be5; +} +/* label focus color */ +.input-field input[type=text]:focus + label { + color: #039be5; +} +/* label underline focus color */ +.input-field input[type=text]:focus { + border-bottom: 1px solid #039be5; + box-shadow: 0 1px 0 0 #039be5; +} +/* valid color */ +.input-field input[type=text].valid { + border-bottom: 1px solid #039be5; + box-shadow: 0 1px 0 0 #039be5; +} +/* invalid color */ +.input-field input[type=text].invalid { + border-bottom: 1px solid #c62828; + box-shadow: 0 1px 0 0 #c62828; +} +/* icon prefix focus color */ +.input-field .prefix.active { + color: #039be5; +} + +.tabs .tab a { + color: #039be5; + display: block; + width: 100%; + height: 100%; + padding: 0 24px; + font-size: 14px; + text-overflow: ellipsis; + overflow: hidden; + -webkit-transition: color .28s ease, background-color .28s ease; + transition: color .28s ease, background-color .28s ease; +} + +.tabs .tab a:focus, .tabs .tab a:focus.active { + background-color: #e1f5fe; + outline: none; +} + +.tabs .tab a:hover, .tabs .tab a.active { + background-color: transparent; + color: #039be5; +} + +.tabs .tab.disabled a, +.tabs .tab.disabled a:hover { + color: #039be5; + cursor: default; +} + +.tabs .indicator { + position: absolute; + bottom: 0; + height: 2px; + background-color: #039be5; + will-change: left, right; } diff --git a/web/telegram_logo.svg b/web/telegram_logo.svg index 49a8638..1edff13 100644 --- a/web/telegram_logo.svg +++ b/web/telegram_logo.svg @@ -1,58 +1,17 @@ - - - - - - - - - - image/svg+xml - - - - - - - - - + + + + + + + + + + + + + + + + + \ No newline at end of file