Skip to content

Commit 2b2561d

Browse files
authored
Merge pull request #1353 from thunderstore-io/02-24-correct_isnew_to_be_isupdated_in_package_card_and_details
Correct isNew to be isUpdated in package card and details
2 parents 10a951f + 8586e72 commit 2b2561d

File tree

2 files changed

+25
-9
lines changed

2 files changed

+25
-9
lines changed

apps/cyberstorm-remix/app/p/packageListing.tsx

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import {
2929
faThumbsUp,
3030
faWarning,
3131
faThumbTack,
32+
faCodeMerge,
3233
} from "@fortawesome/free-solid-svg-icons";
3334
import TeamMembers from "./components/TeamMembers/TeamMembers";
3435
import { useEffect, useRef, useState } from "react";
@@ -252,6 +253,10 @@ export default function PackageListing() {
252253
// );
253254

254255
const isNew =
256+
Math.round((Date.now() - Date.parse(listing.datetime_created)) / 86400000) <
257+
3;
258+
259+
const isUpdated =
255260
Math.round((Date.now() - Date.parse(listing.last_updated)) / 86400000) < 3;
256261

257262
const likeAction = PackageLikeAction({
@@ -589,7 +594,8 @@ export default function PackageListing() {
589594
listing.is_pinned ||
590595
listing.is_deprecated ||
591596
listing.is_nsfw ||
592-
isNew ? (
597+
isNew ||
598+
isUpdated ? (
593599
<div className="package-listing-sidebar__categories">
594600
<div className="package-listing-sidebar__header">
595601
<Heading csLevel="4" csSize="4">
@@ -604,7 +610,8 @@ export default function PackageListing() {
604610
{listing.is_pinned ||
605611
listing.is_deprecated ||
606612
listing.is_nsfw ||
607-
isNew ? (
613+
isNew ||
614+
isUpdated ? (
608615
<div className="package-listing-sidebar__body">
609616
{listing.is_pinned ? (
610617
<NewTag
@@ -654,6 +661,14 @@ export default function PackageListing() {
654661
New
655662
</NewTag>
656663
) : null}
664+
{isUpdated ? (
665+
<NewTag csSize="small" csVariant="green">
666+
<NewIcon noWrapper csMode="inline">
667+
<FontAwesomeIcon icon={faCodeMerge} />
668+
</NewIcon>
669+
Updated
670+
</NewTag>
671+
) : null}
657672
</div>
658673
) : null}
659674
</div>

packages/cyberstorm/src/newComponents/Card/CardPackage/CardPackage.tsx

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import {
33
faThumbTack,
44
faWarning,
55
faThumbsUp,
6+
faCodeMerge,
67
} from "@fortawesome/free-solid-svg-icons";
78
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
89
import { PackageListing } from "@thunderstore/dapper/types";
@@ -11,7 +12,7 @@ import { formatInteger } from "../../../utils/utils";
1112
import { NewLink, NewIcon, Image, NewTag, NewMetaItem } from "../../..";
1213
import { TooltipWrapper } from "../../../primitiveComponents/utils/utils";
1314
import "./CardPackage.css";
14-
import { faLips, faSparkles } from "@fortawesome/pro-solid-svg-icons";
15+
import { faLips } from "@fortawesome/pro-solid-svg-icons";
1516
import { RelativeTime } from "../../../components/RelativeTime/RelativeTime";
1617

1718
interface Props {
@@ -24,7 +25,7 @@ export function CardPackage(props: Props) {
2425
const { packageData, isLiked, packageLikeAction } = props;
2526
const updateTime = Date.parse(packageData.last_updated);
2627
const updateTimeDelta = Math.round((Date.now() - updateTime) / 86400000);
27-
const isNew = updateTimeDelta < 3;
28+
const isUpdated = updateTimeDelta < 3;
2829

2930
return (
3031
<div className="card-package">
@@ -40,7 +41,7 @@ export function CardPackage(props: Props) {
4041
{packageData.is_pinned ||
4142
packageData.is_nsfw ||
4243
packageData.is_deprecated ||
43-
isNew ? (
44+
isUpdated ? (
4445
<div className="card-package__tag">
4546
{packageData.is_pinned ? (
4647
<NewTag csSize="small" csModifiers={["dark"]} csVariant="blue">
@@ -66,12 +67,12 @@ export function CardPackage(props: Props) {
6667
Deprecated
6768
</NewTag>
6869
) : null}
69-
{isNew ? (
70-
<NewTag csSize="small" csModifiers={["dark"]} csVariant="green">
70+
{isUpdated ? (
71+
<NewTag csSize="small" csVariant="green">
7172
<NewIcon noWrapper csMode="inline">
72-
<FontAwesomeIcon icon={faSparkles} />
73+
<FontAwesomeIcon icon={faCodeMerge} />
7374
</NewIcon>
74-
New
75+
Updated
7576
</NewTag>
7677
) : null}
7778
</div>

0 commit comments

Comments
 (0)