Skip to content

Commit cf93d67

Browse files
committed
- better handling of the latest nugets. severs sends first/lastPublished dates, frontend decides about status.
- css cosmetics
1 parent 72248d7 commit cf93d67

33 files changed

Lines changed: 1984 additions & 1973 deletions

community-app/frontend/src/components/overview/LatestNugets.vue

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
33
import { ref, onMounted } from 'vue'
44
import { useRouter } from 'vue-router'
5-
import { NEllipsis, NSkeleton, NAvatar, NTag } from 'naive-ui'
5+
import { NEllipsis, NSkeleton, NImage, NTag } from 'naive-ui'
66
import { useLatestNugetsStore } from './LatestNugetsStore.js'
77
import Constants from '../../constants.js'
88
import SectionTitle from './SectionTitle.vue'
@@ -45,12 +45,12 @@ function showAll()
4545
</template>
4646
<template v-else>
4747
<ul v-if="store.nugets.length > 0" class="list-group list-group-flush list">
48-
<li v-for="(nuget, index) in store.nugets" :key="index" class="list-group-item d-flex flex-nowrap link">
49-
<NAvatar v-if="nuget.icon" objectFit="contain" :src="nuget.icon" :size="25" class="mr-3" :class="{ 'noImageBack': nuget.icon !== null }"/>
50-
<NEllipsis :line-clamp="1" :tooltip=false>
48+
<li v-for="(nuget, index) in store.nugets" :key="index" class="list-group-item d-flex flex-nowrap link align-items-baseline">
49+
<NImage v-if="nuget.icon" objectFit="contain" :src="nuget.icon" :height="25" class="align-self-center" :class="{ 'noImageBack': nuget.icon !== null }"/>
50+
<NEllipsis :line-clamp="1" :tooltip=false class="ml-3">
5151
<a :href="nuget.link" target="_blank">{{ nuget.id }}</a>
5252
</NEllipsis>
53-
<span class="by">{{ nuget.by }}</span>
53+
<div class="by d-none d-sm-inline ml-3">{{ nuget.by }}</div>
5454
<NTag v-if="nuget.status" size="small" round :bordered="false" class="px-2 ml-3 text-muted text-right" :class="{'new': nuget.status == 'new'}">{{ nuget.status }}</NTag>
5555
</li>
5656
</ul>

community-app/frontend/src/components/overview/LatestNugetsStore.js

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,26 @@ async function fetchLatestNugets(){
3838

3939
const nugets = json.map((n)=>{
4040

41-
// const by=[... new Set([ ...n.owners, ...n.authors])];
41+
let status="";
42+
43+
try{
44+
if (new Date(n.firstPublished).getTime() + twoWeeks > Date.now()) {
45+
status = "new";
46+
}
47+
else if (n.firstPublished != n.lastPublished) {
48+
status = "updated";
49+
}
50+
}
51+
catch{
52+
// server still using an old API. Status will stay ""
53+
}
4254

4355
return {
4456
id: n.id,
4557
icon: n.icon || "",
4658
by: n.owners.join(', '),
4759
link: `${Constants.NUGET_PACK_LINK}${n.id}#readme-body-tab`,
48-
status: n.status
60+
status: status
4961
}
5062
})
5163

community-app/frontend/src/styles/style.scss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ $orange-hover: #ee4b28;
1313
.by{
1414
font-size: 0.8rem;
1515
color: #888;
16-
padding: 0.2rem 1rem;
1716
}
1817

1918
.new{
Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

static/js/vue/app-BusinessList-CfBAk_cS.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

static/js/vue/app-BusinessList-wZXkXUBA.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

static/js/vue/app-BusinessListStore-BBSkMg35.js renamed to static/js/vue/app-BusinessListStore-DVyNA_QR.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)