complete project using prettier!
This commit is contained in:
@@ -26,13 +26,14 @@ const renderLogDetails = (log: ActivityLogItem, onLogClick?: ActivityLogClickHan
|
||||
case 'recipe_created':
|
||||
return (
|
||||
<span>
|
||||
{userName} added a new recipe:{" "}
|
||||
{userName} added a new recipe:{' '}
|
||||
<strong
|
||||
onClick={isClickable ? () => onLogClick(log) : undefined}
|
||||
className={isClickable ? "text-blue-500 hover:underline cursor-pointer" : ""}
|
||||
className={isClickable ? 'text-blue-500 hover:underline cursor-pointer' : ''}
|
||||
>
|
||||
{log.details.recipe_name || 'Untitled Recipe'}
|
||||
</strong>.
|
||||
</strong>
|
||||
.
|
||||
</span>
|
||||
);
|
||||
case 'user_registered':
|
||||
@@ -44,13 +45,14 @@ const renderLogDetails = (log: ActivityLogItem, onLogClick?: ActivityLogClickHan
|
||||
case 'recipe_favorited':
|
||||
return (
|
||||
<span>
|
||||
{userName} favorited the recipe:{" "}
|
||||
{userName} favorited the recipe:{' '}
|
||||
<strong
|
||||
onClick={isClickable ? () => onLogClick(log) : undefined}
|
||||
className={isClickable ? "text-blue-500 hover:underline cursor-pointer" : ""}
|
||||
className={isClickable ? 'text-blue-500 hover:underline cursor-pointer' : ''}
|
||||
>
|
||||
{log.details.recipe_name || 'a recipe'}
|
||||
</strong>.
|
||||
</strong>
|
||||
.
|
||||
</span>
|
||||
);
|
||||
case 'list_shared':
|
||||
@@ -59,7 +61,7 @@ const renderLogDetails = (log: ActivityLogItem, onLogClick?: ActivityLogClickHan
|
||||
{userName} shared the list "
|
||||
<strong
|
||||
onClick={isClickable ? () => onLogClick(log) : undefined}
|
||||
className={isClickable ? "text-blue-500 hover:underline cursor-pointer" : ""}
|
||||
className={isClickable ? 'text-blue-500 hover:underline cursor-pointer' : ''}
|
||||
>
|
||||
{log.details.list_name || 'a shopping list'}
|
||||
</strong>
|
||||
@@ -87,7 +89,8 @@ export const ActivityLog: React.FC<ActivityLogProps> = ({ userProfile, onLogClic
|
||||
setError(null);
|
||||
try {
|
||||
const response = await fetchActivityLog(20, 0);
|
||||
if (!response.ok) throw new Error((await response.json()).message || 'Failed to fetch logs');
|
||||
if (!response.ok)
|
||||
throw new Error((await response.json()).message || 'Failed to fetch logs');
|
||||
setLogs(await response.json());
|
||||
} catch (err) {
|
||||
setError(err instanceof Error ? err.message : 'Failed to load activity.');
|
||||
@@ -105,7 +108,9 @@ export const ActivityLog: React.FC<ActivityLogProps> = ({ userProfile, onLogClic
|
||||
|
||||
return (
|
||||
<div className="bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 shadow-sm p-4">
|
||||
<h3 className="text-lg font-semibold text-gray-800 dark:text-gray-100 mb-4">Recent Activity</h3>
|
||||
<h3 className="text-lg font-semibold text-gray-800 dark:text-gray-100 mb-4">
|
||||
Recent Activity
|
||||
</h3>
|
||||
{isLoading && <p className="text-gray-500 dark:text-gray-400">Loading activity...</p>}
|
||||
{error && <p className="text-red-500">{error}</p>}
|
||||
{!isLoading && !error && logs.length === 0 && (
|
||||
@@ -118,12 +123,20 @@ export const ActivityLog: React.FC<ActivityLogProps> = ({ userProfile, onLogClic
|
||||
{log.user_avatar_url ? (
|
||||
(() => {
|
||||
const altText = log.user_full_name || 'User Avatar';
|
||||
console.log(`[ActivityLog] Rendering avatar for log ${log.activity_log_id}. Alt: "${altText}"`);
|
||||
return <img className="h-8 w-8 rounded-full" src={log.user_avatar_url} alt={altText} />;
|
||||
console.log(
|
||||
`[ActivityLog] Rendering avatar for log ${log.activity_log_id}. Alt: "${altText}"`,
|
||||
);
|
||||
return (
|
||||
<img className="h-8 w-8 rounded-full" src={log.user_avatar_url} alt={altText} />
|
||||
);
|
||||
})()
|
||||
) : (
|
||||
<span className="h-8 w-8 rounded-full bg-gray-300 dark:bg-gray-600 flex items-center justify-center">
|
||||
<svg className="h-5 w-5 text-gray-500 dark:text-gray-400" fill="currentColor" viewBox="0 0 20 20">
|
||||
<svg
|
||||
className="h-5 w-5 text-gray-500 dark:text-gray-400"
|
||||
fill="currentColor"
|
||||
viewBox="0 0 20 20"
|
||||
>
|
||||
<path d="M10 9a3 3 0 100-6 3 3 0 000 6zm-7 9a7 7 0 1114 0H3z" />
|
||||
</svg>
|
||||
</span>
|
||||
@@ -142,4 +155,4 @@ export const ActivityLog: React.FC<ActivityLogProps> = ({ userProfile, onLogClic
|
||||
</ul>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user