Convert gitgram/ and aitimemachine/ from embedded git repos (which showed as opaque submodule gitlinks on GitHub) into fully-tracked first-party content. AITM now merges its 7 vendored repos as first-party engines: - memory: beads (Go task DAG) + context7 (docs SDK), unified into saved_contexts - git: vendored C git (bundled binary) + gitnexus (in-process code intelligence) - agentic: a2a (@a2a-js/sdk) + pal (AITM-managed Python subprocess) Includes the full session's product build: Gitgram web/mobile/backend features, AITM website/CLI/MCP, the unified memory layer, engine build tooling (scripts/build-engines.sh, Dockerfile, CI), docs (README, ENGINES.md, ARCHITECTURE.md), and extensive test suites. Build artifacts, node_modules, external/, and gemini-cli are gitignored. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
87 lines
2.2 KiB
TypeScript
87 lines
2.2 KiB
TypeScript
'use client'
|
|
|
|
import { usePresence } from '@/hooks/usePresence'
|
|
|
|
interface OnlineIndicatorProps {
|
|
userId: string
|
|
size?: 'sm' | 'md'
|
|
}
|
|
|
|
const SIZE_CLASSES: Record<NonNullable<OnlineIndicatorProps['size']>, string> = {
|
|
sm: 'w-2.5 h-2.5',
|
|
md: 'w-3.5 h-3.5',
|
|
}
|
|
|
|
export function OnlineIndicator({ userId, size = 'sm' }: OnlineIndicatorProps) {
|
|
const { onlineUsers } = usePresence()
|
|
const isOnline = onlineUsers.some((u) => u.id === userId)
|
|
|
|
if (!isOnline) return null
|
|
|
|
return (
|
|
<span
|
|
className={`${SIZE_CLASSES[size]} rounded-full bg-[var(--accent)] ring-2 ring-[var(--background)] block flex-shrink-0`}
|
|
aria-label="Online"
|
|
title="Online"
|
|
/>
|
|
)
|
|
}
|
|
|
|
// Avatar wrapper with online badge — preserved for existing usages
|
|
interface AvatarWithOnlineStatusProps {
|
|
userId: string
|
|
avatar?: string
|
|
username: string
|
|
size?: number
|
|
showOnlineStatus?: boolean
|
|
}
|
|
|
|
export function AvatarWithOnlineStatus({
|
|
userId,
|
|
avatar,
|
|
username,
|
|
size = 40,
|
|
showOnlineStatus = true,
|
|
}: AvatarWithOnlineStatusProps) {
|
|
const { onlineUsers } = usePresence()
|
|
const isOnline = showOnlineStatus && onlineUsers.some((u) => u.id === userId)
|
|
|
|
return (
|
|
<div className="relative inline-block">
|
|
{avatar ? (
|
|
<img
|
|
src={avatar}
|
|
alt={username}
|
|
className="rounded-full object-cover"
|
|
style={{ width: size, height: size }}
|
|
/>
|
|
) : (
|
|
<div
|
|
className="rounded-full bg-primary/20 flex items-center justify-center"
|
|
style={{ width: size, height: size }}
|
|
>
|
|
<span
|
|
className="text-primary font-semibold"
|
|
style={{ fontSize: size * 0.4 }}
|
|
>
|
|
{username?.[0]?.toUpperCase() ?? '?'}
|
|
</span>
|
|
</div>
|
|
)}
|
|
{showOnlineStatus && (
|
|
<span
|
|
className={`absolute bottom-0 right-0 rounded-full border-2 border-[var(--background)] ${
|
|
isOnline ? 'bg-[var(--accent)]' : 'bg-[var(--foreground-secondary)]'
|
|
}`}
|
|
style={{
|
|
width: Math.max(size * 0.25, 10),
|
|
height: Math.max(size * 0.25, 10),
|
|
}}
|
|
/>
|
|
)}
|
|
</div>
|
|
)
|
|
}
|
|
|
|
export default OnlineIndicator
|