Skip to content

Correct isNew to be isUpdated in package card and details #1353

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions apps/cyberstorm-remix/app/p/packageListing.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import {
faThumbsUp,
faWarning,
faThumbTack,
faCodeMerge,
} from "@fortawesome/free-solid-svg-icons";
import TeamMembers from "./components/TeamMembers/TeamMembers";
import { useEffect, useRef, useState } from "react";
Expand Down Expand Up @@ -252,6 +253,10 @@ export default function PackageListing() {
// );

const isNew =
Math.round((Date.now() - Date.parse(listing.datetime_created)) / 86400000) <
3;

const isUpdated =
Math.round((Date.now() - Date.parse(listing.last_updated)) / 86400000) < 3;

const likeAction = PackageLikeAction({
Expand Down Expand Up @@ -589,7 +594,8 @@ export default function PackageListing() {
listing.is_pinned ||
listing.is_deprecated ||
listing.is_nsfw ||
isNew ? (
isNew ||
isUpdated ? (
<div className="package-listing-sidebar__categories">
<div className="package-listing-sidebar__header">
<Heading csLevel="4" csSize="4">
Expand All @@ -604,7 +610,8 @@ export default function PackageListing() {
{listing.is_pinned ||
listing.is_deprecated ||
listing.is_nsfw ||
isNew ? (
isNew ||
isUpdated ? (
<div className="package-listing-sidebar__body">
{listing.is_pinned ? (
<NewTag
Expand Down Expand Up @@ -654,6 +661,14 @@ export default function PackageListing() {
New
</NewTag>
) : null}
{isUpdated ? (
<NewTag csSize="small" csVariant="green">
<NewIcon noWrapper csMode="inline">
<FontAwesomeIcon icon={faCodeMerge} />
</NewIcon>
Updated
</NewTag>
) : null}
</div>
) : null}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
faThumbTack,
faWarning,
faThumbsUp,
faCodeMerge,
} from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { PackageListing } from "@thunderstore/dapper/types";
Expand All @@ -11,7 +12,7 @@ import { formatInteger } from "../../../utils/utils";
import { NewLink, NewIcon, Image, NewTag, NewMetaItem } from "../../..";
import { TooltipWrapper } from "../../../primitiveComponents/utils/utils";
import "./CardPackage.css";
import { faLips, faSparkles } from "@fortawesome/pro-solid-svg-icons";
import { faLips } from "@fortawesome/pro-solid-svg-icons";
import { RelativeTime } from "../../../components/RelativeTime/RelativeTime";

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

return (
<div className="card-package">
Expand All @@ -40,7 +41,7 @@ export function CardPackage(props: Props) {
{packageData.is_pinned ||
packageData.is_nsfw ||
packageData.is_deprecated ||
isNew ? (
isUpdated ? (
<div className="card-package__tag">
{packageData.is_pinned ? (
<NewTag csSize="small" csModifiers={["dark"]} csVariant="blue">
Expand All @@ -66,12 +67,12 @@ export function CardPackage(props: Props) {
Deprecated
</NewTag>
) : null}
{isNew ? (
<NewTag csSize="small" csModifiers={["dark"]} csVariant="green">
{isUpdated ? (
<NewTag csSize="small" csVariant="green">
<NewIcon noWrapper csMode="inline">
<FontAwesomeIcon icon={faSparkles} />
<FontAwesomeIcon icon={faCodeMerge} />
</NewIcon>
New
Updated
</NewTag>
) : null}
</div>
Expand Down
Loading