浏览代码

feat: merge Work and Projects into one Work view

The nav reads All, About, Work, Blog. Side projects join the AWS work
under Work, the command palette offers one "Work and projects" entry,
and old #projects links open the Work view.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QEPoSHwHCYMNpm2iKxY9hL
Claude 1 月之前
父节点
当前提交
6bc1dfd37e
共有 5 个文件被更改,包括 18 次插入 和 22 次删除
  1. 6 6
      app/page.tsx
  2. 4 4
      components/bento/bento-grid.tsx
  3. 3 10
      components/nav/command-palette.tsx
  4. 0 1
      components/nav/site-nav.tsx
  5. 5 1
      lib/view-store.ts

+ 6 - 6
app/page.tsx

@@ -114,7 +114,7 @@ export default async function Page() {
     },
     {
       id: "secondself",
-      tags: ["projects"],
+      tags: ["work"],
       label: projects.secondself.name,
       size: [
         [2, 1],
@@ -133,7 +133,7 @@ export default async function Page() {
     },
     {
       id: "packbook",
-      tags: ["projects"],
+      tags: ["work"],
       label: "PackBook",
       size: [
         [2, 2],
@@ -159,7 +159,7 @@ export default async function Page() {
     },
     {
       id: "webagent",
-      tags: ["projects"],
+      tags: ["work"],
       label: projects.webagent.name,
       size: [
         [1, 2],
@@ -180,7 +180,7 @@ export default async function Page() {
     },
     {
       id: "chatbot",
-      tags: ["projects"],
+      tags: ["work"],
       label: projects.chatbot.name,
       size: [
         [2, 1],
@@ -227,7 +227,7 @@ export default async function Page() {
     },
     {
       id: "emoji",
-      tags: ["projects"],
+      tags: ["work"],
       label: "Text to emoji",
       size: [
         [1, 1],
@@ -240,7 +240,7 @@ export default async function Page() {
     },
     {
       id: "paper",
-      tags: ["projects", "work"],
+      tags: ["work"],
       label: projects.paper.name,
       size: [
         [1, 1],

+ 4 - 4
components/bento/bento-grid.tsx

@@ -25,10 +25,10 @@ import {
 import { springs } from "@/lib/motion";
 import { prefersReducedMotion } from "@/lib/utils";
 import {
-  isView,
   onBeforeViewChange,
   setView,
   useView,
+  viewFromHash,
   type View,
 } from "@/lib/view-store";
 
@@ -183,9 +183,9 @@ export function BentoGrid({ items }: { items: BentoItem[] }) {
 
   useEffect(() => {
     const fromHash = () => {
-      const hash = window.location.hash.slice(1);
-
-      setView(isView(hash) ? hash : "all", { updateUrl: false });
+      setView(viewFromHash(window.location.hash.slice(1)), {
+        updateUrl: false,
+      });
     };
 
     fromHash();

+ 3 - 10
components/nav/command-palette.tsx

@@ -102,19 +102,12 @@ export default function CommandPalette({
       {
         id: "work",
         group: "Navigate",
-        label: "Work at AWS",
-        keywords: "amazon finops q artifacts",
+        label: "Work and projects",
+        keywords:
+          "aws amazon finops q artifacts side projects packbook secondself",
         icon: <Dot className="bg-ember" />,
         run: go("work"),
       },
-      {
-        id: "projects",
-        group: "Navigate",
-        label: "Side projects",
-        keywords: "packbook secondself",
-        icon: <Dot className="bg-ember" />,
-        run: go("projects"),
-      },
       {
         id: "blog",
         group: "Navigate",

+ 0 - 1
components/nav/site-nav.tsx

@@ -22,7 +22,6 @@ const TABS: Tab[] = [
   { id: "all", label: "All" },
   { id: "about", label: "About" },
   { id: "work", label: "Work" },
-  { id: "projects", label: "Projects" },
   { id: "blog", label: "Blog" },
 ];
 

+ 5 - 1
lib/view-store.ts

@@ -2,7 +2,7 @@
 
 import { useSyncExternalStore } from "react";
 
-export const VIEWS = ["all", "about", "work", "projects"] as const;
+export const VIEWS = ["all", "about", "work"] as const;
 export type View = (typeof VIEWS)[number];
 
 type Listener = () => void;
@@ -14,6 +14,10 @@ const beforeChange = new Set<Listener>();
 export const isView = (value: string): value is View =>
   (VIEWS as readonly string[]).includes(value);
 
+/** The view a URL hash asks for. Work and projects were once two views; old #projects links land on Work. */
+export const viewFromHash = (hash: string): View =>
+  hash === "projects" ? "work" : isView(hash) ? hash : "all";
+
 export function getView() {
   return current;
 }