diff --git a/src/lib/images/senator/Byron_Donalds.png b/src/lib/images/senator/Byron_Donalds.png new file mode 100644 index 00000000..d20ee217 Binary files /dev/null and b/src/lib/images/senator/Byron_Donalds.png differ diff --git a/src/lib/utils.ts b/src/lib/utils.ts index 320a4cef..c5aa7c3b 100644 --- a/src/lib/utils.ts +++ b/src/lib/utils.ts @@ -597,6 +597,7 @@ function convertNYTimeToLocalTime(nyTimeString) { export function getPartyForPoliticians(name) { // Predefined list of senators and their parties const senatorPartyMap = { + "Bryon Donalds": "Republican", "Blake Moore": "Republican", "Bill Hagerty": "Republican", "Scott Peters": "Democratic", diff --git a/src/routes/politicians/flow-data/+page.svelte b/src/routes/politicians/flow-data/+page.svelte index 7427cf1f..9a2fe104 100644 --- a/src/routes/politicians/flow-data/+page.svelte +++ b/src/routes/politicians/flow-data/+page.svelte @@ -14,55 +14,19 @@ let cloudFrontUrl = import.meta.env.VITE_IMAGE_URL; let rawData = data?.getPoliticianRSS; - let slicedRawData = []; - let displayList = []; - - let isLoaded = false; - let displayStructure = "Table"; - let displayRows = 100; - - let filterList = []; - - let changeRowFilter = false; - let changeRuleFilter = false; + let displayList = rawData?.slice(0, 50) || []; async function handleScroll() { const scrollThreshold = document.body.offsetHeight * 0.8; // 80% of the website height const isBottom = window.innerHeight + window.scrollY >= scrollThreshold; - if (isBottom && displayList?.length !== slicedRawData?.length) { + if (isBottom && displayList?.length !== rawData?.length) { const nextIndex = displayList?.length; - const filteredNewResults = slicedRawData?.slice(nextIndex, nextIndex + 9); + const filteredNewResults = rawData?.slice(nextIndex, nextIndex + 9); displayList = [...displayList, ...filteredNewResults]; } } onMount(async () => { - rawData?.forEach((item) => { - let representative = item?.representative || ""; - - representative = representative - ?.replace("Jr", "") - .replace(/Dr./g, "") - .replace(/Dr_/g, ""); - - const fullName = representative - ?.replace(/(\s(?:Dr\s)?\w(?:\.|(?=\s)))?\s/g, "_") - .trim(); - item.representative = fullName?.replace(/_/g, " "); - }); - - rawData = rawData?.map((item) => { - const party = getPartyForPoliticians(item?.representative); - return { - ...item, - party: party, - }; - }); - - slicedRawData = rawData?.slice(0, displayRows) ?? []; - displayList = slicedRawData?.slice(0, 20) ?? []; - isLoaded = true; - window.addEventListener("scroll", handleScroll); //window.addEventListener('keydown', handleKeyDown); @@ -135,7 +99,7 @@
- {#if isLoaded} -
-
-
-
-
-
+
+
+
+
+
+ -
- + + + + + + + + + + + + {#each displayList as item, index} - - - - - - - - - {#each displayList as item, index} - - - - + + + - + - - - {/each} - -
+ Person + + Company + + Date + + Amount + Type
- Person - - Company - - Date - - Amount - Type
- - - -
- +
+ - - {item?.assetDescription.length > - charNumber - ? formatString( - item?.assetDescription.slice( - 0, - charNumber, - ), - ) + "..." - : formatString(item?.assetDescription) - ?.replace("- Common Stock", "") - ?.replace( - "Common Stock", - "", - )} + -
- {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} -
-
- + {item?.assetDescription.length > + charNumber + ? formatString( + item?.assetDescription.slice( + 0, + charNumber, + ), + ) + "..." + : formatString(item?.assetDescription) + ?.replace("- Common Stock", "") + ?.replace("Common Stock", "")} +
+ - + + {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} + + + {/each} + +
-
-
-
-
- {:else} -
-
- + + + +
+
- {/if} +