Skip to content

Commit 4ff4d8a

Browse files
AugustinMauroyEGAMAGZcrowlKats
authored
feat: add report package button (#972)
#925 Adding button to report malware. Desktop: <img width="1551" alt="Capture d’écran 2025-02-22 à 11 07 43" src="https://github.com/user-attachments/assets/67c7079b-2f04-4256-80b7-bfb0354098b1" /> Mobile: <img width="686" alt="Capture d’écran 2025-02-22 à 11 09 46" src="https://github.com/user-attachments/assets/d676f9a8-99d4-42e6-8c0c-7e499e3be0db" /> --------- Co-authored-by: Gamaliel Garcia <46827955+EGAMAGZ@users.noreply.github.com> Co-authored-by: Leo Kettmeir <crowlkats@toaxl.com>
1 parent 8cd11fe commit 4ff4d8a

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

frontend/routes/package/(_components)/PackageHeader.tsx

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { getScoreTextColorClass } from "../../../utils/score_ring_color.ts";
66
import {
77
TbAlertTriangleFilled,
88
TbExternalLink,
9+
TbFlag,
910
TbRosetteDiscountCheck,
1011
} from "@preact-icons/tb";
1112
import { Tooltip } from "../../../components/Tooltip.tsx";
@@ -33,6 +34,16 @@ export function PackageHeader({
3334
(pkg.latestVersion === null ||
3435
greaterThan(selectedVersionSemver, parse(pkg.latestVersion)));
3536

37+
const reportPackageBody = `Hello JSR team,
38+
I would like to report a package for the following reason:
39+
`;
40+
41+
const mailLink = `mailto:report@jsr.io?subject=${
42+
encodeURIComponent(
43+
`Report package: ${pkg.scope}/${pkg.name}@${selectedVersion?.version}`,
44+
)
45+
}&body=${encodeURIComponent(reportPackageBody)}`;
46+
3647
return (
3748
<div class="space-y-6 mt-0 md:mt-4">
3849
{pkg.isArchived && (
@@ -213,6 +224,15 @@ export function PackageHeader({
213224
</div>
214225
)}
215226
</div>
227+
228+
<div class="flex flex-row items-center gap-2">
229+
<a
230+
class="inline-flex items-center gap-1.5 md:gap-1 text-md md:text-xs bg-red-50 border-1 border-red-300/30 rounded-md p-1.5 md:p-1 text-red-500 font-semibold hover:bg-red-100 focus:outline-none focus:border-1 focus:border-red-300 focus:ring-1 focus:ring-red-300 focus:ring-opacity-50"
231+
href={mailLink}
232+
>
233+
<TbFlag class="size-6 md:size-4" /> Report package
234+
</a>
235+
</div>
216236
</div>
217237
</div>
218238
</div>

0 commit comments

Comments
 (0)