@@ -3,36 +3,34 @@ import styles from "./PluginCard.module.css";
33
44interface Plugin {
55 id : string ;
6+ group : string ;
67 name : string ;
78 description : string ;
89 category : string ;
910 tags : string [ ] ;
10- icon : string ;
1111 logoUrl ?: string ;
1212 author : string ;
13- moduleType ?: "openchoreo" | "backstage" ;
14- repo ?: string ;
15- moduleUrl ?: string ;
16- stars ?: number ; // generated
13+ sourceUrl ?: string ;
14+ default ?: boolean ;
1715 released ?: boolean ;
1816}
1917
2018interface PluginCardProps {
2119 plugin : Plugin ;
2220}
2321
24- function getRepoUrl ( repo ?: string ) : string | null {
25- if ( ! repo ) return null ;
26-
27- const r = repo . trim ( ) . replace ( / \/ + $ / , "" ) ;
28- if ( / ^ h t t p s ? : \/ \/ / i . test ( r ) ) return r ;
29- if ( / ^ ( w w w \. ) ? g i t h u b \. c o m \/ / i . test ( r ) ) return `https:// ${ r } ` ;
30- return `https://github.com/ ${ r } ` ;
31- }
22+ const GROUP_LABELS : Record < string , string > = {
23+ module : "Module" ,
24+ integration : "Integration" ,
25+ agent : "Agent" ,
26+ skill : "Skill" ,
27+ "component-type" : "Component Type" ,
28+ workflow : "Workflow" ,
29+ } ;
3230
3331export const PluginCard : React . FC < PluginCardProps > = ( { plugin } ) => {
34- const repoUrl = React . useMemo ( ( ) => getRepoUrl ( plugin . repo ) , [ plugin . repo ] ) ;
35- const exploreUrl = plugin . moduleUrl || repoUrl ;
32+ const exploreUrl = plugin . sourceUrl ;
33+ const groupName = GROUP_LABELS [ plugin . group ] ?? plugin . group ;
3634
3735 return (
3836 < article className = { `card ${ styles . card } ` } >
@@ -41,8 +39,6 @@ export const PluginCard: React.FC<PluginCardProps> = ({ plugin }) => {
4139 < div className = { styles . iconWrapper } >
4240 { plugin . logoUrl ? (
4341 < img src = { plugin . logoUrl } alt = { `${ plugin . name } logo` } className = { styles . logo } />
44- ) : plugin . icon ? (
45- < span className = { styles . icon } > { plugin . icon } </ span >
4642 ) : (
4743 < div className = { styles . placeholder } > Logo</ div >
4844 ) }
@@ -54,12 +50,7 @@ export const PluginCard: React.FC<PluginCardProps> = ({ plugin }) => {
5450 </ div >
5551 </ div >
5652
57- { plugin . moduleType && (
58- < span className = { plugin . moduleType === "openchoreo" ? styles . labelCore : styles . labelBackstage } >
59- { plugin . moduleType === "openchoreo" ? "OpenChoreo Module" : "Backstage Curated Module" }
60- </ span >
61- ) }
62-
53+ < span className = { styles . groupLabel } > { groupName } </ span >
6354 </ div >
6455
6556 < div className = { styles . body } >
0 commit comments