add paywall to price export
This commit is contained in:
parent
a0c8a3900a
commit
402367e98d
@ -10,11 +10,9 @@
|
|||||||
swapComponent,
|
swapComponent,
|
||||||
governmentContractComponent,
|
governmentContractComponent,
|
||||||
optionsNetFlowComponent,
|
optionsNetFlowComponent,
|
||||||
borrowedShareComponent,
|
|
||||||
clinicalTrialComponent,
|
clinicalTrialComponent,
|
||||||
optionComponent,
|
optionComponent,
|
||||||
failToDeliverComponent,
|
failToDeliverComponent,
|
||||||
marketMakerComponent,
|
|
||||||
screenWidth,
|
screenWidth,
|
||||||
displayCompanyName,
|
displayCompanyName,
|
||||||
numberOfUnreadNotification,
|
numberOfUnreadNotification,
|
||||||
@ -46,8 +44,7 @@
|
|||||||
import { convertTimestamp } from "$lib/utils";
|
import { convertTimestamp } from "$lib/utils";
|
||||||
import { Button } from "$lib/components/shadcn/button/index.js";
|
import { Button } from "$lib/components/shadcn/button/index.js";
|
||||||
import * as DropdownMenu from "$lib/components/shadcn/dropdown-menu/index.js";
|
import * as DropdownMenu from "$lib/components/shadcn/dropdown-menu/index.js";
|
||||||
|
import { goto } from "$app/navigation";
|
||||||
import toast from "svelte-french-toast";
|
|
||||||
|
|
||||||
export let data;
|
export let data;
|
||||||
export let form;
|
export let form;
|
||||||
@ -708,6 +705,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function exportData(timePeriod: string) {
|
async function exportData(timePeriod: string) {
|
||||||
|
if (data?.user?.tier === "Pro") {
|
||||||
let exportList = [];
|
let exportList = [];
|
||||||
|
|
||||||
const response = await fetch("/api/export-price-data", {
|
const response = await fetch("/api/export-price-data", {
|
||||||
@ -720,13 +718,15 @@
|
|||||||
|
|
||||||
exportList = await response.json();
|
exportList = await response.json();
|
||||||
|
|
||||||
exportList = exportList?.map(({ time, open, high, low, close, date }) => ({
|
exportList = exportList?.map(
|
||||||
|
({ time, open, high, low, close, date }) => ({
|
||||||
date: timePeriod === "max" ? time : date, // Use 'time' if timePeriod is "max", otherwise use 'date'
|
date: timePeriod === "max" ? time : date, // Use 'time' if timePeriod is "max", otherwise use 'date'
|
||||||
open,
|
open,
|
||||||
high,
|
high,
|
||||||
low,
|
low,
|
||||||
close,
|
close,
|
||||||
}));
|
}),
|
||||||
|
);
|
||||||
|
|
||||||
const csvRows = [];
|
const csvRows = [];
|
||||||
|
|
||||||
@ -800,6 +800,9 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
} else {
|
||||||
|
goto("/pricing");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateClosePrice(data, extendPriceChart) {
|
function updateClosePrice(data, extendPriceChart) {
|
||||||
@ -1189,25 +1192,6 @@
|
|||||||
on:click={() => exportData("30min")}
|
on:click={() => exportData("30min")}
|
||||||
class="cursor-pointer hover:bg-[#27272A]"
|
class="cursor-pointer hover:bg-[#27272A]"
|
||||||
>
|
>
|
||||||
<!--<svg
|
|
||||||
class="w-3.5 h-3.5 mr-1 {data?.user?.tier === 'Pro'
|
|
||||||
? 'hidden'
|
|
||||||
: ''}"
|
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
|
||||||
viewBox="0 0 24 24"
|
|
||||||
><path
|
|
||||||
fill="#A3A3A3"
|
|
||||||
d="M17 9V7c0-2.8-2.2-5-5-5S7 4.2 7 7v2c-1.7 0-3 1.3-3 3v7c0 1.7 1.3 3 3 3h10c1.7 0 3-1.3 3-3v-7c0-1.7-1.3-3-3-3M9 7c0-1.7 1.3-3 3-3s3 1.3 3 3v2H9z"
|
|
||||||
/></svg
|
|
||||||
>
|
|
||||||
-->
|
|
||||||
30 min
|
|
||||||
</DropdownMenu.Item>
|
|
||||||
<DropdownMenu.Item
|
|
||||||
on:click={() => exportData("1hour")}
|
|
||||||
class="cursor-pointer hover:bg-[#27272A]"
|
|
||||||
>
|
|
||||||
<!--
|
|
||||||
<svg
|
<svg
|
||||||
class="w-3.5 h-3.5 mr-1 {data?.user?.tier === 'Pro'
|
class="w-3.5 h-3.5 mr-1 {data?.user?.tier === 'Pro'
|
||||||
? 'hidden'
|
? 'hidden'
|
||||||
@ -1219,7 +1203,24 @@
|
|||||||
d="M17 9V7c0-2.8-2.2-5-5-5S7 4.2 7 7v2c-1.7 0-3 1.3-3 3v7c0 1.7 1.3 3 3 3h10c1.7 0 3-1.3 3-3v-7c0-1.7-1.3-3-3-3M9 7c0-1.7 1.3-3 3-3s3 1.3 3 3v2H9z"
|
d="M17 9V7c0-2.8-2.2-5-5-5S7 4.2 7 7v2c-1.7 0-3 1.3-3 3v7c0 1.7 1.3 3 3 3h10c1.7 0 3-1.3 3-3v-7c0-1.7-1.3-3-3-3M9 7c0-1.7 1.3-3 3-3s3 1.3 3 3v2H9z"
|
||||||
/></svg
|
/></svg
|
||||||
>
|
>
|
||||||
-->
|
|
||||||
|
30 min
|
||||||
|
</DropdownMenu.Item>
|
||||||
|
<DropdownMenu.Item
|
||||||
|
on:click={() => exportData("1hour")}
|
||||||
|
class="cursor-pointer hover:bg-[#27272A]"
|
||||||
|
>
|
||||||
|
<svg
|
||||||
|
class="w-3.5 h-3.5 mr-1 {data?.user?.tier === 'Pro'
|
||||||
|
? 'hidden'
|
||||||
|
: ''}"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
><path
|
||||||
|
fill="#A3A3A3"
|
||||||
|
d="M17 9V7c0-2.8-2.2-5-5-5S7 4.2 7 7v2c-1.7 0-3 1.3-3 3v7c0 1.7 1.3 3 3 3h10c1.7 0 3-1.3 3-3v-7c0-1.7-1.3-3-3-3M9 7c0-1.7 1.3-3 3-3s3 1.3 3 3v2H9z"
|
||||||
|
/></svg
|
||||||
|
>
|
||||||
1 hour
|
1 hour
|
||||||
</DropdownMenu.Item>
|
</DropdownMenu.Item>
|
||||||
<DropdownMenu.Item
|
<DropdownMenu.Item
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user