@@ -721,6 +721,8 @@ class TabsTab extends ImmutableComponent {
721
721
class PaymentsTab extends ImmutableComponent {
722
722
constructor ( ) {
723
723
super ( )
724
+ this . printKeys = this . printKeys . bind ( this )
725
+ this . saveKeys = this . saveKeys . bind ( this )
724
726
this . createWallet = this . createWallet . bind ( this )
725
727
}
726
728
@@ -730,6 +732,22 @@ class PaymentsTab extends ImmutableComponent {
730
732
}
731
733
}
732
734
735
+ copyToClipboard ( text ) {
736
+ aboutActions . setClipboard ( text )
737
+ }
738
+
739
+ generateKeyFile ( backupAction ) {
740
+ aboutActions . generateKeyFile ( backupAction )
741
+ }
742
+
743
+ printKeys ( ) {
744
+ this . generateKeyFile ( 'print' )
745
+ }
746
+
747
+ saveKeys ( ) {
748
+ this . generateKeyFile ( 'save' )
749
+ }
750
+
733
751
get enabled ( ) {
734
752
return getSetting ( settings . PAYMENTS_ENABLED , this . props . settings )
735
753
}
@@ -839,6 +857,120 @@ class PaymentsTab extends ImmutableComponent {
839
857
</ div >
840
858
}
841
859
860
+ get advancedSettingsContent ( ) {
861
+ const minDuration = this . props . ledgerData . get ( 'minDuration' )
862
+ const minPublisherVisits = this . props . ledgerData . get ( 'minPublisherVisits' )
863
+
864
+ return < div className = 'board' >
865
+ < div className = 'panel' >
866
+ < div className = 'settingsPanelDivider' >
867
+ < div data-l10n-id = 'minimumPageTimeSetting' />
868
+ < SettingsList >
869
+ < SettingItem >
870
+ < select
871
+ id = 'fundsSelectBox'
872
+ defaultValue = { minDuration || 8 }
873
+ onChange = { changeSetting . bind ( null , this . props . onChangeSetting , settings . MINIMUM_VISIT_TIME ) } > >
874
+ < option value = '5' > 5 seconds</ option >
875
+ < option value = '8' > 8 seconds</ option >
876
+ < option value = '60' > 1 minute</ option >
877
+ </ select >
878
+ </ SettingItem >
879
+ </ SettingsList >
880
+ < div data-l10n-id = 'minimumVisitsSetting' />
881
+ < SettingsList >
882
+ < SettingItem >
883
+ < select
884
+ id = 'fundsSelectBox'
885
+ defaultValue = { minPublisherVisits || 5 }
886
+ onChange = { changeSetting . bind ( null , this . props . onChangeSetting , settings . MINIMUM_VISTS ) } > >>
887
+ < option value = '2' > 2 visits</ option >
888
+ < option value = '5' > 5 visits</ option >
889
+ < option value = '10' > 10 visits</ option >
890
+ </ select >
891
+ </ SettingItem >
892
+ </ SettingsList >
893
+ </ div >
894
+ { this . enabled
895
+ ? < SettingCheckbox
896
+ dataL10nId = 'notifications'
897
+ prefKey = { settings . PAYMENTS_NOTIFICATIONS }
898
+ settings = { this . props . settings }
899
+ onChangeSetting = { this . props . onChangeSetting } />
900
+ : null }
901
+ </ div >
902
+ </ div >
903
+ }
904
+
905
+ get advancedSettingsFooter ( ) {
906
+ return < div className = 'panel advancedSettingsFooter' >
907
+ < Button l10nId = 'backupLedger' className = 'primaryButton' onClick = { this . props . showOverlay . bind ( this , 'ledgerBackup' ) } />
908
+ < Button l10nId = 'recoverLedger' className = 'primaryButton' onClick = { this . props . showOverlay . bind ( this , 'ledgerRecovery' ) } />
909
+ < Button l10nId = 'done' className = 'whiteButton inlineButton' onClick = { this . props . hideOverlay . bind ( this , 'advancedSettings' ) } />
910
+ </ div >
911
+ }
912
+
913
+ get ledgerBackupContent ( ) {
914
+ const paymentId = this . props . ledgerData . get ( 'paymentId' )
915
+ const passphrase = this . props . ledgerData . get ( 'passphrase' )
916
+
917
+ return < div className = 'board' >
918
+ < div className = 'panel' >
919
+ < span data-l10n-id = 'ledgerBackupContent' />
920
+ < div >
921
+ < div className = 'copyContainer' >
922
+ < Button l10nId = 'copy' className = 'whiteButton inlineButton' onClick = { this . copyToClipboard . bind ( this , paymentId ) } />
923
+ </ div >
924
+ < div className = 'keyContainer' >
925
+ < h2 data-l10n-id = 'firstKey' />
926
+ < span > { paymentId } </ span >
927
+ </ div >
928
+ </ div >
929
+ < div >
930
+ < div className = 'copyContainer' >
931
+ < Button l10nId = 'copy' className = 'whiteButton inlineButton' onClick = { this . copyToClipboard . bind ( this , passphrase ) } />
932
+ </ div >
933
+ < div className = 'keyContainer' >
934
+ < h2 data-l10n-id = 'secondKey' />
935
+ < span > { passphrase } </ span >
936
+ </ div >
937
+ </ div >
938
+ </ div >
939
+ </ div >
940
+ }
941
+
942
+ get ledgerBackupFooter ( ) {
943
+ return < div className = 'panel advancedSettingsFooter' >
944
+ < Button l10nId = 'printKeys' className = 'primaryButton' onClick = { this . printKeys } />
945
+ < Button l10nId = 'saveRecoveryFile' className = 'primaryButton' onClick = { this . saveKeys } />
946
+ < Button l10nId = 'done' className = 'whiteButton inlineButton' onClick = { this . props . hideOverlay . bind ( this , 'ledgerBackup' ) } />
947
+ </ div >
948
+ }
949
+
950
+ get ledgerRecoveryContent ( ) {
951
+ return < div className = 'board' >
952
+ < div className = 'panel' >
953
+ < h3 data-l10n-id = 'ledgerRecoverySubtitle' />
954
+ < span data-l10n-id = 'ledgerRecoveryContent' />
955
+ < SettingsList >
956
+ < SettingItem >
957
+ < h2 data-l10n-id = 'firstKey' />
958
+ < input type = 'text' />
959
+ < h2 data-l10n-id = 'secondKey' />
960
+ < input type = 'text' />
961
+ </ SettingItem >
962
+ </ SettingsList >
963
+ </ div >
964
+ </ div >
965
+ }
966
+
967
+ get ledgerRecoveryFooter ( ) {
968
+ return < div className = 'panel advancedSettingsFooter' >
969
+ < Button l10nId = 'cancel' className = 'whiteButton inlineButton' onClick = { this . props . hideOverlay . bind ( this , 'ledgerBackup' ) } />
970
+ < Button l10nId = 'recover' className = 'primaryButton' />
971
+ </ div >
972
+ }
973
+
842
974
get nextReconcileDate ( ) {
843
975
const ledgerData = this . props . ledgerData
844
976
if ( ! ledgerData . get ( 'reconcileStamp' ) ) {
@@ -947,6 +1079,21 @@ class PaymentsTab extends ImmutableComponent {
947
1079
? < ModalOverlay title = { 'paymentHistoryTitle' } customTitleClasses = { 'paymentHistory' } content = { this . paymentHistoryContent } footer = { this . paymentHistoryFooter } onHide = { this . props . hideOverlay . bind ( this , 'paymentHistory' ) } />
948
1080
: null
949
1081
}
1082
+ {
1083
+ this . enabled && this . props . advancedSettingsOverlayVisible
1084
+ ? < ModalOverlay title = { 'advancedSettingsTitle' } content = { this . advancedSettingsContent } footer = { this . advancedSettingsFooter } onHide = { this . props . hideOverlay . bind ( this , 'advancedSettings' ) } />
1085
+ : null
1086
+ }
1087
+ {
1088
+ this . enabled && this . props . ledgerBackupOverlayVisible
1089
+ ? < ModalOverlay title = { 'ledgerBackupTitle' } content = { this . ledgerBackupContent } footer = { this . ledgerBackupFooter } onHide = { this . props . hideOverlay . bind ( this , 'ledgerBackup' ) } />
1090
+ : null
1091
+ }
1092
+ {
1093
+ this . enabled && this . props . ledgerRecoveryOverlayVisible
1094
+ ? < ModalOverlay title = { 'ledgerRecoveryTitle' } content = { this . ledgerRecoveryContent } footer = { this . ledgerRecoveryFooter } onHide = { this . props . hideOverlay . bind ( this , 'ledgerRecovery' ) } />
1095
+ : null
1096
+ }
950
1097
< div className = 'titleBar' >
951
1098
< div className = 'sectionTitleWrapper pull-left' >
952
1099
< span className = 'sectionTitle' > Brave Payments</ span >
@@ -957,7 +1104,7 @@ class PaymentsTab extends ImmutableComponent {
957
1104
< span data-l10n-id = 'off' />
958
1105
< SettingCheckbox dataL10nId = 'on' prefKey = { settings . PAYMENTS_ENABLED } settings = { this . props . settings } onChangeSetting = { this . props . onChangeSetting } />
959
1106
</ div >
960
- { this . enabled ? < SettingCheckbox dataL10nId = 'notifications' prefKey = { settings . PAYMENTS_NOTIFICATIONS } settings = { this . props . settings } onChangeSetting = { this . props . onChangeSetting } /> : null }
1107
+ < Button l10nId = 'advancedSettings' className = 'whiteButton inlineButton' onClick = { this . props . showOverlay . bind ( this , 'advancedSettings' ) } />
961
1108
</ div >
962
1109
</ div >
963
1110
{
@@ -1367,6 +1514,9 @@ class AboutPreferences extends React.Component {
1367
1514
bitcoinOverlayVisible : false ,
1368
1515
qrcodeOverlayVisible : false ,
1369
1516
paymentHistoryOverlayVisible : false ,
1517
+ advancedSettingsOverlayVisible : false ,
1518
+ ledgerBackupOverlayVisible : false ,
1519
+ ledgerRecoveryOverlayVisible : false ,
1370
1520
addFundsOverlayVisible : false ,
1371
1521
preferenceTab : hash . toUpperCase ( ) in preferenceTabs ? hash : preferenceTabs . GENERAL ,
1372
1522
hintNumber : this . getNextHintNumber ( ) ,
@@ -1497,6 +1647,9 @@ class AboutPreferences extends React.Component {
1497
1647
bitcoinOverlayVisible = { this . state . bitcoinOverlayVisible }
1498
1648
qrcodeOverlayVisible = { this . state . qrcodeOverlayVisible }
1499
1649
paymentHistoryOverlayVisible = { this . state . paymentHistoryOverlayVisible }
1650
+ advancedSettingsOverlayVisible = { this . state . advancedSettingsOverlayVisible }
1651
+ ledgerBackupOverlayVisible = { this . state . ledgerBackupOverlayVisible }
1652
+ ledgerRecoveryOverlayVisible = { this . state . ledgerRecoveryOverlayVisible }
1500
1653
addFundsOverlayVisible = { this . state . addFundsOverlayVisible }
1501
1654
showOverlay = { this . setOverlayVisible . bind ( this , true ) }
1502
1655
hideOverlay = { this . setOverlayVisible . bind ( this , false ) } />
0 commit comments