Files
CU_Points/frontend/components/ui/Badge.tsx
T
emilandClaude Sonnet 4.6 50b3c4198a feat: initial commit — backend API + student cabinet frontend
- Go backend: auth (JWT), points earn/spend, QR token generation,
  partners, admin grant/stats endpoints with chi router
- Next.js 14 frontend: login, student dashboard, transaction history,
  QR display, partners list
- PostgreSQL migrations (4 tables), Redis cache, Docker Compose
- CORS middleware, role-based route protection, Zustand auth store

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-01 10:03:27 +03:00

30 lines
759 B
TypeScript

import type { TransactionType } from '@/lib/types';
const TYPE_LABELS: Record<TransactionType, string> = {
earn: 'Начисление',
spend: 'Списание',
admin_grant: 'Начисление',
expire: 'Сгорание',
};
const TYPE_CLASSES: Record<TransactionType, string> = {
earn: 'bg-green-900/50 text-green-400',
spend: 'bg-red-900/50 text-red-400',
admin_grant: 'bg-blue-900/50 text-blue-400',
expire: 'bg-gray-700 text-gray-400',
};
interface BadgeProps {
type: TransactionType;
}
export function Badge({ type }: BadgeProps) {
return (
<span
className={`inline-flex shrink-0 items-center rounded-full px-2 py-0.5 text-xs font-medium ${TYPE_CLASSES[type]}`}
>
{TYPE_LABELS[type]}
</span>
);
}