-
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
56 additions
and
2 deletions.
There are no files selected for viewing
38 changes: 38 additions & 0 deletions
38
next_app/src/components/views/components/editor/components/history.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { useGlobalState } from "@/hooks"; | ||
import { MsgHistory } from "@/hooks/useGlobalState"; | ||
import { ExternalLink } from "lucide-react"; | ||
import Link from "next/link"; | ||
import { useEffect } from "react"; | ||
import { useLocalStorage } from "usehooks-ts"; | ||
|
||
export default function History() { | ||
const globalState = useGlobalState(); | ||
|
||
useEffect(() => { | ||
console.log(globalState.history) | ||
}, [globalState.history]) | ||
|
||
return ( | ||
<div> | ||
{ | ||
!globalState.history[globalState.activeProject] && <div className="text-center text-sm text-gray-400 p-4">No history available</div> | ||
} | ||
{ | ||
globalState.history[globalState.activeProject] && globalState.history[globalState.activeProject].toReversed().map((msg: MsgHistory) => { | ||
return ( | ||
<div key={msg.id} className="flex items-start space-x-6 font-btr-code p-4 border-b"> | ||
<div className="flex flex-col gap-1"> | ||
<div className="flex gap-2 items-center"> | ||
<div className="text-sm text-gray-400 ">{new Date(msg.timestamp).toLocaleString()}</div> | ||
<Link href={`https://www.ao.link/#/message/${msg.id}`} target="_blank" className="flex items-center text-primary text-sm">ao.link <ExternalLink size={16} className="ml-1" /></Link> | ||
</div> | ||
<div className="text-xs">{msg.id}</div> | ||
</div> | ||
<pre className="text-xs max-h-[200px] overflow-scroll">{msg.code}</pre> | ||
</div> | ||
) | ||
}) | ||
} | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters