Skip to content

Commit 0c10398

Browse files
authored
Merge pull request #342 from usnistgov/ux/home-page-invert-new-resources-position
Reorder home feed cards so “Latest Releases” shows before “Latest Updates”
2 parents 94f5d05 + 5151576 commit 0c10398

1 file changed

Lines changed: 24 additions & 29 deletions

File tree

angular/src/app/home/home.component.ts

Lines changed: 24 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -98,21 +98,6 @@ export class HomeComponent implements OnInit, OnDestroy, AfterViewInit {
9898
aiURL: string;
9999
recentDatasets: any[] = [];
100100
recentFeeds: RecentFeedConfig[] = [
101-
{
102-
id: "latest-updated",
103-
label: "Latest Updates",
104-
description: "Resources most recently updated across the catalog.",
105-
icon: "pi pi-history",
106-
metricsLabel: "updates",
107-
sort: "annotated:desc",
108-
filter: "@type=Dataset",
109-
keywordsLimit: 2,
110-
typesLimit: 1,
111-
dateFields: [
112-
{ field: "annotated", label: "Updated" },
113-
{ field: "modified", label: "Modified" },
114-
],
115-
},
116101
{
117102
id: "latest-released",
118103
label: "Latest Releases",
@@ -129,6 +114,22 @@ export class HomeComponent implements OnInit, OnDestroy, AfterViewInit {
129114
{ field: "annotated", label: "Updated" },
130115
],
131116
},
117+
{
118+
id: "latest-updated",
119+
label: "Latest Updates",
120+
description: "Resources most recently updated across the catalog.",
121+
icon: "pi pi-history",
122+
metricsLabel: "updates",
123+
sort: "annotated:desc",
124+
filter: "@type=Dataset",
125+
keywordsLimit: 2,
126+
typesLimit: 1,
127+
dateFields: [
128+
{ field: "annotated", label: "Updated" },
129+
{ field: "modified", label: "Modified" },
130+
],
131+
},
132+
132133
// {
133134
// id: "data-publications",
134135
// label: "Data Publications",
@@ -655,20 +656,15 @@ export class HomeComponent implements OnInit, OnDestroy, AfterViewInit {
655656
variant,
656657
"filter"
657658
);
658-
const hasSort = Object.prototype.hasOwnProperty.call(
659-
variant,
660-
"sort"
661-
);
659+
const hasSort = Object.prototype.hasOwnProperty.call(variant, "sort");
662660
const hasFreeText = Object.prototype.hasOwnProperty.call(
663661
variant,
664662
"freeText"
665663
);
666664
strategies.push({
667665
filter: hasFilter ? variant.filter ?? undefined : feed.filter,
668666
sort: hasSort ? variant.sort ?? undefined : feed.sort,
669-
freeText: hasFreeText
670-
? variant.freeText ?? ""
671-
: feed.freeText ?? "",
667+
freeText: hasFreeText ? variant.freeText ?? "" : feed.freeText ?? "",
672668
queryRows: variant.queryRows ?? feed.queryRows,
673669
});
674670
});
@@ -871,7 +867,9 @@ export class HomeComponent implements OnInit, OnDestroy, AfterViewInit {
871867
if (!itemsShown) return "";
872868
const total = state.total;
873869
const baseLabel =
874-
itemsShown === 1 ? "Showing 1 resource" : `Showing ${itemsShown} resources`;
870+
itemsShown === 1
871+
? "Showing 1 resource"
872+
: `Showing ${itemsShown} resources`;
875873
const metricsLabel = this.activeRecentFeed?.metricsLabel;
876874
const suffix =
877875
typeof total === "number" && total > itemsShown
@@ -991,9 +989,7 @@ export class HomeComponent implements OnInit, OnDestroy, AfterViewInit {
991989
return [];
992990
}
993991

994-
formatResourceTypes(
995-
types: string[] | string | undefined | null
996-
): string[] {
992+
formatResourceTypes(types: string[] | string | undefined | null): string[] {
997993
let normalized: string[] = [];
998994
if (typeof types === "string") {
999995
normalized = [types];
@@ -1069,8 +1065,7 @@ export class HomeComponent implements OnInit, OnDestroy, AfterViewInit {
10691065
const remaining = seconds - minutes * 60;
10701066
if (minutes >= 1) {
10711067
const minLabel = minutes === 1 ? "min" : "mins";
1072-
const secLabel =
1073-
remaining >= 1 ? ` ${remaining.toFixed(0)} s` : "";
1068+
const secLabel = remaining >= 1 ? ` ${remaining.toFixed(0)} s` : "";
10741069
return `${minutes} ${minLabel}${secLabel}`;
10751070
}
10761071
return `${seconds.toFixed(1)} s`;
@@ -1131,7 +1126,7 @@ export class HomeComponent implements OnInit, OnDestroy, AfterViewInit {
11311126
}
11321127

11331128
getTopicDepthClass(topic: TopicTreeNode) {
1134-
const level = topic?.level ?? (this.topicPath.length + 1);
1129+
const level = topic?.level ?? this.topicPath.length + 1;
11351130
if (level <= 1) return "topic-chip--depth-root";
11361131
if (level === 2) return "topic-chip--depth-child";
11371132
return "topic-chip--depth-grandchild";

0 commit comments

Comments
 (0)