From 3f1ac5ef40e214a162b699a0999748cb9dc2244e Mon Sep 17 00:00:00 2001 From: MuslemRahimi Date: Thu, 24 Oct 2024 23:07:05 +0200 Subject: [PATCH] refactor code --- src/routes/analysts/+page.svelte | 108 +- src/routes/analysts/top-stocks/+page.svelte | 606 +++--- .../corporate-lobbying-tracker/+page.svelte | 621 +++--- src/routes/cramer-tracker/+page.svelte | 25 +- src/routes/dividends-calendar/+page.svelte | 25 +- src/routes/earnings-calendar/+page.svelte | 992 +++++---- src/routes/economic-calendar/+page.svelte | 1154 +++++++---- src/routes/list/+layout.svelte | 597 +++--- src/routes/most-shorted-stocks/+page.svelte | 24 +- src/routes/politicians/flow-data/+page.svelte | 1796 ++++++++++------- src/routes/price-alert/+page.svelte | 953 +++++---- src/routes/sitemap.xml/+server.ts | 1 + src/routes/watchlist/+layout.svelte | 341 ++-- 13 files changed, 4129 insertions(+), 3114 deletions(-) diff --git a/src/routes/analysts/+page.svelte b/src/routes/analysts/+page.svelte index 0ceb2460..863393e4 100644 --- a/src/routes/analysts/+page.svelte +++ b/src/routes/analysts/+page.svelte @@ -1,12 +1,10 @@ - - - - - + - {$numberOfUnreadNotification > 0 ? `(${$numberOfUnreadNotification})` : ''} Top 100 Strong Buy Stocks · stocknear + {$numberOfUnreadNotification > 0 ? `(${$numberOfUnreadNotification})` : ""} Top + 100 Strong Buy Stocks · stocknear - - + + - - - + + + - + - - - + + + - - - - - - -
- - - -
- -
-
+ +
+ -
- -
-
- - -
-
-

- Top Stocks -

-
- - - Uncover 'Strong Buy' stocks from 5-star Wall Street analysts - - - -
- - - - - -
- - - - +
+
+
+
+
+
+ +
+
+

+ Top Stocks +

-
- - Strong Buy stocks by top-rated analysts with a star rating of 4 or above, known for their exceptional accuracy and returns. Stocks are ranked based on the volume of analyst ratings. + + Uncover 'Strong Buy' stocks from 5-star Wall Street analysts + +
+ + + +
- - - +
+ +
-
- - + +
+ + Strong Buy stocks by top-rated analysts with a star rating of 4 or above, + known for their exceptional accuracy and returns. Stocks are ranked based + on the volume of analyst ratings. +
+ +
+ {#if isLoaded} +
+ + + + + + {#each analytRatingList as item, index} + + + + + + + + + + + + + + + + + {/each} + +
+ {item?.rank} + + + {item?.ticker} + + + {item?.name?.length > charNumber + ? item?.name?.slice(0, charNumber) + "..." + : item?.name} + + {item?.counter} + + {item?.priceTarget?.toFixed(2)} + + {item?.price?.toFixed(2)} + + {item?.marketCap !== null + ? abbreviateNumber(item?.marketCap) + : "-"} + + {#if Number(item?.upside) >= 0} + +{Number(item?.upside)?.toFixed(2)}% + {:else} + {Number(item?.upside)?.toFixed(2)}% + {/if} +
+
+ + + {:else} +
+
+ +
+
+ {/if} +
+
+ +
- - - -
- - \ No newline at end of file + + + diff --git a/src/routes/corporate-lobbying-tracker/+page.svelte b/src/routes/corporate-lobbying-tracker/+page.svelte index 949215ab..04ae480f 100644 --- a/src/routes/corporate-lobbying-tracker/+page.svelte +++ b/src/routes/corporate-lobbying-tracker/+page.svelte @@ -1,321 +1,374 @@ - -} - - -$: charNumber = $screenWidth < 640 ? 15 : 20; - - - - - + - {$numberOfUnreadNotification > 0 ? `(${$numberOfUnreadNotification})` : ''} Latest Lobbiyng Disclosure Tracker · stocknear + {$numberOfUnreadNotification > 0 ? `(${$numberOfUnreadNotification})` : ""} Latest + Lobbiyng Disclosure Tracker · stocknear - - + + - - - + + + - + - - - + + + - - - - - -
- - - -
- -
-
+ +
+ -
- -
-
- - - -
-
-

- Lobbying Tracker -

-
- - - Track the latest lobbying spendings of US stock companies - - - -
- - - - - -
- - - - -
- - {#if isLoaded} - - - -
- - -
- - - - - - - - - - - - - {#each displayList as item, index} - - - - - - - - - - - - - - - - - - - {/each} - -
- Date - - Symbol - - Name - - Sector - { changeOrder(order); }} class="cursor-pointer text-end bg-[#09090B] text-white text-[1rem] font-semibold"> - Amount - -
- {formatDate(item?.date)} - - - {item?.ticker} - - - {item?.name?.length > charNumber ? item?.name?.slice(0,charNumber) + "..." : item?.name} - - {item?.sector} - - ${new Intl.NumberFormat("en", { - minimumFractionDigits: 0, - maximumFractionDigits: 0, - }).format(item?.amount)} -
- -
- -
- - - - - {:else} -
-
- -
-
- {/if} - - -
- - - + {#if isLoaded} +
+
+ + + + + + - + + + + + + {#each displayList as item, index} + + + + + + + + + + + + {/each} + +
+ Date + + Symbol + + Name + + Sector + { + changeOrder(order); + }} + class="cursor-pointer text-end bg-[#09090B] text-white text-[1rem] font-semibold" + > + Amount + +
+ {formatDate(item?.date)} + + + {item?.ticker} + + + {item?.name?.length > charNumber + ? item?.name?.slice(0, charNumber) + "..." + : item?.name} + + {item?.sector} + + ${new Intl.NumberFormat("en", { + minimumFractionDigits: 0, + maximumFractionDigits: 0, + }).format(item?.amount)} +
+
+ +
+ + {:else} +
+
+ +
+
+ {/if} + + +
- -
- - - -
- - \ No newline at end of file + + diff --git a/src/routes/cramer-tracker/+page.svelte b/src/routes/cramer-tracker/+page.svelte index 9cc76d73..cf7e48a4 100644 --- a/src/routes/cramer-tracker/+page.svelte +++ b/src/routes/cramer-tracker/+page.svelte @@ -1,9 +1,7 @@ - + + + + {$numberOfUnreadNotification > 0 ? `(${$numberOfUnreadNotification})` : ""} Earnings + Calendar · stocknear + + - - - - {$numberOfUnreadNotification > 0 ? `(${$numberOfUnreadNotification})` : ''} Earnings Calendar · stocknear - - - - - - - - - - - - - - + + + + + + + + + + +
+ -
- - - - -
- -
-
- - -
+
+
+
+
+
+
+ +
+
+

+ Earnings Calendar +

+
-
-
- - -
-
-

- Earnings Calendar -

+ +
+ + + + + +
- - - -
- - - - - -
- - -
- - -
- - - - - -
- - - -
- - - {#each weekday as day,index} - -
-
- - - + {/each} +
-
+
+
- -
- - - \ No newline at end of file + + +
diff --git a/src/routes/economic-calendar/+page.svelte b/src/routes/economic-calendar/+page.svelte index ca1d6f07..c6175127 100644 --- a/src/routes/economic-calendar/+page.svelte +++ b/src/routes/economic-calendar/+page.svelte @@ -1,13 +1,19 @@ - - - - + - {$numberOfUnreadNotification > 0 ? `(${$numberOfUnreadNotification})` : ''} Worldwide Economic Calendar · stocknear + {$numberOfUnreadNotification > 0 ? `(${$numberOfUnreadNotification})` : ""} Worldwide + Economic Calendar · stocknear - - + + - - - + + + - + - - - + + + - - - - - -
- - - - -
- -
-
- - -
- -
-
- - -
-
-

- Economic Calendar -

-
- - - - -
- - - - - + + +
+ + +
+
+
+
+
+
+ +
+
+

+ Economic Calendar +

- - + +
- - -
- - - - -
- - -
- - - {#each (filterList?.length === 0 ? weekday : weekdayFiltered) as day,index} - -
- -
- {/each} - + + + + - -
+
+
+
- - + +
+ + Get the latest dividend announcement + + +
+ +
- - +
- - - \ No newline at end of file diff --git a/src/routes/list/+layout.svelte b/src/routes/list/+layout.svelte index a5c19d15..e8300756 100644 --- a/src/routes/list/+layout.svelte +++ b/src/routes/list/+layout.svelte @@ -1,321 +1,328 @@ - - - - {$numberOfUnreadNotification > 0 ? `(${$numberOfUnreadNotification})` : ''} Stock Lists · stocknear + + {$numberOfUnreadNotification > 0 ? `(${$numberOfUnreadNotification})` : ""} Stock + Lists · stocknear - + - - - + + + - - - + + + - - - -
- - + + +
diff --git a/src/routes/most-shorted-stocks/+page.svelte b/src/routes/most-shorted-stocks/+page.svelte index 52fd8bd4..61ff7dcc 100644 --- a/src/routes/most-shorted-stocks/+page.svelte +++ b/src/routes/most-shorted-stocks/+page.svelte @@ -1,5 +1,4 @@ - - - - - - {$numberOfUnreadNotification > 0 ? `(${$numberOfUnreadNotification})` : ''} Latest Congressional Trading · stocknear - - - - - - - - - - - - - - - - - - - - -
- - - -
- -
-
+ + + + {$numberOfUnreadNotification > 0 ? `(${$numberOfUnreadNotification})` : ""} Latest + Congressional Trading · stocknear + + + + + + + + -
- -
-
- - -
-
-

- Latest Trades of Politicians -

+ + + + + + + +
+ + +
+
+
+
+
+
+ +
+
+

+ Latest Trades of Politicians +

+
+ +
- - - -
- - - - - - - - -
- - - - - - - {#if isLoaded} - - -
- -
-
-
- - -
- -
- - - - - - - - - - - - - {#each displayList as item, index} - goto(`/politicians/${item?.id}`)} class="cursor-pointer odd:bg-[#27272A] border-b-[#09090B] {index+1 === rawData?.length && data?.user?.tier !== 'Pro' ? 'opacity-[0.1]' : ''}"> - - - - - - - + + + + {#each displayList as item, index} + + - + - + + + + + + + + {/each} + +
- Person - - Company - - Transaction - - Disclosure - - Amount - Type
-
-
- -
-
- {getAbbreviatedName(item?.representative?.replace('_',' '))} - {item?.party} -
-
- -
-
- {item?.ticker?.length !== 0 ? item?.ticker : '-'} - {item?.assetDescription.length > charNumber ? formatString(item?.assetDescription.slice(0,charNumber)) + "..." : formatString(item?.assetDescription)?.replace("- Common Stock", "")?.replace("Common Stock", "")} -
-
- {new Date(item?.transactionDate)?.toLocaleString('en-US', { month: 'short', day: 'numeric', year: 'numeric', daySuffix: '2-digit' })} + + {#if isLoaded} +
+
+
+
+
+
+ + + + + - - - - - - - {/each} - -
+ Person + + Company - {new Date(item?.disclosureDate)?.toLocaleString('en-US', { month: 'short', day: 'numeric', year: 'numeric', daySuffix: '2-digit' })} + + Transaction - {item?.amount?.replace("$1,000,001 - $5,000,000","$1Mio - $5Mio")} + + Disclosure - {#if item?.type === 'Bought'} - Bought - {:else if item?.type === 'Sold'} - Sold - {/if} + + Amount
-
- +
Type
+ + + +
+ {item?.ticker?.length !== 0 + ? item?.ticker + : "-"} + {item?.assetDescription.length > + charNumber + ? formatString( + item?.assetDescription.slice( + 0, + charNumber, + ), + ) + "..." + : formatString(item?.assetDescription) + ?.replace("- Common Stock", "") + ?.replace( + "Common Stock", + "", + )} +
+
+ {new Date( + item?.transactionDate, + )?.toLocaleString("en-US", { + month: "short", + day: "numeric", + year: "numeric", + daySuffix: "2-digit", + })} + + {new Date( + item?.disclosureDate, + )?.toLocaleString("en-US", { + month: "short", + day: "numeric", + year: "numeric", + daySuffix: "2-digit", + })} + + {item?.amount?.replace( + "$1,000,001 - $5,000,000", + "$1Mio - $5Mio", + )} + + {#if item?.type === "Bought"} + Bought + {:else if item?.type === "Sold"} + Sold + {/if} +
+
+ + + +
+
- -
+
+
+ {:else} +
+
+ +
+
+ {/if} + +
+ +
-
- {:else} - - - {/if} - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - + + + + + +{#if $screenWidth >= 640} - + - - - - - - + + + - {:else} +{:else}
- +
- - -
- - - - -
- - -
- -
- - -
-

- Filter List -

- -
- - -
- -
-
-

Political Party

-
    -
  • - -
  • -
  • - -
  • -
-
- -
-
    -
  • - -
  • - -
-
-
- - - -
-
-

Transaction Type

-
    -
  • - -
  • -
-
- -
-
    -
  • - -
  • - -
-
-
- - - - - - +
+

+ Filter List +

+
+ + +
+ +
+
+

+ Political Party +

+
    +
  • + +
  • +
  • + +
  • +
+
+ +
+
    +
  • + +
  • + +
+
+
+ + + +
+
+

+ Transaction Type +

+
    +
  • + +
  • +
+
+ +
+
    +
  • + +
  • + +
+
+
+ + + + + - - - -
- - - -
-
-
+ +
+
+
+
- {/if} +{/if} \ No newline at end of file + } + diff --git a/src/routes/price-alert/+page.svelte b/src/routes/price-alert/+page.svelte index d9526434..1887ef4a 100644 --- a/src/routes/price-alert/+page.svelte +++ b/src/routes/price-alert/+page.svelte @@ -1,466 +1,627 @@ - - - {$numberOfUnreadNotification > 0 ? `(${$numberOfUnreadNotification})` : ''} Price Alert · stocknear - - + + {$numberOfUnreadNotification > 0 ? `(${$numberOfUnreadNotification})` : ""} Price + Alert · stocknear + + - - - - - - + + + + + + - - - - - + + + + + - - - - - - - - -
- + +
- +
- -
-
+
+
+
+
+
+ +
+
+

+ Price Alert +

+
- -
- - -
-
- - -
-
-

- Price Alert -

-
- - - Get email notifications instantly when your alert goes off, so you never miss out! - -
- - - - - - -
-
- - - {#if isLoaded} -
-
- Stock Indexes - {getCurrentDateFormatted()} -
- -
-
- - - - -
-
- -
- - - - - {#if priceAlertList?.length === 0} -
- - No Alerts set + + Get email notifications instantly when your alert goes off, so + you never miss out! - - - Create price alerts for your stocks that have the most potential in your opinion. +
+ + + + + +
+
+ + {#if isLoaded} +
+
+ Stock Indexes - {getCurrentDateFormatted()} +
+ +
+
+ + + + +
+
+
+ + {#if priceAlertList?.length === 0} +
+ + No Alerts set + + + + Create price alerts for your stocks that have the most + potential in your opinion. {#if !data?.user} - - Get Started - - + + Get Started + + - + {/if} - -
+
{:else} - -
+
{#if editMode} - {/if} -
- -
- + + +
+
- - - - - - - + + + + + + + {#each priceAlertList as item, index} - - stockSelector(item?.symbol, item?.assetType)} class="sm:hover:bg-[#245073] sm:hover:bg-opacity-[0.2] odd:bg-[#27272A] border-b-[#09090B] cursor-pointer"> - - - - - - - + + + stockSelector(item?.symbol, item?.assetType)} + class="sm:hover:bg-[#245073] sm:hover:bg-opacity-[0.2] odd:bg-[#27272A] border-b-[#09090B] cursor-pointer" + > + - - + - + + - - + - - - - - + + + + {/each}
SymbolCompanyVolumePrice when CreatedPrice TargetCurrent PriceChangeSymbolCompanyVolumePrice when CreatedPrice TargetCurrent PriceChange
handleFilter(item?.id)} class="text-blue-400 font-medium text-sm sm:text-[1rem] whitespace-nowrap text-start border-b-[#09090B] flex flex-row items-center"> - - {item?.symbol} - handleFilter(item?.id)} class="text-white text-sm sm:text-[1rem] whitespace-nowrap border-b-[#09090B]"> - {item?.name?.length > charNumber ? item?.name?.slice(0,charNumber) + "..." : item?.name} - - {new Intl.NumberFormat("en", { - minimumFractionDigits: 2, - maximumFractionDigits: 2 - }).format(item?.volume)} - - - ${item?.priceWhenCreated} -
handleFilter(item?.id)} + class="text-blue-400 font-medium text-sm sm:text-[1rem] whitespace-nowrap text-start border-b-[#09090B] flex flex-row items-center" + > + + {item?.symbol} + - ${item?.targetPrice} - handleFilter(item?.id)} + class="text-white text-sm sm:text-[1rem] whitespace-nowrap border-b-[#09090B]" + > + {item?.name?.length > charNumber + ? item?.name?.slice(0, charNumber) + "..." + : item?.name} + - ${item.price?.toFixed(2)} - + {abbreviateNumber(item?.volume)} + + {item?.priceWhenCreated} + - {#if item?.changesPercentage >=0} - +{item?.changesPercentage?.toFixed(2)}% - {:else} - {item?.changesPercentage?.toFixed(2)}% - {/if} - + {item?.targetPrice} +
+ {item.price?.toFixed(2)} + + {#if item?.changesPercentage >= 0} + +{item?.changesPercentage?.toFixed(2)}% + {:else} + {item?.changesPercentage?.toFixed(2)}% + + {/if} +
- - - - -
- - - + {/if} - {:else} -
-
- -
-
- - {/if} - -
- - - +
- - -
-
- - -
- - - -
- \ No newline at end of file +
diff --git a/src/routes/sitemap.xml/+server.ts b/src/routes/sitemap.xml/+server.ts index b3ce4378..f763ef37 100644 --- a/src/routes/sitemap.xml/+server.ts +++ b/src/routes/sitemap.xml/+server.ts @@ -15,6 +15,7 @@ const pages = [ { title: "/donation" }, //{title: "/portfolio"}, { title: "/sentiment-tracker" }, + { title: "/insider-tracker" }, { title: "/industry" }, { title: "/industry/sectors" }, { title: "/industry/all" }, diff --git a/src/routes/watchlist/+layout.svelte b/src/routes/watchlist/+layout.svelte index 97c72755..569ba3cc 100644 --- a/src/routes/watchlist/+layout.svelte +++ b/src/routes/watchlist/+layout.svelte @@ -1,40 +1,37 @@ - @@ -43,159 +40,175 @@ let activeIdx = 0;
- - - -
- +
- +
- -
-
- - -
- -
-
- -
-
-

- Watchlist -

-
- - - Monitor the performance and recent updates of your favorite options. - -
- - - - - +
+
+
+
+
+ +
+
+

+ Watchlist +

- - - - + + + Monitor the performance and recent updates of your favorite + options. +
- + + +
- -
+
+ + +
+ + +
+ +
- -
- - -
- - - - \ No newline at end of file