diff --git a/catalyst_voices/lib/common/ext/space_ext.dart b/catalyst_voices/lib/common/ext/space_ext.dart index 3d234f86fd9..b71cfe26f93 100644 --- a/catalyst_voices/lib/common/ext/space_ext.dart +++ b/catalyst_voices/lib/common/ext/space_ext.dart @@ -8,8 +8,6 @@ import 'package:flutter/material.dart'; extension SpaceExt on Space { void go(BuildContext context) { switch (this) { - case Space.treasury: - const TreasuryRoute().go(context); case Space.discovery: const DiscoveryRoute().go(context); case Space.workspace: @@ -18,42 +16,44 @@ extension SpaceExt on Space { const VotingRoute().go(context); case Space.fundedProjects: const FundedProjectsRoute().go(context); + case Space.treasury: + const TreasuryRoute().go(context); } } String localizedName(VoicesLocalizations localizations) { return switch (this) { - Space.treasury => localizations.spaceTreasuryName, Space.discovery => localizations.spaceDiscoveryName, Space.workspace => localizations.spaceWorkspaceName, Space.voting => localizations.spaceVotingName, Space.fundedProjects => localizations.spaceFundedProjects, + Space.treasury => localizations.spaceTreasuryName, }; } SvgGenImage get icon => switch (this) { - Space.treasury => VoicesAssets.icons.fund, Space.discovery => VoicesAssets.icons.lightBulb, Space.workspace => VoicesAssets.icons.briefcase, Space.voting => VoicesAssets.icons.vote, Space.fundedProjects => VoicesAssets.icons.flag, + Space.treasury => VoicesAssets.icons.fund, }; Color backgroundColor(BuildContext context) => switch (this) { - Space.treasury => Theme.of(context).colors.successContainer!, Space.discovery => Theme.of(context).colors.iconsSecondary!.withOpacity(0.16), Space.workspace => Theme.of(context).colorScheme.primaryContainer, Space.voting => Theme.of(context).colors.warningContainer!, Space.fundedProjects => Theme.of(context).colors.iconsSecondary!.withOpacity(0.16), + Space.treasury => Theme.of(context).colors.successContainer!, }; Color foregroundColor(BuildContext context) => switch (this) { - Space.treasury => Theme.of(context).colors.iconsSuccess!, Space.discovery => Theme.of(context).colors.iconsSecondary!, Space.workspace => Theme.of(context).colorScheme.primary, Space.voting => Theme.of(context).colors.iconsWarning!, Space.fundedProjects => Theme.of(context).colors.iconsSecondary!, + Space.treasury => Theme.of(context).colors.iconsSuccess!, }; } diff --git a/catalyst_voices/lib/pages/overall_spaces/spaces_overview_list_view.dart b/catalyst_voices/lib/pages/overall_spaces/spaces_overview_list_view.dart index 8f3814ade5b..4dbe45c741e 100644 --- a/catalyst_voices/lib/pages/overall_spaces/spaces_overview_list_view.dart +++ b/catalyst_voices/lib/pages/overall_spaces/spaces_overview_list_view.dart @@ -38,12 +38,12 @@ class _SpacesListViewState extends State { itemBuilder: (context, index) { final space = Space.values[index]; return switch (space) { - Space.treasury => TreasuryOverview(key: ObjectKey(space)), Space.discovery => DiscoveryOverview(key: ObjectKey(space)), Space.workspace => WorkspaceOverview(key: ObjectKey(space)), Space.voting => VotingOverview(key: ObjectKey(space)), Space.fundedProjects => FundedProjectsOverview(key: ObjectKey(space)), + Space.treasury => TreasuryOverview(key: ObjectKey(space)), }; }, separatorBuilder: (context, index) => const SizedBox(width: 16), diff --git a/catalyst_voices/lib/pages/spaces/drawer/discovery_menu.dart b/catalyst_voices/lib/pages/spaces/drawer/discovery_menu.dart index 39e5b356e79..fa588ba1df4 100644 --- a/catalyst_voices/lib/pages/spaces/drawer/discovery_menu.dart +++ b/catalyst_voices/lib/pages/spaces/drawer/discovery_menu.dart @@ -18,20 +18,24 @@ class DiscoveryDrawerMenu extends StatelessWidget { leading: VoicesAssets.icons.home.buildIcon(), name: 'Discovery Dashboard', backgroundColor: Space.discovery.backgroundColor(context), + onTap: () => Scaffold.of(context).closeDrawer(), ), const VoicesDivider(), VoicesNavTile( leading: VoicesAssets.icons.user.buildIcon(), name: 'Catalyst Roles', + onTap: () => Scaffold.of(context).closeDrawer(), ), VoicesNavTile( leading: VoicesAssets.icons.annotation.buildIcon(), name: 'Feedback', + onTap: () => Scaffold.of(context).closeDrawer(), ), const VoicesDivider(), VoicesNavTile( leading: VoicesAssets.icons.arrowRight.buildIcon(), name: 'Catalyst Gitbook documentation', + onTap: () => Scaffold.of(context).closeDrawer(), ), ], ); diff --git a/catalyst_voices/lib/pages/spaces/drawer/guest_menu.dart b/catalyst_voices/lib/pages/spaces/drawer/guest_menu.dart index 99d937c50f8..bc2df6ec182 100644 --- a/catalyst_voices/lib/pages/spaces/drawer/guest_menu.dart +++ b/catalyst_voices/lib/pages/spaces/drawer/guest_menu.dart @@ -21,18 +21,22 @@ class GuestMenu extends StatelessWidget { leading: VoicesAssets.icons.home.buildIcon(), name: 'Home', backgroundColor: space.backgroundColor(context), + onTap: () => Scaffold.of(context).closeDrawer(), ), VoicesNavTile( leading: VoicesAssets.icons.calendar.buildIcon(), name: 'Discover ideas', + onTap: () => Scaffold.of(context).closeDrawer(), ), VoicesNavTile( leading: VoicesAssets.icons.clipboardCheck.buildIcon(), name: 'Learn about Keychain', + onTap: () => Scaffold.of(context).closeDrawer(), ), VoicesNavTile( leading: VoicesAssets.icons.questionMarkCircle.buildIcon(), name: 'FAQ', + onTap: () => Scaffold.of(context).closeDrawer(), ), ], ); diff --git a/catalyst_voices/lib/pages/spaces/drawer/individual_private_campaigns.dart b/catalyst_voices/lib/pages/spaces/drawer/individual_private_campaigns.dart index 641cc9cb0bc..37b49509d90 100644 --- a/catalyst_voices/lib/pages/spaces/drawer/individual_private_campaigns.dart +++ b/catalyst_voices/lib/pages/spaces/drawer/individual_private_campaigns.dart @@ -8,28 +8,31 @@ class IndividualPrivateCampaigns extends StatelessWidget { @override Widget build(BuildContext context) { - return const Column( + return Column( mainAxisSize: MainAxisSize.min, children: [ - SpaceHeader(Space.treasury), - SectionHeader( + const SpaceHeader(Space.treasury), + const SectionHeader( leading: SizedBox(width: 12), title: Text('Individual private campaigns'), ), VoicesNavTile( name: 'Fund name 1', status: ProposalStatus.ready, - trailing: MoreOptionsButton(), + trailing: const MoreOptionsButton(), + onTap: () => Scaffold.of(context).closeDrawer(), ), VoicesNavTile( name: 'Campaign 1', status: ProposalStatus.draft, - trailing: MoreOptionsButton(), + trailing: const MoreOptionsButton(), + onTap: () => Scaffold.of(context).closeDrawer(), ), VoicesNavTile( name: 'What happens with a campaign title that is longer that', status: ProposalStatus.draft, - trailing: MoreOptionsButton(), + trailing: const MoreOptionsButton(), + onTap: () => Scaffold.of(context).closeDrawer(), ), ], ); diff --git a/catalyst_voices/lib/pages/spaces/drawer/my_private_proposals.dart b/catalyst_voices/lib/pages/spaces/drawer/my_private_proposals.dart index a7a5f93af02..39813bf2fa3 100644 --- a/catalyst_voices/lib/pages/spaces/drawer/my_private_proposals.dart +++ b/catalyst_voices/lib/pages/spaces/drawer/my_private_proposals.dart @@ -8,28 +8,31 @@ class MyPrivateProposals extends StatelessWidget { @override Widget build(BuildContext context) { - return const Column( + return Column( mainAxisSize: MainAxisSize.min, children: [ - SpaceHeader(Space.workspace), - SectionHeader( + const SpaceHeader(Space.workspace), + const SectionHeader( leading: SizedBox(width: 12), title: Text('My private proposals (3/5)'), ), VoicesNavTile( name: 'My first proposal', status: ProposalStatus.draft, - trailing: MoreOptionsButton(), + trailing: const MoreOptionsButton(), + onTap: () => Scaffold.of(context).closeDrawer(), ), VoicesNavTile( name: 'My second proposal', status: ProposalStatus.inProgress, - trailing: MoreOptionsButton(), + trailing: const MoreOptionsButton(), + onTap: () => Scaffold.of(context).closeDrawer(), ), VoicesNavTile( name: 'My third proposal', status: ProposalStatus.inProgress, - trailing: MoreOptionsButton(), + trailing: const MoreOptionsButton(), + onTap: () => Scaffold.of(context).closeDrawer(), ), ], ); diff --git a/catalyst_voices/lib/pages/spaces/drawer/space_header.dart b/catalyst_voices/lib/pages/spaces/drawer/space_header.dart index 595f0f9db67..724c6d72db3 100644 --- a/catalyst_voices/lib/pages/spaces/drawer/space_header.dart +++ b/catalyst_voices/lib/pages/spaces/drawer/space_header.dart @@ -37,10 +37,6 @@ class SpaceHeader extends StatelessWidget { ?.copyWith(color: theme.colors.textPrimary), ), ), - ChevronExpandButton( - isExpanded: false, - onTap: () {}, - ), ], ), ); diff --git a/catalyst_voices/lib/pages/spaces/drawer/voting_rounds.dart b/catalyst_voices/lib/pages/spaces/drawer/voting_rounds.dart index da89cae0b26..598cedd01ab 100644 --- a/catalyst_voices/lib/pages/spaces/drawer/voting_rounds.dart +++ b/catalyst_voices/lib/pages/spaces/drawer/voting_rounds.dart @@ -21,14 +21,16 @@ class VotingRounds extends StatelessWidget { name: 'Voting round 14', status: ProposalStatus.open, leading: VoicesAssets.icons.vote.buildIcon(), + onTap: () => Scaffold.of(context).closeDrawer(), ), const SectionHeader( leading: SizedBox(width: 12), title: Text('Funding tracks / Categories'), ), - const VoicesNavTile( + VoicesNavTile( name: 'My first proposal', - trailing: MoreOptionsButton(), + trailing: const MoreOptionsButton(), + onTap: () => Scaffold.of(context).closeDrawer(), ), const VoicesDivider(), const SectionHeader( @@ -38,10 +40,12 @@ class VotingRounds extends StatelessWidget { VoicesNavTile( name: 'Drep signup', leading: VoicesAssets.icons.user.buildIcon(), + onTap: () => Scaffold.of(context).closeDrawer(), ), VoicesNavTile( name: 'Drep delegation', leading: VoicesAssets.icons.user.buildIcon(), + onTap: () => Scaffold.of(context).closeDrawer(), ), const VoicesDivider(), ], diff --git a/catalyst_voices/lib/pages/workspace/workspace_page.dart b/catalyst_voices/lib/pages/workspace/workspace_page.dart index a788f9bab8b..ae19d067832 100644 --- a/catalyst_voices/lib/pages/workspace/workspace_page.dart +++ b/catalyst_voices/lib/pages/workspace/workspace_page.dart @@ -57,6 +57,12 @@ class WorkspacePage extends StatefulWidget { } class _WorkspacePageState extends State { + // This future is here only because we're loading too much at once + // and drawer animation hangs for sec. + // + // Should be deleted later with normal data source + final _delayFuture = Future.delayed(const Duration(milliseconds: 500)); + @override Widget build(BuildContext context) { return ProposalControllerScope( @@ -66,8 +72,17 @@ class _WorkspacePageState extends State { navigation: _proposalNavigation, ), right: const ProposalSetupPanel(), - child: ProposalDetails( - navigation: _proposalNavigation, + child: FutureBuilder( + future: _delayFuture, + builder: (context, snapshot) { + if (snapshot.connectionState != ConnectionState.done) { + return const SizedBox.shrink(); + } + + return ProposalDetails( + navigation: _proposalNavigation, + ); + }, ), ), ); diff --git a/catalyst_voices/lib/routes/routing/spaces_route.dart b/catalyst_voices/lib/routes/routing/spaces_route.dart index ee13a93ba20..8d9ca25a7ac 100644 --- a/catalyst_voices/lib/routes/routing/spaces_route.dart +++ b/catalyst_voices/lib/routes/routing/spaces_route.dart @@ -14,22 +14,22 @@ part 'spaces_route.g.dart'; @TypedShellRoute( routes: >[ - TypedGoRoute(path: '/${Routes.currentMilestone}/treasury'), TypedGoRoute(path: '/${Routes.currentMilestone}/discovery'), TypedGoRoute(path: '/${Routes.currentMilestone}/workspace'), TypedGoRoute(path: '/${Routes.currentMilestone}/voting'), TypedGoRoute( path: '/${Routes.currentMilestone}/funded_projects', ), + TypedGoRoute(path: '/${Routes.currentMilestone}/treasury'), ], ) final class SpacesShellRouteData extends ShellRouteData { static const _spacePathMapping = { - 'treasury': Space.treasury, 'discovery': Space.discovery, 'workspace': Space.workspace, 'voting': Space.voting, 'funded_projects': Space.fundedProjects, + 'treasury': Space.treasury, }; const SpacesShellRouteData(); @@ -59,15 +59,6 @@ final class SpacesShellRouteData extends ShellRouteData { } } -final class TreasuryRoute extends GoRouteData with FadePageTransitionMixin { - const TreasuryRoute(); - - @override - Widget build(BuildContext context, GoRouterState state) { - return const TreasuryPage(); - } -} - final class DiscoveryRoute extends GoRouteData with FadePageTransitionMixin { const DiscoveryRoute(); @@ -104,3 +95,12 @@ final class FundedProjectsRoute extends GoRouteData return const FundedProjectsPage(); } } + +final class TreasuryRoute extends GoRouteData with FadePageTransitionMixin { + const TreasuryRoute(); + + @override + Widget build(BuildContext context, GoRouterState state) { + return const TreasuryPage(); + } +} diff --git a/catalyst_voices/lib/routes/routing/spaces_route.g.dart b/catalyst_voices/lib/routes/routing/spaces_route.g.dart index dc54a81a2a8..a3ae841792e 100644 --- a/catalyst_voices/lib/routes/routing/spaces_route.g.dart +++ b/catalyst_voices/lib/routes/routing/spaces_route.g.dart @@ -13,10 +13,6 @@ List get $appRoutes => [ RouteBase get $spacesShellRouteData => ShellRouteData.$route( factory: $SpacesShellRouteDataExtension._fromState, routes: [ - GoRouteData.$route( - path: '/m4/treasury', - factory: $TreasuryRouteExtension._fromState, - ), GoRouteData.$route( path: '/m4/discovery', factory: $DiscoveryRouteExtension._fromState, @@ -33,6 +29,10 @@ RouteBase get $spacesShellRouteData => ShellRouteData.$route( path: '/m4/funded_projects', factory: $FundedProjectsRouteExtension._fromState, ), + GoRouteData.$route( + path: '/m4/treasury', + factory: $TreasuryRouteExtension._fromState, + ), ], ); @@ -41,23 +41,6 @@ extension $SpacesShellRouteDataExtension on SpacesShellRouteData { const SpacesShellRouteData(); } -extension $TreasuryRouteExtension on TreasuryRoute { - static TreasuryRoute _fromState(GoRouterState state) => const TreasuryRoute(); - - String get location => GoRouteData.$location( - '/m4/treasury', - ); - - void go(BuildContext context) => context.go(location); - - Future push(BuildContext context) => context.push(location); - - void pushReplacement(BuildContext context) => - context.pushReplacement(location); - - void replace(BuildContext context) => context.replace(location); -} - extension $DiscoveryRouteExtension on DiscoveryRoute { static DiscoveryRoute _fromState(GoRouterState state) => const DiscoveryRoute(); @@ -128,3 +111,20 @@ extension $FundedProjectsRouteExtension on FundedProjectsRoute { void replace(BuildContext context) => context.replace(location); } + +extension $TreasuryRouteExtension on TreasuryRoute { + static TreasuryRoute _fromState(GoRouterState state) => const TreasuryRoute(); + + String get location => GoRouteData.$location( + '/m4/treasury', + ); + + void go(BuildContext context) => context.go(location); + + Future push(BuildContext context) => context.push(location); + + void pushReplacement(BuildContext context) => + context.pushReplacement(location); + + void replace(BuildContext context) => context.replace(location); +} diff --git a/catalyst_voices/packages/catalyst_voices_localization/lib/generated/catalyst_voices_localizations.dart b/catalyst_voices/packages/catalyst_voices_localization/lib/generated/catalyst_voices_localizations.dart index 68db51b6101..2ae03bd9b8a 100644 --- a/catalyst_voices/packages/catalyst_voices_localization/lib/generated/catalyst_voices_localizations.dart +++ b/catalyst_voices/packages/catalyst_voices_localization/lib/generated/catalyst_voices_localizations.dart @@ -571,7 +571,7 @@ abstract class VoicesLocalizations { /// Name of space shown in different spaces that indicates its origin /// /// In en, this message translates to: - /// **'Treasury'** + /// **'Treasury space'** String get spaceTreasuryName; /// Name of space shown in different spaces that indicates its origin @@ -595,7 +595,7 @@ abstract class VoicesLocalizations { /// Name of space shown in different spaces that indicates its origin /// /// In en, this message translates to: - /// **'Funded Projects'** + /// **'Funded project space'** String get spaceFundedProjects; /// Refers to a lock action, i.e. to lock the session. diff --git a/catalyst_voices/packages/catalyst_voices_localization/lib/generated/catalyst_voices_localizations_en.dart b/catalyst_voices/packages/catalyst_voices_localization/lib/generated/catalyst_voices_localizations_en.dart index be2c03cdb54..967640ee62b 100644 --- a/catalyst_voices/packages/catalyst_voices_localization/lib/generated/catalyst_voices_localizations_en.dart +++ b/catalyst_voices/packages/catalyst_voices_localization/lib/generated/catalyst_voices_localizations_en.dart @@ -299,7 +299,7 @@ class VoicesLocalizationsEn extends VoicesLocalizations { String get clickToRestart => 'Click to restart'; @override - String get spaceTreasuryName => 'Treasury'; + String get spaceTreasuryName => 'Treasury space'; @override String get spaceDiscoveryName => 'Discovery space'; @@ -311,7 +311,7 @@ class VoicesLocalizationsEn extends VoicesLocalizations { String get spaceVotingName => 'Voting space'; @override - String get spaceFundedProjects => 'Funded Projects'; + String get spaceFundedProjects => 'Funded project space'; @override String get lock => 'Lock'; diff --git a/catalyst_voices/packages/catalyst_voices_localization/lib/generated/catalyst_voices_localizations_es.dart b/catalyst_voices/packages/catalyst_voices_localization/lib/generated/catalyst_voices_localizations_es.dart index 55c10668621..33e8773d20f 100644 --- a/catalyst_voices/packages/catalyst_voices_localization/lib/generated/catalyst_voices_localizations_es.dart +++ b/catalyst_voices/packages/catalyst_voices_localization/lib/generated/catalyst_voices_localizations_es.dart @@ -299,7 +299,7 @@ class VoicesLocalizationsEs extends VoicesLocalizations { String get clickToRestart => 'Click to restart'; @override - String get spaceTreasuryName => 'Treasury'; + String get spaceTreasuryName => 'Treasury space'; @override String get spaceDiscoveryName => 'Discovery space'; @@ -311,7 +311,7 @@ class VoicesLocalizationsEs extends VoicesLocalizations { String get spaceVotingName => 'Voting space'; @override - String get spaceFundedProjects => 'Funded Projects'; + String get spaceFundedProjects => 'Funded project space'; @override String get lock => 'Lock'; diff --git a/catalyst_voices/packages/catalyst_voices_localization/lib/l10n/intl_en.arb b/catalyst_voices/packages/catalyst_voices_localization/lib/l10n/intl_en.arb index faf1ba26304..215e697aaf0 100644 --- a/catalyst_voices/packages/catalyst_voices_localization/lib/l10n/intl_en.arb +++ b/catalyst_voices/packages/catalyst_voices_localization/lib/l10n/intl_en.arb @@ -362,7 +362,7 @@ "@clickToRestart": { "description": "In different places update popup body" }, - "spaceTreasuryName": "Treasury", + "spaceTreasuryName": "Treasury space", "@spaceTreasuryName": { "description": "Name of space shown in different spaces that indicates its origin" }, @@ -378,7 +378,7 @@ "@spaceVotingName": { "description": "Name of space shown in different spaces that indicates its origin" }, - "spaceFundedProjects": "Funded Projects", + "spaceFundedProjects": "Funded project space", "@spaceFundedProjects": { "description": "Name of space shown in different spaces that indicates its origin" }, diff --git a/catalyst_voices/packages/catalyst_voices_models/lib/src/space.dart b/catalyst_voices/packages/catalyst_voices_models/lib/src/space.dart index ebe3214a430..ecb202ad14f 100644 --- a/catalyst_voices/packages/catalyst_voices_models/lib/src/space.dart +++ b/catalyst_voices/packages/catalyst_voices_models/lib/src/space.dart @@ -1,8 +1,8 @@ /// Main spaces between which user can navigate. enum Space { - treasury, discovery, workspace, voting, - fundedProjects; + fundedProjects, + treasury; }