Skip to content

Commit

Permalink
Merge branch 'main' into feat/chain-sync-v2
Browse files Browse the repository at this point in the history
  • Loading branch information
stevenj committed Sep 19, 2024
2 parents 96b784d + 2d32951 commit c174601
Show file tree
Hide file tree
Showing 16 changed files with 98 additions and 69 deletions.
12 changes: 6 additions & 6 deletions catalyst_voices/lib/common/ext/space_ext.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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!,
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ class _SpacesListViewState extends State<SpacesListView> {
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),
Expand Down
4 changes: 4 additions & 0 deletions catalyst_voices/lib/pages/spaces/drawer/discovery_menu.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
),
],
);
Expand Down
4 changes: 4 additions & 0 deletions catalyst_voices/lib/pages/spaces/drawer/guest_menu.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
),
],
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
),
],
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
),
],
);
Expand Down
4 changes: 0 additions & 4 deletions catalyst_voices/lib/pages/spaces/drawer/space_header.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,6 @@ class SpaceHeader extends StatelessWidget {
?.copyWith(color: theme.colors.textPrimary),
),
),
ChevronExpandButton(
isExpanded: false,
onTap: () {},
),
],
),
);
Expand Down
8 changes: 6 additions & 2 deletions catalyst_voices/lib/pages/spaces/drawer/voting_rounds.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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(),
],
Expand Down
19 changes: 17 additions & 2 deletions catalyst_voices/lib/pages/workspace/workspace_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ class WorkspacePage extends StatefulWidget {
}

class _WorkspacePageState extends State<WorkspacePage> {
// 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<void>.delayed(const Duration(milliseconds: 500));

@override
Widget build(BuildContext context) {
return ProposalControllerScope(
Expand All @@ -66,8 +72,17 @@ class _WorkspacePageState extends State<WorkspacePage> {
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,
);
},
),
),
);
Expand Down
22 changes: 11 additions & 11 deletions catalyst_voices/lib/routes/routing/spaces_route.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,22 @@ part 'spaces_route.g.dart';

@TypedShellRoute<SpacesShellRouteData>(
routes: <TypedRoute<RouteData>>[
TypedGoRoute<TreasuryRoute>(path: '/${Routes.currentMilestone}/treasury'),
TypedGoRoute<DiscoveryRoute>(path: '/${Routes.currentMilestone}/discovery'),
TypedGoRoute<WorkspaceRoute>(path: '/${Routes.currentMilestone}/workspace'),
TypedGoRoute<VotingRoute>(path: '/${Routes.currentMilestone}/voting'),
TypedGoRoute<FundedProjectsRoute>(
path: '/${Routes.currentMilestone}/funded_projects',
),
TypedGoRoute<TreasuryRoute>(path: '/${Routes.currentMilestone}/treasury'),
],
)
final class SpacesShellRouteData extends ShellRouteData {
static const _spacePathMapping = <String, Space>{
'treasury': Space.treasury,
'discovery': Space.discovery,
'workspace': Space.workspace,
'voting': Space.voting,
'funded_projects': Space.fundedProjects,
'treasury': Space.treasury,
};

const SpacesShellRouteData();
Expand Down Expand Up @@ -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();

Expand Down Expand Up @@ -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();
}
}
42 changes: 21 additions & 21 deletions catalyst_voices/lib/routes/routing/spaces_route.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit c174601

Please sign in to comment.