diff --git a/components/FlipTracking/FlipTracking.tsx b/components/FlipTracking/FlipTracking.tsx
index 1bbe60a1..95f0f369 100644
--- a/components/FlipTracking/FlipTracking.tsx
+++ b/components/FlipTracking/FlipTracking.tsx
@@ -335,8 +335,8 @@ export function FlipTracking(props: Props) {
{
- setRangeStartDate(e)
- loadFlipsForTimespan(e, rangeEndDate)
+ setRangeStartDate(e ?? new Date())
+ loadFlipsForTimespan(e ?? new Date(), rangeEndDate)
}}
className={'form-control'}
minDate={new Date(new Date().getTime() - 1000 * 60 * 60 * 24 * 30 * 2)}
@@ -348,8 +348,8 @@ export function FlipTracking(props: Props) {
{
- setRangeEndDate(e)
- loadFlipsForTimespan(rangeStartDate, e)
+ setRangeEndDate(e?? new Date())
+ loadFlipsForTimespan(rangeStartDate, e?? new Date())
}}
minDate={new Date(new Date().getTime() - 1000 * 60 * 60 * 24 * 30 * 2)}
maxDate={new Date()}
diff --git a/components/Premium/BuyPremium/BuyPremium.tsx b/components/Premium/BuyPremium/BuyPremium.tsx
index 1155f37a..577e6a5e 100644
--- a/components/Premium/BuyPremium/BuyPremium.tsx
+++ b/components/Premium/BuyPremium/BuyPremium.tsx
@@ -56,42 +56,14 @@ function BuyPremium(props: Props) {
})
}
- function onSubscriptionBuy(googleToken: string) {
- let productId = ''
- if (purchasePremiumType.productId === 'premium') {
- productId = 'l_premium'
- }
- if (purchasePremiumType.productId === 'premium_plus') {
- productId = 'l_prem_plus'
- }
-
- api.purchasePremiumSubscription(productId, googleToken).then(data => {
- window.open(data.directLink, '_self')
- })
- }
-
function onPremiumBuyCancel() {
setShowPrepaidConfirmationDialog(false)
}
- function onSubscriptionBuyCancel() {
- setShowSubscriptionConfirmationDialog(false)
- }
-
function getPurchasePrice() {
return purchasePremiumOption.value * purchasePremiumOption.price
}
- function getSubscriptionPrice() {
- if (purchasePremiumType.productId === 'premium') {
- return 8.69
- }
- if (purchasePremiumType.productId === 'premium_plus') {
- return 29.69
- }
- return -1
- }
-
function getDurationString(): string {
let durationString = purchasePremiumType.durationString
let duration = +purchasePremiumOption.value
@@ -181,20 +153,6 @@ function BuyPremium(props: Props) {
) : null}
This is a prepaid service. We won't automatically charge you after your premium time runs out!
- {(purchasePremiumType.productId === 'premium' || purchasePremiumType.productId === 'premium_plus') &&
- (!props.premiumSubscriptions || props.premiumSubscriptions.length === 0) ? (
-
- If you want to it to automatically renew itself,{' '}
- {
- setShowSubscriptionConfirmationDialog(true)
- }}
- style={{ color: '#007bff', cursor: 'pointer' }}
- >
- click here
-
-
- ) : null}
-
{getSubscriptionPrice()} per month>}
- purchasePremiumType={purchasePremiumType}
- onHide={onSubscriptionBuyCancel}
- onConfirm={onSubscriptionBuy}
- activePremiumProduct={props.activePremiumProduct}
- />
>
)
}
diff --git a/components/Premium/BuySubscription/BuySubscription.module.css b/components/Premium/BuySubscription/BuySubscription.module.css
new file mode 100644
index 00000000..ad3e4c25
--- /dev/null
+++ b/components/Premium/BuySubscription/BuySubscription.module.css
@@ -0,0 +1,8 @@
+.purchaseButtonContainer{
+ display: flex;
+ justify-content: center;
+}
+
+.purchaseButton{
+ width: 80%;
+}
\ No newline at end of file
diff --git a/components/Premium/BuySubscription/BuySubscription.tsx b/components/Premium/BuySubscription/BuySubscription.tsx
new file mode 100644
index 00000000..b24ffe63
--- /dev/null
+++ b/components/Premium/BuySubscription/BuySubscription.tsx
@@ -0,0 +1,126 @@
+import { useState } from 'react'
+import BuyPremiumConfirmationDialog from '../BuyPremiumConfirmationDialog/BuyPremiumConfirmationDialog'
+import { PREMIUM_TYPES } from '../../../utils/PremiumTypeUtils'
+import api from '../../../api/ApiHelper'
+import { Button, Card, Col, Row } from 'react-bootstrap'
+import styles from './BuySubscription.module.css'
+import NumberElement from '../../Number/Number'
+
+interface Props {
+ activePremiumProduct: PremiumProduct
+}
+
+function BuySubscription(props: Props) {
+ const [selectedPremiumType, setSelectedPremiumType] = useState()
+
+ function getSubscriptionPrice() {
+ if (!selectedPremiumType) {
+ return -1
+ }
+ if (selectedPremiumType.productId === 'premium') {
+ return 8.69
+ }
+ if (selectedPremiumType.productId === 'premium_plus') {
+ return 29.69
+ }
+ return -1
+ }
+
+ function onSubscriptionBuyCancel() {
+ setSelectedPremiumType(undefined)
+ }
+
+ function onSubscriptionBuy(googleToken: string) {
+ if (!selectedPremiumType) {
+ return
+ }
+ let productId = ''
+ if (selectedPremiumType.productId === 'premium') {
+ productId = 'l_premium'
+ }
+ if (selectedPremiumType.productId === 'premium_plus') {
+ productId = 'l_prem_plus'
+ }
+
+ api.purchasePremiumSubscription(productId, googleToken).then(data => {
+ window.open(data.directLink, '_self')
+ })
+ }
+
+ return (
+ <>
+
+
+
+
+ Premium+
+
+
+
+ - top flip receive time
+ - all tools for analysis
+ - full auction archive
+
+ Use NICEDISCOUNT
for 31% discount for 1 month
+ Use BLACKFRIDAY
for 10% discount for 12 months
+
+
+
+
+
+
+
+
+
+
+ Premium
+
+
+
+ - up to 1s slower than prem+
+ - a lot of tools
+ - extended history & filter access
+
+ Use NICEDISCOUNT
for 31% discount for 1 month
+ Use BLACKFRIDAY
for 10% discount for 12 months
+
+
+
+
+
+
+
+
+ {selectedPremiumType && (
+ type.productId === 'premium')?.options[0]!}
+ purchasePrice={<>{getSubscriptionPrice()} per month>}
+ purchasePremiumType={selectedPremiumType!}
+ onHide={onSubscriptionBuyCancel}
+ onConfirm={onSubscriptionBuy}
+ activePremiumProduct={props.activePremiumProduct}
+ />
+ )}
+ >
+ )
+}
+
+export default BuySubscription
diff --git a/components/Premium/Premium.tsx b/components/Premium/Premium.tsx
index 95532510..b2940ab4 100644
--- a/components/Premium/Premium.tsx
+++ b/components/Premium/Premium.tsx
@@ -14,6 +14,7 @@ import { CANCELLATION_RIGHT_CONFIRMED } from '../../utils/SettingsUtils'
import { getHighestPriorityPremiumProduct } from '../../utils/PremiumTypeUtils'
import PremiumStatus from './PremiumStatus/PremiumStatus'
import { toast } from 'react-toastify'
+import BuySubscription from './BuySubscription/BuySubscription'
function Premium() {
let [isLoggedIn, setIsLoggedIn] = useState(false)
@@ -110,6 +111,15 @@ function Premium() {
{isLoggedIn ? (