import React from 'react'; import { useDispatch, useSelector } from 'react-redux'; import { deleteLinkedInAccount, setPrimaryLinkedInAccount } from '../../store/reducers/linkedinAccountsSlice'; const LinkedInAccountCard = ({ account, onRefresh }) => { const dispatch = useDispatch(); const { deletingAccount, settingPrimary } = useSelector(state => state.linkedinAccounts); const handleDelete = async () => { if (window.confirm(`Are you sure you want to disconnect ${account.account_name}?`)) { try { await dispatch(deleteLinkedInAccount(account.id)).unwrap(); onRefresh(); } catch (error) { console.error('Failed to delete account:', error); } } }; const handleSetPrimary = async () => { try { await dispatch(setPrimaryLinkedInAccount(account.id)).unwrap(); onRefresh(); } catch (error) { console.error('Failed to set primary account:', error); } }; const isDeleting = deletingAccount === account.id; const isSettingPrimary = settingPrimary === account.id; return (
@{account.sub}
{/* Account Status */}