Skip to content

Commit e7dfae3

Browse files
committed
refactor: migrate marketplace plugin schema for upcoming redesign
Signed-off-by: LakshanSS <lakshan230897@gmail.com>
1 parent 805fe25 commit e7dfae3

4 files changed

Lines changed: 111 additions & 183 deletions

File tree

src/components/PluginCard/PluginCard.module.css

Lines changed: 4 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,7 @@
4545
object-fit: contain;
4646
}
4747

48-
.icon {
49-
font-size: 2rem;
50-
}
51-
52-
/* Placeholder when no logo/icon */
48+
/* Placeholder when no logo */
5349
.placeholder {
5450
width: 36px;
5551
height: 36px;
@@ -83,9 +79,8 @@
8379
color: var(--ifm-color-emphasis-700);
8480
}
8581

86-
/* Module type labels */
87-
.labelCore,
88-
.labelBackstage {
82+
/* Group label */
83+
.groupLabel {
8984
display: inline-block;
9085
white-space: nowrap;
9186
padding: 0.2rem 0.55rem;
@@ -94,36 +89,17 @@
9489
font-weight: 600;
9590
flex-shrink: 0;
9691
margin-left: 0.75rem;
97-
}
98-
99-
.labelCore {
10092
background: #e8f4ff;
10193
color: #0070c9;
10294
border: 1px solid #b3d7f5;
10395
}
10496

105-
.labelBackstage {
106-
background: #f0ecff;
107-
color: #6441c8;
108-
border: 1px solid #cfc2f5;
109-
}
110-
111-
html[data-theme='dark'] .labelCore {
97+
html[data-theme='dark'] .groupLabel {
11298
background: #0c2a45;
11399
color: #5ab3f7;
114100
border-color: #1f4d78;
115101
}
116102

117-
html[data-theme='dark'] .labelBackstage {
118-
background: #1e1340;
119-
color: #a78bfa;
120-
border-color: #3b2a6e;
121-
}
122-
123-
.stars {
124-
margin-top: 0.15rem;
125-
}
126-
127103
/* --- Body --- */
128104
.body {
129105
flex-grow: 1;

src/components/PluginCard/PluginCard.tsx

Lines changed: 14 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3,36 +3,34 @@ import styles from "./PluginCard.module.css";
33

44
interface 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

2018
interface 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 (/^https?:\/\//i.test(r)) return r;
29-
if (/^(www\.)?github\.com\//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

3331
export 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

Comments
 (0)