severo HF staff strickvl commited on
Commit
7e1e8c1
1 Parent(s): 75844ad

Add links to avatar and full name (#1)

Browse files

- Add links to avatar and full name (cbeb7ff9d291282c742888a7e2eb4d2081e7da02)


Co-authored-by: Alex Strick van Linschoten <strickvl@users.noreply.huggingface.co>

Files changed (1) hide show
  1. components/Content.tsx +32 -29
components/Content.tsx CHANGED
@@ -378,40 +378,43 @@ const AccountDetails = memo(({ account }: { account: AccountDetails }) => {
378
  fullname,
379
  user,
380
  followed_by,
381
- // followers_count,
382
- // details
383
- } = account
384
- // let formatter = Intl.NumberFormat('en', { notation: 'compact' })
385
- // let numFollowers = formatter.format(followers_count)
386
-
387
- const [expandedFollowers, setExpandedFollowers] = useState(false)
388
- const hasAvatar = avatarUrl && !avatarUrl.endsWith('.svg')
389
  return (
390
  <li className="px-4 py-3 pb-7 sm:px-0 sm:py-4">
391
  <div className="flex flex-col gap-4 sm:flex-row">
392
  <div className="flex-shrink-0 m-auto">
393
- {/* eslint-disable-next-line @next/next/no-img-element */}
394
- {hasAvatar ? (
395
- <img
396
- className="w-16 h-16 sm:w-8 sm:h-8 rounded-full"
397
- src={avatarUrl}
398
- />
399
- ) : (
400
- <div className="w-16 h-16 sm:w-8 sm:h-8" />
401
- )}
 
 
 
 
 
 
 
402
  </div>
403
  <div className="flex-1 min-w-0">
404
  <p className="text-sm font-medium text-gray-900 truncate dark:text-white">
405
- {fullname}
 
 
 
 
 
 
 
406
  </p>
407
- {/* <div className="flex flex-col sm:flex-row text-sm text-gray-500 dark:text-gray-400">
408
- <span className="truncate">{user}</span>
409
- <span className="sm:inline hidden whitespace-pre"> | </span>
410
- <span>{numFollowers} followers</span>
411
- </div> */}
412
- {/* <br />
413
- <small className="text-sm dark:text-gray-200">{details}</small> */}
414
- <br />
415
  <small className="text-xs text-gray-800 dark:text-gray-400">
416
  Followed by{' '}
417
  {followed_by.size < 9 || expandedFollowers ? (
@@ -441,15 +444,15 @@ const AccountDetails = memo(({ account }: { account: AccountDetails }) => {
441
  href={`https://huggingface.co/${user}`}
442
  className="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded"
443
  target="_blank"
444
- rel="noreferrer"
445
  >
446
  Follow
447
  </a>
448
  </div>
449
  </div>
450
  </li>
451
- )
452
- })
453
  AccountDetails.displayName = 'AccountDetails'
454
 
455
  function ErrorLog({ errors }: { errors: Array<string> }) {
 
378
  fullname,
379
  user,
380
  followed_by,
381
+ } = account;
382
+
383
+ const [expandedFollowers, setExpandedFollowers] = useState(false);
384
+ const hasAvatar = avatarUrl && !avatarUrl.endsWith('.svg');
385
+
 
 
 
386
  return (
387
  <li className="px-4 py-3 pb-7 sm:px-0 sm:py-4">
388
  <div className="flex flex-col gap-4 sm:flex-row">
389
  <div className="flex-shrink-0 m-auto">
390
+ <a
391
+ href={`https://huggingface.co/${user}`}
392
+ target="_blank"
393
+ rel="noopener noreferrer"
394
+ className="block"
395
+ >
396
+ {hasAvatar ? (
397
+ <img
398
+ className="w-16 h-16 sm:w-8 sm:h-8 rounded-full hover:opacity-80 transition-opacity"
399
+ src={avatarUrl}
400
+ alt={`${fullname}'s avatar`}
401
+ />
402
+ ) : (
403
+ <div className="w-16 h-16 sm:w-8 sm:h-8 bg-gray-200 rounded-full hover:bg-gray-300 transition-colors" />
404
+ )}
405
+ </a>
406
  </div>
407
  <div className="flex-1 min-w-0">
408
  <p className="text-sm font-medium text-gray-900 truncate dark:text-white">
409
+ <a
410
+ href={`https://huggingface.co/${user}`}
411
+ target="_blank"
412
+ rel="noopener noreferrer"
413
+ className="hover:underline"
414
+ >
415
+ {fullname}
416
+ </a>
417
  </p>
 
 
 
 
 
 
 
 
418
  <small className="text-xs text-gray-800 dark:text-gray-400">
419
  Followed by{' '}
420
  {followed_by.size < 9 || expandedFollowers ? (
 
444
  href={`https://huggingface.co/${user}`}
445
  className="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded"
446
  target="_blank"
447
+ rel="noopener noreferrer"
448
  >
449
  Follow
450
  </a>
451
  </div>
452
  </div>
453
  </li>
454
+ );
455
+ });
456
  AccountDetails.displayName = 'AccountDetails'
457
 
458
  function ErrorLog({ errors }: { errors: Array<string> }) {