-
-
-
-
-
-
-
- Discover
-
-
-
(image = detail)}>
-
-
-
-
-
- {image?.title}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/routes/explore/+page.ts b/src/routes/explore/+page.ts
deleted file mode 100644
index c2c8c8f3..00000000
--- a/src/routes/explore/+page.ts
+++ /dev/null
@@ -1,124 +0,0 @@
-import { userRegion, getCache, setCache } from '$lib/store';
-import { pb } from "$lib/pocketbase";
-
-const usRegion = ['cle1','iad1','pdx1','sfo1'];
-
-let apiURL;
-
-userRegion.subscribe(value => {
-
- if (usRegion.includes(value)) {
- apiURL = import.meta.env.VITE_USEAST_API_URL;
- } else {
- apiURL = import.meta.env.VITE_EU_API_URL;
- }
-});
-
-
-
-export const load = async () => {
- const getRecentBlogPost = async () => {
- let output;
-
- // Get cached data for the specific tickerID
- const cachedData = getCache('allBlogPost', 'getRecentBlogPost');
- if (cachedData) {
- output = cachedData;
- } else {
-
- // make the POST request to the endpoint
- output = (await pb.collection('articles').getList(1,4, {sort: '-created'}))?.items;
-
- // Cache the data for this specific tickerID with a specific name 'getRecentBlogPost'
- setCache('allBlogPost', output, 'getRecentBlogPost');
- }
-
- return output;
- };
-
- const getDailyGainerLoserActive = async () => {
- let output;
-
- // Get cached data for the specific tickerID
- const cachedData = getCache('', 'getDailyGainerLoserActive');
- if (cachedData) {
- output = cachedData;
- } else {
-
- // make the POST request to the endpoint
- const response = await fetch(apiURL + '/market-movers', {
- method: 'GET',
- headers: {
- 'Content-Type': 'application/json',
- },
- });
-
- output = await response.json();
-
- setCache('', output, 'getDailyGainerLoserActive');
- }
-
- return output;
- };
-
- const getMarketNews = async () => {
- let output;
-
- // Get cached data for the specific tickerID
- const cachedData = getCache('', 'getMarketNews');
- if (cachedData) {
- output = cachedData;
- } else {
-
- // make the POST request to the endpoint
- const response = await fetch(apiURL + '/market-news', {
- method: 'GET',
- headers: {
- 'Content-Type': 'application/json',
- },
- });
-
- output = await response.json();
-
- // Cache the data for this specific tickerID with a specific name 'getMarketNews'
- setCache('', output, 'getMarketNews');
- }
-
- return output;
- };
-
- const getPopularETFs = async () => {
- let output;
-
- // Get cached data for the specific tickerID
- const cachedData = getCache('', 'getPopularETFs');
- if (cachedData) {
- output = cachedData;
- } else {
-
- // make the POST request to the endpoint
- const response = await fetch(apiURL + '/popular-etfs', {
- method: 'GET',
- headers: {
- 'Content-Type': 'application/json',
- },
- });
-
- output = await response.json();
-
- // Cache the data for this specific tickerID with a specific name 'getPopularETFs'
- setCache('', output, 'getPopularETFs');
- }
-
- return output;
- };
-
-
- // Make sure to return a promise
- return {
- getRecentBlogPost: await getRecentBlogPost(),
- getDailyGainerLoserActive: await getDailyGainerLoserActive(),
- getMarketNews: await getMarketNews(),
- getPopularETFs: await getPopularETFs(),
- };
- };
\ No newline at end of file
diff --git a/src/routes/market-news/+page.svelte b/src/routes/market-news/+page.svelte
index fe339638..0f453987 100644
--- a/src/routes/market-news/+page.svelte
+++ b/src/routes/market-news/+page.svelte
@@ -111,7 +111,7 @@ function checkIfYoutubeVideo(link) {
- {item.title}
+ {item?.title?.length > 120 ? item?.title?.slice(0,120) +'...' : item?.title}
{item?.text.length > 100 ? item?.text.slice(0,100) + "..." : item?.text}
diff --git a/src/routes/market-news/crypto/+page.svelte b/src/routes/market-news/crypto/+page.svelte
index c3a701e2..026c6b9c 100644
--- a/src/routes/market-news/crypto/+page.svelte
+++ b/src/routes/market-news/crypto/+page.svelte
@@ -107,10 +107,10 @@ function checkIfYoutubeVideo(link) {
- {item.title}
+ {item?.title?.length > 120 ? item?.title?.slice(0,120) +'...' : item?.title}
- {item?.text.length > 100 ? item?.text.slice(0,100) + "..." : item?.text}
+ {item?.text?.length > 100 ? item?.text?.slice(0,100) + "..." : item?.text}
diff --git a/src/routes/market-news/general/+page.svelte b/src/routes/market-news/general/+page.svelte
index eacee8eb..a0cb85da 100644
--- a/src/routes/market-news/general/+page.svelte
+++ b/src/routes/market-news/general/+page.svelte
@@ -105,7 +105,7 @@
{item?.summary?.length > 100 ? item?.summary?.slice(0,100) + "..." : item?.summary}
diff --git a/src/routes/politicians/[slug]/+page.svelte b/src/routes/politicians/[slug]/+page.svelte
index e518b291..37bd72f9 100644
--- a/src/routes/politicians/[slug]/+page.svelte
+++ b/src/routes/politicians/[slug]/+page.svelte
@@ -284,14 +284,14 @@ onMount(async () => {