Skip to content

Commit

Permalink
show user's asked questions
Browse files Browse the repository at this point in the history
  • Loading branch information
nicele08 committed Aug 7, 2024
1 parent 5a1d792 commit 5ff9eb0
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
14 changes: 13 additions & 1 deletion src/components/shared/accounts/AccountsTableData.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,19 @@ const AccountsTableData = ({ data }: { data: User[] }) => {
<td className="px-6 py-4">{item.phone_number || '-'}</td>
<td className="px-6 py-4">{roleToString(item.role)}</td>
<td className="px-6 py-4">
{item.total_ratings?.toLocaleString() || '-'}
{item.role === 'USER' ? (
<span title="Asked Questions">
{item.total_questions?.toLocaleString() || 0}
</span>
) : (
<span
title={
item.role !== 'ADMIN' ? 'Annotations made' : ''
}
>
{item.total_ratings?.toLocaleString() || '-'}
</span>
)}
</td>
<td className="px-6 py-4">
{item.last_login
Expand Down
1 change: 1 addition & 0 deletions src/interfaces/user.type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export interface User {
created_by: string | null;
is_blocked: boolean;
total_ratings?: number;
total_questions?: number;
}

export const allowedRoles: Role[] = [
Expand Down
3 changes: 2 additions & 1 deletion src/pages/accounts/AccountsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,8 @@ const AccountsPage = () => {
Role
</th>
<th scope="col" className="px-6 py-3">
Annotations
Annotations /<br />
Contributions
</th>
<th scope="col" className="px-6 py-3">
Last Login
Expand Down

0 comments on commit 5ff9eb0

Please sign in to comment.