11import { Table , TableBody , TableCell , TableRow } from "./ui/table" ;
22import { Tooltip , TooltipContent , TooltipProvider , TooltipTrigger } from "./ui/tooltip" ;
33import { Badge } from "./ui/badge" ;
4- import { ExternalLink , Image as ImageIcon , LucideTerminalSquare , Package , ScrollText , Download , Bug } from "lucide-react" ;
4+ import { ExternalLink , LucideTerminalSquare , Package , ScrollText , Download , Bug } from "lucide-react" ;
55import { buttonVariants } from "./ui/button" ;
66import { useClipboard } from "../hooks/use-clipboard" ;
77import FormulaLinks from "./formula-links" ;
@@ -10,9 +10,10 @@ interface AppProps {
1010 data : { [ key : string ] : any } ;
1111 logs : string ;
1212 repo : string ;
13+ downloadable ?: boolean ;
1314}
1415
15- type FieldType = "link" | "version" | "size" | "date" | "hash" | "files" | "number" | "metric" | "category" | "default" | "links" | "tags" | "repology" | "provides" | "string[]" ;
16+ type FieldType = "link" | "version" | "size" | "date" | "hash" | "files" | "number" | "metric" | "category" | "default" | "links" | "tags" | "repology" | "provides" | "string[]" | "license" ;
1617
1718interface ResolverField {
1819 label : string ;
@@ -29,7 +30,7 @@ const resolver: { [key: string]: ResolverField } = {
2930 bsum : { label : "BLAKE3SUM" , type : "hash" } ,
3031 repology : { label : "Repology" , type : "repology" } ,
3132 appstream : { label : "AppStream" , type : "link" } ,
32- license : { label : "License" , type : "string[]" , joinWith : ", " } ,
33+ license : { label : "License" , type : "license " } ,
3334 snapshots : { label : "Snapshots" , type : "version" } ,
3435 tag : { label : "Tags" , type : "tags" } ,
3536 app_id : { label : "Application ID" , type : "default" } ,
@@ -49,10 +50,10 @@ const resolver: { [key: string]: ResolverField } = {
4950 icon : { label : "Icon" , type : "link" } ,
5051 provides : { label : "Provides" , type : "provides" } ,
5152 description : { label : "Description" , type : "default" } ,
52- host : { label : "Host" , type : "default" } ,
5353 pkg_type : { label : "Package Type" , type : "default" } ,
5454 pkg_webpage : { label : "Package Webpage" , type : "link" } ,
55- maintainer : { label : "Maintainer" , type : "string[]" , joinWith : ", " } ,
55+ maintainer : { label : "Maintainer" , type : "string[]" , joinWith : "\n" } ,
56+ host : { label : "Host" , type : "tags" } ,
5657 rank : { label : "Rank" , type : "metric" } ,
5758 build_ghactions : { label : "GH Actions Build" , type : "link" } ,
5859 ghcr_blob : { label : "GHCR Blob" , type : "link" } ,
@@ -175,6 +176,24 @@ function Show({ value, Key, props }: { value: any, props: AppProps, Key?: string
175176 </ div >
176177 ) ;
177178
179+ case "license" :
180+ const l = value as string [ ] ;
181+ return (
182+ < div className = "flex flex-wrap gap-1" >
183+ { l . map ( ( s ) => {
184+ return (
185+ < div key = { s } className = "flex" >
186+ < a href = { `https://spdx.org/licenses/${ s } .html` } target = "_blank" rel = "noreferrer"
187+ className = "underline underline-offset-4" >
188+ < Badge className = "bg-blue-100 dark:bg-blue-900 text-blue-800 dark:text-blue-100" >
189+ { s }
190+ </ Badge >
191+ </ a >
192+ </ div >
193+ ) ;
194+ } ) }
195+ </ div >
196+ ) ;
178197 case "repology" :
179198 const repology = value as string [ ] ;
180199 return (
@@ -256,7 +275,7 @@ function Show({ value, Key, props }: { value: any, props: AppProps, Key?: string
256275 }
257276}
258277
259- export default function App ( { data, logs : build , repo } : AppProps ) {
278+ export default function App ( { data, logs : build , repo, downloadable = true } : AppProps ) {
260279 const { copy, copied } = useClipboard ( ) ;
261280
262281 // Thanks @Azathothas for forcing us to write this hellifying script
@@ -276,7 +295,7 @@ export default function App({ data, logs: build, repo }: AppProps) {
276295 arch = { data . host }
277296 family = { pkg_family }
278297 name = { pkg }
279- download_url = { data . download_url }
298+ download_url = { downloadable ? data . download_url : "none" }
280299 />
281300 < Table className = "border border-muted/70 mt-4 rounded-xl" >
282301 < TableBody >
0 commit comments