import { ShieldCheck, SignIn, Trash } from "../ui/icons"; import type { SocialAccountRecord } from "@shared/types"; import { timeAgo } from "../../lib/formatters"; import { Card } from "../ui"; import { platformConfig } from "./social-config"; interface AccountCardProps { account: SocialAccountRecord; onLogin: () => void; onDelete: () => void; onClick?: () => void; } export function AccountCard({ account, onLogin, onDelete, onClick }: AccountCardProps) { const platform = platformConfig[account.platform] ?? platformConfig.other; const isLoggedIn = account.status === "logged_in" || account.status === "active"; const PlatformIcon = platform.icon; const cardContent = ( <>
{account.displayName || account.accountName} {platform.label}
@{account.accountName} {account.requireApproval ? ( Approval required ) : null} {account.lastUsedAt ? Last used {timeAgo(account.lastUsedAt)} : null}
); return (
{onClick ? ( ) : (
{cardContent}
)}
{account.status === "logged_in" ? "Logged In" : account.status === "active" ? "Active" : account.status.replace("_", " ")} {account.status === "login_required" ? ( ) : null}
); }