update price alert
This commit is contained in:
parent
1af431052a
commit
f2ab85b076
@ -1,7 +1,6 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import toast from "svelte-french-toast";
|
import toast from "svelte-french-toast";
|
||||||
import {
|
import {
|
||||||
screenWidth,
|
|
||||||
openPriceAlert,
|
openPriceAlert,
|
||||||
displayCompanyName,
|
displayCompanyName,
|
||||||
stockTicker,
|
stockTicker,
|
||||||
@ -9,17 +8,21 @@
|
|||||||
cryptoTicker,
|
cryptoTicker,
|
||||||
assetType,
|
assetType,
|
||||||
} from "$lib/store";
|
} from "$lib/store";
|
||||||
import RangeSlider from "svelte-range-slider-pips";
|
|
||||||
|
|
||||||
export let data;
|
export let data;
|
||||||
|
export let ticker;
|
||||||
|
|
||||||
let currentPrice = data?.getStockQuote?.price;
|
let currentPrice = Number(data?.getStockQuote?.price?.toFixed(2));
|
||||||
let values = [0];
|
let targetPrice = currentPrice; //(currentPrice * (1 + targetPrice / 100))?.toFixed(2);
|
||||||
let displayPrice = (currentPrice * (1 + values?.at(0) / 100))?.toFixed(2);
|
let condition = "above";
|
||||||
|
|
||||||
|
function changeStatement(event) {
|
||||||
|
condition = event.target.value;
|
||||||
|
}
|
||||||
|
|
||||||
async function handleCreateAlert() {
|
async function handleCreateAlert() {
|
||||||
if (values?.at(0) === 0) {
|
if (targetPrice < 0) {
|
||||||
toast.error(`Percentage change must not be zero`, {
|
toast.error(`Target Price must be above zero`, {
|
||||||
style:
|
style:
|
||||||
"border-radius: 10px; background: #333; color: #fff; padding: 12px; margin-top: 10px; box-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.25);",
|
"border-radius: 10px; background: #333; color: #fff; padding: 12px; margin-top: 10px; box-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.25);",
|
||||||
});
|
});
|
||||||
@ -37,10 +40,9 @@
|
|||||||
: $cryptoTicker,
|
: $cryptoTicker,
|
||||||
name: $displayCompanyName,
|
name: $displayCompanyName,
|
||||||
assetType: $assetType,
|
assetType: $assetType,
|
||||||
priceWhenCreated: currentPrice?.toFixed(2),
|
priceWhenCreated: currentPrice,
|
||||||
condition: values?.at(0) < 0 ? "below" : "above",
|
condition: condition,
|
||||||
targetPrice: displayPrice,
|
targetPrice: targetPrice,
|
||||||
path: "create-price-alert",
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Make the POST request to the endpoint
|
// Make the POST request to the endpoint
|
||||||
@ -52,92 +54,22 @@
|
|||||||
body: JSON.stringify(postData),
|
body: JSON.stringify(postData),
|
||||||
});
|
});
|
||||||
|
|
||||||
const output = await response.json();
|
//const output = await response.json();
|
||||||
|
|
||||||
if (output === "success") {
|
|
||||||
toast.success(`Successfully created price alert`, {
|
toast.success(`Successfully created price alert`, {
|
||||||
style:
|
style:
|
||||||
"border-radius: 10px; background: #333; color: #fff; padding: 12px; margin-top: 10px; box-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.25);",
|
"border-radius: 10px; background: #333; color: #fff; padding: 12px; margin-top: 10px; box-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.25);",
|
||||||
});
|
});
|
||||||
values = [0];
|
targetPrice = currentPrice;
|
||||||
displayPrice = currentPrice;
|
|
||||||
} else {
|
|
||||||
toast.error(`Something went wrong. Please try again!`, {
|
|
||||||
style:
|
|
||||||
"border-radius: 10px; background: #333; color: #fff; padding: 12px; margin-top: 10px; box-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.25);",
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
function numPadInput(number) {
|
|
||||||
// Check if the input number is a single digit number
|
|
||||||
if (number >= 0 && number <= 9) {
|
|
||||||
if (Math?.abs(displayPrice - currentPrice) < 0.001) {
|
|
||||||
displayPrice = Number(number);
|
|
||||||
} else {
|
|
||||||
if ((String(displayPrice)?.split(".")[1] || "")?.length < 2) {
|
|
||||||
displayPrice = Number(String(displayPrice) + String(number));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
values[0] = (displayPrice / currentPrice - 1) * 100;
|
|
||||||
|
|
||||||
const button = document.getElementById(`numPad-${number}`);
|
|
||||||
if (button) {
|
|
||||||
button.classList.add("bg-white", "bg-opacity-[0.05]");
|
|
||||||
setTimeout(() => {
|
|
||||||
button.classList.remove("bg-white", "bg-opacity-[0.05]");
|
|
||||||
}, 120);
|
|
||||||
}
|
|
||||||
} else if (number === "remove") {
|
|
||||||
displayPrice = String(displayPrice).slice(0, -1);
|
|
||||||
// If displayPrice becomes an empty string, set it to 0
|
|
||||||
if (displayPrice === "") {
|
|
||||||
displayPrice = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
values[0] = (displayPrice / currentPrice - 1) * 100;
|
|
||||||
|
|
||||||
const button = document.getElementById(`numPad-remove`);
|
|
||||||
if (button) {
|
|
||||||
button.classList.add("bg-white", "bg-opacity-[0.05]");
|
|
||||||
setTimeout(() => {
|
|
||||||
button.classList.remove("bg-white", "bg-opacity-[0.05]");
|
|
||||||
}, 120);
|
|
||||||
}
|
|
||||||
} else if (number === "dot") {
|
|
||||||
if (
|
|
||||||
!String(displayPrice)?.includes(".") &&
|
|
||||||
(String(displayPrice)?.split(".")[1] || "")?.length < 2
|
|
||||||
) {
|
|
||||||
displayPrice = String(displayPrice) + ".";
|
|
||||||
console.log(displayPrice);
|
|
||||||
}
|
|
||||||
|
|
||||||
values[0] = (displayPrice / currentPrice - 1) * 100;
|
|
||||||
|
|
||||||
const button = document.getElementById(`numPad-dot`);
|
|
||||||
if (button) {
|
|
||||||
button.classList.add("bg-white", "bg-opacity-[0.05]");
|
|
||||||
setTimeout(() => {
|
|
||||||
button.classList.remove("bg-white", "bg-opacity-[0.05]");
|
|
||||||
}, 120);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$: isPositive = values[0] < 0;
|
|
||||||
$: origin = isPositive
|
|
||||||
? "--left: auto; --right: 50%"
|
|
||||||
: "--right: auto; --left: 50%";
|
|
||||||
$: color = isPositive ? "#FF2F1F" : "#0DDE00";
|
|
||||||
|
|
||||||
$: {
|
$: {
|
||||||
if ($openPriceAlert === true) {
|
if ($openPriceAlert === true) {
|
||||||
$openPriceAlert = false;
|
$openPriceAlert = false;
|
||||||
currentPrice = data?.getStockQuote?.price;
|
currentPrice = Number(data?.getStockQuote?.price?.toFixed(2));
|
||||||
values = [0];
|
targetPrice = currentPrice;
|
||||||
displayPrice = (currentPrice * (1 + values?.at(0) / 100))?.toFixed(2);
|
condition = "above";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
@ -149,23 +81,22 @@
|
|||||||
/>
|
/>
|
||||||
</svelte:head>
|
</svelte:head>
|
||||||
|
|
||||||
{#if $screenWidth >= 640}
|
<!--Start Trade Modal-->
|
||||||
<!--Start Trade Modal-->
|
<input type="checkbox" id="priceAlertModal" class="modal-toggle" />
|
||||||
<input type="checkbox" id="priceAlertModal" class="modal-toggle" />
|
|
||||||
|
|
||||||
<dialog id="priceAlertModal" class="modal modal-bottom sm:modal-middle">
|
<dialog id="priceAlertModal" class="modal modal-middle p-2 sm:p-0">
|
||||||
<label
|
<label
|
||||||
for="priceAlertModal"
|
for="priceAlertModal"
|
||||||
class="cursor-pointer modal-backdrop bg-[#fff] bg-opacity-[0.02]"
|
class="cursor-pointer modal-backdrop bg-[#000] bg-opacity-[0.3]"
|
||||||
></label>
|
></label>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
class="modal-box rounded-none w-full bg-[#000] border border-gray-800 h-[450px]"
|
class="modal-box rounded-md w-full bg-[#1E222D] border border-gray-600 min-h-fit h-[600px] sm:h-[500px]"
|
||||||
>
|
>
|
||||||
<!--Start Trade Modal-->
|
<!--Start Trade Modal-->
|
||||||
<label
|
<label
|
||||||
for="priceAlertModal"
|
for="priceAlertModal"
|
||||||
class="cursor-pointer absolute right-5 top-5 bg-[#000] text-[1.8rem] text-white"
|
class="cursor-pointer absolute right-5 top-5 text-[1.8rem] text-white"
|
||||||
>
|
>
|
||||||
<svg
|
<svg
|
||||||
class="w-8 h-8"
|
class="w-8 h-8"
|
||||||
@ -179,311 +110,94 @@
|
|||||||
</label>
|
</label>
|
||||||
|
|
||||||
<div class="flex flex-col w-full">
|
<div class="flex flex-col w-full">
|
||||||
<h2 class="text-white font-medium text-lg text-center m-auto mb-5 mt-3">
|
<h2 class="text-white font-semibold text-lg text-start mb-5">
|
||||||
Price Alerts
|
Create Price Alert on {ticker}
|
||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
<div class="flex justify-between items-center">
|
|
||||||
<body class="w-11/12 m-auto">
|
|
||||||
<div
|
<div
|
||||||
class="mt-8 text-center flex flex-col justify-center items-center mb-14"
|
class="flex flex-col sm:flex-row justify-between items-start sm:items-center mt-5 font-semibold text-white"
|
||||||
>
|
>
|
||||||
<div class="text-white font-medium text-5xl">
|
<label class="text-sm w-[20%] mb-1 sm:mb-0">Symbol</label>
|
||||||
${displayPrice}
|
<label
|
||||||
</div>
|
class="rounded-md bg-[#2A2E39] w-full sm:w-[80%] py-2 px-2 text-sm border border-gray-600"
|
||||||
<div class="text-sm text-white text-opacity-[0.5] mt-2">
|
>
|
||||||
Current Price: ${currentPrice}
|
<img
|
||||||
</div>
|
style="clip-path: circle(50%);"
|
||||||
|
class="w-4 h-4 inline-block -mt-1 mr-1"
|
||||||
|
src={`https://financialmodelingprep.com/image-stock/${ticker}.png`}
|
||||||
|
loading="lazy"
|
||||||
|
/>
|
||||||
|
|
||||||
|
{ticker}, Regular trading hours
|
||||||
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div
|
<div class="flex flex-col gap-4 mt-5 font-semibold text-white">
|
||||||
class="positive-negative-slider"
|
<!-- Condition Label -->
|
||||||
style="--range: {Math.abs(
|
<div class="flex flex-col sm:flex-row items-start sm:items-center">
|
||||||
values[0] / 2,
|
<label class="text-sm w-[20%] mb-1 sm:mb-0">Condition</label>
|
||||||
)}%; {origin}; --range-color: {color};"
|
<input
|
||||||
>
|
type="text"
|
||||||
<RangeSlider
|
value="Price"
|
||||||
id="large"
|
class="w-full sm:w-[80%] bg-[#2A2E39] border border-gray-600 text-sm rounded-md py-2 px-3 text-white"
|
||||||
on:change={() =>
|
readonly
|
||||||
(displayPrice = (
|
|
||||||
currentPrice *
|
|
||||||
(1 + values?.at(0) / 100)
|
|
||||||
)?.toFixed(2))}
|
|
||||||
suffix="%"
|
|
||||||
min={-100}
|
|
||||||
max={100}
|
|
||||||
all={false}
|
|
||||||
first={false}
|
|
||||||
last={false}
|
|
||||||
rest={false}
|
|
||||||
hoverable={false}
|
|
||||||
bind:values
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
{#if values?.at(0) !== 0}
|
|
||||||
<div class="text-white text-center m-auto text-sm">
|
<!-- Crossing Dropdown -->
|
||||||
Triggers once when price moves {values?.at(0) > 0
|
<div class="flex flex-col sm:flex-row items-start sm:items-center">
|
||||||
? "above"
|
<label class="text-sm w-[20%] mb-1 sm:mb-0">Crossing</label>
|
||||||
: "below"}
|
<select
|
||||||
{#if values?.at(0) > 0}
|
on:change={changeStatement}
|
||||||
<svg
|
class="w-full sm:w-[80%] bg-[#2A2E39] border border-gray-600 text-sm rounded-md py-2 px-3 text-white"
|
||||||
class="inline-block w-5 h-5 -mr-1"
|
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
|
||||||
viewBox="0 0 24 24"
|
|
||||||
><g id="evaArrowUpFill0"
|
|
||||||
><g id="evaArrowUpFill1"
|
|
||||||
><path
|
|
||||||
id="evaArrowUpFill2"
|
|
||||||
fill="#00FC50"
|
|
||||||
d="M16.21 16H7.79a1.76 1.76 0 0 1-1.59-1a2.1 2.1 0 0 1 .26-2.21l4.21-5.1a1.76 1.76 0 0 1 2.66 0l4.21 5.1A2.1 2.1 0 0 1 17.8 15a1.76 1.76 0 0 1-1.59 1Z"
|
|
||||||
/></g
|
|
||||||
></g
|
|
||||||
></svg
|
|
||||||
>
|
>
|
||||||
<span class="text-[#00FC50] font-medium"
|
<option value="above" selected>Above</option>
|
||||||
>+{values?.at(0)?.toFixed(2)}%</span
|
<option value="below">Below</option>
|
||||||
>
|
</select>
|
||||||
{:else if values?.at(0) < 0}
|
|
||||||
<svg
|
|
||||||
class="inline-block w-5 h-5 -mr-1 rotate-180"
|
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
|
||||||
viewBox="0 0 24 24"
|
|
||||||
><g id="evaArrowUpFill0"
|
|
||||||
><g id="evaArrowUpFill1"
|
|
||||||
><path
|
|
||||||
id="evaArrowUpFill2"
|
|
||||||
fill="#FF2F1F"
|
|
||||||
d="M16.21 16H7.79a1.76 1.76 0 0 1-1.59-1a2.1 2.1 0 0 1 .26-2.21l4.21-5.1a1.76 1.76 0 0 1 2.66 0l4.21 5.1A2.1 2.1 0 0 1 17.8 15a1.76 1.76 0 0 1-1.59 1Z"
|
|
||||||
/></g
|
|
||||||
></g
|
|
||||||
></svg
|
|
||||||
>
|
|
||||||
<span class="inline-block text-[#FF2F1F] font-medium"
|
|
||||||
>{values?.at(0)?.toFixed(2)}%
|
|
||||||
</span>
|
|
||||||
{/if}
|
|
||||||
</div>
|
|
||||||
{:else}
|
|
||||||
<div
|
|
||||||
class="text-white text-opacity-60 m-auto text-center text-sm"
|
|
||||||
>
|
|
||||||
Set a trigger by moving the slider.
|
|
||||||
</div>
|
|
||||||
{/if}
|
|
||||||
</body>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="w-full pt-8 m-auto flex justify-center items-center">
|
<!-- Value Input -->
|
||||||
|
<div class="flex flex-col sm:flex-row items-start sm:items-center">
|
||||||
|
<label class="text-sm w-[20%] mb-1 sm:mb-0">Value</label>
|
||||||
|
|
||||||
|
<input
|
||||||
|
type="number"
|
||||||
|
bind:value={targetPrice}
|
||||||
|
step="0.1"
|
||||||
|
class="w-full sm:w-[80%] bg-[#2A2E39] border border-gray-600 text-sm rounded-md py-2 px-3 text-white"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{#if !isNaN(targetPrice) && targetPrice !== undefined && targetPrice !== null}
|
||||||
|
<div class="flex flex-col gap-2 mt-5 text-white">
|
||||||
|
<label class="text-sm sm:text-[1rem] font-semibold"
|
||||||
|
>Quick Summary:</label
|
||||||
|
>
|
||||||
|
<p class="text-sm sm:text-[1rem]">
|
||||||
|
Your price alert will notify you when the stock price is {condition}
|
||||||
|
{targetPrice?.toFixed(2)}.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
<!-- Action Buttons -->
|
||||||
|
<div class="flex justify-end gap-4 mt-6 absolute bottom-5 right-5">
|
||||||
|
<label
|
||||||
|
for="priceAlertModal"
|
||||||
|
class="cursor-pointer border border-gray-600 text-white py-2 px-4 rounded-md text-sm"
|
||||||
|
>
|
||||||
|
Cancel
|
||||||
|
</label>
|
||||||
<button
|
<button
|
||||||
on:click={handleCreateAlert}
|
on:click={handleCreateAlert}
|
||||||
class="m-auto cursor-pointer px-7 py-2 rounded-full transition ease-out {values?.at(
|
class="bg-white text-black py-2 px-4 rounded-md text-sm"
|
||||||
0,
|
|
||||||
) !== 0
|
|
||||||
? 'bg-[#0DDE00]'
|
|
||||||
: 'bg-gray-600'} text-center text-black font-medium"
|
|
||||||
>
|
>
|
||||||
Create
|
Save
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!--End Trade Modal-->
|
<!--End Trade Modal-->
|
||||||
</div>
|
</div>
|
||||||
</dialog>
|
</dialog>
|
||||||
{:else}
|
|
||||||
<!--Start Mobile Price Alert-->
|
|
||||||
<div class="drawer drawer-end overflow-hidden w-screen z-40">
|
|
||||||
<input id="priceAlertModal" type="checkbox" class="drawer-toggle" />
|
|
||||||
<div class="drawer-side overflow-y-scroll overflow-hidden">
|
|
||||||
<div
|
|
||||||
class="bg-[#000] min-h-screen px-5 w-screen pb-20 overflow-y-scroll overflow-hidden"
|
|
||||||
>
|
|
||||||
<!--Start Header-->
|
|
||||||
<div
|
|
||||||
class="bg-[#000] w-full p-1 flex flex-col items-center pb-5 h-auto"
|
|
||||||
>
|
|
||||||
<label for="priceAlertModal" class="absolute left-6 top-6">
|
|
||||||
<svg
|
|
||||||
class="w-6 h-6 inline-block mb-0.5"
|
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
|
||||||
viewBox="0 0 24 24"
|
|
||||||
><path
|
|
||||||
fill="#fff"
|
|
||||||
d="M9.125 21.1L.7 12.7q-.15-.15-.213-.325T.425 12q0-.2.063-.375T.7 11.3l8.425-8.425q.35-.35.875-.35t.9.375q.375.375.375.875t-.375.875L3.55 12l7.35 7.35q.35.35.35.863t-.375.887q-.375.375-.875.375t-.875-.375Z"
|
|
||||||
/></svg
|
|
||||||
>
|
|
||||||
</label>
|
|
||||||
<h2
|
|
||||||
class="text-center m-auto text-[1.1rem] font-medium text-white mt-5"
|
|
||||||
>
|
|
||||||
Price Alert
|
|
||||||
</h2>
|
|
||||||
</div>
|
|
||||||
<!--End Header-->
|
|
||||||
|
|
||||||
<div class="flex justify-between items-center">
|
|
||||||
<body class="w-11/12 m-auto">
|
|
||||||
<div
|
|
||||||
class="mt-8 text-center flex flex-col justify-center items-center mb-14"
|
|
||||||
>
|
|
||||||
<div class="text-white font-medium text-5xl">
|
|
||||||
${displayPrice}
|
|
||||||
</div>
|
|
||||||
<div class="text-sm text-white text-opacity-[0.5] mt-2">
|
|
||||||
Current Price: ${currentPrice}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="text-center font-medium flex justify-center">
|
|
||||||
{#if (displayPrice / currentPrice - 1) * 100 > 100}
|
|
||||||
<span class="text-[#00FC50]"
|
|
||||||
>{((displayPrice / currentPrice - 1) * 100)?.toFixed(
|
|
||||||
2,
|
|
||||||
)}%</span
|
|
||||||
>
|
|
||||||
{:else if values?.at(0) > 0}
|
|
||||||
<span class="text-[#00FC50]">{values?.at(0)?.toFixed(2)}%</span>
|
|
||||||
{:else if values?.at(0) < 0}
|
|
||||||
<span class="inline-block text-[#FF2F1F]"
|
|
||||||
>{values?.at(0)?.toFixed(2)}%
|
|
||||||
</span>
|
|
||||||
{:else}
|
|
||||||
<span class="inline-block text-white text-opacity-[0.6]"
|
|
||||||
>0%</span
|
|
||||||
>
|
|
||||||
{/if}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div
|
|
||||||
class="positive-negative-slider"
|
|
||||||
style="--range: {Math.abs(
|
|
||||||
values[0] / 2,
|
|
||||||
)}%; {origin}; --range-color: {color};"
|
|
||||||
>
|
|
||||||
<RangeSlider
|
|
||||||
id="large"
|
|
||||||
on:change={() =>
|
|
||||||
(displayPrice = (
|
|
||||||
currentPrice *
|
|
||||||
(1 + values?.at(0) / 100)
|
|
||||||
)?.toFixed(2))}
|
|
||||||
suffix="%"
|
|
||||||
min={-100}
|
|
||||||
max={100}
|
|
||||||
all={false}
|
|
||||||
first={false}
|
|
||||||
last={false}
|
|
||||||
rest={false}
|
|
||||||
hoverable={false}
|
|
||||||
bind:values
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div
|
|
||||||
class="{values?.at(0) !== 0
|
|
||||||
? 'invisible'
|
|
||||||
: ''} text-white text-opacity-60 m-auto text-center text-sm"
|
|
||||||
>
|
|
||||||
Set a trigger by moving the slider.
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="w-full pt-4 flex justify-end items-center ml-auto pr-8">
|
|
||||||
<button
|
|
||||||
on:click={handleCreateAlert}
|
|
||||||
class="ml-auto cursor-pointer px-5 py-2 rounded-full transition ease-out {values?.at(
|
|
||||||
0,
|
|
||||||
) !== 0
|
|
||||||
? 'bg-[#0DDE00]'
|
|
||||||
: 'bg-gray-600'} text-center text-black font-medium"
|
|
||||||
>
|
|
||||||
Create
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div
|
|
||||||
class="flex flex-wrap pl-5 rounded-xl bg-[#000] max-w-sm mx-auto mt-5"
|
|
||||||
>
|
|
||||||
{#each Array.from({ length: 9 }, (_, i) => i + 1) as number}
|
|
||||||
<div class="w-1/3">
|
|
||||||
<button
|
|
||||||
id={"numPad-" + number}
|
|
||||||
on:click={() => numPadInput(number)}
|
|
||||||
class="transition ease-out w-20 h-20 text-2xl text-white font-bold rounded-full"
|
|
||||||
>{number}</button
|
|
||||||
>
|
|
||||||
</div>
|
|
||||||
{/each}
|
|
||||||
<div class="w-1/3">
|
|
||||||
<button
|
|
||||||
id="numPad-dot"
|
|
||||||
on:click={() => numPadInput("dot")}
|
|
||||||
class="transition ease-out w-20 h-20 text-2xl text-white font-bold rounded-full"
|
|
||||||
>.</button
|
|
||||||
>
|
|
||||||
</div>
|
|
||||||
<div class="w-1/3">
|
|
||||||
<button
|
|
||||||
id="numPad-0"
|
|
||||||
on:click={() => numPadInput(0)}
|
|
||||||
class="transition ease-out w-20 h-20 text-2xl text-white font-bold rounded-full"
|
|
||||||
>0</button
|
|
||||||
>
|
|
||||||
</div>
|
|
||||||
<div class="w-1/3">
|
|
||||||
<button
|
|
||||||
id="numPad-remove"
|
|
||||||
on:click={() => numPadInput("remove")}
|
|
||||||
class="transition ease-out w-20 h-20 text-2xl text-white font-bold rounded-full"
|
|
||||||
>
|
|
||||||
<svg
|
|
||||||
class="w-6 h-6 inline-block"
|
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
|
||||||
viewBox="0 0 24 24"
|
|
||||||
><path
|
|
||||||
fill="gray"
|
|
||||||
d="M9.125 21.1L.7 12.7q-.15-.15-.213-.325T.425 12q0-.2.063-.375T.7 11.3l8.425-8.425q.35-.35.875-.35t.9.375q.375.375.375.875t-.375.875L3.55 12l7.35 7.35q.35.35.35.863t-.375.887q-.375.375-.875.375t-.875-.375Z"
|
|
||||||
/></svg
|
|
||||||
>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!--End Mobile Price Alert-->
|
|
||||||
{/if}
|
|
||||||
|
|
||||||
<style>
|
|
||||||
#large {
|
|
||||||
font-size: 1em;
|
|
||||||
margin-inline: 0;
|
|
||||||
--range-handle-focus: gray;
|
|
||||||
}
|
|
||||||
#large .rangeFloat {
|
|
||||||
font-size: 1.2em;
|
|
||||||
}
|
|
||||||
|
|
||||||
#x {
|
|
||||||
margin-inline: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.positive-negative-slider {
|
|
||||||
background: white;
|
|
||||||
position: relative;
|
|
||||||
--range-slider: transparent;
|
|
||||||
margin-inline: 1em;
|
|
||||||
border-radius: 10px;
|
|
||||||
}
|
|
||||||
.positive-negative-slider::after {
|
|
||||||
content: "";
|
|
||||||
position: absolute;
|
|
||||||
left: var(--left);
|
|
||||||
right: var(--right);
|
|
||||||
top: 0;
|
|
||||||
bottom: 0;
|
|
||||||
width: var(--range, 0);
|
|
||||||
background-color: var(--range-color);
|
|
||||||
border-radius: inherit;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|||||||
@ -620,7 +620,7 @@
|
|||||||
>Reddit Tracker</a
|
>Reddit Tracker</a
|
||||||
>
|
>
|
||||||
</Button>
|
</Button>
|
||||||
|
<!--
|
||||||
<Button
|
<Button
|
||||||
builders={[builder]}
|
builders={[builder]}
|
||||||
type="submit"
|
type="submit"
|
||||||
@ -632,6 +632,7 @@
|
|||||||
>Lobbying Tracker</a
|
>Lobbying Tracker</a
|
||||||
>
|
>
|
||||||
</Button>
|
</Button>
|
||||||
|
-->
|
||||||
<Button
|
<Button
|
||||||
builders={[builder]}
|
builders={[builder]}
|
||||||
type="submit"
|
type="submit"
|
||||||
@ -1084,12 +1085,13 @@
|
|||||||
class="text-[1rem] text-white ml-4 mt-4"
|
class="text-[1rem] text-white ml-4 mt-4"
|
||||||
>Reddit Tracker</a
|
>Reddit Tracker</a
|
||||||
>
|
>
|
||||||
|
<!--
|
||||||
<a
|
<a
|
||||||
href="/corporate-lobbying-tracker"
|
href="/corporate-lobbying-tracker"
|
||||||
class="text-[1rem] text-white ml-4 mt-4"
|
class="text-[1rem] text-white ml-4 mt-4"
|
||||||
>Lobbying Tracker</a
|
>Lobbying Tracker</a
|
||||||
>
|
>
|
||||||
|
-->
|
||||||
<a
|
<a
|
||||||
href="/sentiment-tracker"
|
href="/sentiment-tracker"
|
||||||
class="text-[1rem] text-white ml-4 mt-4"
|
class="text-[1rem] text-white ml-4 mt-4"
|
||||||
|
|||||||
@ -155,7 +155,7 @@
|
|||||||
</svelte:head>
|
</svelte:head>
|
||||||
|
|
||||||
<section
|
<section
|
||||||
class="w-full max-w-3xl sm:max-w-screen-2xl overflow-hidden pb-20 pt-5 px-4 lg:px-3"
|
class="w-full max-w-3xl sm:max-w-screen-2xl overflow-hidden min-h-screen pb-20 pt-5 px-4 lg:px-3"
|
||||||
>
|
>
|
||||||
<div class="text-sm sm:text-[1rem] breadcrumbs">
|
<div class="text-sm sm:text-[1rem] breadcrumbs">
|
||||||
<ul>
|
<ul>
|
||||||
|
|||||||
@ -19,6 +19,8 @@
|
|||||||
import { page } from "$app/stores";
|
import { page } from "$app/stores";
|
||||||
import toast from "svelte-french-toast";
|
import toast from "svelte-french-toast";
|
||||||
import CryptoProfileCard from "$lib/components/CryptoProfileCard.svelte";
|
import CryptoProfileCard from "$lib/components/CryptoProfileCard.svelte";
|
||||||
|
import PriceAlert from "$lib/components/PriceAlert.svelte";
|
||||||
|
|
||||||
export let data;
|
export let data;
|
||||||
|
|
||||||
//$assetType = 'stock';
|
//$assetType = 'stock';
|
||||||
@ -209,18 +211,10 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
let LoginPopup;
|
let LoginPopup;
|
||||||
let PriceAlert;
|
|
||||||
|
|
||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
if (!data?.user) {
|
if (!data?.user) {
|
||||||
LoginPopup = (await import("$lib/components/LoginPopup.svelte")).default;
|
LoginPopup = (await import("$lib/components/LoginPopup.svelte")).default;
|
||||||
} else {
|
|
||||||
/*
|
|
||||||
AddPortfolio = (await import('$lib/components/AddPortfolio.svelte')).default;
|
|
||||||
BuyTrade = (await import('$lib/components/BuyTrade.svelte')).default;
|
|
||||||
SellTrade = (await import('$lib/components/SellTrade.svelte')).default;
|
|
||||||
*/
|
|
||||||
PriceAlert = (await import("$lib/components/PriceAlert.svelte")).default;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//const startTime = currentDateTime.set({ hour: 15, minute: 30 });
|
//const startTime = currentDateTime.set({ hour: 15, minute: 30 });
|
||||||
@ -935,107 +929,102 @@
|
|||||||
{/if}
|
{/if}
|
||||||
-->
|
-->
|
||||||
|
|
||||||
{#if PriceAlert}
|
<PriceAlert {data} ticker={$cryptoTicker} />
|
||||||
<PriceAlert {data} />
|
|
||||||
{/if}
|
|
||||||
|
|
||||||
<!--Start Type of Trade-->
|
<!--Start Type of Trade-->
|
||||||
|
|
||||||
<input type="checkbox" id="typeOfTrade" class="modal-toggle" />
|
<input type="checkbox" id="typeOfTrade" class="modal-toggle" />
|
||||||
|
|
||||||
<dialog
|
<dialog
|
||||||
id="typeOfTrade"
|
id="addWatchListModal"
|
||||||
class="modal modal-bottom sm:modal-middle overflow-hidden"
|
class="modal modal-bottom sm:modal-middle bg-[#000] bg-opacity-[0.5]"
|
||||||
>
|
>
|
||||||
<label
|
<label
|
||||||
for="typeOfTrade"
|
id="addWatchListModal"
|
||||||
class="cursor-pointer modal-backdrop bg-[#fff] bg-opacity-[0.08]"
|
for="addWatchListModal"
|
||||||
|
class="cursor-pointer modal-backdrop"
|
||||||
></label>
|
></label>
|
||||||
|
|
||||||
<div class="modal-box w-full bg-[#000] border border-slate-600 pb-10">
|
<div
|
||||||
<div class="flex flex-col">
|
class="modal-box rounded-md w-full bg-[#1E222D] sm:border sm:border-gray-600"
|
||||||
<div class="text-white text-md flex flex-col flex-shrink-0">
|
>
|
||||||
<div class="rounded-full w-10 h-10 relative bg-gray-900 mb-2">
|
<label
|
||||||
<img
|
for="addWatchListModal"
|
||||||
class="rounded-full w-6 h-6 absolute inset-1/2 transform -translate-x-1/2 -translate-y-1/2"
|
class="cursor-pointer bg-[#1E222D] absolute right-5 top-2 text-[1.8rem] text-white"
|
||||||
src={`https://financialmodelingprep.com/image-stock/${$cryptoTicker}.png`}
|
>
|
||||||
/>
|
✕
|
||||||
</div>
|
</label>
|
||||||
<span class="mb-1">
|
|
||||||
{$displayCompanyName?.length > 30
|
|
||||||
? $displayCompanyName?.slice(0, 30) + "..."
|
|
||||||
: $displayCompanyName}
|
|
||||||
</span>
|
|
||||||
<div class="flex flex-row items-center mb-10">
|
|
||||||
<span class="mb-1 text-sm font-medium">
|
|
||||||
Current Price: ${$currentPortfolioPrice}
|
|
||||||
</span>
|
|
||||||
<span class="text-blue-400 text-sm font-medium ml-auto">
|
|
||||||
Holding Shares: {holdingShares}
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="text-white">
|
<div class="text-white">
|
||||||
<h3 class="font-bold text-2xl mb-5">Type of Trade</h3>
|
<h3 class="font-semibold text-lg sm:text-xl mb-10">Add to Watchlist</h3>
|
||||||
|
|
||||||
<ul class="menu dropdown-content text-white bg-[#000] rounded -ml-6">
|
<div class="flex flex-col items-center w-full max-w-3xl bg-[#1E222D]">
|
||||||
<li class="mb-3">
|
{#each userWatchList as item}
|
||||||
<label
|
<label
|
||||||
for="typeOfTrade"
|
on:click|stopPropagation={() => toggleUserWatchlist(item?.id)}
|
||||||
on:click={() => handleTypeOfTrade("buy")}
|
class="cursor-pointer w-full flex flex-row justify-start items-center mb-5"
|
||||||
class="cursor-pointer flex flex-row justify-start items-center"
|
|
||||||
>
|
>
|
||||||
<div class="rounded-full w-10 h-10 relative bg-gray-800">
|
<div
|
||||||
|
class="flex flex-row items-center w-full bg-[#2A2E39] p-3 rounded-md {item?.ticker?.includes(
|
||||||
|
$cryptoTicker,
|
||||||
|
)
|
||||||
|
? 'border border-gray-400'
|
||||||
|
: ''}"
|
||||||
|
>
|
||||||
|
<div class="flex flex-col items-center w-full">
|
||||||
|
<span class="ml-1 text-white font-medium mr-auto">
|
||||||
|
{item?.title}
|
||||||
|
</span>
|
||||||
|
<span class="ml-1 text-white text-sm font-medium mr-auto">
|
||||||
|
{item?.ticker?.length}
|
||||||
|
{item?.ticker?.length !== 1 ? "Companies" : "Company"}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div
|
||||||
|
class="rounded-full w-8 h-8 relative border border-[#737373]"
|
||||||
|
>
|
||||||
|
{#if item?.ticker?.includes($cryptoTicker)}
|
||||||
<svg
|
<svg
|
||||||
class="h-5 w-5 absolute inset-1/2 transform -translate-x-1/2 -translate-y-1/2"
|
class="w-full h-full rounded-full"
|
||||||
viewBox="0 0 16 16"
|
viewBox="0 0 48 48"
|
||||||
version="1.1"
|
version="1.1"
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||||
fill="green"
|
fill="#09090B000"
|
||||||
><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g
|
><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g
|
||||||
id="SVGRepo_tracerCarrier"
|
id="SVGRepo_tracerCarrier"
|
||||||
stroke-linecap="round"
|
stroke-linecap="round"
|
||||||
stroke-linejoin="round"
|
stroke-linejoin="round"
|
||||||
></g><g id="SVGRepo_iconCarrier">
|
></g><g id="SVGRepo_iconCarrier">
|
||||||
<rect width="16" height="16" id="icon-bound" fill="none"
|
<!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
|
||||||
></rect>
|
<title>ic_fluent_checkmark_circle_48_filled</title>
|
||||||
|
<desc>Created with Sketch.</desc>
|
||||||
|
<g
|
||||||
|
stroke="none"
|
||||||
|
stroke-width="1"
|
||||||
|
fill="none"
|
||||||
|
fill-rule="evenodd"
|
||||||
|
>
|
||||||
|
<g
|
||||||
|
id="ic_fluent_checkmark_circle_48_filled"
|
||||||
|
fill="#fff"
|
||||||
|
fill-rule="nonzero"
|
||||||
|
>
|
||||||
<path
|
<path
|
||||||
d="M0,11h11.2l-2.6,2.6L10,15l6-6H0V11z M4.8,5l2.6-2.6L6,1L0,7h16V5H4.8z"
|
d="M24,4 C35.045695,4 44,12.954305 44,24 C44,35.045695 35.045695,44 24,44 C12.954305,44 4,35.045695 4,24 C4,12.954305 12.954305,4 24,4 Z M32.6338835,17.6161165 C32.1782718,17.1605048 31.4584514,17.1301307 30.9676119,17.5249942 L30.8661165,17.6161165 L20.75,27.732233 L17.1338835,24.1161165 C16.6457281,23.6279612 15.8542719,23.6279612 15.3661165,24.1161165 C14.9105048,24.5717282 14.8801307,25.2915486 15.2749942,25.7823881 L15.3661165,25.8838835 L19.8661165,30.3838835 C20.3217282,30.8394952 21.0415486,30.8698693 21.5323881,30.4750058 L21.6338835,30.3838835 L32.6338835,19.3838835 C33.1220388,18.8957281 33.1220388,18.1042719 32.6338835,17.6161165 Z"
|
||||||
></path>
|
>
|
||||||
|
</path>
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
</g></svg
|
</g></svg
|
||||||
>
|
>
|
||||||
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
<span class="ml-1 text-white text-lg font-medium"
|
|
||||||
>Buy {$cryptoTicker} Shares</span
|
|
||||||
>
|
|
||||||
</label>
|
|
||||||
</li>
|
|
||||||
<li class="mb-3">
|
|
||||||
<label
|
|
||||||
for="typeOfTrade"
|
|
||||||
on:click={() => handleTypeOfTrade("sell")}
|
|
||||||
class="cursor-pointer flex flex-row justify-start items-center"
|
|
||||||
>
|
|
||||||
<div class="rounded-full w-10 h-10 relative bg-gray-800">
|
|
||||||
<svg
|
|
||||||
class="h-5 w-5 absolute inset-1/2 transform -translate-x-1/2 -translate-y-1/2"
|
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
|
||||||
viewBox="0 0 24 24"
|
|
||||||
><path
|
|
||||||
fill="red"
|
|
||||||
d="M14.25 21.4q-.575.575-1.425.575T11.4 21.4l-8.8-8.8q-.275-.275-.438-.65T2 11.15V4q0-.825.588-1.413T4 2h7.15q.425 0 .8.163t.65.437l8.8 8.825q.575.575.575 1.413T21.4 14.25l-7.15 7.15ZM6.5 8q.625 0 1.063-.438T8 6.5q0-.625-.438-1.063T6.5 5q-.625 0-1.063.438T5 6.5q0 .625.438 1.063T6.5 8Z"
|
|
||||||
/></svg
|
|
||||||
>
|
|
||||||
</div>
|
</div>
|
||||||
<span class="ml-1 text-white text-lg font-medium">
|
|
||||||
Sell {$cryptoTicker} Shares
|
|
||||||
</span>
|
|
||||||
</label>
|
</label>
|
||||||
</li>
|
{/each}
|
||||||
</ul>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</dialog>
|
</dialog>
|
||||||
|
|||||||
@ -21,6 +21,7 @@
|
|||||||
import { page } from "$app/stores";
|
import { page } from "$app/stores";
|
||||||
import toast from "svelte-french-toast";
|
import toast from "svelte-french-toast";
|
||||||
import Markethour from "$lib/components/Markethour.svelte";
|
import Markethour from "$lib/components/Markethour.svelte";
|
||||||
|
import PriceAlert from "$lib/components/PriceAlert.svelte";
|
||||||
|
|
||||||
export let data;
|
export let data;
|
||||||
$: $realtimePrice = data?.getStockQuote?.price?.toFixed(2);
|
$: $realtimePrice = data?.getStockQuote?.price?.toFixed(2);
|
||||||
@ -194,16 +195,10 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
let LoginPopup;
|
let LoginPopup;
|
||||||
let PriceAlert;
|
|
||||||
|
|
||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
if (!data?.user) {
|
if (!data?.user) {
|
||||||
LoginPopup = (await import("$lib/components/LoginPopup.svelte")).default;
|
LoginPopup = (await import("$lib/components/LoginPopup.svelte")).default;
|
||||||
} else {
|
|
||||||
//AddPortfolio = (await import('$lib/components/AddPortfolio.svelte')).default;
|
|
||||||
//BuyTrade = (await import('$lib/components/BuyTrade.svelte')).default;
|
|
||||||
//SellTrade = (await import('$lib/components/SellTrade.svelte')).default;
|
|
||||||
PriceAlert = (await import("$lib/components/PriceAlert.svelte")).default;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($isOpen) {
|
if ($isOpen) {
|
||||||
@ -747,10 +742,7 @@
|
|||||||
<!--End Login Modal-->
|
<!--End Login Modal-->
|
||||||
|
|
||||||
<!--Start SellTrade Modal-->
|
<!--Start SellTrade Modal-->
|
||||||
{#if PriceAlert}
|
<PriceAlert {data} ticker={$etfTicker} />
|
||||||
<PriceAlert {data} />
|
|
||||||
{/if}
|
|
||||||
|
|
||||||
<!--Start Add Watchlist Modal-->
|
<!--Start Add Watchlist Modal-->
|
||||||
<input type="checkbox" id="addWatchListModal" class="modal-toggle" />
|
<input type="checkbox" id="addWatchListModal" class="modal-toggle" />
|
||||||
|
|
||||||
@ -764,10 +756,12 @@
|
|||||||
class="cursor-pointer modal-backdrop"
|
class="cursor-pointer modal-backdrop"
|
||||||
></label>
|
></label>
|
||||||
|
|
||||||
<div class="modal-box w-full bg-[#191919] sm:border sm:border-gray-800">
|
<div
|
||||||
|
class="modal-box rounded-md w-full bg-[#1E222D] sm:border sm:border-gray-600"
|
||||||
|
>
|
||||||
<label
|
<label
|
||||||
for="addWatchListModal"
|
for="addWatchListModal"
|
||||||
class="cursor-pointer bg-[#191919] absolute right-5 top-2 text-[1.8rem] text-white"
|
class="cursor-pointer bg-[#1E222D] absolute right-5 top-2 text-[1.8rem] text-white"
|
||||||
>
|
>
|
||||||
✕
|
✕
|
||||||
</label>
|
</label>
|
||||||
@ -775,26 +769,24 @@
|
|||||||
<div class="text-white">
|
<div class="text-white">
|
||||||
<h3 class="font-semibold text-lg sm:text-xl mb-10">Add to Watchlist</h3>
|
<h3 class="font-semibold text-lg sm:text-xl mb-10">Add to Watchlist</h3>
|
||||||
|
|
||||||
<div class="flex flex-col items-center w-full max-w-3xl bg-[#191919]">
|
<div class="flex flex-col items-center w-full max-w-3xl bg-[#1E222D]">
|
||||||
{#each userWatchList as item}
|
{#each userWatchList as item}
|
||||||
<label
|
<label
|
||||||
on:click|stopPropagation={() => toggleUserWatchlist(item?.id)}
|
on:click|stopPropagation={() => toggleUserWatchlist(item?.id)}
|
||||||
class="cursor-pointer w-full flex flex-row justify-start items-center mb-5"
|
class="cursor-pointer w-full flex flex-row justify-start items-center mb-5"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="flex flex-row items-center w-full bg-[#313131] p-3 rounded-md {item?.ticker?.includes(
|
class="flex flex-row items-center w-full bg-[#2A2E39] p-3 rounded-md {item?.ticker?.includes(
|
||||||
$etfTicker,
|
$etfTicker,
|
||||||
)
|
)
|
||||||
? 'ring-2 ring-[#04E000]'
|
? 'border border-gray-400'
|
||||||
: ''}"
|
: ''}"
|
||||||
>
|
>
|
||||||
<div class="flex flex-col items-center w-full">
|
<div class="flex flex-col items-center w-full">
|
||||||
<span class="ml-1 text-white font-medium mr-auto">
|
<span class="ml-1 text-white font-medium mr-auto">
|
||||||
{item?.title}
|
{item?.title}
|
||||||
</span>
|
</span>
|
||||||
<span
|
<span class="ml-1 text-white text-sm font-medium mr-auto">
|
||||||
class="ml-1 text-white text-opacity-40 text-sm font-medium mr-auto"
|
|
||||||
>
|
|
||||||
{item?.ticker?.length}
|
{item?.ticker?.length}
|
||||||
{item?.ticker?.length !== 1 ? "Companies" : "Company"}
|
{item?.ticker?.length !== 1 ? "Companies" : "Company"}
|
||||||
</span>
|
</span>
|
||||||
@ -827,7 +819,7 @@
|
|||||||
>
|
>
|
||||||
<g
|
<g
|
||||||
id="ic_fluent_checkmark_circle_48_filled"
|
id="ic_fluent_checkmark_circle_48_filled"
|
||||||
fill="#04E000"
|
fill="#fff"
|
||||||
fill-rule="nonzero"
|
fill-rule="nonzero"
|
||||||
>
|
>
|
||||||
<path
|
<path
|
||||||
|
|||||||
@ -24,6 +24,7 @@
|
|||||||
import toast from "svelte-french-toast";
|
import toast from "svelte-french-toast";
|
||||||
import { convertTimestamp } from "$lib/utils";
|
import { convertTimestamp } from "$lib/utils";
|
||||||
import AIScore from "$lib/components/AIScore.svelte";
|
import AIScore from "$lib/components/AIScore.svelte";
|
||||||
|
import PriceAlert from "$lib/components/PriceAlert.svelte";
|
||||||
|
|
||||||
export let data;
|
export let data;
|
||||||
let prePostData = data?.getPrePostQuote || {};
|
let prePostData = data?.getPrePostQuote || {};
|
||||||
@ -203,16 +204,10 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
let LoginPopup;
|
let LoginPopup;
|
||||||
let PriceAlert;
|
|
||||||
|
|
||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
if (!data?.user) {
|
if (!data?.user) {
|
||||||
LoginPopup = (await import("$lib/components/LoginPopup.svelte")).default;
|
LoginPopup = (await import("$lib/components/LoginPopup.svelte")).default;
|
||||||
} else {
|
|
||||||
//AddPortfolio = (await import('$lib/components/AddPortfolio.svelte')).default;
|
|
||||||
//BuyTrade = (await import('$lib/components/BuyTrade.svelte')).default;
|
|
||||||
//SellTrade = (await import('$lib/components/SellTrade.svelte')).default;
|
|
||||||
PriceAlert = (await import("$lib/components/PriceAlert.svelte")).default;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($isOpen) {
|
if ($isOpen) {
|
||||||
@ -978,9 +973,7 @@
|
|||||||
<!--End Login Modal-->
|
<!--End Login Modal-->
|
||||||
|
|
||||||
<!--Start SellTrade Modal-->
|
<!--Start SellTrade Modal-->
|
||||||
{#if PriceAlert}
|
<PriceAlert {data} ticker={$stockTicker} />
|
||||||
<PriceAlert {data} />
|
|
||||||
{/if}
|
|
||||||
|
|
||||||
<!--Start Add Watchlist Modal-->
|
<!--Start Add Watchlist Modal-->
|
||||||
<input type="checkbox" id="addWatchListModal" class="modal-toggle" />
|
<input type="checkbox" id="addWatchListModal" class="modal-toggle" />
|
||||||
@ -995,10 +988,12 @@
|
|||||||
class="cursor-pointer modal-backdrop"
|
class="cursor-pointer modal-backdrop"
|
||||||
></label>
|
></label>
|
||||||
|
|
||||||
<div class="modal-box w-full bg-[#191919] sm:border sm:border-gray-800">
|
<div
|
||||||
|
class="modal-box rounded-md w-full bg-[#1E222D] sm:border sm:border-gray-600"
|
||||||
|
>
|
||||||
<label
|
<label
|
||||||
for="addWatchListModal"
|
for="addWatchListModal"
|
||||||
class="cursor-pointer bg-[#191919] absolute right-5 top-2 text-[1.8rem] text-white"
|
class="cursor-pointer bg-[#1E222D] absolute right-5 top-2 text-[1.8rem] text-white"
|
||||||
>
|
>
|
||||||
✕
|
✕
|
||||||
</label>
|
</label>
|
||||||
@ -1006,26 +1001,24 @@
|
|||||||
<div class="text-white">
|
<div class="text-white">
|
||||||
<h3 class="font-semibold text-lg sm:text-xl mb-10">Add to Watchlist</h3>
|
<h3 class="font-semibold text-lg sm:text-xl mb-10">Add to Watchlist</h3>
|
||||||
|
|
||||||
<div class="flex flex-col items-center w-full max-w-3xl bg-[#191919]">
|
<div class="flex flex-col items-center w-full max-w-3xl bg-[#1E222D]">
|
||||||
{#each userWatchList as item}
|
{#each userWatchList as item}
|
||||||
<label
|
<label
|
||||||
on:click|stopPropagation={() => toggleUserWatchlist(item?.id)}
|
on:click|stopPropagation={() => toggleUserWatchlist(item?.id)}
|
||||||
class="cursor-pointer w-full flex flex-row justify-start items-center mb-5"
|
class="cursor-pointer w-full flex flex-row justify-start items-center mb-5"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="flex flex-row items-center w-full bg-[#313131] p-3 rounded-md {item?.ticker?.includes(
|
class="flex flex-row items-center w-full bg-[#2A2E39] p-3 rounded-md {item?.ticker?.includes(
|
||||||
$stockTicker,
|
$stockTicker,
|
||||||
)
|
)
|
||||||
? 'ring-2 ring-[#04E000]'
|
? 'border border-gray-400'
|
||||||
: ''}"
|
: ''}"
|
||||||
>
|
>
|
||||||
<div class="flex flex-col items-center w-full">
|
<div class="flex flex-col items-center w-full">
|
||||||
<span class="ml-1 text-white font-medium mr-auto">
|
<span class="ml-1 text-white font-medium mr-auto">
|
||||||
{item?.title}
|
{item?.title}
|
||||||
</span>
|
</span>
|
||||||
<span
|
<span class="ml-1 text-white text-sm font-medium mr-auto">
|
||||||
class="ml-1 text-white text-opacity-40 text-sm font-medium mr-auto"
|
|
||||||
>
|
|
||||||
{item?.ticker?.length}
|
{item?.ticker?.length}
|
||||||
{item?.ticker?.length !== 1 ? "Companies" : "Company"}
|
{item?.ticker?.length !== 1 ? "Companies" : "Company"}
|
||||||
</span>
|
</span>
|
||||||
@ -1058,7 +1051,7 @@
|
|||||||
>
|
>
|
||||||
<g
|
<g
|
||||||
id="ic_fluent_checkmark_circle_48_filled"
|
id="ic_fluent_checkmark_circle_48_filled"
|
||||||
fill="#04E000"
|
fill="#fff"
|
||||||
fill-rule="nonzero"
|
fill-rule="nonzero"
|
||||||
>
|
>
|
||||||
<path
|
<path
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user