Skip to content

Commit f86230a

Browse files
committed
Merge branch 'main' into 2091-map-proposal-elements-for-testing
2 parents 1c6ccaf + 46b6151 commit f86230a

File tree

42 files changed

+976
-601
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+976
-601
lines changed

catalyst-gateway/bin/src/service/api/cardano/rbac/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ pub(crate) struct Api;
1515
#[OpenApi(tag = "ApiTags::Cardano")]
1616
impl Api {
1717
#[oai(
18-
path = "/draft/rbac/registration",
18+
path = "/v1/rbac/registration",
1919
method = "get",
2020
operation_id = "rbacRegistrations"
2121
)]

catalyst_voices/apps/voices/integration_test/pageobject/onboarding/create_flow/step_3_setup_base_profile.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ class SetupBaseProfilePanel extends OnboardingPageBase {
6565
expect($(ideascaleInfoCard), findsOneWidget);
6666
expect(
6767
infoCardTitleLocator.text,
68-
(await t()).createBaseProfileSetupIdeascaleAccount,
68+
(await t()).createBaseProfileHasIdeascaleAccountAlready,
6969
);
7070
expect(
7171
infoCardDescriptionLocator.text,

catalyst_voices/apps/voices/lib/dependency/dependencies.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ final class Dependencies extends DependencyProvider {
142142
return NewProposalCubit(
143143
get<CampaignService>(),
144144
get<ProposalService>(),
145+
get<UserObserver>(),
145146
get<DocumentMapper>(),
146147
);
147148
})

catalyst_voices/apps/voices/lib/pages/account/widgets/account_roles_tile.dart

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,11 @@ class _AccountRolesTileState extends State<_AccountRolesTile> {
4242
return PropertyTile(
4343
title: context.l10n.myRoles,
4444
key: const Key('AddRoleTile'),
45-
action: _EditButton(
46-
onTap: widget.state.canAddRole ? _addAccountRole : null,
47-
),
45+
action: widget.state.canAddRole
46+
? _EditButton(
47+
onTap: _addAccountRole,
48+
)
49+
: null,
4850
child: _Roles(items: widget.state.items),
4951
);
5052
}
Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,48 @@
1+
import 'dart:async';
2+
3+
import 'package:catalyst_voices/routes/routing/proposal_route.dart';
14
import 'package:catalyst_voices/widgets/buttons/voices_buttons.dart';
5+
import 'package:catalyst_voices/widgets/modals/proposals/share_proposal_dialog.dart';
6+
import 'package:catalyst_voices/widgets/snackbar/voices_snackbar.dart';
7+
import 'package:catalyst_voices/widgets/snackbar/voices_snackbar_type.dart';
8+
import 'package:catalyst_voices_blocs/catalyst_voices_blocs.dart';
9+
import 'package:catalyst_voices_localization/catalyst_voices_localization.dart';
10+
import 'package:catalyst_voices_models/catalyst_voices_models.dart';
211
import 'package:flutter/material.dart';
12+
import 'package:flutter_bloc/flutter_bloc.dart';
313

414
class ProposalShareButton extends StatelessWidget {
515
const ProposalShareButton({super.key});
616

717
@override
818
Widget build(BuildContext context) {
9-
return ShareButton(
10-
onTap: () {
11-
// TODO(LynxLynxx): Implement Share
19+
return BlocSelector<ProposalCubit, ProposalState, DocumentRef?>(
20+
selector: (state) {
21+
return state.data.header.proposalRef;
22+
},
23+
builder: (context, proposalRef) {
24+
return ShareButton(
25+
onTap: () {
26+
if (proposalRef != null) {
27+
final url = ProposalRoute.fromRef(ref: proposalRef).location;
28+
unawaited(ShareProposalDialog.show(context, url));
29+
} else {
30+
_showErrorSnackbar(context);
31+
}
32+
},
33+
);
1234
},
1335
);
1436
}
37+
38+
void _showErrorSnackbar(BuildContext context) {
39+
VoicesSnackBar.hideCurrent(context);
40+
41+
VoicesSnackBar(
42+
type: VoicesSnackBarType.error,
43+
behavior: SnackBarBehavior.floating,
44+
title: context.l10n.somethingWentWrong,
45+
message: context.l10n.shareProposalErrorDescription,
46+
).show(context);
47+
}
1548
}

catalyst_voices/apps/voices/lib/pages/registration/create_base_profile/stage/setup_panel.dart

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -39,26 +39,6 @@ class SetupPanel extends StatelessWidget {
3939
}
4040
}
4141

42-
class _Title extends StatelessWidget {
43-
const _Title();
44-
45-
@override
46-
Widget build(BuildContext context) {
47-
final theme = Theme.of(context);
48-
final textTheme = theme.textTheme;
49-
50-
final textStyle = (textTheme.titleMedium ?? const TextStyle()).copyWith(
51-
color: theme.colors.textOnPrimaryLevel1,
52-
);
53-
54-
return Text(
55-
key: const Key('TitleText'),
56-
context.l10n.createBaseProfileSetupTitle,
57-
style: textStyle,
58-
);
59-
}
60-
}
61-
6242
class _DisplayNameSelector extends StatelessWidget {
6343
const _DisplayNameSelector();
6444

@@ -164,7 +144,7 @@ class _IdeascaleInfoCard extends StatelessWidget {
164144
key: const Key('IdeascaleInfoCard'),
165145
icon: VoicesAssets.icons.mailOpen.buildIcon(),
166146
title: Text(
167-
context.l10n.createBaseProfileSetupIdeascaleAccount,
147+
context.l10n.createBaseProfileHasIdeascaleAccountAlready,
168148
key: const Key('InfoCardTitle'),
169149
),
170150
desc: BulletList(
@@ -179,6 +159,21 @@ class _IdeascaleInfoCard extends StatelessWidget {
179159
}
180160
}
181161

162+
class _Navigation extends StatelessWidget {
163+
final bool isNextEnabled;
164+
165+
const _Navigation({
166+
required this.isNextEnabled,
167+
});
168+
169+
@override
170+
Widget build(BuildContext context) {
171+
return RegistrationBackNextNavigation(
172+
isNextEnabled: isNextEnabled,
173+
);
174+
}
175+
}
176+
182177
class _NavigationSelector extends StatelessWidget {
183178
const _NavigationSelector();
184179

@@ -191,17 +186,22 @@ class _NavigationSelector extends StatelessWidget {
191186
}
192187
}
193188

194-
class _Navigation extends StatelessWidget {
195-
final bool isNextEnabled;
196-
197-
const _Navigation({
198-
required this.isNextEnabled,
199-
});
189+
class _Title extends StatelessWidget {
190+
const _Title();
200191

201192
@override
202193
Widget build(BuildContext context) {
203-
return RegistrationBackNextNavigation(
204-
isNextEnabled: isNextEnabled,
194+
final theme = Theme.of(context);
195+
final textTheme = theme.textTheme;
196+
197+
final textStyle = (textTheme.titleMedium ?? const TextStyle()).copyWith(
198+
color: theme.colors.textOnPrimaryLevel1,
199+
);
200+
201+
return Text(
202+
key: const Key('TitleText'),
203+
context.l10n.createBaseProfileSetupTitle,
204+
style: textStyle,
205205
);
206206
}
207207
}

catalyst_voices/apps/voices/lib/pages/registration/create_keychain/stage/seed_phrase_check_panel.dart

Lines changed: 83 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -17,69 +17,6 @@ class SeedPhraseCheckPanel extends StatefulWidget {
1717
State<SeedPhraseCheckPanel> createState() => _SeedPhraseCheckPanelState();
1818
}
1919

20-
class _SeedPhraseCheckPanelState extends State<SeedPhraseCheckPanel> {
21-
@override
22-
Widget build(BuildContext context) {
23-
return Column(
24-
children: [
25-
Expanded(
26-
child: _BlocLoadable(
27-
builder: (context) {
28-
return _BlocSeedPhraseWords(
29-
onUserWordsChanged: _onWordsSequenceChanged,
30-
onImportTap: _importSeedPhrase,
31-
onResetTap: _clearUserWords,
32-
);
33-
},
34-
),
35-
),
36-
const SizedBox(height: 10),
37-
const _BlocNavigation(),
38-
],
39-
);
40-
}
41-
42-
Future<void> _importSeedPhrase() async {
43-
final showUpload = await UploadSeedPhraseConfirmationDialog.show(context);
44-
if (showUpload) {
45-
await _showUploadDialog();
46-
}
47-
}
48-
49-
Future<void> _showUploadDialog() async {
50-
final words = await UploadSeedPhraseDialog.show(context);
51-
52-
if (!mounted) return;
53-
54-
final areWordsMatching =
55-
RegistrationCubit.of(context).keychainCreation.areWordsMatching(words);
56-
57-
final isValid = areWordsMatching &&
58-
SeedPhrase.isValid(
59-
words: words,
60-
);
61-
62-
if (isValid) {
63-
_onWordsSequenceChanged(words);
64-
} else {
65-
final showUpload = await IncorrectSeedPhraseDialog.show(context);
66-
if (showUpload) {
67-
await _showUploadDialog();
68-
}
69-
}
70-
}
71-
72-
void _clearUserWords() {
73-
RegistrationCubit.of(context).keychainCreation.setUserSeedPhraseWords([]);
74-
}
75-
76-
void _onWordsSequenceChanged(List<SeedPhraseWord> words) {
77-
RegistrationCubit.of(context)
78-
.keychainCreation
79-
.setUserSeedPhraseWords(words);
80-
}
81-
}
82-
8320
class _BlocLoadable extends StatelessWidget {
8421
final WidgetBuilder builder;
8522

@@ -101,17 +38,33 @@ class _BlocLoadable extends StatelessWidget {
10138
}
10239
}
10340

41+
class _BlocNavigation extends StatelessWidget {
42+
const _BlocNavigation();
43+
44+
@override
45+
Widget build(BuildContext context) {
46+
return BlocSeedPhraseSelector<bool>(
47+
selector: (state) => state.areUserWordsCorrect,
48+
builder: (context, state) {
49+
return RegistrationBackNextNavigation(
50+
isNextEnabled: state,
51+
);
52+
},
53+
);
54+
}
55+
}
56+
10457
class _BlocSeedPhraseWords extends StatelessWidget {
58+
final ValueChanged<List<SeedPhraseWord>> onUserWordsChanged;
59+
60+
final VoidCallback? onImportTap;
61+
final VoidCallback? onResetTap;
10562
const _BlocSeedPhraseWords({
10663
required this.onUserWordsChanged,
10764
this.onImportTap,
10865
this.onResetTap,
10966
});
11067

111-
final ValueChanged<List<SeedPhraseWord>> onUserWordsChanged;
112-
final VoidCallback? onImportTap;
113-
final VoidCallback? onResetTap;
114-
11568
@override
11669
Widget build(BuildContext context) {
11770
return BlocSeedPhraseSelector<
@@ -139,6 +92,69 @@ class _BlocSeedPhraseWords extends StatelessWidget {
13992
}
14093
}
14194

95+
class _SeedPhraseCheckPanelState extends State<SeedPhraseCheckPanel> {
96+
@override
97+
Widget build(BuildContext context) {
98+
return Column(
99+
children: [
100+
Expanded(
101+
child: _BlocLoadable(
102+
builder: (context) {
103+
return _BlocSeedPhraseWords(
104+
onUserWordsChanged: _onWordsSequenceChanged,
105+
onImportTap: _importSeedPhrase,
106+
onResetTap: _clearUserWords,
107+
);
108+
},
109+
),
110+
),
111+
const SizedBox(height: 10),
112+
const _BlocNavigation(),
113+
],
114+
);
115+
}
116+
117+
void _clearUserWords() {
118+
RegistrationCubit.of(context).keychainCreation.setUserSeedPhraseWords([]);
119+
}
120+
121+
Future<void> _importSeedPhrase() async {
122+
final showUpload = await UploadSeedPhraseConfirmationDialog.show(context);
123+
if (showUpload) {
124+
await _showUploadDialog();
125+
}
126+
}
127+
128+
void _onWordsSequenceChanged(List<SeedPhraseWord> words) {
129+
RegistrationCubit.of(context)
130+
.keychainCreation
131+
.setUserSeedPhraseWords(words);
132+
}
133+
134+
Future<void> _showUploadDialog() async {
135+
final words = await UploadSeedPhraseDialog.show(context);
136+
137+
if (!mounted || words == null) return;
138+
139+
final areWordsMatching =
140+
RegistrationCubit.of(context).keychainCreation.areWordsMatching(words);
141+
142+
final isValid = areWordsMatching &&
143+
SeedPhrase.isValid(
144+
words: words,
145+
);
146+
147+
if (isValid) {
148+
_onWordsSequenceChanged(words);
149+
} else {
150+
final showUpload = await IncorrectSeedPhraseDialog.show(context);
151+
if (showUpload) {
152+
await _showUploadDialog();
153+
}
154+
}
155+
}
156+
}
157+
142158
class _SeedPhraseWords extends StatelessWidget {
143159
final List<SeedPhraseWord> words;
144160
final List<SeedPhraseWord> userWords;
@@ -177,19 +193,3 @@ class _SeedPhraseWords extends StatelessWidget {
177193
);
178194
}
179195
}
180-
181-
class _BlocNavigation extends StatelessWidget {
182-
const _BlocNavigation();
183-
184-
@override
185-
Widget build(BuildContext context) {
186-
return BlocSeedPhraseSelector<bool>(
187-
selector: (state) => state.areUserWordsCorrect,
188-
builder: (context, state) {
189-
return RegistrationBackNextNavigation(
190-
isNextEnabled: state,
191-
);
192-
},
193-
);
194-
}
195-
}

0 commit comments

Comments
 (0)