diff --git a/frontend/pweb/lib/l10n/en.arb b/frontend/pweb/lib/l10n/en.arb index 512ecbc1..f8bff51f 100644 --- a/frontend/pweb/lib/l10n/en.arb +++ b/frontend/pweb/lib/l10n/en.arb @@ -128,7 +128,7 @@ "payoutNavReports": "Reports", "payoutNavSettings": "Settings", "payoutNavLogout": "Logout", - "payoutNavMethods": "Payouts", + "payoutNavMethods": "Payout Methods", "expand": "Expand", "collapse": "Collapse", "pageTitleRecipients": "Recipient address book", diff --git a/frontend/pweb/lib/l10n/ru.arb b/frontend/pweb/lib/l10n/ru.arb index e6709cf4..28578227 100644 --- a/frontend/pweb/lib/l10n/ru.arb +++ b/frontend/pweb/lib/l10n/ru.arb @@ -128,7 +128,7 @@ "payoutNavReports": "Отчеты", "payoutNavSettings": "Настройки", "payoutNavLogout": "Выйти", - "payoutNavMethods": "Выплаты", + "payoutNavMethods": "Способы выплат", "expand": "Развернуть", "collapse": "Свернуть", "pageTitleRecipients": "Адресная книга получателей", diff --git a/frontend/pweb/lib/pages/dashboard/dashboard.dart b/frontend/pweb/lib/pages/dashboard/dashboard.dart index a348c539..b7e044c5 100644 --- a/frontend/pweb/lib/pages/dashboard/dashboard.dart +++ b/frontend/pweb/lib/pages/dashboard/dashboard.dart @@ -70,16 +70,17 @@ class _DashboardPageState extends State { icon: Icons.person_add, ), ), - const SizedBox(width: AppSpacing.small), - Expanded( - flex: 0, - child: TransactionRefButton( - onTap: () => _setActive(false), - isActive: _showContainerMultiple, - label: l10n.sendMultiple, - icon: Icons.group_add, - ), - ), + //TODO bring back multiple payouts + // const SizedBox(width: AppSpacing.small), + // Expanded( + // flex: 0, + // child: TransactionRefButton( + // onTap: () => _setActive(false), + // isActive: _showContainerMultiple, + // label: l10n.sendMultiple, + // icon: Icons.group_add, + // ), + // ), ], ), const SizedBox(height: AppSpacing.medium), diff --git a/frontend/pweb/lib/pages/settings/profile/account/name/editing.dart b/frontend/pweb/lib/pages/settings/profile/account/name/editing.dart new file mode 100644 index 00000000..57046f70 --- /dev/null +++ b/frontend/pweb/lib/pages/settings/profile/account/name/editing.dart @@ -0,0 +1,73 @@ +import 'package:flutter/material.dart'; + +import 'package:pweb/providers/account_name.dart'; + + +class AccountNameEditingFields extends StatelessWidget { + const AccountNameEditingFields({ + super.key, + required this.hintText, + required this.lastNameHint, + required this.inputWidth, + required this.borderWidth, + required this.state, + }); + + final String hintText; + final String lastNameHint; + final double inputWidth; + final double borderWidth; + final AccountNameState state; + + @override + Widget build(BuildContext context) { + final theme = Theme.of(context); + + return SizedBox( + width: inputWidth, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + TextFormField( + controller: state.firstNameController, + style: theme.textTheme.headlineMedium?.copyWith( + fontWeight: FontWeight.bold, + ), + autofocus: true, + enabled: !state.isBusy, + decoration: InputDecoration( + hintText: hintText, + labelText: hintText, + isDense: true, + border: UnderlineInputBorder( + borderSide: BorderSide( + color: theme.colorScheme.primary, + width: borderWidth, + ), + ), + ), + ), + const SizedBox(height: 8), + TextFormField( + controller: state.lastNameController, + style: theme.textTheme.headlineSmall?.copyWith( + fontWeight: FontWeight.w600, + ), + enabled: !state.isBusy, + decoration: InputDecoration( + hintText: lastNameHint, + labelText: lastNameHint, + isDense: true, + border: UnderlineInputBorder( + borderSide: BorderSide( + color: theme.colorScheme.primary, + width: borderWidth, + ), + ), + ), + ), + ], + ), + ); + } +} diff --git a/frontend/pweb/lib/pages/settings/profile/account/name/line.dart b/frontend/pweb/lib/pages/settings/profile/account/name/line.dart new file mode 100644 index 00000000..6de2ad64 --- /dev/null +++ b/frontend/pweb/lib/pages/settings/profile/account/name/line.dart @@ -0,0 +1,24 @@ +import 'package:flutter/material.dart'; + + +class AccountNameSingleLineText extends StatelessWidget { + const AccountNameSingleLineText({ + super.key, + required this.text, + required this.style, + }); + + final String text; + final TextStyle? style; + + @override + Widget build(BuildContext context) { + return Text( + text, + maxLines: 1, + softWrap: false, + overflow: TextOverflow.ellipsis, + style: style, + ); + } +} diff --git a/frontend/pweb/lib/pages/settings/profile/account/name/text.dart b/frontend/pweb/lib/pages/settings/profile/account/name/text.dart index 566c959f..7fd154fd 100644 --- a/frontend/pweb/lib/pages/settings/profile/account/name/text.dart +++ b/frontend/pweb/lib/pages/settings/profile/account/name/text.dart @@ -2,6 +2,8 @@ import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; +import 'package:pweb/pages/settings/profile/account/name/editing.dart'; +import 'package:pweb/pages/settings/profile/account/name/view.dart'; import 'package:pweb/providers/account_name.dart'; @@ -22,63 +24,22 @@ class AccountNameText extends StatelessWidget { @override Widget build(BuildContext context) { final state = context.watch(); - final theme = Theme.of(context); if (state.isEditing) { - return SizedBox( - width: inputWidth, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - TextFormField( - controller: state.firstNameController, - style: theme.textTheme.headlineMedium?.copyWith( - fontWeight: FontWeight.bold, - ), - autofocus: true, - enabled: !state.isBusy, - decoration: InputDecoration( - hintText: hintText, - labelText: hintText, - isDense: true, - border: UnderlineInputBorder( - borderSide: BorderSide( - color: theme.colorScheme.primary, - width: borderWidth, - ), - ), - ), - ), - const SizedBox(height: 8), - TextFormField( - controller: state.lastNameController, - style: theme.textTheme.headlineSmall?.copyWith( - fontWeight: FontWeight.w600, - ), - enabled: !state.isBusy, - decoration: InputDecoration( - hintText: lastNameHint, - labelText: lastNameHint, - isDense: true, - border: UnderlineInputBorder( - borderSide: BorderSide( - color: theme.colorScheme.primary, - width: borderWidth, - ), - ), - ), - ), - ], - ), + return AccountNameEditingFields( + hintText: hintText, + lastNameHint: lastNameHint, + borderWidth: borderWidth, + inputWidth: inputWidth, + state: state, ); } - final displayName = state.currentFullName.isNotEmpty ? state.currentFullName : hintText; - return Text( - displayName, - style: theme.textTheme.headlineMedium?.copyWith( - fontWeight: FontWeight.bold, - ), + return AccountNameViewText( + hintText: hintText, + inputWidth: inputWidth, + firstName: state.currentFirstName, + lastName: state.currentLastName, ); } } diff --git a/frontend/pweb/lib/pages/settings/profile/account/name/view.dart b/frontend/pweb/lib/pages/settings/profile/account/name/view.dart new file mode 100644 index 00000000..ca090c8f --- /dev/null +++ b/frontend/pweb/lib/pages/settings/profile/account/name/view.dart @@ -0,0 +1,73 @@ +import 'package:flutter/material.dart'; + +import 'package:pweb/pages/settings/profile/account/name/line.dart'; + + +class AccountNameViewText extends StatelessWidget { + const AccountNameViewText({ + super.key, + required this.hintText, + required this.inputWidth, + required this.firstName, + required this.lastName, + }); + + final String hintText; + final double inputWidth; + final String firstName; + final String lastName; + + @override + Widget build(BuildContext context) { + final theme = Theme.of(context); + final trimmedFirstName = firstName.trim(); + final trimmedLastName = lastName.trim(); + final hasFirstName = trimmedFirstName.isNotEmpty; + final hasLastName = trimmedLastName.isNotEmpty; + + final firstLineStyle = theme.textTheme.headlineMedium?.copyWith( + fontWeight: FontWeight.bold, + ); + final secondLineStyle = theme.textTheme.headlineMedium?.copyWith( + fontWeight: FontWeight.bold, + ); + + if (!hasFirstName && !hasLastName) { + return SizedBox( + width: inputWidth, + child: AccountNameSingleLineText( + text: hintText, + style: firstLineStyle, + ), + ); + } + + if (!hasFirstName || !hasLastName) { + final singleLineName = hasFirstName ? trimmedFirstName : trimmedLastName; + return SizedBox( + width: inputWidth, + child: AccountNameSingleLineText( + text: singleLineName, + style: firstLineStyle, + ), + ); + } + + return SizedBox( + width: inputWidth, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AccountNameSingleLineText( + text: trimmedFirstName, + style: firstLineStyle, + ), + AccountNameSingleLineText( + text: trimmedLastName, + style: secondLineStyle, + ), + ], + ), + ); + } +} diff --git a/frontend/pweb/lib/widgets/sidebar/sidebar.dart b/frontend/pweb/lib/widgets/sidebar/sidebar.dart index b3e354ac..1cef014c 100644 --- a/frontend/pweb/lib/widgets/sidebar/sidebar.dart +++ b/frontend/pweb/lib/widgets/sidebar/sidebar.dart @@ -46,7 +46,8 @@ class PayoutSidebar extends StatelessWidget { PayoutDestination.recipients, PayoutDestination.invitations, PayoutDestination.methods, - PayoutDestination.reports, + //PayoutDestination.reports, + //TODO Add when ready ]; final theme = Theme.of(context); diff --git a/frontend/pweb/lib/widgets/sidebar/user.dart b/frontend/pweb/lib/widgets/sidebar/user.dart index 0370bcf9..a2a7ef9a 100644 --- a/frontend/pweb/lib/widgets/sidebar/user.dart +++ b/frontend/pweb/lib/widgets/sidebar/user.dart @@ -57,7 +57,7 @@ class UserProfileCard extends StatelessWidget { child: Text( userName ?? loc.userNamePlaceholder, style: theme.textTheme.bodyLarge?.copyWith( - fontSize: 20, + fontSize: 18, fontWeight: FontWeight.w500, ), maxLines: 2,