feat: recently viewed

This commit is contained in:
TrèsAbhi committed 2026-01-18 17:55:38 -06:00
1 parent 7399c402af
commit 49f84db473
8 files changed
+86 -7

No files matched your search

+5
View File
@@ -65,5 +65,10 @@
"navbar": { "navbar": {
"home": "Home", "home": "Home",
"settings": "Settings" "settings": "Settings"
},
"recent": {
"title": "Recent",
"no_recent": "Your recently viewed pages will appear here."
} }
} }
@@ -9,7 +9,7 @@ export interface HeadingProps extends Omit<TextProps, "size"> {
export function Heading({ export function Heading({
className, className,
weight, weight,
size = "2", size = "1",
...props ...props
}: HeadingProps) { }: HeadingProps) {
return ( return (
@@ -140,5 +140,19 @@ const strings = await api.strings(locale);
</div> </div>
<Text lowContrast className="label">{strings.navbar.settings}</Text> <Text lowContrast className="label">{strings.navbar.settings}</Text>
</LinkI18n> </LinkI18n>
<LinkI18n {locale} href="/settings" className="action" tabIndex={0}>
<div class="selector">
<GearIcon className="icon" />
</div>
<Text lowContrast className="label">{strings.navbar.settings}</Text>
</LinkI18n>
<LinkI18n {locale} href="/settings" className="action" tabIndex={0}>
<div class="selector">
<GearIcon className="icon" />
</div>
<Text lowContrast className="label">{strings.navbar.settings}</Text>
</LinkI18n>
</div> </div>
</div> </div>
@@ -0,0 +1,9 @@
.recent {
.list {
min-height: var(--space-7);
display: flex;
align-items: center;
justify-content: center;
}
}
@@ -0,0 +1,34 @@
import { LocaleProvider } from "../../hooks/useLocale";
import { useStrings } from "../../hooks/useStrings";
import { Heading } from "../Heading";
import { Section } from "../Section";
import { Text } from "../Text";
import styles from "./index.module.css";
interface Props {
locale: string;
skeleton?: boolean;
}
export function RecentItems({ locale, skeleton }: Props) {
return (
<LocaleProvider locale={locale}>
<Content />
</LocaleProvider>
);
}
function Content() {
const strings = useStrings();
return (
<Section first className={styles.recent}>
<Heading size="3">{strings.recent.title}</Heading>
<div className={styles.list}>
<Text lowContrast size="minor">
{strings.recent.no_recent}
</Text>
</div>
</Section>
);
}
@@ -11,4 +11,8 @@
flex-direction: column; flex-direction: column;
gap: var(--space-4); gap: var(--space-4);
} }
&[data-first="true"] .content {
padding-top: var(--space-6);
}
} }
@@ -2,13 +2,17 @@ import type { ComponentProps } from "react";
import { classNames } from "../../core/ui/classNames"; import { classNames } from "../../core/ui/classNames";
import "./index.css"; import "./index.css";
export function Section({ export interface SectionProps extends ComponentProps<"div"> {
className, first?: boolean;
children, }
...props
}: ComponentProps<"div">) { export function Section({ className, children, ...props }: SectionProps) {
return ( return (
<div className={classNames("section", className)} {...props}> <div
data-first={props.first}
className={classNames("section", className)}
{...props}
>
<div className="content">{children}</div> <div className="content">{children}</div>
</div> </div>
); );
@@ -2,6 +2,7 @@
import locales from "@blitzkit/i18n/locales.json"; import locales from "@blitzkit/i18n/locales.json";
import type { GetStaticPaths } from "astro"; import type { GetStaticPaths } from "astro";
import HomeHero from "../../components/HomeHero.astro"; import HomeHero from "../../components/HomeHero.astro";
import { RecentItems } from "../../components/RecentItems";
import BaseLayout from "../../layouts/BaseLayout.astro"; import BaseLayout from "../../layouts/BaseLayout.astro";
export const getStaticPaths = (() => { export const getStaticPaths = (() => {
@@ -18,4 +19,12 @@ const { locale } = Astro.props;
<BaseLayout {locale} accent="amber"> <BaseLayout {locale} accent="amber">
<HomeHero {locale} /> <HomeHero {locale} />
<RecentItems {locale} client:only="react">
<RecentItems {locale} skeleton slot="fallback" />
</RecentItems>
<!-- <Section>
{Object.values(tools).map((tool) => <ToolCard {locale} {tool} />)}
</Section> -->
</BaseLayout> </BaseLayout>