From 25906cbb903eb4e40d70b5e795a840663f685a09 Mon Sep 17 00:00:00 2001 From: MuslemRahimi Date: Fri, 31 Jan 2025 12:15:30 +0100 Subject: [PATCH] ui fixes --- src/lib/components/Map.svelte | 5 + src/routes/newsletter/+page.svelte | 4 +- src/routes/potus-tracker/+page.svelte | 468 +++++++++++++++----------- 3 files changed, 282 insertions(+), 195 deletions(-) diff --git a/src/lib/components/Map.svelte b/src/lib/components/Map.svelte index b6b15e4b..f7ec1275 100644 --- a/src/lib/components/Map.svelte +++ b/src/lib/components/Map.svelte @@ -12,6 +12,7 @@ import Feature from "ol/Feature"; import Point from "ol/geom/Point"; import { Style, Circle, Fill } from "ol/style"; + import { defaults as defaultInteractions } from "ol/interaction"; // White House coordinates const LON = -77.0365427; @@ -89,6 +90,10 @@ maxZoom: 18, }), controls: [], + interactions: defaultInteractions({ + mouseWheelZoom: false, // Disable scroll zoom + pinchZoom: false, // Disable pinch-to-zoom + }), }); animate(); diff --git a/src/routes/newsletter/+page.svelte b/src/routes/newsletter/+page.svelte index c94a89f3..34a6d0f6 100644 --- a/src/routes/newsletter/+page.svelte +++ b/src/routes/newsletter/+page.svelte @@ -7,7 +7,7 @@
@@ -20,7 +20,7 @@ Stay informed in just 2 minutes per day

- Market Bullets is a free newsletter that makes it super easy to keep up + Market Bullets is a Pro Newsletter that makes it super easy to keep up with financial markets.

diff --git a/src/routes/potus-tracker/+page.svelte b/src/routes/potus-tracker/+page.svelte index 2003e120..da895bab 100644 --- a/src/routes/potus-tracker/+page.svelte +++ b/src/routes/potus-tracker/+page.svelte @@ -4,6 +4,7 @@ import Infobox from "$lib/components/Infobox.svelte"; import { monthNames } from "$lib/utils"; import { screenWidth } from "$lib/store"; + import ArrowLogo from "lucide-svelte/icons/move-up-right"; import { Chart } from "svelte-echarts"; @@ -42,6 +43,18 @@ return acc; }, {}); + let groupedOrders = executiveOrders.reduce((acc, item) => { + const dateKey = new Intl.DateTimeFormat("en-US", { + day: "2-digit", + month: "short", + year: "numeric", + }).format(new Date(item.date)); + + if (!acc[dateKey]) acc[dateKey] = []; + acc[dateKey].push(item); + return acc; + }, {}); + let modalTitle = "n/a"; let modalDescription = "n/a"; let modalLink = "#"; @@ -55,7 +68,17 @@ }, ]; + const subTabs = [ + { + title: "Presidential Schedule", + }, + { + title: "Executive Orders", + }, + ]; + let activeIdx = 0; + let subActiveIdx = 0; function plotData() { const history = data?.getEggPrice?.history || []; @@ -167,7 +190,7 @@ lineStyle: { width: 2 }, data: yoyChangeList, itemStyle: { - color: "#9B5DC4", + color: "#2b7fff", }, smooth: true, showSymbol: false, @@ -215,21 +238,30 @@ class="flex flex-row items-center w-full text-[1rem] text-white" > {#each tabs as item, i} - (activeIdx = i)} class="p-2 px-5 cursor-pointer {activeIdx === i ? 'text-white bg-primary sm:hover:bg-opacity-[0.95] font-semibold' : 'text-gray-400 sm:hover:text-white sm:hover:bg-primary sm:hover:bg-opacity-[0.95]'}" > {item.title} - + {/each} {#if activeIdx === 0} -

+
+ = 0 ? "grown" : "declined"} by + ${data?.getData?.returnSince ?? "n/a"}%.`} + /> +
+ +

The US President is currently located in {data?.getData?.city ?? "n/a"}

@@ -241,7 +273,9 @@ Map data © OpenStreetMap {:else} -

Egg Stats:

+

+ Quick Stats: +

-
+
- - The Federal Reserve Economic Data is collected monthly and - updates egg prices across the United States. - + {/if} -

- Official Presidential Schedule -

- -
- = 0 ? "grown" : "declined"} by - ${data?.getData?.returnSince ?? "n/a"}%.`} - /> -
- -
- {#each Object.entries(groupedByDate) as [date, items], indexA} -
-
+
    + {#each subTabs as item, i} +
- -
- {#each items as item, indexB} -
-
-
- - - - - - - + {item.title} + + {/each} + + - {#if indexA === 0 && indexB === 0} - - {/if} + {#if subActiveIdx === 0} +

+ Official Presidential Schedule +

+ +
+ {#each Object.entries(groupedByDate) as [date, items], indexA} +
+
+ + {date} + {#if items?.at(0)?.changesPercentage} +
+ S&P500 + {items.length > 0 + ? items?.at(0)?.changesPercentage + : "n/a"}% +
+ {/if} +
+ +
+ {#each items as item, indexB} +
+
+
+ + + + + + + + + {#if indexA === 0 && indexB === 0} + + {/if} +
+ + + {item.time_formatted} - {item.location} +
- - {item.time_formatted} - {item.location} + + {item.details}
- - - {item.details} - + {/each} +
+ {/each} +
+ {:else} +

+ Latest Executive Orders analyzed by AI +

+
+ {#each Object.entries(groupedOrders) as [date, items]} +
+
+ {date}
- {/each} -
- {/each} -
+
+ + {#each items as item, index} +
+
+
+ + + + + + + {#if index === 0} + + {/if} +
+ + + + {item?.sentiment} + + - + {item.title} + +
+ + {item.description} + + + Source + +
+ {/each} +
+ {/each} +
+ {/if}
- - - - - - - - -