Skip to content
This repository has been archived by the owner on Feb 4, 2022. It is now read-only.

Commit

Permalink
Merge pull request #304 from OpenbookOrg/feature/86-request-invite-sp…
Browse files Browse the repository at this point in the history
…lash-page

Feature/86 request invite splash page
  • Loading branch information
lifenautjoe authored Jun 5, 2019
2 parents 928a786 + 947e1cd commit aa361e6
Show file tree
Hide file tree
Showing 11 changed files with 430 additions and 2 deletions.
3 changes: 2 additions & 1 deletion .sample.env.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
"SENTRY_DSN": "",
"INTERCOM_IOS_KEY": "",
"INTERCOM_ANDROID_KEY": "",
"INTERCOM_APP_ID": ""
"INTERCOM_APP_ID": "",
"OPENBOOK_SOCIAL_API_URL": ""
}
5 changes: 5 additions & 0 deletions assets/lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@
"AUTH.CREATE_ACC.PASTE_LINK": "Paste your registration link below",
"AUTH.CREATE_ACC.PASTE_PASSWORD_RESET_LINK": "Paste your password reset link below",
"AUTH.CREATE_ACC.PASTE_LINK_HELP_TEXT": "Use the link from the Join Openbook button in your invitation email.",
"AUTH.CREATE_ACC.REQUEST_INVITE": "No invite? Request one here.",
"AUTH.CREATE_ACC.SUBSCRIBE": "Request",
"AUTH.CREATE_ACC.SUBSCRIBE_TO_WAITLIST_TEXT": "Request an invite!",
"AUTH.CREATE_ACC.CONGRATULATIONS": "Congratulations!",
"AUTH.CREATE_ACC.YOUR_SUBSCRIBED": "You're {0} on the waitlist.",
"AUTH.CREATE_ACC.ALMOST_THERE": "Almost there...",
"AUTH.CREATE_ACC.WHAT_NAME": "What's your name?",
"AUTH.CREATE_ACC.NAME_PLACEHOLDER": "James Bond",
Expand Down
5 changes: 5 additions & 0 deletions assets/lang/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
"AUTH.CREATE_ACC.PASTE_LINK": "Paste your registration link below",
"AUTH.CREATE_ACC.PASTE_PASSWORD_RESET_LINK": "Paste your password reset link below",
"AUTH.CREATE_ACC.PASTE_LINK_HELP_TEXT": "Use the link from the Join Openbook button in your invitation email.",
"AUTH.CREATE_ACC.REQUEST_INVITE": "Need an invite? Request it here.",
"AUTH.CREATE_ACC.SUBSCRIBE": "Subscribe",
"AUTH.CREATE_ACC.SUBSCRIBE_TO_WAITLIST_TEXT": "Join the waitlist and get early access!",
"AUTH.CREATE_ACC.CONGRATULATIONS": "Congratulations!",
"AUTH.CREATE_ACC.YOUR_SUBSCRIBED": "You're {0} on the waitlist.",
"AUTH.OR": "o",
"AUTH.CREATE_ACC.LETS_GET_STARTED": "Comenzemos",
"AUTH.CREATE_ACC.WELCOME_TO_ALPHA": "Welcome to the Alpha!",
Expand Down
11 changes: 11 additions & 0 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ import 'package:Openbook/pages/auth/reset_password/verify_reset_password_link_st
import 'package:Openbook/pages/auth/login.dart';
import 'package:Openbook/pages/auth/splash.dart';
import 'package:Openbook/pages/home/home.dart';
import 'package:Openbook/pages/waitlist/subscribe_done_step.dart';
import 'package:Openbook/pages/waitlist/subscribe_email_step.dart';
import 'package:Openbook/provider.dart';
import 'package:Openbook/pages/auth/create_account/name_step.dart';
import 'package:Openbook/plugins/desktop/error-reporting.dart';
Expand Down Expand Up @@ -134,6 +136,15 @@ class MyApp extends StatelessWidget {
'/auth/password_reset_success_step': (BuildContext context) {
bootstrapOpenbookProviderInContext(context);
return OBAuthPasswordResetSuccessPage();
},
'/waitlist/subscribe_email_step': (BuildContext context) {
bootstrapOpenbookProviderInContext(context);
return OBWaitlistSubscribePage();
},
'/waitlist/subscribe_done_step': (BuildContext context) {
bootstrapOpenbookProviderInContext(context);
WaitlistSubscribeArguments args = ModalRoute.of(context).settings.arguments;
return OBWaitlistSubscribeDoneStep(count: args.count);
}
}),
),
Expand Down
24 changes: 23 additions & 1 deletion lib/pages/auth/create_account/create_account.dart
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ class OBAuthCreateAccountPageState extends State<OBAuthCreateAccountPage> {
_buildLinkForm(),
const SizedBox(
height: 20.0
)
),
_buildRequestInvite(context: context)
],
))),
),
Expand Down Expand Up @@ -195,4 +196,25 @@ class OBAuthCreateAccountPageState extends State<OBAuthCreateAccountPage> {
]),
);
}

Widget _buildRequestInvite({@required BuildContext context}) {
String requestInviteText = _localizationService.trans('AUTH.CREATE_ACC.REQUEST_INVITE');

return OBSecondaryButton(
isFullWidth: true,
isLarge: true,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
requestInviteText,
style: TextStyle(fontSize: 18.0, color: Colors.white),
)
],
),
onPressed: () {
Navigator.pushNamed(context, '/waitlist/subscribe_email_step');
},
);
}
}
118 changes: 118 additions & 0 deletions lib/pages/waitlist/subscribe_done_step.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
import 'package:Openbook/provider.dart';
import 'package:Openbook/services/localization.dart';
import 'package:Openbook/widgets/buttons/button.dart';
import 'package:Openbook/widgets/buttons/success_button.dart';
import 'package:flutter/material.dart';

class WaitlistSubscribeArguments {
int count;

WaitlistSubscribeArguments({this.count});

}

class OBWaitlistSubscribeDoneStep extends StatefulWidget {
final int count;

OBWaitlistSubscribeDoneStep({@required this.count});

@override
State<StatefulWidget> createState() {
return OBWaitlistSubscribeDoneStepState();
}
}

class OBWaitlistSubscribeDoneStepState extends State<OBWaitlistSubscribeDoneStep> {
LocalizationService localizationService;

@override
Widget build(BuildContext context) {
var openbookProvider = OpenbookProvider.of(context);
localizationService = openbookProvider.localizationService;

return Scaffold(
body: Container(
child: Center(child: SingleChildScrollView(child: _buildAllSet())),
),
bottomNavigationBar: _buildBottomBar(),
);
}

Widget _buildBottomBar() {
return BottomAppBar(
color: Colors.transparent,
elevation: 0.0,
child: Container(
padding: EdgeInsets.symmetric(horizontal: 20.0, vertical: 20.0),
child: Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Expanded(
child: _buildNextButton(context: context),
),
],
),
),
);
}

Widget _buildAllSet() {
String congratulationsText = localizationService.trans('AUTH.CREATE_ACC.CONGRATULATIONS');
String countText = localizationService.trans('AUTH.CREATE_ACC.YOUR_SUBSCRIBED');

return Column(
children: <Widget>[
Text(
'👍‍',
style: TextStyle(fontSize: 45.0, color: Colors.white),
),
const SizedBox(
height: 20.0,
),
Text(congratulationsText,
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 24.0,
fontWeight: FontWeight.bold,
//color: Colors.white
)),
const SizedBox(
height: 20.0,
),
Text(countText.replaceFirst('{0}', widget.count.toString()),
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 20.0
),
),
const SizedBox(
height: 20.0,
),
]
);
}

Widget _buildNextButton({@required BuildContext context}) {

return OBSuccessButton(
minWidth: double.infinity,
size: OBButtonSize.large,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
'Done',
style: TextStyle(fontSize: 18.0),
)
],
),
onPressed: () {
Navigator.popUntil(context, (route){
return route.isFirst;
});
Navigator.pushReplacementNamed(context, '/auth');
},
);
}
}
Loading

0 comments on commit aa361e6

Please sign in to comment.