From 2980887333b00d6b6bc2e5fe877e694362af8adb Mon Sep 17 00:00:00 2001 From: NaiJi Date: Wed, 4 Jan 2023 14:42:22 +0400 Subject: [PATCH] feat: Add DNS provider selection page Upload cloudflare svg --- assets/images/logos/cloudflare.svg | 10 +++++ assets/translations/en.json | 4 +- assets/translations/ru.json | 4 +- .../initializing/dns_provider_form_cubit.dart | 3 +- .../initializing/dns_provider_picker.dart | 39 ++++--------------- 5 files changed, 25 insertions(+), 35 deletions(-) create mode 100644 assets/images/logos/cloudflare.svg diff --git a/assets/images/logos/cloudflare.svg b/assets/images/logos/cloudflare.svg new file mode 100644 index 00000000..a8cbf3bc --- /dev/null +++ b/assets/images/logos/cloudflare.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/assets/translations/en.json b/assets/translations/en.json index 7d39a922..5f74b0e1 100644 --- a/assets/translations/en.json +++ b/assets/translations/en.json @@ -285,11 +285,13 @@ "select_provider_countries_text_hetzner": "Germany, Finland, USA", "select_provider_countries_text_do": "USA, Netherlands, Singapore, UK, Germany, Canada, India, Australia", "select_provider_price_title": "Average price", + "select_provider_price_free": "Free", "select_provider_price_text_hetzner": "€8 per month for a relatively small server and 50GB of disk storage", "select_provider_price_text_do": "$17 per month for a relatively small server and 50GB of disk storage", "select_provider_payment_title": "Payment methods", "select_provider_payment_text_hetzner": "Credit cards, SWIFT, SEPA, PayPal", "select_provider_payment_text_do": "Credit cards, Google Pay, PayPal", + "select_provider_payment_text_cloudflare": "Credit cards", "select_provider_email_notice": "E-mail hosting won't be available for new clients. Nevertheless it will be unlocked as soon as you complete your first payment.", "select_provider_site_button": "Visit site", "connect_to_server_provider": "Now log in ", @@ -310,7 +312,7 @@ "choose_server_type_storage": "{} GB of system storage", "choose_server_type_payment_per_month": "{} per month", "no_server_types_found": "No available server types found. Make sure your account is accessible and try to change your server location.", - "cloudflare_bad_key_error": "Cloudflare API key is invalid", + "dns_provider_bad_key_error": "API key is invalid", "backblaze_bad_key_error": "Backblaze storage information is invalid", "connect_to_dns": "Connect the DNS provider", "select_dns": "Now let's select a DNS provider", diff --git a/assets/translations/ru.json b/assets/translations/ru.json index 29492950..82183962 100644 --- a/assets/translations/ru.json +++ b/assets/translations/ru.json @@ -284,11 +284,13 @@ "select_provider_countries_text_hetzner": "Германия, Финляндия, США", "select_provider_countries_text_do": "США, Нидерланды, Сингапур, Великобритания, Германия, Канада, Индия, Австралия", "select_provider_price_title": "Средняя цена", + "select_provider_price_free": "Бесплатно", "select_provider_price_text_hetzner": "€8 в месяц за небольшой сервер и 50GB места на диске", "select_provider_price_text_do": "$17 в месяц за небольшой сервер и 50GB места на диске", "select_provider_payment_title": "Методы оплаты", "select_provider_payment_text_hetzner": "Банковские карты, SWIFT, SEPA, PayPal", "select_provider_payment_text_do": "Банковские карты, Google Pay, PayPal", + "select_provider_payment_text_cloudflare": "Банковские карты", "select_provider_email_notice": "Хостинг электронной почты недоступен для новых клиентов. Разблокировать можно будет после первой оплаты.", "select_provider_site_button": "Посетить сайт", "connect_to_server_provider": "Авторизоваться в ", @@ -309,7 +311,7 @@ "choose_server_type_storage": "{} GB системного хранилища", "choose_server_type_payment_per_month": "{} в месяц", "no_server_types_found": "Не найдено доступных типов сервера! Пожалуйста, убедитесь, что у вас есть доступ к провайдеру сервера...", - "cloudflare_bad_key_error": "Cloudflare API ключ неверен", + "dns_provider_bad_key_error": "API ключ неверен", "backblaze_bad_key_error": "Информация о Backblaze хранилище неверна", "connect_to_dns": "Подключите DNS провайдер", "manage_domain_dns": "Для управления DNS вашего домена", diff --git a/lib/logic/cubit/forms/setup/initializing/dns_provider_form_cubit.dart b/lib/logic/cubit/forms/setup/initializing/dns_provider_form_cubit.dart index bfcaf0f9..eb23dd42 100644 --- a/lib/logic/cubit/forms/setup/initializing/dns_provider_form_cubit.dart +++ b/lib/logic/cubit/forms/setup/initializing/dns_provider_form_cubit.dart @@ -11,7 +11,6 @@ class DnsProviderFormCubit extends FormCubit { initalValue: '', validations: [ RequiredStringValidation('validations.required'.tr()), - LengthStringNotEqualValidation(40) ], ); @@ -43,7 +42,7 @@ class DnsProviderFormCubit extends FormCubit { } if (!isKeyValid) { - apiKey.setError('initializing.cloudflare_bad_key_error'.tr()); + apiKey.setError('initializing.dns_provider_bad_key_error'.tr()); } return isKeyValid; diff --git a/lib/ui/pages/setup/initializing/dns_provider_picker.dart b/lib/ui/pages/setup/initializing/dns_provider_picker.dart index 99aadfbc..da6098f5 100644 --- a/lib/ui/pages/setup/initializing/dns_provider_picker.dart +++ b/lib/ui/pages/setup/initializing/dns_provider_picker.dart @@ -164,7 +164,7 @@ class ProviderSelectionPage extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - 'initializing.connect_to_server'.tr(), + 'initializing.select_dns'.tr(), style: Theme.of(context).textTheme.headlineSmall, ), const SizedBox(height: 10), @@ -187,10 +187,10 @@ class ProviderSelectionPage extends StatelessWidget { padding: const EdgeInsets.all(10), decoration: BoxDecoration( borderRadius: BorderRadius.circular(40), - color: const Color(0xFFD50C2D), + color: const Color.fromARGB(255, 241, 215, 166), ), child: SvgPicture.asset( - 'assets/images/logos/hetzner.svg', + 'assets/images/logos/cloudflare.svg', ), ), const SizedBox(width: 16), @@ -201,22 +201,12 @@ class ProviderSelectionPage extends StatelessWidget { ], ), const SizedBox(height: 16), - Text( - 'initializing.select_provider_countries_title'.tr(), - style: Theme.of(context).textTheme.bodyLarge, - ), - Text( - 'initializing.select_provider_countries_text_hetzner' - .tr(), - style: Theme.of(context).textTheme.bodySmall, - ), - const SizedBox(height: 16), Text( 'initializing.select_provider_price_title'.tr(), style: Theme.of(context).textTheme.bodyLarge, ), Text( - 'initializing.select_provider_price_text_hetzner'.tr(), + 'initializing.select_provider_price_free'.tr(), style: Theme.of(context).textTheme.bodySmall, ), const SizedBox(height: 16), @@ -225,12 +215,8 @@ class ProviderSelectionPage extends StatelessWidget { style: Theme.of(context).textTheme.bodyLarge, ), Text( - 'initializing.select_provider_payment_text_hetzner'.tr(), - style: Theme.of(context).textTheme.bodySmall, - ), - const SizedBox(height: 16), - Text( - 'initializing.select_provider_email_notice'.tr(), + 'initializing.select_provider_payment_text_cloudflare' + .tr(), style: Theme.of(context).textTheme.bodySmall, ), const SizedBox(height: 16), @@ -245,7 +231,7 @@ class ProviderSelectionPage extends StatelessWidget { // Outlined button that will open website BrandOutlinedButton( onPressed: () => - launchURL('https://cloud.digitalocean.com/'), + launchURL('https://dash.cloudflare.com/'), title: 'initializing.select_provider_site_button'.tr(), ), ], @@ -281,21 +267,12 @@ class ProviderSelectionPage extends StatelessWidget { ], ), const SizedBox(height: 16), - Text( - 'initializing.select_provider_countries_title'.tr(), - style: Theme.of(context).textTheme.bodyLarge, - ), - Text( - 'initializing.select_provider_countries_text_do'.tr(), - style: Theme.of(context).textTheme.bodySmall, - ), - const SizedBox(height: 16), Text( 'initializing.select_provider_price_title'.tr(), style: Theme.of(context).textTheme.bodyLarge, ), Text( - 'initializing.select_provider_price_text_do'.tr(), + 'initializing.select_provider_price_free'.tr(), style: Theme.of(context).textTheme.bodySmall, ), const SizedBox(height: 16),