Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 19 additions & 9 deletions src/components/Learn/TipOfTheDay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,24 @@ import { BlockStack, InlineStack } from "@/components/ui/layout";
import { Heading, Paragraph } 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);
}

export function TipOfTheDay() {
const index = getDayOfYear(new Date()) % tips.length;
const tip = tips[index];

return (
<div className="h-full rounded-xl border border-border bg-card p-5">
<BlockStack gap="3" className="h-full">
Expand All @@ -29,16 +39,16 @@ export function TipOfTheDay() {
<Heading level={3}>Tip of the day</Heading>
</InlineStack>
<Badge size="sm" variant="secondary">
{STUB_TIP.category}
{tip.category}
</Badge>
</InlineStack>

<BlockStack gap="1" className="flex-1">
<Paragraph size="sm" weight="semibold">
{STUB_TIP.title}
{tip.title}
</Paragraph>
<Paragraph size="sm" tone="subdued">
{STUB_TIP.body}
{tip.body}
</Paragraph>
</BlockStack>

Expand Down
6 changes: 5 additions & 1 deletion src/routes/Dashboard/DashboardHomeView.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Link } from "@tanstack/react-router";

import { RunSection } from "@/components/Home/RunSection/RunSection";
import { TipOfTheDay } from "@/components/Learn/TipOfTheDay";
import { AnnouncementBanners } from "@/components/shared/AnnouncementBanners";
import { BlockStack, InlineStack } from "@/components/ui/layout";
import {
Expand Down Expand Up @@ -170,10 +171,13 @@ export function DashboardHomeView() {
<BlockStack gap="6">
<AnnouncementBanners />

<div className="grid grid-cols-3 gap-6 overflow-hidden">
<div className="w-full grid grid-cols-6 gap-6 overflow-hidden">
<FavoritesPreview />
<RecentlyViewedPreview />
<RecentComponentsPreview />
<div className="col-span-3 max-w-4xl mx-auto">
<TipOfTheDay />
</div>
</div>

<BlockStack gap="3">
Expand Down
Loading