Skip to content

Commit

Permalink
feat: define the rest of stages for wallet link
Browse files Browse the repository at this point in the history
  • Loading branch information
dtscalac committed Sep 26, 2024
1 parent 756de95 commit 9dd48ce
Show file tree
Hide file tree
Showing 9 changed files with 101 additions and 28 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import 'package:catalyst_voices/widgets/buttons/voices_filled_button.dart';
import 'package:catalyst_voices_assets/catalyst_voices_assets.dart';
import 'package:catalyst_voices_blocs/catalyst_voices_blocs.dart';
import 'package:catalyst_voices_localization/catalyst_voices_localization.dart';
import 'package:flutter/material.dart';

// TODO(dtscalac): define content
class SelectWalletPanel extends StatelessWidget {
const SelectWalletPanel({super.key});

Expand All @@ -12,23 +12,21 @@ class SelectWalletPanel extends StatelessWidget {
return Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
const SizedBox(height: 24),
Text(
context.l10n.walletLinkIntroTitle,
style: Theme.of(context).textTheme.titleMedium,
),
const SizedBox(height: 24),
Text(
context.l10n.walletLinkIntroContent,
style: Theme.of(context).textTheme.bodyMedium,
),
const Spacer(),
VoicesFilledButton(
leading: VoicesAssets.icons.wallet.buildIcon(),
onTap: () {
RegistrationBloc.of(context).add(const PreviousStepEvent());
},
child: const Text('Previous'),
),
const SizedBox(height: 12),
VoicesFilledButton(
leading: VoicesAssets.icons.wallet.buildIcon(),
onTap: () {
RegistrationBloc.of(context).add(const NextStepEvent());
},
child: Text(context.l10n.chooseCardanoWallet),
child: const Text('Next'),
),
],
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ class WalletLinkPanel extends StatelessWidget {
return switch (stage) {
WalletLinkStage.intro => const IntroPanel(),
WalletLinkStage.selectWallet => const SelectWalletPanel(),
// TODO(dtscalac): define panels
WalletLinkStage.walletDetails => const SelectWalletPanel(),
WalletLinkStage.rolesChooser => const SelectWalletPanel(),
WalletLinkStage.rolesSummary => const SelectWalletPanel(),
WalletLinkStage.rbacTransaction => const SelectWalletPanel(),
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,25 @@ class RegistrationInfoPanel extends StatelessWidget {
};
}

_HeaderStrings buildWalletStageHeader(WalletLinkStage stage) {
_HeaderStrings buildWalletLinkStageHeader(WalletLinkStage stage) {
return switch (stage) {
WalletLinkStage.intro => _HeaderStrings(
title: 'Link keys to your Catalyst Keychain',
subtitle: 'Link your Cardano wallet',
WalletLinkStage.intro ||
WalletLinkStage.selectWallet ||
WalletLinkStage.walletDetails =>
_HeaderStrings(
title: context.l10n.walletLinkHeader,
subtitle: context.l10n.walletLinkWalletSubheader,
),
WalletLinkStage.selectWallet => _HeaderStrings(
title: 'Link keys to your Catalyst Keychain',
subtitle: 'Link your Cardano wallet',
WalletLinkStage.rolesChooser ||
WalletLinkStage.rolesSummary =>
_HeaderStrings(
title: context.l10n.walletLinkHeader,
subtitle: context.l10n.walletLinkRolesSubheader,
),
WalletLinkStage.rbacTransaction =>
_HeaderStrings(
title: context.l10n.walletLinkHeader,
subtitle: context.l10n.walletLinkTransactionSubheader,
),
};
}
Expand All @@ -79,7 +89,7 @@ class RegistrationInfoPanel extends StatelessWidget {
FinishAccountCreation() => _HeaderStrings(title: 'TODO'),
Recover() => _HeaderStrings(title: 'TODO'),
CreateKeychain(:final stage) => buildKeychainStageHeader(stage),
WalletLink(:final stage) => buildWalletStageHeader(stage),
WalletLink(:final stage) => buildWalletLinkStageHeader(stage),
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,15 @@ final class RegistrationWalletLinkController
final nextStep = switch (_stage) {
WalletLinkStage.intro =>
const WalletLink(stage: WalletLinkStage.selectWallet),
WalletLinkStage.selectWallet => null,
WalletLinkStage.selectWallet =>
const WalletLink(stage: WalletLinkStage.walletDetails),
WalletLinkStage.walletDetails =>
const WalletLink(stage: WalletLinkStage.rolesChooser),
WalletLinkStage.rolesChooser =>
const WalletLink(stage: WalletLinkStage.rolesSummary),
WalletLinkStage.rolesSummary =>
const WalletLink(stage: WalletLinkStage.rbacTransaction),
WalletLinkStage.rbacTransaction => null,
};

if (nextStep != null) {
Expand All @@ -33,6 +41,14 @@ final class RegistrationWalletLinkController
WalletLinkStage.intro => null,
WalletLinkStage.selectWallet =>
const WalletLink(stage: WalletLinkStage.intro),
WalletLinkStage.walletDetails =>
const WalletLink(stage: WalletLinkStage.selectWallet),
WalletLinkStage.rolesChooser =>
const WalletLink(stage: WalletLinkStage.walletDetails),
WalletLinkStage.rolesSummary =>
const WalletLink(stage: WalletLinkStage.rolesChooser),
WalletLinkStage.rbacTransaction =>
const WalletLink(stage: WalletLinkStage.rolesSummary),
};

if (previousStep != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -682,11 +682,23 @@ abstract class VoicesLocalizations {
/// **'Link keys to your Catalyst Keychain'**
String get walletLinkHeader;

/// A subheader in link wallet flow in registration.
/// A subheader in link wallet flow in registration for wallet connection.
///
/// In en, this message translates to:
/// **'Link your Cardano wallet'**
String get walletLinkSubheader;
String get walletLinkWalletSubheader;

/// A subheader in link wallet flow in registration for role chooser state.
///
/// In en, this message translates to:
/// **'Select your Catalyst roles'**
String get walletLinkRolesSubheader;

/// A subheader in link wallet flow in registration for RBAC transaction.
///
/// In en, this message translates to:
/// **'Sign your Catalyst roles to the\nCardano mainnet'**
String get walletLinkTransactionSubheader;

/// A title in link wallet flow on intro screen.
///
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,13 @@ class VoicesLocalizationsEn extends VoicesLocalizations {
String get walletLinkHeader => 'Link keys to your Catalyst Keychain';

@override
String get walletLinkSubheader => 'Link your Cardano wallet';
String get walletLinkWalletSubheader => 'Link your Cardano wallet';

@override
String get walletLinkRolesSubheader => 'Select your Catalyst roles';

@override
String get walletLinkTransactionSubheader => 'Sign your Catalyst roles to the\nCardano mainnet';

@override
String get walletLinkIntroTitle => 'Link Cardano Wallet & Catalyst Roles to you Catalyst Keychain.';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,13 @@ class VoicesLocalizationsEs extends VoicesLocalizations {
String get walletLinkHeader => 'Link keys to your Catalyst Keychain';

@override
String get walletLinkSubheader => 'Link your Cardano wallet';
String get walletLinkWalletSubheader => 'Link your Cardano wallet';

@override
String get walletLinkRolesSubheader => 'Select your Catalyst roles';

@override
String get walletLinkTransactionSubheader => 'Sign your Catalyst roles to the\nCardano mainnet';

@override
String get walletLinkIntroTitle => 'Link Cardano Wallet & Catalyst Roles to you Catalyst Keychain.';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -438,9 +438,17 @@
"@walletLinkHeader": {
"description": "A header in link wallet flow in registration."
},
"walletLinkSubheader": "Link your Cardano wallet",
"@walletLinkSubheader": {
"description": "A subheader in link wallet flow in registration."
"walletLinkWalletSubheader": "Link your Cardano wallet",
"@walletLinkWalletSubheader": {
"description": "A subheader in link wallet flow in registration for wallet connection."
},
"walletLinkRolesSubheader": "Select your Catalyst roles",
"@walletLinkRolesSubheader": {
"description": "A subheader in link wallet flow in registration for role chooser state."
},
"walletLinkTransactionSubheader": "Sign your Catalyst roles to the\nCardano mainnet",
"@walletLinkTransactionSubheader": {
"description": "A subheader in link wallet flow in registration for RBAC transaction."
},
"walletLinkIntroTitle": "Link Cardano Wallet & Catalyst Roles to you Catalyst Keychain.",
"@walletLinkIntroTitle": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,16 @@ enum WalletLinkStage {

/// A screen where the user is asked to connect the cardano wallet.
selectWallet,

/// Wallet details after successfully connecting a wallet.
walletDetails,

/// A user is asked to select the user roles.
rolesChooser,

/// Summary of chosen user roles.
rolesSummary,

/// The user submits an RBAC transaction to finish the registration.
rbacTransaction,
}

0 comments on commit 9dd48ce

Please sign in to comment.