add paywall to download button

This commit is contained in:
MuslemRahimi 2024-10-25 11:26:48 +02:00
parent be62e9f6d6
commit a0c8a3900a
7 changed files with 348 additions and 252 deletions

View File

@ -1708,7 +1708,7 @@
{/await}
</div>
</Lazy>
<!--
<Lazy>
<div
class="w-full mt-10 sm:mt-5 m-auto sm:pl-6 sm:pb-6 sm:pt-6 {!$borrowedShareComponent
@ -1720,7 +1720,8 @@
{/await}
</div>
</Lazy>
-->
<!--
<Lazy>
<div
class="w-full mt-10 sm:mt-5 m-auto sm:pl-6 sm:pb-6 sm:pt-6 {!$marketMakerComponent
@ -1732,6 +1733,7 @@
{/await}
</div>
</Lazy>
-->
<Lazy>
<div

View File

@ -8,6 +8,7 @@
import * as DropdownMenu from "$lib/components/shadcn/dropdown-menu/index.js";
import { Button } from "$lib/components/shadcn/button/index.js";
import { abbreviateNumber } from "$lib/utils";
import { goto } from "$app/navigation";
//import * as XLSX from 'xlsx';
import { init, use } from "echarts/core";
@ -332,6 +333,7 @@
};
const exportFundamentalData = (format = "csv") => {
if (data?.user?.tier === "Pro") {
const data = fullStatement;
if (!data || data.length === 0) {
return;
@ -364,7 +366,7 @@
// Check the format to export
if (format.toLowerCase() === "csv") {
const csvContent = rows?.map((row) => row.join(",")).join("\n");
const csvContent = rows.map((row) => row.join(",")).join("\n");
const blob = new Blob([csvContent], {
type: "data:text/csv;charset=utf-8",
});
@ -373,7 +375,7 @@
a.href = url;
a.download =
$stockTicker.toLowerCase() +
`${filterRule === "annual" ? "_annual" : "_quarter"}_balance_sheet_statement.csv`;
`${filterRule === "annual" ? "_annual" : "_quarter"}_cashflow_statement.csv`;
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
@ -389,6 +391,9 @@
}
*/
} else {
goto("/pricing");
}
};
$: {
@ -623,6 +628,17 @@
class="ml-2 w-full border-gray-600 border bg-[#09090B] sm:hover:bg-[#27272A] ease-out flex flex-row justify-between items-center px-3 py-2 text-white rounded-lg truncate"
>
<span class="truncate text-white">Download</span>
<svg
class="{data?.user?.tier === 'Pro'
? 'hidden'
: ''} ml-1 -mt-0.5 w-3.5 h-3.5"
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
>
</Button>
</div>
</div>

View File

@ -9,7 +9,7 @@
import { Button } from "$lib/components/shadcn/button/index.js";
//import * as XLSX from 'xlsx';
import { Chart } from "svelte-echarts";
import { goto } from "$app/navigation";
import { init, use } from "echarts/core";
import { LineChart, BarChart } from "echarts/charts";
import { GridComponent, TooltipComponent } from "echarts/components";
@ -278,6 +278,7 @@
};
const exportFundamentalData = (format = "csv") => {
if (data?.user?.tier === "Pro") {
const data = fullStatement;
if (!data || data.length === 0) {
return;
@ -310,7 +311,7 @@
// Check the format to export
if (format.toLowerCase() === "csv") {
const csvContent = rows?.map((row) => row.join(",")).join("\n");
const csvContent = rows.map((row) => row.join(",")).join("\n");
const blob = new Blob([csvContent], {
type: "data:text/csv;charset=utf-8",
});
@ -335,6 +336,9 @@
}
*/
} else {
goto("/pricing");
}
};
$: {
@ -567,6 +571,17 @@
class="ml-2 w-full border-gray-600 border bg-[#09090B] sm:hover:bg-[#27272A] ease-out flex flex-row justify-between items-center px-3 py-2 text-white rounded-lg truncate"
>
<span class="truncate text-white">Download</span>
<svg
class="{data?.user?.tier === 'Pro'
? 'hidden'
: ''} ml-1 -mt-0.5 w-3.5 h-3.5"
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
>
</Button>
</div>
</div>

View File

@ -6,6 +6,7 @@
} from "$lib/store";
import * as DropdownMenu from "$lib/components/shadcn/dropdown-menu/index.js";
import { Button } from "$lib/components/shadcn/button/index.js";
import { goto } from "$app/navigation";
import { Chart } from "svelte-echarts";
import { init, use } from "echarts/core";
import { BarChart } from "echarts/charts";
@ -260,6 +261,7 @@
}
const exportData = (format = "csv") => {
if (data?.user?.tier === "Pro") {
// Add headers row
const csvRows = [];
csvRows.push("Date,Employees,Change,Growth");
@ -309,6 +311,9 @@
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
} else {
goto("/pricing");
}
};
</script>
@ -546,6 +551,17 @@
class="ml-2 w-full border-gray-600 border bg-[#09090B] sm:hover:bg-[#27272A] ease-out flex flex-row justify-between items-center px-3 py-2 text-white rounded-lg truncate"
>
<span class="truncate text-white">Download</span>
<svg
class="{data?.user?.tier === 'Pro'
? 'hidden'
: ''} ml-1 -mt-0.5 w-3.5 h-3.5"
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
>
</Button>
</div>
</div>

View File

@ -9,7 +9,7 @@
import { Button } from "$lib/components/shadcn/button/index.js";
//import * as XLSX from 'xlsx';
import { Chart } from "svelte-echarts";
import { goto } from "$app/navigation";
import { init, use } from "echarts/core";
import { LineChart, BarChart } from "echarts/charts";
import { GridComponent, TooltipComponent } from "echarts/components";
@ -258,6 +258,7 @@
displayStatement = "revenue";
const exportFundamentalData = (format = "csv") => {
if (data?.user?.tier === "Pro") {
const data = fullStatement;
if (!data || data.length === 0) {
return;
@ -315,6 +316,9 @@
}
*/
} else {
goto("/pricing");
}
};
$: {
@ -548,6 +552,17 @@
class="ml-2 w-full border-gray-600 border bg-[#09090B] sm:hover:bg-[#27272A] ease-out flex flex-row justify-between items-center px-3 py-2 text-white rounded-lg truncate"
>
<span class="truncate text-white">Download</span>
<svg
class="{data?.user?.tier === 'Pro'
? 'hidden'
: ''} ml-1 -mt-0.5 w-3.5 h-3.5"
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
>
</Button>
</div>
</div>

View File

@ -8,6 +8,7 @@
import * as DropdownMenu from "$lib/components/shadcn/dropdown-menu/index.js";
import { Button } from "$lib/components/shadcn/button/index.js";
//import * as XLSX from 'xlsx';
import { goto } from "$app/navigation";
import { Chart } from "svelte-echarts";
import { init, use } from "echarts/core";
@ -242,6 +243,7 @@
}
const exportData = (format = "csv") => {
if (data?.user?.tier === "Pro") {
// Add headers row
const csvRows = [];
@ -286,6 +288,9 @@
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
} else {
goto("/pricing");
}
};
</script>
@ -447,6 +452,17 @@
class="ml-2 w-full border-gray-600 border bg-[#09090B] sm:hover:bg-[#27272A] ease-out flex flex-row justify-between items-center px-3 py-2 text-white rounded-lg truncate"
>
<span class="truncate text-white">Download</span>
<svg
class="{data?.user?.tier === 'Pro'
? 'hidden'
: ''} ml-1 -mt-0.5 w-3.5 h-3.5"
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
>
</Button>
</div>

View File

@ -9,6 +9,7 @@
import * as DropdownMenu from "$lib/components/shadcn/dropdown-menu/index.js";
import { Button } from "$lib/components/shadcn/button/index.js";
//import * as XLSX from 'xlsx';
import { goto } from "$app/navigation";
import { init, use } from "echarts/core";
import { LineChart, BarChart } from "echarts/charts";
import { GridComponent, TooltipComponent } from "echarts/components";
@ -217,6 +218,7 @@
}
const exportFundamentalData = (format = "csv") => {
if (data?.user?.tier === "Pro") {
const data = fullStatement;
if (!data || data.length === 0) {
return;
@ -258,7 +260,7 @@
a.href = url;
a.download =
$stockTicker.toLowerCase() +
`${filterRule === "annual" ? "_annual" : "_quarter"}_ratios_statement.csv`;
`${filterRule === "annual" ? "_annual" : "_quarter"}_balance_sheet_statement.csv`;
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
@ -274,6 +276,9 @@
}
*/
} else {
goto("/pricing");
}
};
fullStatement = data?.getRatiosStatement;
@ -532,6 +537,17 @@
class="ml-2 w-full border-gray-600 border bg-[#09090B] sm:hover:bg-[#27272A] ease-out flex flex-row justify-between items-center px-3 py-2 text-white rounded-lg truncate"
>
<span class="truncate text-white">Download</span>
<svg
class="{data?.user?.tier === 'Pro'
? 'hidden'
: ''} ml-1 -mt-0.5 w-3.5 h-3.5"
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
>
</Button>
</div>
</div>