forked from SilverHoodCorp/polar-bookshelf
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
the links for bronze, silver, and gold work...
- Loading branch information
burton
committed
May 30, 2019
1 parent
e8112a3
commit 041f543
Showing
4 changed files
with
96 additions
and
10 deletions.
There are no files selected for viewing
64 changes: 64 additions & 0 deletions
64
apps/repository/js/splash/splashes/premium/PremiumButton.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import * as React from 'react'; | ||
import Button from 'reactstrap/lib/Button'; | ||
import {Logger} from '../../../../../../web/js/logger/Logger'; | ||
import {Nav} from '../../../../../../web/js/ui/util/Nav'; | ||
import {Toaster} from '../../../../../../web/js/ui/toaster/Toaster'; | ||
|
||
const log = Logger.create(); | ||
|
||
export class PremiumButton extends React.Component<IProps, IState> { | ||
|
||
constructor(props: IProps, context: any) { | ||
super(props, context); | ||
|
||
this.state = { | ||
}; | ||
|
||
} | ||
|
||
public render() { | ||
|
||
const {to, from} = this.props; | ||
|
||
// true if we're BUYING a new plan... | ||
const buy = from === 'free'; | ||
|
||
const text = buy ? "Buy" : "Upgrade"; | ||
|
||
const buyHandler = () => { | ||
// if we're buying a NEW product go ahead and redirect us to | ||
// stripe and use their BUY package. This is better than embedding | ||
// the stripe SDK and also stripe ALSO needs to run over HTTPS | ||
Nav.openLinkWithNewTab(`https://getpolarized.io/[email protected]&plan=${to}`); | ||
}; | ||
|
||
const upgradeHandler = () => { | ||
Toaster.info("Not implemented yet"); | ||
}; | ||
|
||
const handler = buy ? buyHandler : upgradeHandler; | ||
|
||
return ( | ||
|
||
<Button color="secondary" | ||
onClick={() => handler()}> | ||
|
||
{text} | ||
|
||
</Button> | ||
|
||
); | ||
} | ||
|
||
} | ||
|
||
export interface IProps { | ||
readonly from: Plan; | ||
readonly to: Plan; | ||
} | ||
|
||
export interface IState { | ||
|
||
} | ||
|
||
export type Plan = 'free' | 'bronze' | 'silver' | 'gold'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters