ui fixes
This commit is contained in:
parent
56e6d5d4a2
commit
a03927bf5a
@ -566,7 +566,15 @@ class="fixed 2xl:block top-0 left-0 xl:left-auto w-56 sm:{collapse ? 'w-20' : 'w
|
|||||||
<li on:click={() => showSidebar = !showSidebar} class="mb-1 last:mb-0 hover:bg-[#272727] rounded-md {$page.url.pathname=== '/analysts/top-stocks' ? 'text-white bg-[#272727] xl:bg-[#0F0F0F] rounded-md ' : ''}">
|
<li on:click={() => showSidebar = !showSidebar} class="mb-1 last:mb-0 hover:bg-[#272727] rounded-md {$page.url.pathname=== '/analysts/top-stocks' ? 'text-white bg-[#272727] xl:bg-[#0F0F0F] rounded-md ' : ''}">
|
||||||
<a href={"/analysts/top-stocks"} for="sidebar" class="block text-slate-400 hover:text-slate-200 transition duration-150 truncate">
|
<a href={"/analysts/top-stocks"} for="sidebar" class="block text-slate-400 hover:text-slate-200 transition duration-150 truncate">
|
||||||
<span class="text-sm font-medium text-white ">
|
<span class="text-sm font-medium text-white ">
|
||||||
Top Stocks
|
Top Analyst Stocks
|
||||||
|
</span>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li on:click={() => showSidebar = !showSidebar} class="mb-1 last:mb-0 hover:bg-[#272727] rounded-md {$page.url.pathname=== '/analysts/top-stocks' ? 'text-white bg-[#272727] xl:bg-[#0F0F0F] rounded-md ' : ''}">
|
||||||
|
<a href={"/most-shorted-stocks"} for="sidebar" class="block text-slate-400 hover:text-slate-200 transition duration-150 truncate">
|
||||||
|
<span class="text-sm font-medium text-white ">
|
||||||
|
Most Shorted Stocks
|
||||||
</span>
|
</span>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
|||||||
@ -7,7 +7,8 @@
|
|||||||
import InfoModal from '$lib/components/InfoModal.svelte';
|
import InfoModal from '$lib/components/InfoModal.svelte';
|
||||||
import nancyPelosiProfile from '$lib/images/senator/Nancy_Pelosi.png';
|
import nancyPelosiProfile from '$lib/images/senator/Nancy_Pelosi.png';
|
||||||
import warrenBuffetProfile from '$lib/images/hedge_funds/0001067983.png';
|
import warrenBuffetProfile from '$lib/images/hedge_funds/0001067983.png';
|
||||||
import michaelBurryProfile from '$lib/images/hedge_funds/0001649339.png';
|
//import michaelBurryProfile from '$lib/images/hedge_funds/0001649339.png';
|
||||||
|
import analystAvatar from '$lib/images/hedge_funds/default-avatar.png';
|
||||||
|
|
||||||
import { screenWidth, numberOfUnreadNotification} from '$lib/store';
|
import { screenWidth, numberOfUnreadNotification} from '$lib/store';
|
||||||
|
|
||||||
@ -164,7 +165,7 @@ onMount( async() => {
|
|||||||
<!-- Start Column -->
|
<!-- Start Column -->
|
||||||
<div >
|
<div >
|
||||||
|
|
||||||
|
<!--
|
||||||
<div class="text-center mb-5 relative w-fit flex justify-center m-auto">
|
<div class="text-center mb-5 relative w-fit flex justify-center m-auto">
|
||||||
<a href="/most-shorted-stocks" class="text-white antialiased bg-[#202020] w-full px-4 py-2 rounded-xl m-auto font-medium text-sm flex items-center">
|
<a href="/most-shorted-stocks" class="text-white antialiased bg-[#202020] w-full px-4 py-2 rounded-xl m-auto font-medium text-sm flex items-center">
|
||||||
<svg class="w-6 h-6 inline-block mr-2" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 36 36"><path fill="#f4900c" d="m33.629 16.565l-.092 1.608l-.041.814c-.02.265-.092.529-.142.794l-.285 1.598c-.153.519-.326 1.028-.499 1.547c-.743 2.025-1.791 4.029-3.246 5.698a23.476 23.476 0 0 1-5.006 4.396c-1.903 1.221-3.867 2.167-6.126 2.859l-.385.121l-.427-.142c-1.526-.499-2.798-1.099-4.101-1.832c-1.272-.722-2.503-1.536-3.612-2.524l-.835-.732l-.784-.794c-.529-.519-.987-1.109-1.455-1.689a20.511 20.511 0 0 1-2.3-3.826c-.611-1.353-1.109-2.768-1.404-4.213c-.071-.366-.183-.722-.224-1.089l-.132-1.089c-.071-.733-.193-1.435-.153-2.279c.061-1.618.56-3.175 1.313-4.508a14.016 14.016 0 0 1 2.849-3.48l3.46-3.053l-1.669 4.174c-.57 1.435-.845 3.134-.193 4.202c.315.529.885.814 1.587.824c.733 0 1.475-.203 1.872-.692c.407-.478.438-1.231.183-1.954c-.326-.753-.631-1.77-.59-2.696c0-.946.275-1.893.753-2.717c.488-.824 1.19-1.496 1.984-1.994l1.028-.641l-.285 1.19c-.295 1.221-.081 2.503.733 3.287c.804.784 2.076 1.058 3.103.794c1.028-.275 1.72-1.109 1.76-2.025c.081-.946-.417-2.015-1.058-3.002L16.932 0l3.887 1.628c1.089.448 2.167.956 3.185 1.669c1.007.712 2.004 1.608 2.686 2.788c.712 1.16 1.007 2.584.977 3.836c0 .315-.02.621-.041.926c-.041.305-.051.55-.122.936c-.122.682-.305 1.19-.458 1.709c-.315.997-.519 2.025-.295 2.564c.132.509 1.292.906 2.147.794c.916-.092 1.77-.733 2.371-1.577c.6-.855.916-1.923 1.079-2.981l.132-.834l.295.763c.549 1.383.864 2.859.854 4.344"/><path fill="#ffcc4d" d="M33.146 16.503c-.001-1.463.068-2.222-.507-3.52c-.393 3.824-3.228 5.144-5.792 4.23c-2.402-.857-.783-4.198-.664-5.793c.202-2.703-.01-5.796-5.919-8.369c2.455 3.903.284 6.327-1.993 6.475c-2.526.164-4.84-1.804-3.986-4.997c-2.765 1.693-2.846 4.543-1.993 6.386c.89 1.921-.036 3.518-2.206 3.695c-2.426.199-3.773-2.158-2.531-5.913c-2.151 2.104-3.676 4.837-3.449 7.805C5.142 30.035 17.841 33.93 17.841 33.93s15.319-3.757 15.305-17.427"/><path fill="#dd2e44" d="M30.935 19.489a7.234 7.234 0 0 0-7.233-7.234a7.22 7.22 0 0 0-5.878 3.027a7.22 7.22 0 0 0-5.877-3.027a7.234 7.234 0 0 0-7.234 7.234c0 .566.072 1.114.195 1.643c1.004 6.24 7.943 12.824 12.915 14.632c4.972-1.808 11.911-8.391 12.914-14.631a7.074 7.074 0 0 0 .198-1.644"/><path fill="#ffcc4d" d="M24.312 31.553s1.426-2.769 1.319-5.645c-.038-1.024-.327-2.019-.736-2.958c-.958-2.196-2.806-7.706 1.147-10.661c0 0-.755 1.269-.085 3.581c.265.915.761 1.741 1.35 2.49c1.36 1.732 4.219 6.501-.484 10.948zm-7.659 3.728s-1.581-1.515-2.421-3.652c-.299-.761-.406-1.58-.406-2.398c-.001-1.911-.409-6.529-4.242-7.427c0 0 .957.687 1.205 2.591c.098.753-.001 1.516-.192 2.251c-.441 1.701-.972 5.909 3.886 7.659z"/></svg>
|
<svg class="w-6 h-6 inline-block mr-2" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 36 36"><path fill="#f4900c" d="m33.629 16.565l-.092 1.608l-.041.814c-.02.265-.092.529-.142.794l-.285 1.598c-.153.519-.326 1.028-.499 1.547c-.743 2.025-1.791 4.029-3.246 5.698a23.476 23.476 0 0 1-5.006 4.396c-1.903 1.221-3.867 2.167-6.126 2.859l-.385.121l-.427-.142c-1.526-.499-2.798-1.099-4.101-1.832c-1.272-.722-2.503-1.536-3.612-2.524l-.835-.732l-.784-.794c-.529-.519-.987-1.109-1.455-1.689a20.511 20.511 0 0 1-2.3-3.826c-.611-1.353-1.109-2.768-1.404-4.213c-.071-.366-.183-.722-.224-1.089l-.132-1.089c-.071-.733-.193-1.435-.153-2.279c.061-1.618.56-3.175 1.313-4.508a14.016 14.016 0 0 1 2.849-3.48l3.46-3.053l-1.669 4.174c-.57 1.435-.845 3.134-.193 4.202c.315.529.885.814 1.587.824c.733 0 1.475-.203 1.872-.692c.407-.478.438-1.231.183-1.954c-.326-.753-.631-1.77-.59-2.696c0-.946.275-1.893.753-2.717c.488-.824 1.19-1.496 1.984-1.994l1.028-.641l-.285 1.19c-.295 1.221-.081 2.503.733 3.287c.804.784 2.076 1.058 3.103.794c1.028-.275 1.72-1.109 1.76-2.025c.081-.946-.417-2.015-1.058-3.002L16.932 0l3.887 1.628c1.089.448 2.167.956 3.185 1.669c1.007.712 2.004 1.608 2.686 2.788c.712 1.16 1.007 2.584.977 3.836c0 .315-.02.621-.041.926c-.041.305-.051.55-.122.936c-.122.682-.305 1.19-.458 1.709c-.315.997-.519 2.025-.295 2.564c.132.509 1.292.906 2.147.794c.916-.092 1.77-.733 2.371-1.577c.6-.855.916-1.923 1.079-2.981l.132-.834l.295.763c.549 1.383.864 2.859.854 4.344"/><path fill="#ffcc4d" d="M33.146 16.503c-.001-1.463.068-2.222-.507-3.52c-.393 3.824-3.228 5.144-5.792 4.23c-2.402-.857-.783-4.198-.664-5.793c.202-2.703-.01-5.796-5.919-8.369c2.455 3.903.284 6.327-1.993 6.475c-2.526.164-4.84-1.804-3.986-4.997c-2.765 1.693-2.846 4.543-1.993 6.386c.89 1.921-.036 3.518-2.206 3.695c-2.426.199-3.773-2.158-2.531-5.913c-2.151 2.104-3.676 4.837-3.449 7.805C5.142 30.035 17.841 33.93 17.841 33.93s15.319-3.757 15.305-17.427"/><path fill="#dd2e44" d="M30.935 19.489a7.234 7.234 0 0 0-7.233-7.234a7.22 7.22 0 0 0-5.878 3.027a7.22 7.22 0 0 0-5.877-3.027a7.234 7.234 0 0 0-7.234 7.234c0 .566.072 1.114.195 1.643c1.004 6.24 7.943 12.824 12.915 14.632c4.972-1.808 11.911-8.391 12.914-14.631a7.074 7.074 0 0 0 .198-1.644"/><path fill="#ffcc4d" d="M24.312 31.553s1.426-2.769 1.319-5.645c-.038-1.024-.327-2.019-.736-2.958c-.958-2.196-2.806-7.706 1.147-10.661c0 0-.755 1.269-.085 3.581c.265.915.761 1.741 1.35 2.49c1.36 1.732 4.219 6.501-.484 10.948zm-7.659 3.728s-1.581-1.515-2.421-3.652c-.299-.761-.406-1.58-.406-2.398c-.001-1.911-.409-6.529-4.242-7.427c0 0 .957.687 1.205 2.591c.098.753-.001 1.516-.192 2.251c-.441 1.701-.972 5.909 3.886 7.659z"/></svg>
|
||||||
@ -176,6 +177,7 @@ onMount( async() => {
|
|||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
-->
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -235,7 +237,7 @@ onMount( async() => {
|
|||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
<!--
|
|
||||||
<div class="w-full max-w-64 sm:max-w-3xl m-auto grid grid-cols-1 md:grid-cols-3 gap-y-3 sm:gap-x-5 mt-10 flex justify-center items-center">
|
<div class="w-full max-w-64 sm:max-w-3xl m-auto grid grid-cols-1 md:grid-cols-3 gap-y-3 sm:gap-x-5 mt-10 flex justify-center items-center">
|
||||||
<a href="/politicians/61b59ab669" class="px-4 py-3 text-white bg-[#202327] rounded-lg flex flex-row items-center font-medium transition duration-150 ease-in-out group">
|
<a href="/politicians/61b59ab669" class="px-4 py-3 text-white bg-[#202327] rounded-lg flex flex-row items-center font-medium transition duration-150 ease-in-out group">
|
||||||
<div class="flex flex-row items-center">
|
<div class="flex flex-row items-center">
|
||||||
@ -259,6 +261,18 @@ onMount( async() => {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
|
<a href="/analysts/5874f5e45064ed0001eb1bc5" class="px-4 py-3 text-white bg-[#202327] rounded-lg flex flex-row items-center font-medium transition duration-150 ease-in-out group">
|
||||||
|
<div class="flex flex-row items-center">
|
||||||
|
<div class="shadow-lg rounded-full border border-slate-600 w-10 h-10 relative analyst-striped bg-[#737D62] flex items-center justify-center">
|
||||||
|
<img style="clip-path: circle(50%);" class="rounded-full w-8" src={analystAvatar} loading="lazy"/>
|
||||||
|
</div>
|
||||||
|
<div class="flex flex-col items-start ml-2">
|
||||||
|
<span class="text-sm text-start">Track Keith Horowitz</span>
|
||||||
|
<span class="text-xs text-gray-400">Analyst at Citigroup</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
<!--
|
||||||
<a href="/hedge-funds/0001649339" class="px-4 py-3 text-white bg-[#202327] rounded-lg flex flex-row items-center font-medium transition duration-150 ease-in-out group">
|
<a href="/hedge-funds/0001649339" class="px-4 py-3 text-white bg-[#202327] rounded-lg flex flex-row items-center font-medium transition duration-150 ease-in-out group">
|
||||||
<div class="flex flex-row items-center">
|
<div class="flex flex-row items-center">
|
||||||
<div class="shadow-lg rounded-full border border-slate-600 w-10 h-10 relative hedge-fund-striped bg-[#20202E] flex items-center justify-center">
|
<div class="shadow-lg rounded-full border border-slate-600 w-10 h-10 relative hedge-fund-striped bg-[#20202E] flex items-center justify-center">
|
||||||
@ -270,8 +284,9 @@ onMount( async() => {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
|
||||||
-->
|
-->
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -852,5 +867,16 @@ onMount( async() => {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.analyst-striped {
|
||||||
|
background-image: repeating-linear-gradient(
|
||||||
|
-45deg,
|
||||||
|
#737D62,
|
||||||
|
#737D62 10px,
|
||||||
|
#677058 10px,
|
||||||
|
#677058 20px
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
@ -1,11 +1,9 @@
|
|||||||
<script lang='ts'>
|
<script lang='ts'>
|
||||||
import cardBackground from "$lib/images/bg-hedge-funds.png";
|
import cardBackground from "$lib/images/bg-hedge-funds.png";
|
||||||
import defaultAvatar from "$lib/images/hedge_funds/default-avatar.png";
|
|
||||||
|
|
||||||
import { screenWidth, numberOfUnreadNotification } from '$lib/store';
|
import { screenWidth, numberOfUnreadNotification } from '$lib/store';
|
||||||
import { abbreviateNumber } from '$lib/utils';
|
import { abbreviateNumber } from '$lib/utils';
|
||||||
import { onMount } from 'svelte';
|
import { onMount } from 'svelte';
|
||||||
import { compareTwoStrings } from 'string-similarity';
|
|
||||||
// import * as XLSX from 'xlsx';
|
// import * as XLSX from 'xlsx';
|
||||||
|
|
||||||
export let data;
|
export let data;
|
||||||
|
|||||||
@ -35,15 +35,17 @@ export const load = async () => {
|
|||||||
|
|
||||||
output = (await import('$lib/hedge-funds/all-hedge-funds.json'))?.default;
|
output = (await import('$lib/hedge-funds/all-hedge-funds.json'))?.default;
|
||||||
|
|
||||||
// Cache the data for this specific tickerID with a specific name 'getHedgeFunds'
|
|
||||||
setCache('getHedgeFunds', output, 'getHedgeFunds');
|
|
||||||
}
|
|
||||||
|
|
||||||
await loadImages();
|
await loadImages();
|
||||||
output?.forEach(item => {
|
output?.forEach(item => {
|
||||||
item.image = images[item?.cik] || defaultAvatar;
|
item.image = images[item?.cik] || defaultAvatar;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Cache the data for this specific tickerID with a specific name 'getHedgeFunds'
|
||||||
|
setCache('getHedgeFunds', output, 'getHedgeFunds');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return output;
|
return output;
|
||||||
};
|
};
|
||||||
|
|||||||
@ -42,15 +42,17 @@ export const load = async ({ params }) => {
|
|||||||
output = await response.json();
|
output = await response.json();
|
||||||
|
|
||||||
// Cache the data for this specific tickerID with a specific name 'getHedgeFundsData'
|
// Cache the data for this specific tickerID with a specific name 'getHedgeFundsData'
|
||||||
setCache(params.slug, output, 'getHedgeFundsData');
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
output.holdings = output?.holdings?.filter(item => item?.sharesNumber !== 0 && item?.symbol !== null); //item?.symbol !== null
|
output.holdings = output?.holdings?.filter(item => item?.sharesNumber !== 0 && item?.symbol !== null); //item?.symbol !== null
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
console.log(e)
|
console.log(e)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setCache(params.slug, output, 'getHedgeFundsData');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
displayCompanyName.update(value => output?.name ?? params.slug)
|
displayCompanyName.update(value => output?.name ?? params.slug)
|
||||||
return output;
|
return output;
|
||||||
};
|
};
|
||||||
|
|||||||
@ -57,9 +57,6 @@ export const load = async () => {
|
|||||||
output = await response.json();
|
output = await response.json();
|
||||||
|
|
||||||
// Cache the data for this specific tickerID with a specific name 'getAllPolitician'
|
// Cache the data for this specific tickerID with a specific name 'getAllPolitician'
|
||||||
setCache('', output, 'getAllPolitician');
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
await loadImages();
|
await loadImages();
|
||||||
output?.forEach(item => {
|
output?.forEach(item => {
|
||||||
@ -83,6 +80,13 @@ export const load = async () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
setCache('', output, 'getAllPolitician');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return output;
|
return output;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -1,41 +1,41 @@
|
|||||||
<script lang='ts'>
|
<script lang='ts'>
|
||||||
import { goto } from '$app/navigation';
|
import { goto } from '$app/navigation';
|
||||||
import { screenWidth, numberOfUnreadNotification } from '$lib/store';
|
import { screenWidth, numberOfUnreadNotification } from '$lib/store';
|
||||||
import republicanBackground from "$lib/images/bg-republican.png";
|
import republicanBackground from "$lib/images/bg-republican.png";
|
||||||
import democraticBackground from "$lib/images/bg-democratic.png";
|
import democraticBackground from "$lib/images/bg-democratic.png";
|
||||||
import otherBackground from "$lib/images/bg-other.png";
|
import otherBackground from "$lib/images/bg-other.png";
|
||||||
import { getPartyForPoliticians, abbreviateNumber } from '$lib/utils';
|
import { getPartyForPoliticians, abbreviateNumber } from '$lib/utils';
|
||||||
import defaultAvatar from '$lib/images/senator/default-avatar.png';
|
import defaultAvatar from '$lib/images/senator/default-avatar.png';
|
||||||
import InfiniteLoading from '$lib/components/InfiniteLoading.svelte';
|
import InfiniteLoading from '$lib/components/InfiniteLoading.svelte';
|
||||||
import { Chart } from 'svelte-echarts'
|
import { Chart } from 'svelte-echarts'
|
||||||
|
|
||||||
import { onMount } from 'svelte';
|
import { onMount } from 'svelte';
|
||||||
|
|
||||||
export let data;
|
export let data;
|
||||||
let isLoaded = false;
|
let isLoaded = false;
|
||||||
let rawData = data?.getPolitician;
|
let rawData = data?.getPolitician;
|
||||||
let displayList = [];
|
let displayList = [];
|
||||||
let optionsData = {};
|
let optionsData = {};
|
||||||
|
|
||||||
let name = rawData?.at(0)?.representative ?? 'n/a';
|
let name = rawData?.at(0)?.representative ?? 'n/a';
|
||||||
let numOfTrades = rawData?.length;
|
let numOfTrades = rawData?.length;
|
||||||
let lastTradedDate = rawData?.at(0)?.transactionDate;
|
let lastTradedDate = rawData?.at(0)?.transactionDate;
|
||||||
let politicianParty = 'n/a';
|
let politicianParty = 'n/a';
|
||||||
let images = {};
|
let images = {};
|
||||||
let buySellRatio = 0
|
let buySellRatio = 0
|
||||||
let totalAmountTraded = 0;
|
let totalAmountTraded = 0;
|
||||||
let politicianImage;
|
let politicianImage;
|
||||||
let politicianDistrict;
|
let politicianDistrict;
|
||||||
let politicianCongress;
|
let politicianCongress;
|
||||||
let numOfAssets = new Set(rawData?.map(item => item?.ticker))?.size;
|
let numOfAssets = new Set(rawData?.map(item => item?.ticker))?.size;
|
||||||
|
|
||||||
|
|
||||||
function getYearFromDate(dateString) {
|
function getYearFromDate(dateString) {
|
||||||
return new Date(dateString).getFullYear();
|
return new Date(dateString).getFullYear();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Function to extract the number from the amount string
|
// Function to extract the number from the amount string
|
||||||
function extractNumberFromAmount(amount) {
|
function extractNumberFromAmount(amount) {
|
||||||
const dashIndex = amount?.indexOf('-');
|
const dashIndex = amount?.indexOf('-');
|
||||||
if (dashIndex !== -1) {
|
if (dashIndex !== -1) {
|
||||||
const numberAfterDash = amount?.slice(dashIndex + 1);
|
const numberAfterDash = amount?.slice(dashIndex + 1);
|
||||||
@ -50,20 +50,20 @@ function extractNumberFromAmount(amount) {
|
|||||||
return isNaN(parsedNumber) ? 0 : parsedNumber;
|
return isNaN(parsedNumber) ? 0 : parsedNumber;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Calculate the total sum
|
// Calculate the total sum
|
||||||
totalAmountTraded = rawData?.reduce((sum, item) => {
|
totalAmountTraded = rawData?.reduce((sum, item) => {
|
||||||
const amount = item?.amount;
|
const amount = item?.amount;
|
||||||
const parsedAmount = extractNumberFromAmount(amount);
|
const parsedAmount = extractNumberFromAmount(amount);
|
||||||
return sum + parsedAmount;
|
return sum + parsedAmount;
|
||||||
}, 0);
|
}, 0);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
async function infiniteHandler({ detail: { loaded, complete } })
|
async function infiniteHandler({ detail: { loaded, complete } })
|
||||||
{
|
{
|
||||||
if (displayList?.length === rawData?.length) {
|
if (displayList?.length === rawData?.length) {
|
||||||
complete();
|
complete();
|
||||||
} else {
|
} else {
|
||||||
@ -72,10 +72,10 @@ async function infiniteHandler({ detail: { loaded, complete } })
|
|||||||
displayList = [...displayList, ...newArticles];
|
displayList = [...displayList, ...newArticles];
|
||||||
loaded();
|
loaded();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Function to load images only when they are viewed
|
// Function to load images only when they are viewed
|
||||||
async function loadImages() {
|
async function loadImages() {
|
||||||
const imageFiles = import.meta.glob('$lib/images/senator/*.png');
|
const imageFiles = import.meta.glob('$lib/images/senator/*.png');
|
||||||
const imagesPromises = [];
|
const imagesPromises = [];
|
||||||
|
|
||||||
@ -92,7 +92,7 @@ async function loadImages() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function normalizer(value) {
|
function normalizer(value) {
|
||||||
if (Math?.abs(value) >= 1e12) {
|
if (Math?.abs(value) >= 1e12) {
|
||||||
return { unit: 'T', denominator: 1e12 };
|
return { unit: 'T', denominator: 1e12 };
|
||||||
} else if (Math?.abs(value) >= 1e9) {
|
} else if (Math?.abs(value) >= 1e9) {
|
||||||
@ -104,9 +104,9 @@ function normalizer(value) {
|
|||||||
} else {
|
} else {
|
||||||
return { unit: '', denominator: 1 };
|
return { unit: '', denominator: 1 };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getPlotOptions() {
|
async function getPlotOptions() {
|
||||||
// Get unique years from the data
|
// Get unique years from the data
|
||||||
const uniqueYears = [2017, 2018,2019,2020,2021,2022,2023,2024] //[...new Set(rawData?.map(item => getYearFromDate(item?.transactionDate)))]?.reverse();
|
const uniqueYears = [2017, 2018,2019,2020,2021,2022,2023,2024] //[...new Set(rawData?.map(item => getYearFromDate(item?.transactionDate)))]?.reverse();
|
||||||
// Initialize boughtList and soldList arrays
|
// Initialize boughtList and soldList arrays
|
||||||
@ -186,10 +186,10 @@ async function getPlotOptions() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
return option;
|
return option;
|
||||||
}
|
}
|
||||||
|
|
||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
isLoaded = false;
|
isLoaded = false;
|
||||||
await loadImages();
|
await loadImages();
|
||||||
|
|
||||||
@ -218,17 +218,17 @@ onMount(async () => {
|
|||||||
const typeCounts = rawData?.reduce((counts, item) => {
|
const typeCounts = rawData?.reduce((counts, item) => {
|
||||||
counts[item?.type] = (counts[item?.type ] || 0) + 1;
|
counts[item?.type] = (counts[item?.type ] || 0) + 1;
|
||||||
return counts;
|
return counts;
|
||||||
}, {});
|
}, {});
|
||||||
|
|
||||||
buySellRatio = typeCounts['Bought'] > 0 && typeCounts['Sold'] === undefined ? 1 : typeCounts['Bought'] === undefined ? 0 : typeCounts["Bought"]/typeCounts["Sold"];
|
buySellRatio = typeCounts['Bought'] > 0 && typeCounts['Sold'] === undefined ? 1 : typeCounts['Bought'] === undefined ? 0 : typeCounts["Bought"]/typeCounts["Sold"];
|
||||||
|
|
||||||
displayList = rawData?.slice(0,20) ?? [];
|
displayList = rawData?.slice(0,20) ?? [];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
isLoaded = true;
|
isLoaded = true;
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -247,29 +247,29 @@ onMount(async () => {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
<svelte:head>
|
<svelte:head>
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<meta name="viewport" content="width=device-width" />
|
<meta name="viewport" content="width=device-width" />
|
||||||
<title>
|
<title>
|
||||||
{$numberOfUnreadNotification > 0 ? `(${$numberOfUnreadNotification})` : ''} Which stocks is {name} trading? · stocknear
|
{$numberOfUnreadNotification > 0 ? `(${$numberOfUnreadNotification})` : ''} Which stocks is {name} trading? · stocknear
|
||||||
</title>
|
</title>
|
||||||
<meta name="description" content={`A list of all trades from the US Politician ${name}.`} />
|
<meta name="description" content={`A list of all trades from the US Politician ${name}.`} />
|
||||||
|
|
||||||
<!-- Other meta tags -->
|
<!-- Other meta tags -->
|
||||||
<meta property="og:title" content={`Which stocks is ${name} trading? · stocknear`}/>
|
<meta property="og:title" content={`Which stocks is ${name} trading? · stocknear`}/>
|
||||||
<meta property="og:description" content={`A list of all trades from the US Politician ${name}.`} />
|
<meta property="og:description" content={`A list of all trades from the US Politician ${name}.`} />
|
||||||
<meta property="og:image" content="https://stocknear-pocketbase.s3.amazonaws.com/logo/meta_logo.jpg"/>
|
<meta property="og:image" content="https://stocknear-pocketbase.s3.amazonaws.com/logo/meta_logo.jpg"/>
|
||||||
<meta property="og:type" content="website"/>
|
<meta property="og:type" content="website"/>
|
||||||
<!-- Add more Open Graph meta tags as needed -->
|
<!-- Add more Open Graph meta tags as needed -->
|
||||||
|
|
||||||
<!-- Twitter specific meta tags -->
|
<!-- Twitter specific meta tags -->
|
||||||
<meta name="twitter:card" content="summary_large_image"/>
|
<meta name="twitter:card" content="summary_large_image"/>
|
||||||
<meta name="twitter:title" content={`Which stocks is ${name} trading? · stocknear`}/>
|
<meta name="twitter:title" content={`Which stocks is ${name} trading? · stocknear`}/>
|
||||||
<meta name="twitter:description" content={`A list of all trades from the US Politician ${name}.`} />
|
<meta name="twitter:description" content={`A list of all trades from the US Politician ${name}.`} />
|
||||||
<meta name="twitter:image" content="https://stocknear-pocketbase.s3.amazonaws.com/logo/meta_logo.jpg"/>
|
<meta name="twitter:image" content="https://stocknear-pocketbase.s3.amazonaws.com/logo/meta_logo.jpg"/>
|
||||||
<!-- Add more Twitter meta tags as needed -->
|
<!-- Add more Twitter meta tags as needed -->
|
||||||
|
|
||||||
</svelte:head>
|
</svelte:head>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -610,10 +610,10 @@ onMount(async () => {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.scroller {
|
.scroller {
|
||||||
scrollbar-width: thin;
|
scrollbar-width: thin;
|
||||||
}
|
}
|
||||||
.app {
|
.app {
|
||||||
height: 300px;
|
height: 300px;
|
||||||
max-width: 100%; /* Ensure chart width doesn't exceed the container */
|
max-width: 100%; /* Ensure chart width doesn't exceed the container */
|
||||||
@ -637,9 +637,9 @@ onMount(async () => {
|
|||||||
#840412 10px,
|
#840412 10px,
|
||||||
#840412 20px
|
#840412 20px
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
.democratic-striped {
|
.democratic-striped {
|
||||||
background-image: repeating-linear-gradient(
|
background-image: repeating-linear-gradient(
|
||||||
-45deg,
|
-45deg,
|
||||||
#295AC7,
|
#295AC7,
|
||||||
@ -647,9 +647,9 @@ onMount(async () => {
|
|||||||
#164D9D 10px,
|
#164D9D 10px,
|
||||||
#164D9D 20px
|
#164D9D 20px
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
.other-striped {
|
.other-striped {
|
||||||
background-image: repeating-linear-gradient(
|
background-image: repeating-linear-gradient(
|
||||||
-45deg,
|
-45deg,
|
||||||
#A4A6A8,
|
#A4A6A8,
|
||||||
@ -657,5 +657,5 @@ onMount(async () => {
|
|||||||
#C0C3C5 10px,
|
#C0C3C5 10px,
|
||||||
#C0C3C5 20px
|
#C0C3C5 20px
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
Loading…
x
Reference in New Issue
Block a user