This commit is contained in:
MuslemRahimi 2025-03-09 17:53:18 +01:00
parent 3c5e7f3879
commit bc3a6221a6
21 changed files with 151 additions and 210 deletions

View File

@ -1,5 +1,6 @@
<script lang="ts"> <script lang="ts">
import { toast } from "svelte-sonner"; import { toast } from "svelte-sonner";
import { mode } from "mode-watcher";
import veryGoodEmoji from "$lib/assets/veryGoodEmoji.svg"; import veryGoodEmoji from "$lib/assets/veryGoodEmoji.svg";
import goodEmoji from "$lib/assets/goodEmoji.svg"; import goodEmoji from "$lib/assets/goodEmoji.svg";
@ -40,16 +41,14 @@
async function sendFeedback() { async function sendFeedback() {
if (inputValue?.length === 0) { if (inputValue?.length === 0) {
toast.error("Please enter your feedback", { toast.error("Please enter your feedback", {
style: style: `border-radius: 5px; background: #fff; color: #000; border-color: ${$mode === "light" ? "#F9FAFB" : "#4B5563"}; font-size: 15px;`,
"border-radius: 5px; background: #fff; color: #000; border-color: #4B5563; font-size: 15px;",
}); });
return; return;
} }
if (rating?.length === 0 && category === "general") { if (rating?.length === 0 && category === "general") {
toast.error("Please select an emoji", { toast.error("Please select an emoji", {
style: style: `border-radius: 5px; background: #fff; color: #000; border-color: ${$mode === "light" ? "#F9FAFB" : "#4B5563"}; font-size: 15px;`,
"border-radius: 5px; background: #fff; color: #000; border-color: #4B5563; font-size: 15px;",
}); });
return; return;
} }
@ -75,8 +74,7 @@
}); });
toast.success("Thank you for your feedback", { toast.success("Thank you for your feedback", {
style: style: `border-radius: 5px; background: #fff; color: #000; border-color: ${$mode === "light" ? "#F9FAFB" : "#4B5563"}; font-size: 15px;`,
"border-radius: 5px; background: #fff; color: #000; border-color: #4B5563; font-size: 15px;",
}); });
rating = ""; rating = "";

View File

@ -1,6 +1,7 @@
<script lang="ts"> <script lang="ts">
import { enhance } from "$app/forms"; import { enhance } from "$app/forms";
import { toast } from "svelte-sonner"; import { toast } from "svelte-sonner";
import { mode } from "mode-watcher";
import Input from "$lib/components/Input.svelte"; import Input from "$lib/components/Input.svelte";
import { screenWidth } from "$lib/store"; import { screenWidth } from "$lib/store";
@ -20,22 +21,19 @@
case "redirect": case "redirect":
isClicked = true; isClicked = true;
toast.success("Login successfully!", { toast.success("Login successfully!", {
style: style: `border-radius: 5px; background: #fff; color: #000; border-color: ${$mode === "light" ? "#F9FAFB" : "#4B5563"}; font-size: 15px;`,
"border-radius: 5px; background: #fff; color: #000; border-color: #4B5563; font-size: 15px;",
}); });
await update(); await update();
break; break;
case "failure": case "failure":
toast.error("Invalid credentials", { toast.error("Invalid credentials", {
style: style: `border-radius: 5px; background: #fff; color: #000; border-color: ${$mode === "light" ? "#F9FAFB" : "#4B5563"}; font-size: 15px;`,
"border-radius: 5px; background: #fff; color: #000; border-color: #4B5563; font-size: 15px;",
}); });
await update(); await update();
break; break;
case "error": case "error":
toast.error(result.error.message, { toast.error(result.error.message, {
style: style: `border-radius: 5px; background: #fff; color: #000; border-color: ${$mode === "light" ? "#F9FAFB" : "#4B5563"}; font-size: 15px;`,
"border-radius: 5px; background: #fff; color: #000; border-color: #4B5563; font-size: 15px;",
}); });
break; break;
default: default:
@ -67,22 +65,19 @@
case "redirect": case "redirect":
isClicked = true; isClicked = true;
toast.success("Registration successfully!", { toast.success("Registration successfully!", {
style: style: `border-radius: 5px; background: #fff; color: #000; border-color: ${$mode === "light" ? "#F9FAFB" : "#4B5563"}; font-size: 15px;`,
"border-radius: 5px; background: #fff; color: #000; border-color: #4B5563; font-size: 15px;",
}); });
await update(); await update();
break; break;
case "failure": case "failure":
toast.error("Invalid credentials", { toast.error("Invalid credentials", {
style: style: `border-radius: 5px; background: #fff; color: #000; border-color: ${$mode === "light" ? "#F9FAFB" : "#4B5563"}; font-size: 15px;`,
"border-radius: 5px; background: #fff; color: #000; border-color: #4B5563; font-size: 15px;",
}); });
await update(); await update();
break; break;
case "error": case "error":
toast.error(result.error.message, { toast.error(result.error.message, {
style: style: `border-radius: 5px; background: #fff; color: #000; border-color: ${$mode === "light" ? "#F9FAFB" : "#4B5563"}; font-size: 15px;`,
"border-radius: 5px; background: #fff; color: #000; border-color: #4B5563; font-size: 15px;",
}); });
break; break;
default: default:

View File

@ -1,5 +1,6 @@
<script lang="ts"> <script lang="ts">
import { toast } from "svelte-sonner"; import { toast } from "svelte-sonner";
import { mode } from "mode-watcher";
import { openPriceAlert, newPriceAlertData } from "$lib/store"; import { openPriceAlert, newPriceAlertData } from "$lib/store";
@ -19,8 +20,7 @@
// Validate input locally. // Validate input locally.
if (targetPrice < 0) { if (targetPrice < 0) {
toast.error("Target Price must be above zero", { toast.error("Target Price must be above zero", {
style: style: `border-radius: 5px; background: #fff; color: #000; border-color: ${$mode === "light" ? "#F9FAFB" : "#4B5563"}; font-size: 15px;`,
"border-radius: 5px; background: #fff; color: #000; border-color: #4B5563; font-size: 15px;",
}); });
return; return;
} }
@ -61,8 +61,7 @@
loading: "Creating price alert...", loading: "Creating price alert...",
success: "Successfully created price alert", success: "Successfully created price alert",
error: (err) => err.message || "Failed to create price alert", error: (err) => err.message || "Failed to create price alert",
style: style: `border-radius: 5px; background: #fff; color: #000; border-color: ${$mode === "light" ? "#F9FAFB" : "#4B5563"}; font-size: 15px;`,
"border-radius: 5px; background: #fff; color: #000; border-color: #4B5563; font-size: 15px;",
}); });
// Await the promise and handle the result. // Await the promise and handle the result.

View File

@ -1,5 +1,6 @@
<script lang="ts"> <script lang="ts">
import { toast } from "svelte-sonner"; import { toast } from "svelte-sonner";
import { mode } from "mode-watcher";
export let url; export let url;
@ -14,8 +15,7 @@
.catch((error) => console.log("Error sharing content:", error)); .catch((error) => console.log("Error sharing content:", error));
} else { } else {
toast?.error("Sharing is not supported by your device", { toast?.error("Sharing is not supported by your device", {
style: style: `border-radius: 5px; background: #fff; color: #000; border-color: ${$mode === "light" ? "#F9FAFB" : "#4B5563"}; font-size: 15px;`,
"border-radius: 5px; background: #fff; color: #000; border-color: #4B5563; font-size: 15px;",
}); });
} }
} }

View File

@ -5,6 +5,7 @@
import VirtualList from "svelte-tiny-virtual-list"; import VirtualList from "svelte-tiny-virtual-list";
import HoverStockChart from "$lib/components/HoverStockChart.svelte"; import HoverStockChart from "$lib/components/HoverStockChart.svelte";
import { toast } from "svelte-sonner"; import { toast } from "svelte-sonner";
import { mode } from "mode-watcher";
export let data; export let data;
export let optionsWatchlist; export let optionsWatchlist;
@ -94,8 +95,7 @@
} }
} else { } else {
toast.error("Only for Pro Members", { toast.error("Only for Pro Members", {
style: style: `border-radius: 5px; background: #fff; color: #000; border-color: ${$mode === "light" ? "#F9FAFB" : "#4B5563"}; font-size: 15px;`,
"border-radius: 5px; background: #fff; color: #000; border-color: #4B5563; font-size: 15px;",
}); });
} }
} }

View File

@ -13,6 +13,7 @@
import DownloadData from "$lib/components/DownloadData.svelte"; import DownloadData from "$lib/components/DownloadData.svelte";
import { page } from "$app/stores"; import { page } from "$app/stores";
import { toast } from "svelte-sonner"; import { toast } from "svelte-sonner";
import { mode } from "mode-watcher";
export let data; export let data;
export let rawData; export let rawData;
@ -269,8 +270,7 @@
saveRules(); saveRules();
} else { } else {
toast.error("Only for Pro Members", { toast.error("Only for Pro Members", {
style: style: `border-radius: 5px; background: #fff; color: #000; border-color: ${$mode === "light" ? "#F9FAFB" : "#4B5563"}; font-size: 15px;`,
"border-radius: 5px; background: #fff; color: #000; border-color: #4B5563; font-size: 15px;",
}); });
} }
} }

View File

@ -5,6 +5,7 @@
import { cn, sectorList } from "$lib/utils"; import { cn, sectorList } from "$lib/utils";
import { onMount, onDestroy } from "svelte"; import { onMount, onDestroy } from "svelte";
import { toast } from "svelte-sonner"; import { toast } from "svelte-sonner";
import { mode } from "mode-watcher";
import { DateFormatter, type DateValue } from "@internationalized/date"; import { DateFormatter, type DateValue } from "@internationalized/date";
import * as DropdownMenu from "$lib/components/shadcn/dropdown-menu/index.js"; import * as DropdownMenu from "$lib/components/shadcn/dropdown-menu/index.js";
@ -163,8 +164,7 @@
function handleAddRule() { function handleAddRule() {
if (ruleName === "") { if (ruleName === "") {
toast.error("Please select a rule", { toast.error("Please select a rule", {
style: style: `border-radius: 5px; background: #fff; color: #000; border-color: ${$mode === "light" ? "#F9FAFB" : "#4B5563"}; font-size: 15px;`,
"border-radius: 5px; background: #fff; color: #000; border-color: #4B5563; font-size: 15px;",
}); });
return; return;
} }
@ -440,8 +440,7 @@
} }
} else { } else {
toast.error(`Market is closed`, { toast.error(`Market is closed`, {
style: style: `border-radius: 5px; background: #fff; color: #000; border-color: ${$mode === "light" ? "#F9FAFB" : "#4B5563"}; font-size: 15px;`,
"border-radius: 5px; background: #fff; color: #000; border-color: #4B5563; font-size: 15px;",
}); });
} }
} }
@ -770,8 +769,7 @@
<input <input
on:click={() => on:click={() =>
toast.info("Feature is coming soon 🔥", { toast.info("Feature is coming soon 🔥", {
style: style: `border-radius: 5px; background: #fff; color: #000; border-color: ${$mode === "light" ? "#F9FAFB" : "#4B5563"}; font-size: 15px;`,
"border-radius: 5px; background: #fff; color: #000; border-color: #4B5563; font-size: 15px;",
})} })}
type="checkbox" type="checkbox"
checked={mode} checked={mode}
@ -854,8 +852,7 @@
<Button <Button
on:click={() => on:click={() =>
toast.info("Feature is coming soon 🔥", { toast.info("Feature is coming soon 🔥", {
style: style: `border-radius: 5px; background: #fff; color: #000; border-color: ${$mode === "light" ? "#F9FAFB" : "#4B5563"}; font-size: 15px;`,
"border-radius: 5px; background: #fff; color: #000; border-color: #4B5563; font-size: 15px;",
})} })}
class={cn( class={cn(
"w-full sm:w-[160px] truncate sm:mr-3 py-3 bg-[#000] sm:hover:bg-[#000] sm:hover:text-white text-white justify-center sm:justify-start text-center sm:text-left font-normal border-none rounded-md", "w-full sm:w-[160px] truncate sm:mr-3 py-3 bg-[#000] sm:hover:bg-[#000] sm:hover:text-white text-white justify-center sm:justify-start text-center sm:text-left font-normal border-none rounded-md",

View File

@ -22,6 +22,7 @@
import { onMount, onDestroy, afterUpdate } from "svelte"; import { onMount, onDestroy, afterUpdate } from "svelte";
import { page } from "$app/stores"; import { page } from "$app/stores";
import { toast } from "svelte-sonner"; import { toast } from "svelte-sonner";
import { mode } from "mode-watcher";
import { convertTimestamp } from "$lib/utils"; import { convertTimestamp } from "$lib/utils";
import PriceAlert from "$lib/components/PriceAlert.svelte"; import PriceAlert from "$lib/components/PriceAlert.svelte";
@ -58,8 +59,7 @@
?.catch((error) => console.log("Error sharing content:", error)); ?.catch((error) => console.log("Error sharing content:", error));
} else { } else {
toast.error("Sharing is not supported by your device", { toast.error("Sharing is not supported by your device", {
style: style: `border-radius: 5px; background: #fff; color: #000; border-color: ${$mode === "light" ? "#F9FAFB" : "#4B5563"}; font-size: 15px;`,
"border-radius: 5px; background: #fff; color: #000; border-color: #4B5563; font-size: 15px;",
}); });
} }
} }
@ -107,8 +107,7 @@
updatedTickers.length > 5 updatedTickers.length > 5
) { ) {
toast.error("Upgrade to Pro to add unlimited stocks!", { toast.error("Upgrade to Pro to add unlimited stocks!", {
style: style: `border-radius: 5px; background: #fff; color: #000; border-color: ${$mode === "light" ? "#F9FAFB" : "#4B5563"}; font-size: 15px;`,
"border-radius: 5px; background: #fff; color: #000; border-color: #4B5563; font-size: 15px;",
}); });
return; return;
} }

View File

@ -5,6 +5,7 @@
import { setCache, getCache } from "$lib/store"; import { setCache, getCache } from "$lib/store";
import { onDestroy, onMount } from "svelte"; import { onDestroy, onMount } from "svelte";
import { toast } from "svelte-sonner"; import { toast } from "svelte-sonner";
import { mode } from "mode-watcher";
export let data; export let data;
let isLoaded = false; let isLoaded = false;
@ -65,8 +66,7 @@
} catch (error) { } catch (error) {
console.error("Error loading heatmap:", error); console.error("Error loading heatmap:", error);
toast.error("Failed to load heatmap. Please try again.", { toast.error("Failed to load heatmap. Please try again.", {
style: style: `border-radius: 5px; background: #fff; color: #000; border-color: ${$mode === "light" ? "#F9FAFB" : "#4B5563"}; font-size: 15px;`,
"border-radius: 5px; background: #fff; color: #000; border-color: #4B5563; font-size: 15px;",
}); });
} finally { } finally {
isLoading = false; isLoading = false;
@ -117,8 +117,7 @@
loading: "Downloading heatmap...", loading: "Downloading heatmap...",
success: "Heatmap downloaded!", success: "Heatmap downloaded!",
error: "Download failed. Try again.", error: "Download failed. Try again.",
style: style: `border-radius: 5px; background: #fff; color: #000; border-color: ${$mode === "light" ? "#F9FAFB" : "#4B5563"}; font-size: 15px;`,
"border-radius: 5px; background: #fff; color: #000; border-color: #4B5563; font-size: 15px;",
}, },
); );
} }

View File

@ -22,6 +22,7 @@
import { onMount, onDestroy, afterUpdate } from "svelte"; import { onMount, onDestroy, afterUpdate } from "svelte";
import { page } from "$app/stores"; import { page } from "$app/stores";
import { toast } from "svelte-sonner"; import { toast } from "svelte-sonner";
import { mode } from "mode-watcher";
import { convertTimestamp } from "$lib/utils"; import { convertTimestamp } from "$lib/utils";
import PriceAlert from "$lib/components/PriceAlert.svelte"; import PriceAlert from "$lib/components/PriceAlert.svelte";
@ -61,8 +62,7 @@
?.catch((error) => console.log("Error sharing content:", error)); ?.catch((error) => console.log("Error sharing content:", error));
} else { } else {
toast.error("Sharing is not supported by your device", { toast.error("Sharing is not supported by your device", {
style: style: `border-radius: 5px; background: #fff; color: #000; border-color: ${$mode === "light" ? "#F9FAFB" : "#4B5563"}; font-size: 15px;`,
"border-radius: 5px; background: #fff; color: #000; border-color: #4B5563; font-size: 15px;",
}); });
} }
} }
@ -107,8 +107,7 @@
updatedTickers.length > 5 updatedTickers.length > 5
) { ) {
toast.error("Upgrade to Pro to add unlimited stocks!", { toast.error("Upgrade to Pro to add unlimited stocks!", {
style: style: `border-radius: 5px; background: #fff; color: #000; border-color: ${$mode === "light" ? "#F9FAFB" : "#4B5563"}; font-size: 15px;`,
"border-radius: 5px; background: #fff; color: #000; border-color: #4B5563; font-size: 15px;",
}); });
return; return;
} }

View File

@ -2,6 +2,7 @@
import { enhance } from "$app/forms"; import { enhance } from "$app/forms";
import Input from "$lib/components/Input.svelte"; import Input from "$lib/components/Input.svelte";
import { toast } from "svelte-sonner"; import { toast } from "svelte-sonner";
import { mode } from "mode-watcher";
import SEO from "$lib/components/SEO.svelte"; import SEO from "$lib/components/SEO.svelte";
export let form; export let form;
@ -17,16 +18,14 @@
case "success": case "success":
if (form?.notVerified) { if (form?.notVerified) {
toast.error("Please verify your email first", { toast.error("Please verify your email first", {
style: style: `border-radius: 5px; background: #fff; color: #000; border-color: ${$mode === "light" ? "#F9FAFB" : "#4B5563"}; font-size: 15px;`,
"border-radius: 5px; background: #fff; color: #000; border-color: #4B5563; font-size: 15px;",
}); });
await update(); await update();
break; break;
} else form?.notVerified === false; } else form?.notVerified === false;
{ {
toast.success("Login successfully!", { toast.success("Login successfully!", {
style: style: `border-radius: 5px; background: #fff; color: #000; border-color: ${$mode === "light" ? "#F9FAFB" : "#4B5563"}; font-size: 15px;`,
"border-radius: 5px; background: #fff; color: #000; border-color: #4B5563; font-size: 15px; ",
}); });
await update(); await update();
break; break;
@ -34,22 +33,19 @@
case "redirect": case "redirect":
isClicked = true; isClicked = true;
toast.success("Login successfully!", { toast.success("Login successfully!", {
style: style: `border-radius: 5px; background: #fff; color: #000; border-color: ${$mode === "light" ? "#F9FAFB" : "#4B5563"}; font-size: 15px;`,
"border-radius: 5px; background: #fff; color: #000; border-color: #4B5563; font-size: 15px;",
}); });
await update(); await update();
break; break;
case "failure": case "failure":
toast.error("Invalid credentials", { toast.error("Invalid credentials", {
style: style: `border-radius: 5px; background: #fff; color: #000; border-color: ${$mode === "light" ? "#F9FAFB" : "#4B5563"}; font-size: 15px;`,
"border-radius: 5px; background: #fff; color: #000; border-color: #4B5563; font-size: 15px;",
}); });
await update(); await update();
break; break;
case "error": case "error":
toast.error(result.error.message, { toast.error(result.error.message, {
style: style: `border-radius: 5px; background: #fff; color: #000; border-color: ${$mode === "light" ? "#F9FAFB" : "#4B5563"}; font-size: 15px;`,
"border-radius: 5px; background: #fff; color: #000; border-color: #4B5563; font-size: 15px;",
}); });
break; break;
default: default:

View File

@ -5,6 +5,7 @@
import { cn } from "$lib/utils"; import { cn } from "$lib/utils";
import { onMount, onDestroy } from "svelte"; import { onMount, onDestroy } from "svelte";
import { toast } from "svelte-sonner"; import { toast } from "svelte-sonner";
import { mode } from "mode-watcher";
import { DateFormatter, type DateValue } from "@internationalized/date"; import { DateFormatter, type DateValue } from "@internationalized/date";
import * as DropdownMenu from "$lib/components/shadcn/dropdown-menu/index.js"; import * as DropdownMenu from "$lib/components/shadcn/dropdown-menu/index.js";
@ -230,8 +231,7 @@
function handleAddRule() { function handleAddRule() {
if (ruleName === "") { if (ruleName === "") {
toast.error("Please select a rule", { toast.error("Please select a rule", {
style: style: `border-radius: 5px; background: #fff; color: #000; border-color: ${$mode === "light" ? "#F9FAFB" : "#4B5563"}; font-size: 15px;`,
"border-radius: 5px; background: #fff; color: #000; border-color: #4B5563; font-size: 15px;",
}); });
return; return;
} }
@ -512,8 +512,7 @@
} }
} else { } else {
toast.error(`Market is closed`, { toast.error(`Market is closed`, {
style: style: `border-radius: 5px; background: #fff; color: #000; border-color: ${$mode === "light" ? "#F9FAFB" : "#4B5563"}; font-size: 15px;`,
"border-radius: 5px; background: #fff; color: #000; border-color: #4B5563; font-size: 15px;",
}); });
} }
} }
@ -780,8 +779,7 @@
} }
} else { } else {
toast.error("Only for Pro Members", { toast.error("Only for Pro Members", {
style: style: `border-radius: 5px; background: #fff; color: #000; border-color: ${$mode === "light" ? "#F9FAFB" : "#4B5563"}; font-size: 15px;`,
"border-radius: 5px; background: #fff; color: #000; border-color: #4B5563; font-size: 15px;",
}); });
} }
}; };

View File

@ -9,6 +9,7 @@
} from "$lib/utils"; } from "$lib/utils";
//import { enhance } from '$app/forms'; //import { enhance } from '$app/forms';
import { toast } from "svelte-sonner"; import { toast } from "svelte-sonner";
import { mode } from "mode-watcher";
import { goto } from "$app/navigation"; import { goto } from "$app/navigation";
import { screenWidth, newPriceAlertData } from "$lib/store"; import { screenWidth, newPriceAlertData } from "$lib/store";
@ -84,13 +85,11 @@
async function handleDeleteTickers() { async function handleDeleteTickers() {
if (numberOfChecked === 0) { if (numberOfChecked === 0) {
toast.error(`You need to select symbols before you can delete them`, { toast.error(`You need to select symbols before you can delete them`, {
style: style: `border-radius: 5px; background: #fff; color: #000; border-color: ${$mode === "light" ? "#F9FAFB" : "#4B5563"}; font-size: 15px;`,
"border-radius: 5px; background: #fff; color: #000; border-color: #4B5563; font-size: 15px;",
}); });
} else { } else {
toast.success(`Price alerts deleted successfully`, { toast.success(`Price alerts deleted successfully`, {
style: style: `border-radius: 5px; background: #fff; color: #000; border-color: ${$mode === "light" ? "#F9FAFB" : "#4B5563"}; font-size: 15px;`,
"border-radius: 5px; background: #fff; color: #000; border-color: #4B5563; font-size: 15px;",
}); });
const symbolsToDelete = priceAlertList const symbolsToDelete = priceAlertList

View File

@ -1,6 +1,7 @@
<script lang="ts"> <script lang="ts">
import SEO from "$lib/components/SEO.svelte"; import SEO from "$lib/components/SEO.svelte";
import { toast } from "svelte-sonner"; import { toast } from "svelte-sonner";
import { mode } from "mode-watcher";
import { enhance } from "$app/forms"; import { enhance } from "$app/forms";
import { isPWAInstalled } from "$lib/utils"; import { isPWAInstalled } from "$lib/utils";
@ -23,7 +24,7 @@
let isPushSubscribed = data?.getPushSubscriptionData !== null ? true : false; let isPushSubscribed = data?.getPushSubscriptionData !== null ? true : false;
let notificationChannels = data?.getNotificationChannels; let notificationChannels = data?.getNotificationChannels;
const mode = Object?.entries(notificationChannels) const modeStatus = Object?.entries(notificationChannels)
.filter(([key, value]) => typeof value === "boolean") // Filter boolean properties .filter(([key, value]) => typeof value === "boolean") // Filter boolean properties
.reduce((acc, [key, value]) => { .reduce((acc, [key, value]) => {
acc[key] = value; // Add to mode object acc[key] = value; // Add to mode object
@ -39,29 +40,25 @@
switch (result.type) { switch (result.type) {
case "success": case "success":
toast.success("Subscription Cancelled successfully!", { toast.success("Subscription Cancelled successfully!", {
style: style: `border-radius: 5px; background: #fff; color: #000; border-color: ${$mode === "light" ? "#F9FAFB" : "#4B5563"}; font-size: 15px;`,
"border-radius: 5px; background: #fff; color: #000; border-color: #4B5563; font-size: 15px;",
}); });
await update(); await update();
break; break;
case "redirect": case "redirect":
toast.success("Subscription Cancelled successfully!", { toast.success("Subscription Cancelled successfully!", {
style: style: `border-radius: 5px; background: #fff; color: #000; border-color: ${$mode === "light" ? "#F9FAFB" : "#4B5563"}; font-size: 15px;`,
"border-radius: 5px; background: #fff; color: #000; border-color: #4B5563; font-size: 15px;",
}); });
await update(); await update();
break; break;
case "failure": case "failure":
toast.error("Something went wrong.", { toast.error("Something went wrong.", {
style: style: `border-radius: 5px; background: #fff; color: #000; border-color: ${$mode === "light" ? "#F9FAFB" : "#4B5563"}; font-size: 15px;`,
"border-radius: 5px; background: #fff; color: #000; border-color: #4B5563; font-size: 15px;",
}); });
await update(); await update();
break; break;
case "error": case "error":
toast.error(result.error.message, { toast.error(result.error.message, {
style: style: `border-radius: 5px; background: #fff; color: #000; border-color: ${$mode === "light" ? "#F9FAFB" : "#4B5563"}; font-size: 15px;`,
"border-radius: 5px; background: #fff; color: #000; border-color: #4B5563; font-size: 15px;",
}); });
break; break;
default: default:
@ -85,29 +82,25 @@
switch (result.type) { switch (result.type) {
case "success": case "success":
toast.success("Subscription Reactivate successfully!", { toast.success("Subscription Reactivate successfully!", {
style: style: `border-radius: 5px; background: #fff; color: #000; border-color: ${$mode === "light" ? "#F9FAFB" : "#4B5563"}; font-size: 15px;`,
"border-radius: 5px; background: #fff; color: #000; border-color: #4B5563; font-size: 15px;",
}); });
await update(); await update();
break; break;
case "redirect": case "redirect":
toast.success("Subscription Reactivate successfully!", { toast.success("Subscription Reactivate successfully!", {
style: style: `border-radius: 5px; background: #fff; color: #000; border-color: ${$mode === "light" ? "#F9FAFB" : "#4B5563"}; font-size: 15px;`,
"border-radius: 5px; background: #fff; color: #000; border-color: #4B5563; font-size: 15px;",
}); });
await update(); await update();
break; break;
case "failure": case "failure":
toast.error("Something went wrong.", { toast.error("Something went wrong.", {
style: style: `border-radius: 5px; background: #fff; color: #000; border-color: ${$mode === "light" ? "#F9FAFB" : "#4B5563"}; font-size: 15px;`,
"border-radius: 5px; background: #fff; color: #000; border-color: #4B5563; font-size: 15px;",
}); });
await update(); await update();
break; break;
case "error": case "error":
toast.error(result.error.message, { toast.error(result.error.message, {
style: style: `border-radius: 5px; background: #fff; color: #000; border-color: ${$mode === "light" ? "#F9FAFB" : "#4B5563"}; font-size: 15px;`,
"border-radius: 5px; background: #fff; color: #000; border-color: #4B5563; font-size: 15px;",
}); });
break; break;
default: default:
@ -141,8 +134,7 @@
unsubscribe(); unsubscribe();
isPushSubscribed = false; isPushSubscribed = false;
toast.success("Push notification deactivated successfully!", { toast.success("Push notification deactivated successfully!", {
style: style: `border-radius: 5px; background: #fff; color: #000; border-color: ${$mode === "light" ? "#F9FAFB" : "#4B5563"}; font-size: 15px;`,
"border-radius: 5px; background: #fff; color: #000; border-color: #4B5563; font-size: 15px;",
}); });
} }
@ -152,13 +144,11 @@
if (output?.success === true) { if (output?.success === true) {
isPushSubscribed = true; isPushSubscribed = true;
toast.success("Push notification activated successfully!", { toast.success("Push notification activated successfully!", {
style: style: `border-radius: 5px; background: #fff; color: #000; border-color: ${$mode === "light" ? "#F9FAFB" : "#4B5563"}; font-size: 15px;`,
"border-radius: 5px; background: #fff; color: #000; border-color: #4B5563; font-size: 15px;",
}); });
} else { } else {
toast.error("Your browser does not support push notifications...", { toast.error("Your browser does not support push notifications...", {
style: style: `border-radius: 5px; background: #fff; color: #000; border-color: ${$mode === "light" ? "#F9FAFB" : "#4B5563"}; font-size: 15px;`,
"border-radius: 5px; background: #fff; color: #000; border-color: #4B5563; font-size: 15px;",
}); });
} }
loading = false; loading = false;
@ -167,7 +157,7 @@
async function updateNotificationChannels() { async function updateNotificationChannels() {
const postData = { const postData = {
id: notificationChannels?.id, id: notificationChannels?.id,
...mode, ...modeStatus,
}; };
const response = await fetch("/api/update-notification-channels", { const response = await fetch("/api/update-notification-channels", {
@ -180,7 +170,7 @@
} }
async function toggleMode(state) { async function toggleMode(state) {
mode[state] = !mode[state]; modeStatus[state] = !modeStatus[state];
await updateNotificationChannels(); await updateNotificationChannels();
} }
</script> </script>
@ -191,12 +181,12 @@
/> />
<section <section
class="w-full max-w-3xl sm:max-w-[1400px] overflow-hidden min-h-screen pb-20 pt-5 px-4 lg:px-3" class="text-muted dark:text-white w-full max-w-3xl sm:max-w-[1400px] 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>
<li><a href="/" class="text-gray-300">Home</a></li> <li><a href="/" class="text-muted dark:text-gray-300">Home</a></li>
<li class="text-gray-300">My Account</li> <li class="text-muted dark:text-gray-300">My Account</li>
</ul> </ul>
</div> </div>
@ -207,17 +197,13 @@
> >
<main class="w-full lg:w-3/4 lg:mr-auto"> <main class="w-full lg:w-3/4 lg:mr-auto">
<div class="mb-6 border-b-[2px]"> <div class="mb-6 border-b-[2px]">
<h1 class="mb-1 text-white text-2xl sm:text-3xl font-bold"> <h1 class="mb-1 text-2xl sm:text-3xl font-bold">My Account</h1>
My Account
</h1>
</div> </div>
<div <div
class="rounded border border-gray-600 p-4 text-base xs:p-4 xs:text-lg text-white" class="rounded border border-gray-600 p-4 text-base xs:p-4 xs:text-lg"
> >
<h2 class="text-white text-2xl font-semibold mb-3"> <h2 class=" text-2xl font-semibold mb-3">User Information</h2>
User Information
</h2>
<div class="mt-1"> <div class="mt-1">
<strong>Email:</strong> <strong>Email:</strong>
{data?.user?.email} {data?.user?.email}
@ -230,15 +216,17 @@
year: "numeric", year: "numeric",
})} })}
</div> </div>
<a href="/update-password" class="sm:hover:text-white text-blue-400" <a
href="/update-password"
class="sm:hover:text-muted dark:sm:hover:text-white text-blue-500 dark:text-blue-400"
>Update Password</a >Update Password</a
> >
</div> </div>
<div <div
class="mt-6 rounded border border-gray-600 p-4 text-base xs:p-4 xs:text-lg text-white" class="mt-6 rounded border border-gray-600 p-4 text-base xs:p-4 xs:text-lg"
> >
<h2 class="text-white text-2xl font-semibold mb-3">Notification</h2> <h2 class=" text-2xl font-semibold mb-3">Notification</h2>
Customize your notification alerts based on your preferences. Customize your notification alerts based on your preferences.
<div class="flex flex-col items-start w-full mt-4 mb-4"> <div class="flex flex-col items-start w-full mt-4 mb-4">
@ -246,7 +234,7 @@
<div class="flex flex-row items-center"> <div class="flex flex-row items-center">
<label <label
for="earningsSurpriseInfo" for="earningsSurpriseInfo"
class=" cursor-pointer flex flex-row items-center text-white" class=" cursor-pointer flex flex-row items-center"
> >
<h4>Earnings Surprise</h4> <h4>Earnings Surprise</h4>
</label> </label>
@ -260,12 +248,12 @@
<input <input
on:click={() => toggleMode("earningsSurprise")} on:click={() => toggleMode("earningsSurprise")}
type="checkbox" type="checkbox"
checked={mode["earningsSurprise"]} checked={modeStatus["earningsSurprise"]}
value={mode["earningsSurprise"]} value={modeStatus["earningsSurprise"]}
class="sr-only peer" class="sr-only peer"
/> />
<div <div
class="w-10 h-5 bg-gray-600 rounded-full peer-checked:after:translate-x-4 peer-checked:after:border-white after:content-[''] after:absolute after:top-0.5 after:left-[0.25rem] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-4 after:w-4 after:transition-all peer-checked:bg-purple-500" class="w-10 h-5 bg-gray-600 rounded-full peer-checked:after:translate-x-4 peer-checked:after:border-white after:content-[''] after:absolute after:top-0.5 after:left-[0.25rem] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-4 after:w-4 after:transition-all peer-checked:bg-[#1C64F2]"
></div> ></div>
</label> </label>
</div> </div>
@ -275,7 +263,7 @@
<div class="flex flex-row items-center"> <div class="flex flex-row items-center">
<label <label
for="whyPriceMovedInfo" for="whyPriceMovedInfo"
class=" cursor-pointer flex flex-row items-center text-white" class=" cursor-pointer flex flex-row items-center"
> >
<h4>Why Price Moved</h4> <h4>Why Price Moved</h4>
</label> </label>
@ -289,12 +277,12 @@
<input <input
on:click={() => toggleMode("wiim")} on:click={() => toggleMode("wiim")}
type="checkbox" type="checkbox"
checked={mode["wiim"]} checked={modeStatus["wiim"]}
value={mode["wiim"]} value={modeStatus["wiim"]}
class="sr-only peer" class="sr-only peer"
/> />
<div <div
class="w-10 h-5 bg-gray-600 rounded-full peer-checked:after:translate-x-4 peer-checked:after:border-white after:content-[''] after:absolute after:top-0.5 after:left-[0.25rem] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-4 after:w-4 after:transition-all peer-checked:bg-purple-500" class="w-10 h-5 bg-gray-600 rounded-full peer-checked:after:translate-x-4 peer-checked:after:border-white after:content-[''] after:absolute after:top-0.5 after:left-[0.25rem] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-4 after:w-4 after:transition-all peer-checked:bg-[#1C64F2]"
></div> ></div>
</label> </label>
</div> </div>
@ -304,7 +292,7 @@
<div class="flex flex-row items-center"> <div class="flex flex-row items-center">
<label <label
for="topAnalystInfo" for="topAnalystInfo"
class=" cursor-pointer flex flex-row items-center text-white" class=" cursor-pointer flex flex-row items-center"
> >
<h4>Top Analyst Rating</h4> <h4>Top Analyst Rating</h4>
</label> </label>
@ -318,20 +306,18 @@
<input <input
on:click={() => toggleMode("topAnalyst")} on:click={() => toggleMode("topAnalyst")}
type="checkbox" type="checkbox"
checked={mode["topAnalyst"]} checked={modeStatus["topAnalyst"]}
value={mode["topAnalyst"]} value={modeStatus["topAnalyst"]}
class="sr-only peer" class="sr-only peer"
/> />
<div <div
class="w-10 h-5 bg-gray-600 rounded-full peer-checked:after:translate-x-4 peer-checked:after:border-white after:content-[''] after:absolute after:top-0.5 after:left-[0.25rem] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-4 after:w-4 after:transition-all peer-checked:bg-purple-500" class="w-10 h-5 bg-gray-600 rounded-full peer-checked:after:translate-x-4 peer-checked:after:border-white after:content-[''] after:absolute after:top-0.5 after:left-[0.25rem] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-4 after:w-4 after:transition-all peer-checked:bg-[#1C64F2]"
></div> ></div>
</label> </label>
</div> </div>
</div> </div>
<h3 class="text-white text-xl font-semibold mb-2 mt-4"> <h3 class=" text-xl font-semibold mb-2 mt-4">Push Notification</h3>
Push Notification
</h3>
{#if pwaInstalled} {#if pwaInstalled}
<div class="mt-3"> <div class="mt-3">
{#if nottifPermGranted === null} {#if nottifPermGranted === null}
@ -394,13 +380,11 @@
</div> </div>
<div <div
class="mt-6 rounded border border-gray-600 p-4 text-base xs:p-4 xs:text-lg text-white" class="mt-6 rounded border border-gray-600 p-4 text-base xs:p-4 xs:text-lg"
> >
<h2 class="text-white text-2xl font-semibold mb-3"> <h2 class=" text-2xl font-semibold mb-3">Manage Subscription</h2>
Manage Subscription
</h2>
<div class="flex flex-row items-center"> <div class="flex flex-row items-center">
<span class="text-white text-[1rem] sm:text-lg"> Status: </span> <span class=" text-[1rem] sm:text-lg"> Status: </span>
<div class="ml-2 flex flex-row items-center"> <div class="ml-2 flex flex-row items-center">
<span class="relative flex h-2 w-2"> <span class="relative flex h-2 w-2">
<span <span
@ -422,7 +406,7 @@
></span> ></span>
</span> </span>
<span class="ml-2 text-[1rem] text-slate-200"> <span class="ml-2 text-[1rem] dark:text-slate-200">
{#if data?.user?.freeTrial === true} {#if data?.user?.freeTrial === true}
Active Active
{:else} {:else}
@ -433,7 +417,7 @@
</div> </div>
</div> </div>
{#if subscriptionData?.status_formatted === "Active"} {#if subscriptionData?.status_formatted === "Active"}
<span class="text-white text-sm pr-5"> <span class=" text-sm pr-5">
Your subscription will automatically renew on {new Date( Your subscription will automatically renew on {new Date(
subscriptionData?.renews_at, subscriptionData?.renews_at,
)?.toLocaleDateString("en-GB", { )?.toLocaleDateString("en-GB", {
@ -443,7 +427,7 @@
})} })}
</span> </span>
{:else if subscriptionData?.status_formatted === "Cancelled"} {:else if subscriptionData?.status_formatted === "Cancelled"}
<span class="text-white text-sm"> <span class=" text-sm">
Your subscription will remain active until {new Date( Your subscription will remain active until {new Date(
subscriptionData?.ends_at, subscriptionData?.ends_at,
)?.toLocaleDateString("en-GB", { )?.toLocaleDateString("en-GB", {
@ -454,7 +438,7 @@
</span> </span>
{/if} {/if}
<div class="flex flex-col justify-start items-start mt-4 mb-4"> <div class="flex flex-col justify-start items-start mt-4 mb-4">
<span class="text-white mr-2 text-lg"> Current Plan: </span> <span class=" mr-2 text-lg"> Current Plan: </span>
<span class="text-[1rem]"> <span class="text-[1rem]">
{#if subscriptionData?.first_order_item?.product_name === "Pro Subscription (Life Time Access)"} {#if subscriptionData?.first_order_item?.product_name === "Pro Subscription (Life Time Access)"}
Lifetime Access Lifetime Access
@ -476,7 +460,7 @@
> >
<label <label
for="cancelSubscriptionModal" for="cancelSubscriptionModal"
class="cursor-pointer text-white border border-gray-600 sm:hover:bg-primary bg-opacity-[0.5] text-sm sm:text-[1rem] px-4 py-2 rounded mt-5" class="cursor-pointer border border-gray-600 sm:hover:bg-primary bg-opacity-[0.5] text-sm sm:text-[1rem] px-4 py-2 rounded mt-5"
> >
Cancel Subscription Cancel Subscription
</label> </label>
@ -489,20 +473,23 @@
Reactivate Subscription Reactivate Subscription
</label> </label>
{:else if subscriptionData?.status_formatted === "Paid" && !subscriptionData?.first_order_item?.product_name === "Pro Subscription (Life Time Access)"} {:else if subscriptionData?.status_formatted === "Paid" && !subscriptionData?.first_order_item?.product_name === "Pro Subscription (Life Time Access)"}
<span class="text-white mt-5"> <span class=" mt-5">
Please wait a moment; you will be updated to Pro in a second. Please wait a moment; you will be updated to Pro in a second.
</span> </span>
{:else if subscriptionData?.first_order_item?.product_name?.includes("Life Time")}{:else} {:else if subscriptionData?.first_order_item?.product_name?.includes("Life Time")}{:else}
<a href="/pricing" class="sm:hover:text-white text-blue-400"> <a
href="/pricing"
class="sm:hover:text-muted dark:sm:hover:text-white text-blue-500 dark:text-blue-400"
>
Get Full Access with Pro Subscription. Get Full Access with Pro Subscription.
</a> </a>
{/if} {/if}
</div> </div>
<div <div
class="mt-6 rounded border border-gray-600 p-4 text-base xs:p-4 xs:text-lg text-white" class="mt-6 rounded border border-gray-600 p-4 text-base xs:p-4 xs:text-lg"
> >
<h2 class="text-white text-2xl font-semibold mb-3">Need help?</h2> <h2 class=" text-2xl font-semibold mb-3">Need help?</h2>
<div class="mt-1"> <div class="mt-1">
<strong>Here's how to get support:</strong> <strong>Here's how to get support:</strong>
</div> </div>
@ -511,7 +498,7 @@
<li> <li>
Send an email to <a Send an email to <a
href={`mailto:${emailAddress}`} href={`mailto:${emailAddress}`}
class="text-blue-400 hover:text-white hover:underline" class="sm:hover:text-muted dark:sm:hover:text-white text-blue-500 dark:text-blue-400"
>{emailAddress}</a >{emailAddress}</a
> >
</li> </li>
@ -521,7 +508,7 @@
rel="noopener noreferrer" rel="noopener noreferrer"
target="_blank" target="_blank"
href="https://www.reddit.com/r/stocknear/" href="https://www.reddit.com/r/stocknear/"
class="text-blue-400" class="sm:hover:text-muted dark:sm:hover:text-white text-blue-500 dark:text-blue-400"
> >
r/stocknear</a r/stocknear</a
>. >.
@ -531,7 +518,8 @@
rel="noopener noreferrer" rel="noopener noreferrer"
target="_blank" target="_blank"
href="https://discord.com/invite/hCwZMMZ2MT" href="https://discord.com/invite/hCwZMMZ2MT"
class="text-blue-400">Discord Channel</a class="sm:hover:text-muted dark:sm:hover:text-white text-blue-500 dark:text-blue-400"
>Discord Channel</a
>. >.
</li> </li>
</ul> </ul>
@ -560,9 +548,9 @@
class="modal-box w-full bg-secondary flex flex-col items-center" class="modal-box w-full bg-secondary flex flex-col items-center"
> >
<div class="mx-auto mb-8 h-1.5 w-20 shrink-0 rounded-full bg-gray-500" /> <div class="mx-auto mb-8 h-1.5 w-20 shrink-0 rounded-full bg-gray-500" />
<div class="text-white mb-5 text-center"> <div class=" mb-5 text-center">
<h3 class="font-bold text-2xl mb-5">Are you sure?</h3> <h3 class="font-bold text-2xl mb-5">Are you sure?</h3>
<span class="text-white text-[1rem] font-normal"> <span class=" text-[1rem] font-normal">
You will no longer be charged for this subscription, and at the end of You will no longer be charged for this subscription, and at the end of
the billing period, your account will transfer to the Free Plan. the billing period, your account will transfer to the Free Plan.
</span> </span>
@ -615,9 +603,9 @@
class="modal-box w-full bg-secondary flex flex-col items-center" class="modal-box w-full bg-secondary flex flex-col items-center"
> >
<div class="mx-auto mb-8 h-1.5 w-20 shrink-0 rounded-full bg-gray-500" /> <div class="mx-auto mb-8 h-1.5 w-20 shrink-0 rounded-full bg-gray-500" />
<div class="text-white mb-5 text-center"> <div class=" mb-5 text-center">
<h3 class="font-bold text-2xl mb-5">Reactivate Subscription</h3> <h3 class="font-bold text-2xl mb-5">Reactivate Subscription</h3>
<span class="text-white text-[1rem] font-normal"> <span class=" text-[1rem] font-normal">
Reactivate your Pro Subscription now to unlock unlimited features and Reactivate your Pro Subscription now to unlock unlimited features and
gain the edge over the competition. gain the edge over the competition.
</span> </span>
@ -662,9 +650,9 @@
<!-- Desktop modal content --> <!-- Desktop modal content -->
<div class="modal-box w-full bg-secondary flex flex-col items-center"> <div class="modal-box w-full bg-secondary flex flex-col items-center">
<div class="mx-auto mb-8 h-1.5 w-20 shrink-0 rounded-full bg-gray-500" /> <div class="mx-auto mb-8 h-1.5 w-20 shrink-0 rounded-full bg-gray-500" />
<div class="text-white mb-5 text-center"> <div class=" mb-5 text-center">
<h3 class="font-bold text-2xl mb-5">Paypal not supported</h3> <h3 class="font-bold text-2xl mb-5">Paypal not supported</h3>
<span class="text-white text-[1rem] font-normal"> <span class=" text-[1rem] font-normal">
Apologies, our payment provider currently only supports credit cards for Apologies, our payment provider currently only supports credit cards for
changing plans from monthly to annual. We are working to expand this to changing plans from monthly to annual. We are working to expand this to
other payment methods. other payment methods.
@ -689,12 +677,10 @@
<div class="modal-box rounded w-full bg-secondary border border-gray-600"> <div class="modal-box rounded w-full bg-secondary border border-gray-600">
<div class="flex flex-row items-center pt-5"> <div class="flex flex-row items-center pt-5">
<h4 class="text-white text-2xl font-bold text-center m-auto"> <h4 class=" text-2xl font-bold text-center m-auto">Steps to install</h4>
Steps to install
</h4>
<label <label
for="installModal" for="installModal"
class="inline-block cursor-pointer absolute right-3 top-3 text-[1.3rem] sm:text-[1.8rem] text-white" class="inline-block cursor-pointer absolute right-3 top-3 text-[1.3rem] sm:text-[1.8rem]"
> >
<svg <svg
class="w-6 h-6 sm:w-8 sm:h-8" class="w-6 h-6 sm:w-8 sm:h-8"
@ -708,9 +694,7 @@
</label> </label>
</div> </div>
<div <div class=" flex flex-col justify-center items-center text-xl h-full">
class="text-white flex flex-col justify-center items-center text-xl h-full"
>
<ul class="list-decimal list-inside text-left mt-5"> <ul class="list-decimal list-inside text-left mt-5">
<li class="mb-2">Tap on the Safari share button.</li> <li class="mb-2">Tap on the Safari share button.</li>
<li class="mb-2">Tap on "Add to Home Screen."</li> <li class="mb-2">Tap on "Add to Home Screen."</li>
@ -725,7 +709,7 @@
<div class="border-t border-gray-600 mt-2"> <div class="border-t border-gray-600 mt-2">
<label <label
for="installModal" for="installModal"
class="mt-4 font-semibold text-white text-xl m-auto flex justify-center" class="mt-4 font-semibold text-xl m-auto flex justify-center"
> >
Close Close
</label> </label>

View File

@ -3,6 +3,7 @@
import Input from "$lib/components/Input.svelte"; import Input from "$lib/components/Input.svelte";
import SEO from "$lib/components/SEO.svelte"; import SEO from "$lib/components/SEO.svelte";
import { toast } from "svelte-sonner"; import { toast } from "svelte-sonner";
import { mode } from "mode-watcher";
export let form; export let form;
@ -18,22 +19,19 @@
case "redirect": case "redirect":
isClicked = true; isClicked = true;
toast.success("Registration successfully!", { toast.success("Registration successfully!", {
style: style: `border-radius: 5px; background: #fff; color: #000; border-color: ${$mode === "light" ? "#F9FAFB" : "#4B5563"}; font-size: 15px;`,
"border-radius: 5px; background: #fff; color: #000; border-color: #4B5563; font-size: 15px;",
}); });
await update(); await update();
break; break;
case "failure": case "failure":
toast.error("Invalid credentials", { toast.error("Invalid credentials", {
style: style: `border-radius: 5px; background: #fff; color: #000; border-color: ${$mode === "light" ? "#F9FAFB" : "#4B5563"}; font-size: 15px;`,
"border-radius: 5px; background: #fff; color: #000; border-color: #4B5563; font-size: 15px;",
}); });
await update(); await update();
break; break;
case "error": case "error":
toast.error(result.error.message, { toast.error(result.error.message, {
style: style: `border-radius: 5px; background: #fff; color: #000; border-color: ${$mode === "light" ? "#F9FAFB" : "#4B5563"}; font-size: 15px;`,
"border-radius: 5px; background: #fff; color: #000; border-color: #4B5563; font-size: 15px;",
}); });
break; break;
default: default:

View File

@ -1,5 +1,6 @@
<script lang="ts"> <script lang="ts">
import { toast } from "svelte-sonner"; import { toast } from "svelte-sonner";
import { mode } from "mode-watcher";
import { enhance } from "$app/forms"; import { enhance } from "$app/forms";
import SEO from "$lib/components/SEO.svelte"; import SEO from "$lib/components/SEO.svelte";
@ -14,30 +15,26 @@
switch (result.type) { switch (result.type) {
case "success": case "success":
toast.success("Password resetted. Check your emails!", { toast.success("Password resetted. Check your emails!", {
style: style: `border-radius: 5px; background: #fff; color: #000; border-color: ${$mode === "light" ? "#F9FAFB" : "#4B5563"}; font-size: 15px;`,
"border-radius: 5px; background: #fff; color: #000; border-color: #4B5563; font-size: 15px;",
}); });
await update(); await update();
break; break;
case "redirect": case "redirect":
isClicked = true; isClicked = true;
toast.success("Password resetted. Check your emails!", { toast.success("Password resetted. Check your emails!", {
style: style: `border-radius: 5px; background: #fff; color: #000; border-color: ${$mode === "light" ? "#F9FAFB" : "#4B5563"}; font-size: 15px;`,
"border-radius: 5px; background: #fff; color: #000; border-color: #4B5563; font-size: 15px;",
}); });
await update(); await update();
break; break;
case "failure": case "failure":
toast.error("Invalid credentials", { toast.error("Invalid credentials", {
style: style: `border-radius: 5px; background: #fff; color: #000; border-color: ${$mode === "light" ? "#F9FAFB" : "#4B5563"}; font-size: 15px;`,
"border-radius: 5px; background: #fff; color: #000; border-color: #4B5563; font-size: 15px;",
}); });
await update(); await update();
break; break;
case "error": case "error":
toast.error(result.error.message, { toast.error(result.error.message, {
style: style: `border-radius: 5px; background: #fff; color: #000; border-color: ${$mode === "light" ? "#F9FAFB" : "#4B5563"}; font-size: 15px;`,
"border-radius: 5px; background: #fff; color: #000; border-color: #4B5563; font-size: 15px;",
}); });
break; break;
default: default:

View File

@ -3,6 +3,7 @@
import { goto } from "$app/navigation"; import { goto } from "$app/navigation";
import { clearCache, screenWidth, getCache, setCache } from "$lib/store"; import { clearCache, screenWidth, getCache, setCache } from "$lib/store";
import { toast } from "svelte-sonner"; import { toast } from "svelte-sonner";
import { mode } from "mode-watcher";
import { import {
abbreviateNumber, abbreviateNumber,
@ -1494,8 +1495,7 @@
if (output === "success") { if (output === "success") {
toast.success("Strategy deleted successfully!", { toast.success("Strategy deleted successfully!", {
style: style: `border-radius: 5px; background: #fff; color: #000; border-color: ${$mode === "light" ? "#F9FAFB" : "#4B5563"}; font-size: 15px;`,
"border-radius: 5px; background: #fff; color: #000; border-color: #4B5563; font-size: 15px;",
}); });
strategyList = strategyList =
@ -1532,8 +1532,7 @@
); );
} else if (output === "failure") { } else if (output === "failure") {
toast.error("Something went wrong. Please try again", { toast.error("Something went wrong. Please try again", {
style: style: `border-radius: 5px; background: #fff; color: #000; border-color: ${$mode === "light" ? "#F9FAFB" : "#4B5563"}; font-size: 15px;`,
"border-radius: 5px; background: #fff; color: #000; border-color: #4B5563; font-size: 15px;",
}); });
} }
} }
@ -1549,16 +1548,14 @@
if (!title || title.length === 0) { if (!title || title.length === 0) {
toast.error("Title cannot be empty!", { toast.error("Title cannot be empty!", {
style: style: `border-radius: 5px; background: #fff; color: #000; border-color: ${$mode === "light" ? "#F9FAFB" : "#4B5563"}; font-size: 15px;`,
"border-radius: 5px; background: #fff; color: #000; border-color: #4B5563; font-size: 15px;",
}); });
return; return;
} }
if (title?.length > 100) { if (title?.length > 100) {
toast.error("Title is too long. Keep it simple and concise bruv!", { toast.error("Title is too long. Keep it simple and concise bruv!", {
style: style: `border-radius: 5px; background: #fff; color: #000; border-color: ${$mode === "light" ? "#F9FAFB" : "#4B5563"}; font-size: 15px;`,
"border-radius: 5px; background: #fff; color: #000; border-color: #4B5563; font-size: 15px;",
}); });
return; return;
} }
@ -1581,8 +1578,7 @@
const output = await response?.json(); const output = await response?.json();
if (output?.id && output?.id?.length !== 0) { if (output?.id && output?.id?.length !== 0) {
toast.success("Strategy created successfully!", { toast.success("Strategy created successfully!", {
style: style: `border-radius: 5px; background: #fff; color: #000; border-color: ${$mode === "light" ? "#F9FAFB" : "#4B5563"}; font-size: 15px;`,
"border-radius: 5px; background: #fff; color: #000; border-color: #4B5563; font-size: 15px;",
}); });
const closePopup = document.getElementById("addStrategy"); const closePopup = document.getElementById("addStrategy");
@ -1595,8 +1591,7 @@
selectedPopularStrategy = ""; selectedPopularStrategy = "";
} else { } else {
toast.error("Something went wrong. Please try again later!", { toast.error("Something went wrong. Please try again later!", {
style: style: `border-radius: 5px; background: #fff; color: #000; border-color: ${$mode === "light" ? "#F9FAFB" : "#4B5563"}; font-size: 15px;`,
"border-radius: 5px; background: #fff; color: #000; border-color: #4B5563; font-size: 15px;",
}); });
} }
@ -1711,8 +1706,7 @@
function handleAddRule() { function handleAddRule() {
if (ruleName === "") { if (ruleName === "") {
toast.error("Please select a rule", { toast.error("Please select a rule", {
style: style: `border-radius: 5px; background: #fff; color: #000; border-color: ${$mode === "light" ? "#F9FAFB" : "#4B5563"}; font-size: 15px;`,
"border-radius: 5px; background: #fff; color: #000; border-color: #4B5563; font-size: 15px;",
}); });
return; return;
} }
@ -1926,8 +1920,7 @@ const handleKeyDown = (event) => {
if (printToast === true) { if (printToast === true) {
toast.success("Strategy saved!", { toast.success("Strategy saved!", {
style: style: `border-radius: 5px; background: #fff; color: #000; border-color: ${$mode === "light" ? "#F9FAFB" : "#4B5563"}; font-size: 15px;`,
"border-radius: 5px; background: #fff; color: #000; border-color: #4B5563; font-size: 15px;",
}); });
} }

View File

@ -23,6 +23,7 @@
import { onMount, onDestroy, afterUpdate } from "svelte"; import { onMount, onDestroy, afterUpdate } from "svelte";
import { page } from "$app/stores"; import { page } from "$app/stores";
import { toast } from "svelte-sonner"; import { toast } from "svelte-sonner";
import { mode } from "mode-watcher";
import { convertTimestamp } from "$lib/utils"; import { convertTimestamp } from "$lib/utils";
import AIScore from "$lib/components/AIScore.svelte"; import AIScore from "$lib/components/AIScore.svelte";
@ -63,8 +64,7 @@
?.catch((error) => console.log("Error sharing content:", error)); ?.catch((error) => console.log("Error sharing content:", error));
} else { } else {
toast.error("Sharing is not supported by your device", { toast.error("Sharing is not supported by your device", {
style: style: `border-radius: 5px; background: #fff; color: #000; border-color: ${$mode === "light" ? "#F9FAFB" : "#4B5563"}; font-size: 15px;`,
"border-radius: 5px; background: #fff; color: #000; border-color: #4B5563; font-size: 15px;",
}); });
} }
} }
@ -118,8 +118,7 @@
updatedTickers.length > 5 updatedTickers.length > 5
) { ) {
toast.error("Upgrade to Pro to add unlimited stocks!", { toast.error("Upgrade to Pro to add unlimited stocks!", {
style: style: `border-radius: 5px; background: #fff; color: #000; border-color: ${$mode === "light" ? "#F9FAFB" : "#4B5563"}; font-size: 15px;`,
"border-radius: 5px; background: #fff; color: #000; border-color: #4B5563; font-size: 15px;",
}); });
return; return;
} }

View File

@ -1,6 +1,7 @@
<script lang="ts"> <script lang="ts">
import { enhance } from "$app/forms"; import { enhance } from "$app/forms";
import { toast } from "svelte-sonner"; import { toast } from "svelte-sonner";
import { mode } from "mode-watcher";
import Input from "$lib/components/Input.svelte"; import Input from "$lib/components/Input.svelte";
import SEO from "$lib/components/SEO.svelte"; import SEO from "$lib/components/SEO.svelte";
@ -17,8 +18,7 @@
}); });
} else if (result.error || result.errors) { } else if (result.error || result.errors) {
toast.error("Invalid credentials", { toast.error("Invalid credentials", {
style: style: `border-radius: 5px; background: #fff; color: #000; border-color: ${$mode === "light" ? "#F9FAFB" : "#4B5563"}; font-size: 15px;`,
"border-radius: 5px; background: #fff; color: #000; border-color: #4B5563; font-size: 15px;",
}); });
} }
await update(); await update();

View File

@ -4,6 +4,7 @@
import SEO from "$lib/components/SEO.svelte"; import SEO from "$lib/components/SEO.svelte";
import { onMount } from "svelte"; import { onMount } from "svelte";
import { toast } from "svelte-sonner"; import { toast } from "svelte-sonner";
import { mode } from "mode-watcher";
export let data; export let data;
let editMode = false; let editMode = false;
@ -89,13 +90,11 @@
async function handleDelete() { async function handleDelete() {
if (numberOfChecked === 0) { if (numberOfChecked === 0) {
toast.error(`You need to select symbols before you can delete them`, { toast.error(`You need to select symbols before you can delete them`, {
style: style: `border-radius: 5px; background: #fff; color: #000; border-color: ${$mode === "light" ? "#F9FAFB" : "#4B5563"}; font-size: 15px;`,
"border-radius: 5px; background: #fff; color: #000; border-color: #4B5563; font-size: 15px;",
}); });
} else if (data?.getOptionsWatchlist?.id?.length === 0) { } else if (data?.getOptionsWatchlist?.id?.length === 0) {
toast.error(`You need to select symbols before you can delete them`, { toast.error(`You need to select symbols before you can delete them`, {
style: style: `border-radius: 5px; background: #fff; color: #000; border-color: ${$mode === "light" ? "#F9FAFB" : "#4B5563"}; font-size: 15px;`,
"border-radius: 5px; background: #fff; color: #000; border-color: #4B5563; font-size: 15px;",
}); });
} else { } else {
optionsWatchlist = optionsWatchlist?.filter( optionsWatchlist = optionsWatchlist?.filter(

View File

@ -10,6 +10,7 @@
removeCompanyStrings, removeCompanyStrings,
} from "$lib/utils"; } from "$lib/utils";
import { toast } from "svelte-sonner"; import { toast } from "svelte-sonner";
import { mode } from "mode-watcher";
import { onMount, onDestroy, afterUpdate } from "svelte"; import { onMount, onDestroy, afterUpdate } from "svelte";
import Input from "$lib/components/Input.svelte"; import Input from "$lib/components/Input.svelte";
@ -298,16 +299,14 @@
// Validate the title input // Validate the title input
if (!title || title.toString().trim().length === 0) { if (!title || title.toString().trim().length === 0) {
toast.error("Title cannot be empty!", { toast.error("Title cannot be empty!", {
style: style: `border-radius: 5px; background: #fff; color: #000; border-color: ${$mode === "light" ? "#F9FAFB" : "#4B5563"}; font-size: 15px;`,
"border-radius: 5px; background: #fff; color: #000; border-color: #4B5563; font-size: 15px;",
}); });
return; return;
} }
if (title.toString().length > 100) { if (title.toString().length > 100) {
toast.error("Title is too long. Keep it simple and concise bruv!", { toast.error("Title is too long. Keep it simple and concise bruv!", {
style: style: `border-radius: 5px; background: #fff; color: #000; border-color: ${$mode === "light" ? "#F9FAFB" : "#4B5563"}; font-size: 15px;`,
"border-radius: 5px; background: #fff; color: #000; border-color: #4B5563; font-size: 15px;",
}); });
return; return;
} }
@ -394,8 +393,7 @@
if (output === "success") { if (output === "success") {
toast.success("Watchlist deleted successfully!", { toast.success("Watchlist deleted successfully!", {
style: style: `border-radius: 5px; background: #fff; color: #000; border-color: ${$mode === "light" ? "#F9FAFB" : "#4B5563"}; font-size: 15px;`,
"border-radius: 5px; background: #fff; color: #000; border-color: #4B5563; font-size: 15px;",
}); });
allList = allList?.filter((item) => item?.id !== displayWatchList?.id); allList = allList?.filter((item) => item?.id !== displayWatchList?.id);
@ -408,15 +406,13 @@
clicked.dispatchEvent(new MouseEvent("click")); clicked.dispatchEvent(new MouseEvent("click"));
} else { } else {
toast.error("Something went wrong. Please try again!", { toast.error("Something went wrong. Please try again!", {
style: style: `border-radius: 5px; background: #fff; color: #000; border-color: ${$mode === "light" ? "#F9FAFB" : "#4B5563"}; font-size: 15px;`,
"border-radius: 5px; background: #fff; color: #000; border-color: #4B5563; font-size: 15px;",
}); });
} }
} catch (error) { } catch (error) {
console.error("Error:", error); console.error("Error:", error);
toast.error("An error occurred. Please try again later.", { toast.error("An error occurred. Please try again later.", {
style: style: `border-radius: 5px; background: #fff; color: #000; border-color: ${$mode === "light" ? "#F9FAFB" : "#4B5563"}; font-size: 15px;`,
"border-radius: 5px; background: #fff; color: #000; border-color: #4B5563; font-size: 15px;",
}); });
} }
} }
@ -447,8 +443,7 @@
async function handleDeleteTickers() { async function handleDeleteTickers() {
if (numberOfChecked === 0) { if (numberOfChecked === 0) {
toast.error(`You need to select symbols before you can delete them`, { toast.error(`You need to select symbols before you can delete them`, {
style: style: `border-radius: 5px; background: #fff; color: #000; border-color: ${$mode === "light" ? "#F9FAFB" : "#4B5563"}; font-size: 15px;`,
"border-radius: 5px; background: #fff; color: #000; border-color: #4B5563; font-size: 15px;",
}); });
} else { } else {
watchList = watchList?.filter( watchList = watchList?.filter(
@ -514,8 +509,7 @@
// Check if the ticker is already in the watchlist. // Check if the ticker is already in the watchlist.
if (watchList?.some((item) => item?.symbol === ticker)) { if (watchList?.some((item) => item?.symbol === ticker)) {
toast.error("This symbol is already in your watchlist", { toast.error("This symbol is already in your watchlist", {
style: style: `border-radius: 5px; background: #fff; color: #000; border-color: ${$mode === "light" ? "#F9FAFB" : "#4B5563"}; font-size: 15px;`,
"border-radius: 5px; background: #fff; color: #000; border-color: #4B5563; font-size: 15px;",
}); });
inputValue = ""; inputValue = "";
return; return;
@ -551,8 +545,7 @@
loading: "Updating watchlist...", loading: "Updating watchlist...",
success: "Watchlist updated successfully!", success: "Watchlist updated successfully!",
error: (err) => err.message || "Failed to update watchlist", error: (err) => err.message || "Failed to update watchlist",
style: style: `border-radius: 5px; background: #fff; color: #000; border-color: ${$mode === "light" ? "#F9FAFB" : "#4B5563"}; font-size: 15px;`,
"border-radius: 5px; background: #fff; color: #000; border-color: #4B5563; font-size: 15px;",
}); });
try { try {
@ -612,8 +605,7 @@
saveRules(); saveRules();
} else { } else {
toast.error("Only for Plus & Pro Members", { toast.error("Only for Plus & Pro Members", {
style: style: `border-radius: 5px; background: #fff; color: #000; border-color: ${$mode === "light" ? "#F9FAFB" : "#4B5563"}; font-size: 15px;`,
"border-radius: 5px; background: #fff; color: #000; border-color: #4B5563; font-size: 15px;",
}); });
} }
} }