'use client';
import { updateRole } from './lib/actions';
import { getProfile, updateProfile } from '@/actions/profile';
import { CheckboxWithText } from '@/components/profile/checkbox-with-text';
import { ProfileField } from '@/components/profile/profile-field';
import { Avatar, AvatarFallback, AvatarImage } from '@repo/ui/components/ui/avatar';
import { Button } from '@repo/ui/components/ui/button';
import { Card } from '@repo/ui/components/ui/card';
import { useQuery } from '@tanstack/react-query';
import Link from 'next/link';
type ProfileProps = {
readonly telegramId?: string;
};
export function ProfileCard(props: ProfileProps) {
return (
);
}
export function ProfileFields({ telegramId }: ProfileProps) {
const { data: customer } = useQuery({
queryFn: () => getProfile({ telegramId }),
queryKey: telegramId ? ['profile', 'telegramId', telegramId] : ['profile'],
});
if (!customer) return null;
return (
{telegramId ? false :
}
{telegramId ? (
false
) : (
)}
{telegramId ? (
false
) : (
)}
{telegramId ? (
) : (
false
)}
);
}
function Person({ telegramId }: ProfileProps) {
const { data: customer } = useQuery({
queryFn: () => getProfile({ telegramId }),
queryKey: telegramId ? ['profile', 'telegramId', telegramId] : ['profile'],
});
if (!customer) return null;
return (
{customer?.name.charAt(0)}
{customer?.name}
);
}
function ProfileFieldsHeader() {
return (
);
}