Skip to content

Commit

Permalink
TW-217: Update new link support page (linagora#2190)
Browse files Browse the repository at this point in the history
  • Loading branch information
nqhhdev authored Dec 25, 2024
1 parent f2c0a46 commit 3d6d331
Show file tree
Hide file tree
Showing 8 changed files with 141 additions and 66 deletions.
3 changes: 2 additions & 1 deletion config.sample.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@
"default_max_upload_avatar_size_in_bytes": 1000000,
"dev_mode": false,
"qr_code_download_url": "https://sign-up.twake.app/download/chat",
"enable_logs": false
"enable_logs": false,
"support_url": "https://twake.app/support"
}
3 changes: 3 additions & 0 deletions configurations/icons/ic_twake_support.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 3 additions & 1 deletion docs/configurations/config_web_app_for_public_platform.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ in [config.sample.json](https://github.com/linagora/twake-on-matrix/blob/main/co
"default_max_upload_avatar_size_in_bytes": 1000000,
"dev_mode": false,
"qr_code_download_url": "https://example.com/",
"enable_logs": true
"enable_logs": true,
"support_url": "https://example.com/"
}
```

Expand All @@ -51,5 +52,6 @@ in [config.sample.json](https://github.com/linagora/twake-on-matrix/blob/main/co
- `dev_mode`: Enable to run app in IDE,
- `qr_code_download_url`: URL generate QR code to download app
- `enable_logs`: Enable logs
- `support_url`: Enable/Disable if you want to show support button with the URL. Default is `https://twake.app/support`

If you want to disable it, please change the value or remove this from `config.sample.json`
6 changes: 4 additions & 2 deletions lib/config/app_config.dart
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,7 @@ abstract class AppConfig {
static String get webBaseUrl => _webBaseUrl;
static const String sourceCodeUrl =
'https://github.com/linagora/twake-on-matrix';
static const String supportUrl =
'https://github.com/linagora/twake-on-matrix/issues';
static String supportUrl = 'https://twake.app/support';
static bool renderHtml = true;
static bool hideRedactedEvents = false;
static bool hideUnknownEvents = true;
Expand Down Expand Up @@ -271,5 +270,8 @@ abstract class AppConfig {
if (json['enable_logs'] is bool) {
DebugUtils.enableLogs = json['enable_logs'];
}
if (json['support_url'] is String) {
supportUrl = json['support_url'];
}
}
}
7 changes: 5 additions & 2 deletions lib/pages/app_grid/app_grid_dashboard_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ class AppGridDashboardController extends State<AppGridDashboard> {

final linagoraApplications = ValueNotifier<LinagoraApplications?>(null);

final hoverColor = ValueNotifier<Color>(Colors.transparent);
final hoverColorAppGrid = ValueNotifier<Color>(Colors.transparent);

final hoverColorAppHelp = ValueNotifier<Color>(Colors.transparent);

void _getAppGridConfiguration() {
_getAppGridConfigurationInteractor
Expand Down Expand Up @@ -81,7 +83,8 @@ class AppGridDashboardController extends State<AppGridDashboard> {
void dispose() {
isOpenAppGridDashboardNotifier.dispose();
linagoraApplications.dispose();
hoverColor.dispose();
hoverColorAppGrid.dispose();
hoverColorAppHelp.dispose();
super.dispose();
}

Expand Down
178 changes: 118 additions & 60 deletions lib/pages/app_grid/app_grid_dashboard_view.dart
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
import 'package:fluffychat/config/app_config.dart';
import 'package:fluffychat/pages/app_grid/app_grid_dashboard_controller.dart';
import 'package:fluffychat/pages/app_grid/app_grid_dashboard_overlay.dart';
import 'package:fluffychat/pages/app_grid/app_grid_dashboard_view_style.dart';
import 'package:fluffychat/resource/image_paths.dart';
import 'package:fluffychat/utils/extension/value_notifier_extension.dart';
import 'package:fluffychat/utils/url_launcher.dart';
import 'package:flutter/material.dart';
import 'package:flutter_portal/flutter_portal.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';

class AppGridDashboardView extends StatelessWidget {
final AppGridDashboardController controller;
Expand All @@ -19,71 +22,126 @@ class AppGridDashboardView extends StatelessWidget {
Widget build(BuildContext context) {
return Align(
alignment: Alignment.centerRight,
child: ValueListenableBuilder(
valueListenable: controller.isOpenAppGridDashboardNotifier,
builder: (context, isOpenAppGridDashboard, _) {
return TapRegion(
behavior: HitTestBehavior.opaque,
onTapInside: (_) {
controller.isOpenAppGridDashboardNotifier.toggle();
},
onTapOutside: (_) {
controller.hideAppGridDashboard();
controller.hoverColor.value = Colors.transparent;
},
child: MouseRegion(
cursor: SystemMouseCursors.click,
onEnter: (_) => controller.hoverColor.value =
AppGridDashboardViewStyle.hoverColor,
onExit: (_) {
if (!isOpenAppGridDashboard) {
controller.hoverColor.value = Colors.transparent;
}
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
if (AppConfig.supportUrl.isNotEmpty)
TapRegion(
behavior: HitTestBehavior.opaque,
onTapInside: (_) {
UrlLauncher(
context,
url: AppConfig.supportUrl,
).openUrlInAppBrowser();
},
child: ValueListenableBuilder(
valueListenable: controller.hoverColor,
builder: (context, color, child) {
return PortalTarget(
portalFollower: const SizedBox(
width: AppGridDashboardViewStyle.sizIcAppGrid,
),
visible: isOpenAppGridDashboard,
child: PortalTarget(
anchor: const Aligned(
follower: Alignment.topRight,
target: Alignment.bottomRight,
),
portalFollower: ValueListenableBuilder(
valueListenable: controller.linagoraApplications,
builder: (context, linagoraApplications, child) {
if (linagoraApplications == null) return child!;
return AppGridDashboardOverlay(
linagoraApplications,
);
},
child: const SizedBox.shrink(),
),
visible: isOpenAppGridDashboard,
child: Container(
decoration: BoxDecoration(
color: color,
borderRadius:
AppGridDashboardViewStyle.appGridIconBorderRadius,
),
padding: AppGridDashboardViewStyle.appGridIconPadding,
child: SvgPicture.asset(
ImagePaths.icApplicationGrid,
width: AppGridDashboardViewStyle.sizIcAppGrid,
height: AppGridDashboardViewStyle.sizIcAppGrid,
onTapOutside: (_) {
controller.hoverColorAppHelp.value = Colors.transparent;
},
child: MouseRegion(
cursor: SystemMouseCursors.click,
onEnter: (_) => controller.hoverColorAppHelp.value =
AppGridDashboardViewStyle.hoverColor,
onExit: (_) {
controller.hoverColorAppHelp.value = Colors.transparent;
},
child: ValueListenableBuilder(
valueListenable: controller.hoverColorAppHelp,
builder: (context, color, _) {
return TooltipVisibility(
visible: true,
child: Tooltip(
message: L10n.of(context)!.help,
showDuration: const Duration(seconds: 1),
waitDuration: const Duration(seconds: 1),
child: Container(
decoration: BoxDecoration(
color: color,
borderRadius: AppGridDashboardViewStyle
.appGridIconBorderRadius,
),
padding: AppGridDashboardViewStyle.appGridIconPadding,
child: SvgPicture.asset(
ImagePaths.icTwakeSupport,
width:
AppGridDashboardViewStyle.sizeIcSupportButton,
height:
AppGridDashboardViewStyle.sizeIcSupportButton,
),
),
),
),
);
},
);
},
),
),
),
);
},
ValueListenableBuilder(
valueListenable: controller.isOpenAppGridDashboardNotifier,
builder: (context, isOpenAppGridDashboard, _) {
return TapRegion(
behavior: HitTestBehavior.opaque,
onTapInside: (_) {
controller.isOpenAppGridDashboardNotifier.toggle();
},
onTapOutside: (_) {
controller.hideAppGridDashboard();
controller.hoverColorAppGrid.value = Colors.transparent;
},
child: MouseRegion(
cursor: SystemMouseCursors.click,
onEnter: (_) => controller.hoverColorAppGrid.value =
AppGridDashboardViewStyle.hoverColor,
onExit: (_) {
if (!isOpenAppGridDashboard) {
controller.hoverColorAppGrid.value = Colors.transparent;
}
},
child: ValueListenableBuilder(
valueListenable: controller.hoverColorAppGrid,
builder: (context, color, child) {
return PortalTarget(
portalFollower: const SizedBox(
width: AppGridDashboardViewStyle.sizIcAppGrid,
),
visible: isOpenAppGridDashboard,
child: PortalTarget(
anchor: const Aligned(
follower: Alignment.topRight,
target: Alignment.bottomRight,
),
portalFollower: ValueListenableBuilder(
valueListenable: controller.linagoraApplications,
builder: (context, linagoraApplications, child) {
if (linagoraApplications == null) return child!;
return AppGridDashboardOverlay(
linagoraApplications,
);
},
child: const SizedBox.shrink(),
),
visible: isOpenAppGridDashboard,
child: Container(
decoration: BoxDecoration(
color: color,
borderRadius: AppGridDashboardViewStyle
.appGridIconBorderRadius,
),
padding:
AppGridDashboardViewStyle.appGridIconPadding,
child: SvgPicture.asset(
ImagePaths.icApplicationGrid,
width: AppGridDashboardViewStyle.sizIcAppGrid,
height: AppGridDashboardViewStyle.sizIcAppGrid,
),
),
),
);
},
),
),
);
},
),
],
),
);
}
Expand Down
4 changes: 4 additions & 0 deletions lib/pages/app_grid/app_grid_dashboard_view_style.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ import 'package:flutter/material.dart';
class AppGridDashboardViewStyle {
static const double sizIcAppGrid = 23.0;

static const double sizeSupportButton = 36.0;

static const double sizeIcSupportButton = 24.0;

static const Color hoverColor = Color(0xFFF2F8FB);

static const BorderRadius appGridIconBorderRadius =
Expand Down
2 changes: 2 additions & 0 deletions lib/resource/image_paths.dart
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ class ImagePaths {
static String get logoPng => _getAssetPath('logo.png');
static String get appStore => _getImagePath('app_store.svg');
static String get googlePlay => _getImagePath('google_play.svg');
static String get icTwakeSupport =>
getConfigurationImagePath('ic_twake_support.svg');

static String _getImagePath(String imageName) {
return AssetsPaths.images + imageName;
Expand Down

0 comments on commit 3d6d331

Please sign in to comment.