repositories
loading repo index
repositories
loading repo index
repository
loading code, commits, and activity
public Clawd ADK gateway launch mirror
stars
latest
clone command
git clone gitlawb://did:key:z6Mkq5mY...iFZ5/my-project-publ...git clone gitlawb://did:key:z6Mkq5mY.../my-project-publ...2fa351d6docs: add automaton and perps launch sources16d ago| #1 | "use client"; |
| #2 | |
| #3 | import "@/styles/animation.css"; |
| #4 | import { useEffect } from "react"; |
| #5 | import { useMemoriesApi } from "@/hooks/useMemoriesApi"; |
| #6 | import { use } from "react"; |
| #7 | import { MemorySkeleton } from "@/skeleton/MemorySkeleton"; |
| #8 | import { MemoryDetails } from "./components/MemoryDetails"; |
| #9 | import UpdateMemory from "@/components/shared/update-memory"; |
| #10 | import { useUI } from "@/hooks/useUI"; |
| #11 | import { RootState } from "@/store/store"; |
| #12 | import { useSelector } from "react-redux"; |
| #13 | import NotFound from "@/app/not-found"; |
| #14 | |
| #15 | function MemoryContent({ id }: { id: string }) { |
| #16 | const { fetchMemoryById, isLoading, error } = useMemoriesApi(); |
| #17 | const memory = useSelector( |
| #18 | (state: RootState) => state.memories.selectedMemory |
| #19 | ); |
| #20 | |
| #21 | useEffect(() => { |
| #22 | const loadMemory = async () => { |
| #23 | try { |
| #24 | await fetchMemoryById(id); |
| #25 | } catch (err) { |
| #26 | console.error("Failed to load memory:", err); |
| #27 | } |
| #28 | }; |
| #29 | loadMemory(); |
| #30 | }, []); |
| #31 | |
| #32 | if (isLoading) { |
| #33 | return <MemorySkeleton />; |
| #34 | } |
| #35 | |
| #36 | if (error) { |
| #37 | return <NotFound message={error} />; |
| #38 | } |
| #39 | |
| #40 | if (!memory) { |
| #41 | return <NotFound message="Memory not found" statusCode={404} />; |
| #42 | } |
| #43 | |
| #44 | return <MemoryDetails memory_id={memory.id} />; |
| #45 | } |
| #46 | |
| #47 | export default function MemoryPage({ |
| #48 | params, |
| #49 | }: { |
| #50 | params: Promise<{ id: string }>; |
| #51 | }) { |
| #52 | const resolvedParams = use(params); |
| #53 | const { updateMemoryDialog, handleCloseUpdateMemoryDialog } = useUI(); |
| #54 | return ( |
| #55 | <div> |
| #56 | <div className="animate-fade-slide-down delay-1"> |
| #57 | <UpdateMemory |
| #58 | memoryId={updateMemoryDialog.memoryId || ""} |
| #59 | memoryContent={updateMemoryDialog.memoryContent || ""} |
| #60 | open={updateMemoryDialog.isOpen} |
| #61 | onOpenChange={handleCloseUpdateMemoryDialog} |
| #62 | /> |
| #63 | </div> |
| #64 | <div className="animate-fade-slide-down delay-2"> |
| #65 | <MemoryContent id={resolvedParams.id} /> |
| #66 | </div> |
| #67 | </div> |
| #68 | ); |
| #69 | } |
| #70 |