From 007c13a2128feeeb06f1c9e62af82e3c930a2ecb Mon Sep 17 00:00:00 2001 From: Camiel van Schoonhoven Date: Tue, 19 May 2026 17:21:00 -0700 Subject: [PATCH] feat: Learning Hub Tip of the Day --- src/components/Learn/TipOfTheDay.tsx | 93 ++++++++++++------- src/routes/Dashboard/DashboardHomeView.tsx | 6 +- src/routes/v2/pages/Editor/EditorV2.tsx | 2 + .../Editor/hooks/useTipOfTheDayWindow.tsx | 21 +++++ src/routes/v2/shared/windows/viewPresets.ts | 3 + 5 files changed, 93 insertions(+), 32 deletions(-) create mode 100644 src/routes/v2/pages/Editor/hooks/useTipOfTheDayWindow.tsx diff --git a/src/components/Learn/TipOfTheDay.tsx b/src/components/Learn/TipOfTheDay.tsx index 2c1bc3e8f..21b543058 100644 --- a/src/components/Learn/TipOfTheDay.tsx +++ b/src/components/Learn/TipOfTheDay.tsx @@ -4,50 +4,81 @@ import { Badge } from "@/components/ui/badge"; import { Button } from "@/components/ui/button"; import { Icon } from "@/components/ui/icon"; import { BlockStack, InlineStack } from "@/components/ui/layout"; -import { Heading, Paragraph } from "@/components/ui/typography"; +import { Heading, Text } from "@/components/ui/typography"; import { tracking } from "@/utils/tracking"; -const STUB_TIP = { - id: "subgraph-navigation", - category: "Editor", - title: "Use subgraphs to keep complex pipelines readable", - body: "Double-click any task to dive into its subgraph. Use the breadcrumbs at the top of the editor to navigate back up — perfect for organising large pipelines without clutter.", -}; +import { tips } from "./tips"; + +function getDayOfYear(date: Date) { + const start = Date.UTC(date.getUTCFullYear(), 0, 0); + + const now = Date.UTC( + date.getUTCFullYear(), + date.getUTCMonth(), + date.getUTCDate(), + ); + + return Math.floor((now - start) / 86_400_000); +} + +interface TipOfTheDayProps { + variant?: "card" | "compact"; +} + +export function TipOfTheDay({ variant = "card" }: TipOfTheDayProps = {}) { + const index = getDayOfYear(new Date()) % tips.length; + const tip = tips[index]; + const isCompact = variant === "compact"; + const textSize = isCompact ? "xs" : "sm"; + + const badge = ( + + {tip.category} + + ); -export function TipOfTheDay() { return ( -
- - - -