11// Copyright 2024 the JSR authors. All rights reserved. MIT license.
2- import type { PackageVersionWithUser } from "../../../utils/api_types.ts" ;
2+ import type { PackageVersionWithUser , User } from "../../../utils/api_types.ts" ;
33import { LocalSymbolSearch } from "../(_islands)/LocalSymbolSearch.tsx" ;
44import { Docs } from "../../../util.ts" ;
55import { Params } from "./PackageNav.tsx" ;
66import { BreadcrumbsSticky } from "../(_islands)/BreadcrumbsSticky.tsx" ;
7+ import { TicketModal } from "../../../islands/TicketModal.tsx" ;
8+ import { TbFlag } from "tb-icons" ;
79
810interface DocsProps {
911 docs : Docs ;
1012 params : Params ;
1113 selectedVersion : PackageVersionWithUser ;
1214 showProvenanceBadge ?: boolean ;
15+ user : User | null ;
16+ scope : string ;
17+ pkg : string ;
1318}
1419
1520const USAGE_SELECTOR_SCRIPT = `(() => {
@@ -34,9 +39,12 @@ export function DocsView({
3439 params,
3540 selectedVersion,
3641 showProvenanceBadge,
42+ user,
43+ scope,
44+ pkg,
3745} : DocsProps ) {
3846 return (
39- < div class = "pt-6 space-y-8" >
47+ < div class = "pt-6 pb-8 space-y-8" >
4048 < style
4149 hidden
4250 // deno-lint-ignore react-no-danger
@@ -77,46 +85,87 @@ export function DocsView({
7785 />
7886 < div class = "ddoc hidden" id = "docSearchResults" />
7987
80- { showProvenanceBadge && selectedVersion . rekorLogId && (
81- < div class = "mt-8 mb-8 border-2 border-jsr-cyan-500 max-w-xl rounded-md py-4 px-6" >
82- < div class = "flex flex-row items-end justify-between" >
83- < div class = "items-center" >
84- < span class = "text-sm text-jsr-gray-300" >
85- Built and signed on
86- </ span >
88+ < div class = "flex justify-between items-center gap-4" >
89+ { showProvenanceBadge && selectedVersion . rekorLogId && (
90+ < div class = "mt-8 mb-8 border-2 border-jsr-cyan-500 max-w-xl rounded-md py-4 px-6" >
91+ < div class = "flex flex-row items-end justify-between" >
92+ < div class = "items-center" >
93+ < span class = "text-sm text-jsr-gray-300" >
94+ Built and signed on
95+ </ span >
8796
88- < div class = "flex gap-2 items-center" >
89- < span class = "text-2xl font-bold" > GitHub Actions</ span >
90- < svg
91- aria-hidden = "true"
92- role = "img"
93- class = "text-green-600"
94- viewBox = "0 0 16 16"
95- width = "20"
96- height = "20"
97- fill = "currentColor"
98- style = "display: inline-block; user-select: none; vertical-align: text-bottom;"
99- >
100- < path
101- fill-rule = "evenodd"
102- d = "M9.585.52a2.678 2.678 0 00-3.17 0l-.928.68a1.178 1.178 0 01-.518.215L3.83 1.59a2.678 2.678 0 00-2.24 2.24l-.175 1.14a1.178 1.178 0 01-.215.518l-.68.928a2.678 2.678 0 000 3.17l.68.928c.113.153.186.33.215.518l.175 1.138a2.678 2.678 0 002.24 2.24l1.138.175c.187.029.365.102.518.215l.928.68a2.678 2.678 0 003.17 0l.928-.68a1.17 1.17 0 01.518-.215l1.138-.175a2.678 2.678 0 002.241-2.241l.175-1.138c.029-.187.102-.365.215-.518l.68-.928a2.678 2.678 0 000-3.17l-.68-.928a1.179 1.179 0 01-.215-.518L14.41 3.83a2.678 2.678 0 00-2.24-2.24l-1.138-.175a1.179 1.179 0 01-.518-.215L9.585.52zM7.303 1.728c.415-.305.98-.305 1.394 0l.928.68c.348.256.752.423 1.18.489l1.136.174c.51.078.909.478.987.987l.174 1.137c.066.427.233.831.489 1.18l.68.927c.305.415.305.98 0 1.394l-.68.928a2.678 2.678 0 00-.489 1.18l-.174 1.136a1.178 1.178 0 01-.987.987l-1.137.174a2.678 2.678 0 00-1.18.489l-.927.68c-.415.305-.98.305-1.394 0l-.928-.68a2.678 2.678 0 00-1.18-.489l-1.136-.174a1.178 1.178 0 01-.987-.987l-.174-1.137a2.678 2.678 0 00-.489-1.18l-.68-.927a1.178 1.178 0 010-1.394l.68-.928c.256-.348.423-.752.489-1.18l.174-1.136c.078-.51.478-.909.987-.987l1.137-.174a2.678 2.678 0 001.18-.489l.927-.68zM11.28 6.78a.75.75 0 00-1.06-1.06L7 8.94 5.78 7.72a.75.75 0 00-1.06 1.06l1.75 1.75a.75.75 0 001.06 0l3.75-3.75z"
97+ < div class = "flex gap-2 items-center" >
98+ < span class = "text-2xl font-bold" > GitHub Actions</ span >
99+ < svg
100+ aria-hidden = "true"
101+ role = "img"
102+ class = "text-green-600"
103+ viewBox = "0 0 16 16"
104+ width = "20"
105+ height = "20"
106+ fill = "currentColor"
107+ style = "display: inline-block; user-select: none; vertical-align: text-bottom;"
103108 >
104- </ path >
105- </ svg >
109+ < path
110+ fill-rule = "evenodd"
111+ d = "M9.585.52a2.678 2.678 0 00-3.17 0l-.928.68a1.178 1.178 0 01-.518.215L3.83 1.59a2.678 2.678 0 00-2.24 2.24l-.175 1.14a1.178 1.178 0 01-.215.518l-.68.928a2.678 2.678 0 000 3.17l.68.928c.113.153.186.33.215.518l.175 1.138a2.678 2.678 0 002.24 2.24l1.138.175c.187.029.365.102.518.215l.928.68a2.678 2.678 0 003.17 0l.928-.68a1.17 1.17 0 01.518-.215l1.138-.175a2.678 2.678 0 002.241-2.241l.175-1.138c.029-.187.102-.365.215-.518l.68-.928a2.678 2.678 0 000-3.17l-.68-.928a1.179 1.179 0 01-.215-.518L14.41 3.83a2.678 2.678 0 00-2.24-2.24l-1.138-.175a1.179 1.179 0 01-.518-.215L9.585.52zM7.303 1.728c.415-.305.98-.305 1.394 0l.928.68c.348.256.752.423 1.18.489l1.136.174c.51.078.909.478.987.987l.174 1.137c.066.427.233.831.489 1.18l.68.927c.305.415.305.98 0 1.394l-.68.928a2.678 2.678 0 00-.489 1.18l-.174 1.136a1.178 1.178 0 01-.987.987l-1.137.174a2.678 2.678 0 00-1.18.489l-.927.68c-.415.305-.98.305-1.394 0l-.928-.68a2.678 2.678 0 00-1.18-.489l-1.136-.174a1.178 1.178 0 01-.987-.987l-.174-1.137a2.678 2.678 0 00-.489-1.18l-.68-.927a1.178 1.178 0 010-1.394l.68-.928c.256-.348.423-.752.489-1.18l.174-1.136c.078-.51.478-.909.987-.987l1.137-.174a2.678 2.678 0 001.18-.489l.927-.68zM11.28 6.78a.75.75 0 00-1.06-1.06L7 8.94 5.78 7.72a.75.75 0 00-1.06 1.06l1.75 1.75a.75.75 0 001.06 0l3.75-3.75z"
112+ >
113+ </ path >
114+ </ svg >
115+ </ div >
106116 </ div >
107- </ div >
108117
109- < a
110- href = { `https://search.sigstore.dev/?logIndex=${ selectedVersion . rekorLogId } ` }
111- target = "_blank"
112- rel = "noopener noreferrer"
113- class = "text-sm link"
114- >
115- View transparency log
116- </ a >
118+ < a
119+ href = { `https://search.sigstore.dev/?logIndex=${ selectedVersion . rekorLogId } ` }
120+ target = "_blank"
121+ rel = "noopener noreferrer"
122+ class = "text-sm link"
123+ >
124+ View transparency log
125+ </ a >
126+ </ div >
117127 </ div >
128+ ) }
129+
130+ < div >
131+ < TicketModal
132+ user = { user }
133+ kind = "package_report"
134+ style = "danger"
135+ title = "Report package"
136+ description = {
137+ < >
138+ < p className = "mt-4 text-jsr-gray-600" >
139+ Please provide a reason for reporting this package. We
140+ will review your report and take appropriate action.
141+ </ p >
142+ < p className = "mt-4 text-jsr-gray-600" >
143+ Please review the{ " " }
144+ < a href = "/docs/usage-policy#package-contents-and-metadata" >
145+ JSR usage policy
146+ </ a > { " " }
147+ before submitting a report.
148+ </ p >
149+ </ >
150+ }
151+ fields = { [
152+ {
153+ name : "message" ,
154+ label : "Reason" ,
155+ type : "textarea" ,
156+ required : true ,
157+ } ,
158+ ] }
159+ extraMeta = { {
160+ scope,
161+ name : pkg ,
162+ version : selectedVersion ?. version ,
163+ } }
164+ >
165+ < TbFlag class = "size-6 md:size-4" /> Report package
166+ </ TicketModal >
118167 </ div >
119- ) }
168+ </ div >
120169 </ div >
121170 { docs . toc && (
122171 < div
0 commit comments