From b519645de62bd827cdff1be02a7b7ef1bbd2f982 Mon Sep 17 00:00:00 2001 From: MuslemRahimi Date: Mon, 27 May 2024 18:42:36 +0200 Subject: [PATCH] ui fixes --- src/routes/ai-signals/+page.svelte | 340 -------------- src/routes/ai-signals/+page.ts | 51 --- src/routes/explore/+page.svelte | 478 -------------------- src/routes/explore/+page.ts | 124 ----- src/routes/market-news/+page.svelte | 2 +- src/routes/market-news/crypto/+page.svelte | 4 +- src/routes/market-news/general/+page.svelte | 2 +- src/routes/politicians/[slug]/+page.svelte | 39 +- 8 files changed, 22 insertions(+), 1018 deletions(-) delete mode 100644 src/routes/ai-signals/+page.svelte delete mode 100644 src/routes/ai-signals/+page.ts delete mode 100644 src/routes/explore/+page.svelte delete mode 100644 src/routes/explore/+page.ts diff --git a/src/routes/ai-signals/+page.svelte b/src/routes/ai-signals/+page.svelte deleted file mode 100644 index 75b36f23..00000000 --- a/src/routes/ai-signals/+page.svelte +++ /dev/null @@ -1,340 +0,0 @@ - - - - - - {$numberOfUnreadNotification > 0 ? `(${$numberOfUnreadNotification})` : ''} Top AI Signals · stocknear - - - - - - - - - - - - - - - - - - - - -
- - -
-
- - -
-
-

- Top AI Signals -

-
- - - - -
- - - - - -
- - -
- - -
- - - - -
- - - - AI Algorithm was trained & backtested on the time period between {new Date("2015-01-01").toLocaleString('en-US', { month: 'short', day: 'numeric', year: 'numeric', daySuffix: '2-digit' })} - - - {new Date().toLocaleString('en-US', { month: 'short', day: 'numeric', year: 'numeric', daySuffix: '2-digit' })}. - - - - - - - - - - - - - - - {#each signalList as item,index} - - goto("/stocks/"+item?.symbol)} class="sm:hover:bg-[#245073] sm:hover:bg-opacity-[0.2] {index % 2 === 0 ? 'bg-opacity-[0.25] bg-[#323239]' : 'bg-[#0F0F0F]'} border-b-[#0F0F0F] cursor-pointer"> - - - - - - - - - - - - - - - - - {/each} - - - - -
- {#each signalList as item} -
-
-
- -
- - -
- Win Rate - - {#if item?.winRate >= 0} - - - +{item?.winRate?.toFixed(2)}% - - {:else if item?.winRate < 0} - - - {item?.winRate?.toFixed(2)}% - - {:else} - n/a - {/if} - -
-
-
- -
-
- Market Cap - - {item?.marketCap !== null ? abbreviateNumber(item?.marketCap,true) : '-'} - -
- -
- Return - - {#if item?.return >= 0} - - - +{item?.return?.toFixed(2)}% - - {:else if item?.return < 0} - - - {item?.return?.toFixed(2)}% - - {:else} - n/a - {/if} - -
-
- -
- - -
-
- Max. Drawdown - - {#if item?.maxDrawdown >= 0} - - - +{item?.maxDrawdown?.toFixed(2)}% - - {:else if item?.maxDrawdown < 0} - - - {item?.maxDrawdown?.toFixed(2)}% - - {:else} - n/a - {/if} - -
- -
- New Signal - - {#if item?.nextSignal === 'Buy'} - - - {item?.nextSignal} - - - {:else if item?.nextSignal === 'Hold'} - - - {item?.nextSignal}. - - {:else} - - - {item?.nextSignal}. - - {/if} - -
-
-
- {/each} - - - -
- - -
- - - - -
- - - - \ No newline at end of file diff --git a/src/routes/ai-signals/+page.ts b/src/routes/ai-signals/+page.ts deleted file mode 100644 index 70a5cdf1..00000000 --- a/src/routes/ai-signals/+page.ts +++ /dev/null @@ -1,51 +0,0 @@ -import { userRegion, getCache, setCache } from '$lib/store'; - - -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 getAISignals = async () => { - let output; - - // Get cached data for the specific tickerID - const cachedData = getCache('', 'getAISignals'); - if (cachedData) { - output = cachedData; - } else { - - - // make the POST request to the endpoint - const response = await fetch(apiURL + '/ai-signals', { - method: 'GET', - headers: { - 'Content-Type': 'application/json', - }, - }); - - output = await response.json(); - - // Cache the data for this specific tickerID with a specific name 'getAISignals' - setCache('', output, 'getAISignals'); - } - - return output; - }; - - // Make sure to return a promise - return { - getAISignals: await getAISignals() - }; -}; \ No newline at end of file diff --git a/src/routes/explore/+page.svelte b/src/routes/explore/+page.svelte deleted file mode 100644 index 041238af..00000000 --- a/src/routes/explore/+page.svelte +++ /dev/null @@ -1,478 +0,0 @@ - - - - - - {$numberOfUnreadNotification > 0 ? `(${$numberOfUnreadNotification})` : ''} Explore · stocknear - - - - - - - - - - - - - - - - - - - - -
- - - - - -
- - - - -
- -

- Discover -

-
- (image = detail)}> - - - - -
- {image?.title} -
-
- - - - - - - -
-

- Trending Stocks -

- - - See All - -
- -
- - - -
- - - - - - - - - -
-

- Popular ETF's -

- - - See All - -
- - - - - -
-

- Popular Hedge Funds -

- - - See All - -
- - - - - - -
-

- Categories -

- - - See All - -
- - -
- {#each sectorList as item} - - {item?.title} - - {/each} -
- - - - - -
-

- Latest News -

- - - See All - -
- -
-
- {#each news as item} - - -
- news image -
-

{(new URL(item?.url)).hostname.replace('www.','')}

-
-
- -
- -
- -
- {item.symbol} · {formatDate(item.publishedDate)} ago -
-

{item.title}

-

{item?.text?.length > 250 ? item?.text?.slice(0,250) + '...' : item?.text}

-
- - {/each} -
-
- - - -
- - - - -
- - - - - \ 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?.headline?.length > 100 ? item?.headline?.slice(0,100) + "..." : item?.headline} + {item?.headline?.length > 120 ? item?.headline?.slice(0,120) + "..." : item?.headline}

{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 () => { -

+
-