555e282cc4
pi-agent-plugin checks / lint (push) Has been cancelled
pi-agent-plugin checks / test (20) (push) Has been cancelled
pi-agent-plugin checks / test (22) (push) Has been cancelled
pi-agent-plugin checks / build (push) Has been cancelled
TypeScript SDK CI / check_changes (push) Has been cancelled
TypeScript SDK CI / changelog_check (push) Has been cancelled
ci / changelog_check (push) Has been cancelled
ci / check_changes (push) Has been cancelled
ci / build_mem0 (3.10) (push) Has been cancelled
ci / build_mem0 (3.11) (push) Has been cancelled
ci / build_mem0 (3.12) (push) Has been cancelled
CLI Node CI / lint (push) Has been cancelled
CLI Node CI / test (20) (push) Has been cancelled
CLI Node CI / test (22) (push) Has been cancelled
CLI Node CI / build (push) Has been cancelled
CLI Python CI / lint (push) Has been cancelled
CLI Python CI / test (3.10) (push) Has been cancelled
CLI Python CI / test (3.11) (push) Has been cancelled
CLI Python CI / test (3.12) (push) Has been cancelled
CLI Python CI / build (push) Has been cancelled
openclaw checks / lint (push) Has been cancelled
openclaw checks / test (20) (push) Has been cancelled
openclaw checks / test (22) (push) Has been cancelled
openclaw checks / build (push) Has been cancelled
opencode-plugin checks / build (push) Has been cancelled
TypeScript SDK CI / build_ts_sdk (20) (push) Has been cancelled
TypeScript SDK CI / build_ts_sdk (22) (push) Has been cancelled
TypeScript SDK CI / integration_ts_sdk (20) (push) Has been cancelled
TypeScript SDK CI / integration_ts_sdk (22) (push) Has been cancelled
70 lines
2.3 KiB
TypeScript
70 lines
2.3 KiB
TypeScript
import React, { useEffect } from "react";
|
|
import { useSelector } from "react-redux";
|
|
import { RootState } from "@/store/store";
|
|
import { useStats } from "@/hooks/useStats";
|
|
import Image from "next/image";
|
|
import { constants } from "@/components/shared/source-app";
|
|
const Stats = () => {
|
|
const totalMemories = useSelector(
|
|
(state: RootState) => state.profile.totalMemories
|
|
);
|
|
const totalApps = useSelector((state: RootState) => state.profile.totalApps);
|
|
const apps = useSelector((state: RootState) => state.profile.apps).slice(
|
|
0,
|
|
4
|
|
);
|
|
const { fetchStats } = useStats();
|
|
|
|
useEffect(() => {
|
|
fetchStats();
|
|
}, []);
|
|
|
|
return (
|
|
<div className="bg-zinc-900 rounded-lg border border-zinc-800">
|
|
<div className="bg-zinc-800 border-b border-zinc-800 rounded-t-lg p-4">
|
|
<div className="text-white text-xl font-semibold">Memories Stats</div>
|
|
</div>
|
|
<div className="space-y-3 p-4">
|
|
<div>
|
|
<p className="text-zinc-400">Total Memories</p>
|
|
<h3 className="text-lg font-bold text-white">
|
|
{totalMemories} Memories
|
|
</h3>
|
|
</div>
|
|
<div>
|
|
<p className="text-zinc-400">Total Apps Connected</p>
|
|
<div className="flex flex-col items-start gap-1 mt-2">
|
|
<div className="flex -space-x-2">
|
|
{apps.map((app) => (
|
|
<div
|
|
key={app.id}
|
|
className={`h-8 w-8 rounded-full bg-primary flex items-center justify-center text-xs`}
|
|
>
|
|
<div>
|
|
<div className="w-7 h-7 rounded-full bg-zinc-700 flex items-center justify-center overflow-hidden">
|
|
<Image
|
|
src={
|
|
constants[app.name as keyof typeof constants]
|
|
?.iconImage || ""
|
|
}
|
|
alt={
|
|
constants[app.name as keyof typeof constants]?.name
|
|
}
|
|
width={32}
|
|
height={32}
|
|
/>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
))}
|
|
</div>
|
|
<h3 className="text-lg font-bold text-white">{totalApps} Apps</h3>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
);
|
|
};
|
|
|
|
export default Stats;
|