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 | import React, { useEffect } from "react"; |
| #2 | import { useSelector } from "react-redux"; |
| #3 | import { RootState } from "@/store/store"; |
| #4 | import { useStats } from "@/hooks/useStats"; |
| #5 | import Image from "next/image"; |
| #6 | import { constants } from "@/components/shared/source-app"; |
| #7 | const Stats = () => { |
| #8 | const totalMemories = useSelector( |
| #9 | (state: RootState) => state.profile.totalMemories |
| #10 | ); |
| #11 | const totalApps = useSelector((state: RootState) => state.profile.totalApps); |
| #12 | const apps = useSelector((state: RootState) => state.profile.apps).slice( |
| #13 | 0, |
| #14 | 4 |
| #15 | ); |
| #16 | const { fetchStats } = useStats(); |
| #17 | |
| #18 | useEffect(() => { |
| #19 | fetchStats(); |
| #20 | }, []); |
| #21 | |
| #22 | return ( |
| #23 | <div className="bg-zinc-900 rounded-lg border border-zinc-800"> |
| #24 | <div className="bg-zinc-800 border-b border-zinc-800 rounded-t-lg p-4"> |
| #25 | <div className="text-white text-xl font-semibold">Memories Stats</div> |
| #26 | </div> |
| #27 | <div className="space-y-3 p-4"> |
| #28 | <div> |
| #29 | <p className="text-zinc-400">Total Memories</p> |
| #30 | <h3 className="text-lg font-bold text-white"> |
| #31 | {totalMemories} Memories |
| #32 | </h3> |
| #33 | </div> |
| #34 | <div> |
| #35 | <p className="text-zinc-400">Total Apps Connected</p> |
| #36 | <div className="flex flex-col items-start gap-1 mt-2"> |
| #37 | <div className="flex -space-x-2"> |
| #38 | {apps.map((app) => ( |
| #39 | <div |
| #40 | key={app.id} |
| #41 | className={`h-8 w-8 rounded-full bg-primary flex items-center justify-center text-xs`} |
| #42 | > |
| #43 | <div> |
| #44 | <div className="w-7 h-7 rounded-full bg-zinc-700 flex items-center justify-center overflow-hidden"> |
| #45 | <Image |
| #46 | src={ |
| #47 | constants[app.name as keyof typeof constants] |
| #48 | ?.iconImage || "" |
| #49 | } |
| #50 | alt={ |
| #51 | constants[app.name as keyof typeof constants]?.name |
| #52 | } |
| #53 | width={32} |
| #54 | height={32} |
| #55 | /> |
| #56 | </div> |
| #57 | </div> |
| #58 | </div> |
| #59 | ))} |
| #60 | </div> |
| #61 | <h3 className="text-lg font-bold text-white">{totalApps} Apps</h3> |
| #62 | </div> |
| #63 | </div> |
| #64 | </div> |
| #65 | </div> |
| #66 | ); |
| #67 | }; |
| #68 | |
| #69 | export default Stats; |
| #70 |