renderTree / lastModified

#1
Files changed (1) hide show
  1. index.html +9 -3
index.html CHANGED
@@ -1315,7 +1315,7 @@
1315
  fetchOrgProfile(orgName),
1316
  fetchAllPages(`${HF_API}/models?author=${uEnc}&limit=1000&full=true&${expandParams}`),
1317
  fetchAllPages(`${HF_API}/datasets?author=${uEnc}&limit=1000&full=true&${expandParams}`),
1318
- fetchAllPages(`${HF_API}/spaces?author=${uEnc}&limit=1000&full=true&expand[]=likes`),
1319
  ]);
1320
 
1321
  state.profile = profileData.status === 'fulfilled' ? profileData.value : null;
@@ -1810,13 +1810,19 @@
1810
  nameHtml = name.replace(rx, '<mark style="background:#333333;color:#ffffff;padding:0 2px;border-radius:2px;">$1</mark>');
1811
  }
1812
 
 
1813
  let meta = '';
1814
  if (tab !== 'spaces') {
1815
  const dlAll = getLifetimeDownloads(item);
1816
  const dlMonth = getMonthlyDownloads(item);
1817
- meta += `<span class="t-stat" title="${formatNumFull(dlAll)} downloads (all time)"><i class="fas fa-download"></i> ${formatNum(dlAll)}</span>`;
1818
- meta += `<span class="t-stat" title="${formatNumFull(dlMonth)} downloads (last month)"><i class="fas fa-calendar-alt"></i> ${formatNum(dlMonth)}</span>`;
 
 
 
 
1819
  }
 
1820
  const likes = getItemLikes(item);
1821
  meta += `<span class="t-stat" title="${formatNumFull(likes)} likes"><i class="fas fa-heart"></i> ${formatNum(likes)}</span>`;
1822
  if (item.lastModified) {
 
1315
  fetchOrgProfile(orgName),
1316
  fetchAllPages(`${HF_API}/models?author=${uEnc}&limit=1000&full=true&${expandParams}`),
1317
  fetchAllPages(`${HF_API}/datasets?author=${uEnc}&limit=1000&full=true&${expandParams}`),
1318
+ fetchAllPages(`${HF_API}/spaces?author=${uEnc}&limit=1000&full=true&expand[]=likes&expand[]=createdAt&expand[]=lastModified`),
1319
  ]);
1320
 
1321
  state.profile = profileData.status === 'fulfilled' ? profileData.value : null;
 
1810
  nameHtml = name.replace(rx, '<mark style="background:#333333;color:#ffffff;padding:0 2px;border-radius:2px;">$1</mark>');
1811
  }
1812
 
1813
+ // Modified to only display respective download data based on active filter
1814
  let meta = '';
1815
  if (tab !== 'spaces') {
1816
  const dlAll = getLifetimeDownloads(item);
1817
  const dlMonth = getMonthlyDownloads(item);
1818
+
1819
+ if (state.activeFilter === 'downloads-monthly') {
1820
+ meta += `<span class="t-stat" title="${formatNumFull(dlMonth)} downloads (last month)"><i class="fas fa-calendar-alt"></i> ${formatNum(dlMonth)}</span>`;
1821
+ } else {
1822
+ meta += `<span class="t-stat" title="${formatNumFull(dlAll)} downloads (all time)"><i class="fas fa-download"></i> ${formatNum(dlAll)}</span>`;
1823
+ }
1824
  }
1825
+
1826
  const likes = getItemLikes(item);
1827
  meta += `<span class="t-stat" title="${formatNumFull(likes)} likes"><i class="fas fa-heart"></i> ${formatNum(likes)}</span>`;
1828
  if (item.lastModified) {