Make home page greeting dynamic based on user initials and time of day
This commit is contained in:
8
.vite/deps/_metadata.json
Normal file
8
.vite/deps/_metadata.json
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"hash": "051e2474",
|
||||||
|
"configHash": "e4c88079",
|
||||||
|
"lockfileHash": "d1d1ccd5",
|
||||||
|
"browserHash": "5d55767b",
|
||||||
|
"optimized": {},
|
||||||
|
"chunks": {}
|
||||||
|
}
|
||||||
3
.vite/deps/package.json
Normal file
3
.vite/deps/package.json
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"type": "module"
|
||||||
|
}
|
||||||
@@ -603,6 +603,7 @@ export function App() {
|
|||||||
onSelectCompany={selectCompany}
|
onSelectCompany={selectCompany}
|
||||||
onRemoveHolding={removeHolding}
|
onRemoveHolding={removeHolding}
|
||||||
pendingTicker={settingActiveTicker ?? removingTicker ?? addingTicker}
|
pendingTicker={settingActiveTicker ?? removingTicker ?? addingTicker}
|
||||||
|
profile={profile}
|
||||||
onRunResearch={() => runPipeline("research")}
|
onRunResearch={() => runPipeline("research")}
|
||||||
runningResearch={runningPipeline === "research"}
|
runningResearch={runningPipeline === "research"}
|
||||||
addToast={addToast}
|
addToast={addToast}
|
||||||
@@ -1157,17 +1158,28 @@ function Home(props: {
|
|||||||
onSelectCompany: (tickerOrId: string, screen?: Screen) => void;
|
onSelectCompany: (tickerOrId: string, screen?: Screen) => void;
|
||||||
onRemoveHolding: (ticker: string) => void;
|
onRemoveHolding: (ticker: string) => void;
|
||||||
pendingTicker: string | null;
|
pendingTicker: string | null;
|
||||||
|
profile: Partial<UserProfile>;
|
||||||
onRunResearch: () => void | Promise<void>;
|
onRunResearch: () => void | Promise<void>;
|
||||||
runningResearch: boolean;
|
runningResearch: boolean;
|
||||||
addToast: (t: Omit<Toast, "id">) => void;
|
addToast: (t: Omit<Toast, "id">) => void;
|
||||||
}) {
|
}) {
|
||||||
const holdings = props.holdings;
|
const holdings = props.holdings;
|
||||||
|
const hour = new Date().getHours();
|
||||||
|
const timeGreeting = hour < 12 ? "Good morning" : hour < 17 ? "Good afternoon" : "Good evening";
|
||||||
|
const initials = props.profile.name
|
||||||
|
? props.profile.name
|
||||||
|
.split(" ")
|
||||||
|
.map((n) => n[0])
|
||||||
|
.join("")
|
||||||
|
.toUpperCase()
|
||||||
|
.slice(0, 2)
|
||||||
|
: null;
|
||||||
return (
|
return (
|
||||||
<section className={ui.screen}>
|
<section className={ui.screen}>
|
||||||
<div className="mb-5 flex items-start justify-between gap-4">
|
<div className="mb-5 flex items-start justify-between gap-4">
|
||||||
<div>
|
<div>
|
||||||
<p className={ui.eyebrow}>Morning Briefing</p>
|
<p className={ui.eyebrow}>{timeGreeting.replace("Good ", "")} Briefing</p>
|
||||||
<h1 className={ui.h1}>Good morning, JD</h1>
|
<h1 className={ui.h1}>{timeGreeting}{initials ? `, ${initials}` : ""}</h1>
|
||||||
</div>
|
</div>
|
||||||
<button
|
<button
|
||||||
className={cx(ui.btn, ui.btnPrimary)}
|
className={cx(ui.btn, ui.btnPrimary)}
|
||||||
|
|||||||
Reference in New Issue
Block a user