@industry-theme/git-panels 0.1.3 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"GitPullRequestsPanel.d.ts","sourceRoot":"","sources":["../../src/panels/GitPullRequestsPanel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAuC,MAAM,OAAO,CAAC;AAa5D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAMpD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,oBAAoB,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CA4S9D,CAAC;AAuPF;;GAEG;AACH,eAAO,MAAM,2BAA2B,EAAE,KAAK,CAAC,EAkE/C,CAAC"}
1
+ {"version":3,"file":"GitPullRequestsPanel.d.ts","sourceRoot":"","sources":["../../src/panels/GitPullRequestsPanel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAuC,MAAM,OAAO,CAAC;AAa5D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAMpD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,oBAAoB,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CAyS9D,CAAC;AA0MF;;GAEG;AACH,eAAO,MAAM,2BAA2B,EAAE,KAAK,CAAC,EAkE/C,CAAC"}
@@ -959,7 +959,7 @@ const GitPullRequestsPanel = ({
959
959
  events.on("git-panels.pull-requests:set-filter", (event) => {
960
960
  var _a2;
961
961
  const newFilter = (_a2 = event.payload) == null ? void 0 : _a2.filter;
962
- if (newFilter && ["all", "open", "closed"].includes(newFilter)) {
962
+ if (newFilter && ["open", "closed"].includes(newFilter)) {
963
963
  setFilter(newFilter);
964
964
  }
965
965
  })
@@ -967,15 +967,12 @@ const GitPullRequestsPanel = ({
967
967
  return () => unsubscribers.forEach((unsub) => unsub());
968
968
  }, [events, context]);
969
969
  const filteredPullRequests = useMemo(() => {
970
- if (filter === "all") {
971
- return pullRequests;
972
- }
973
970
  return pullRequests.filter((pr) => pr.state === filter);
974
971
  }, [filter, pullRequests]);
975
972
  const counts = useMemo(() => {
976
973
  const open = pullRequests.filter((pr) => pr.state === "open").length;
977
974
  const closed = pullRequests.filter((pr) => pr.state === "closed").length;
978
- return { open, closed, all: pullRequests.length };
975
+ return { open, closed };
979
976
  }, [pullRequests]);
980
977
  const handleRefresh = async () => {
981
978
  try {
@@ -996,7 +993,7 @@ const GitPullRequestsPanel = ({
996
993
  display: "flex",
997
994
  flexDirection: "column",
998
995
  height: "100%",
999
- backgroundColor: theme2.colors.backgroundSecondary,
996
+ backgroundColor: theme2.colors.background,
1000
997
  overflow: "hidden"
1001
998
  };
1002
999
  const renderState = (icon, title, description) => /* @__PURE__ */ jsx("div", { style: containerStyle, children: /* @__PURE__ */ jsx(
@@ -1086,7 +1083,7 @@ const GitPullRequestsPanel = ({
1086
1083
  minHeight: "40px",
1087
1084
  padding: "0 12px",
1088
1085
  borderBottom: `1px solid ${theme2.colors.border}`,
1089
- backgroundColor: theme2.colors.backgroundSecondary,
1086
+ backgroundColor: theme2.colors.background,
1090
1087
  display: "flex",
1091
1088
  alignItems: "center",
1092
1089
  justifyContent: "space-between",
@@ -1149,9 +1146,9 @@ const GitPullRequestsPanel = ({
1149
1146
  display: "flex",
1150
1147
  borderBottom: `1px solid ${theme2.colors.border}`
1151
1148
  },
1152
- children: ["open", "closed", "all"].map((value) => {
1149
+ children: ["open", "closed"].map((value) => {
1153
1150
  const isActive = filter === value;
1154
- const label = value === "open" ? "Open" : value === "closed" ? "Closed" : "All";
1151
+ const label = value === "open" ? "Open" : "Closed";
1155
1152
  return /* @__PURE__ */ jsxs(
1156
1153
  "button",
1157
1154
  {
@@ -1213,8 +1210,8 @@ const GitPullRequestsPanel = ({
1213
1210
  /* @__PURE__ */ jsx("div", { style: { fontFamily: theme2.fonts.heading, fontSize: theme2.fontSizes[1], fontWeight: 600 }, children: "No pull requests found" }),
1214
1211
  /* @__PURE__ */ jsxs("div", { style: { marginTop: "4px", fontSize: theme2.fontSizes[0] }, children: [
1215
1212
  "There are no ",
1216
- filter !== "all" ? `${filter} ` : "",
1217
- "pull requests to display."
1213
+ filter,
1214
+ " pull requests to display."
1218
1215
  ] })
1219
1216
  ]
1220
1217
  }
@@ -1228,8 +1225,6 @@ const PullRequestCard = ({ pr, theme: theme2, onClick }) => {
1228
1225
  const [isExpanded, setIsExpanded] = useState(false);
1229
1226
  const isMerged = pr.merged_at !== null;
1230
1227
  const isOpen = pr.state === "open";
1231
- const badgeColor = isOpen ? theme2.colors.success || "#22c55e" : isMerged ? theme2.colors.primary : theme2.colors.error || "#ef4444";
1232
- const badgeBg = `${badgeColor}22`;
1233
1228
  const totalComments = (pr.comments || 0) + (pr.review_comments || 0);
1234
1229
  return /* @__PURE__ */ jsxs(
1235
1230
  "div",
@@ -1247,7 +1242,7 @@ const PullRequestCard = ({ pr, theme: theme2, onClick }) => {
1247
1242
  border: `1px solid ${theme2.colors.border}`,
1248
1243
  borderRadius: "12px",
1249
1244
  padding: "16px",
1250
- backgroundColor: theme2.colors.background,
1245
+ backgroundColor: theme2.colors.backgroundSecondary,
1251
1246
  display: "flex",
1252
1247
  flexDirection: "column",
1253
1248
  gap: "10px",
@@ -1261,133 +1256,43 @@ const PullRequestCard = ({ pr, theme: theme2, onClick }) => {
1261
1256
  {
1262
1257
  style: {
1263
1258
  display: "flex",
1264
- alignItems: "center",
1265
- justifyContent: "space-between",
1266
- gap: "8px",
1267
- flexWrap: "wrap",
1268
- minWidth: 0
1259
+ alignItems: "baseline",
1260
+ gap: "8px"
1269
1261
  },
1270
1262
  children: [
1271
1263
  /* @__PURE__ */ jsxs(
1272
- "div",
1264
+ "span",
1273
1265
  {
1274
1266
  style: {
1275
- display: "flex",
1276
- alignItems: "center",
1277
- gap: "8px",
1278
- minWidth: 0,
1279
- overflow: "hidden"
1267
+ fontFamily: theme2.fonts.heading,
1268
+ fontSize: theme2.fontSizes[1],
1269
+ fontWeight: 600,
1270
+ color: theme2.colors.textSecondary,
1271
+ flexShrink: 0
1280
1272
  },
1281
1273
  children: [
1282
- /* @__PURE__ */ jsxs(
1283
- "span",
1284
- {
1285
- style: {
1286
- fontFamily: theme2.fonts.heading,
1287
- fontSize: theme2.fontSizes[1],
1288
- fontWeight: 600,
1289
- color: theme2.colors.textSecondary,
1290
- flexShrink: 0
1291
- },
1292
- children: [
1293
- "#",
1294
- pr.number
1295
- ]
1296
- }
1297
- ),
1298
- /* @__PURE__ */ jsxs(
1299
- "span",
1300
- {
1301
- style: {
1302
- display: "inline-flex",
1303
- alignItems: "center",
1304
- gap: "6px",
1305
- color: theme2.colors.textSecondary,
1306
- fontFamily: theme2.fonts.monospace,
1307
- fontSize: theme2.fontSizes[0],
1308
- overflow: "hidden",
1309
- textOverflow: "ellipsis",
1310
- whiteSpace: "nowrap",
1311
- minWidth: 0
1312
- },
1313
- children: [
1314
- /* @__PURE__ */ jsx(GitBranch, { size: 14, style: { flexShrink: 0 } }),
1315
- ((_a = pr.head) == null ? void 0 : _a.ref) ?? "unknown",
1316
- " → ",
1317
- ((_b = pr.base) == null ? void 0 : _b.ref) ?? "unknown"
1318
- ]
1319
- }
1320
- )
1274
+ "#",
1275
+ pr.number
1321
1276
  ]
1322
1277
  }
1323
1278
  ),
1324
- /* @__PURE__ */ jsxs(
1325
- "div",
1279
+ /* @__PURE__ */ jsx(
1280
+ "span",
1326
1281
  {
1327
1282
  style: {
1328
- display: "flex",
1329
- alignItems: "center",
1330
- gap: "8px",
1331
- flexShrink: 0
1283
+ fontFamily: theme2.fonts.heading,
1284
+ fontSize: theme2.fontSizes[2],
1285
+ fontWeight: 600,
1286
+ color: theme2.colors.text,
1287
+ lineHeight: 1.3,
1288
+ wordBreak: "break-word"
1332
1289
  },
1333
- children: [
1334
- /* @__PURE__ */ jsx(
1335
- "span",
1336
- {
1337
- style: {
1338
- display: "inline-flex",
1339
- alignItems: "center",
1340
- gap: "6px",
1341
- padding: "4px 10px",
1342
- borderRadius: "999px",
1343
- backgroundColor: badgeBg,
1344
- color: badgeColor,
1345
- fontFamily: theme2.fonts.heading,
1346
- fontSize: theme2.fontSizes[0],
1347
- fontWeight: 600,
1348
- textTransform: "uppercase",
1349
- letterSpacing: "0.02em"
1350
- },
1351
- children: isOpen ? "Open" : isMerged ? "Merged" : "Closed"
1352
- }
1353
- ),
1354
- pr.draft && /* @__PURE__ */ jsx(
1355
- "span",
1356
- {
1357
- style: {
1358
- padding: "4px 10px",
1359
- borderRadius: "999px",
1360
- backgroundColor: theme2.colors.backgroundSecondary,
1361
- color: theme2.colors.textSecondary,
1362
- fontFamily: theme2.fonts.heading,
1363
- fontSize: theme2.fontSizes[0],
1364
- fontWeight: 600,
1365
- textTransform: "uppercase",
1366
- letterSpacing: "0.02em"
1367
- },
1368
- children: "Draft"
1369
- }
1370
- )
1371
- ]
1290
+ children: pr.title
1372
1291
  }
1373
1292
  )
1374
1293
  ]
1375
1294
  }
1376
1295
  ),
1377
- /* @__PURE__ */ jsx(
1378
- "div",
1379
- {
1380
- style: {
1381
- fontFamily: theme2.fonts.heading,
1382
- fontSize: theme2.fontSizes[2],
1383
- fontWeight: 600,
1384
- color: theme2.colors.text,
1385
- lineHeight: 1.3,
1386
- wordBreak: "break-word"
1387
- },
1388
- children: pr.title
1389
- }
1390
- ),
1391
1296
  /* @__PURE__ */ jsxs(
1392
1297
  "div",
1393
1298
  {
@@ -1401,9 +1306,26 @@ const PullRequestCard = ({ pr, theme: theme2, onClick }) => {
1401
1306
  fontSize: theme2.fontSizes[0]
1402
1307
  },
1403
1308
  children: [
1309
+ pr.draft && /* @__PURE__ */ jsx(
1310
+ "span",
1311
+ {
1312
+ style: {
1313
+ padding: "4px 10px",
1314
+ borderRadius: "999px",
1315
+ backgroundColor: theme2.colors.background,
1316
+ color: theme2.colors.textSecondary,
1317
+ fontFamily: theme2.fonts.heading,
1318
+ fontSize: theme2.fontSizes[0],
1319
+ fontWeight: 600,
1320
+ textTransform: "uppercase",
1321
+ letterSpacing: "0.02em"
1322
+ },
1323
+ children: "Draft"
1324
+ }
1325
+ ),
1404
1326
  /* @__PURE__ */ jsxs("span", { children: [
1405
1327
  "by ",
1406
- ((_c = pr.user) == null ? void 0 : _c.login) ?? "unknown"
1328
+ ((_a = pr.user) == null ? void 0 : _a.login) ?? "unknown"
1407
1329
  ] }),
1408
1330
  /* @__PURE__ */ jsxs(
1409
1331
  "span",
@@ -1453,47 +1375,76 @@ const PullRequestCard = ({ pr, theme: theme2, onClick }) => {
1453
1375
  ]
1454
1376
  }
1455
1377
  ),
1456
- pr.body && /* @__PURE__ */ jsxs(Fragment, { children: [
1457
- /* @__PURE__ */ jsxs(
1458
- "button",
1459
- {
1460
- type: "button",
1461
- onClick: (e) => {
1462
- e.stopPropagation();
1463
- setIsExpanded(!isExpanded);
1464
- },
1465
- style: {
1466
- display: "inline-flex",
1467
- alignItems: "center",
1468
- gap: "4px",
1469
- padding: 0,
1470
- border: "none",
1471
- backgroundColor: "transparent",
1472
- color: theme2.colors.textSecondary,
1473
- fontFamily: theme2.fonts.body,
1474
- fontSize: theme2.fontSizes[0],
1475
- cursor: "pointer"
1476
- },
1477
- children: [
1478
- isExpanded ? /* @__PURE__ */ jsx(ChevronUp, { size: 14 }) : /* @__PURE__ */ jsx(ChevronDown, { size: 14 }),
1479
- isExpanded ? "Collapse" : "Expand"
1480
- ]
1481
- }
1482
- ),
1483
- isExpanded && /* @__PURE__ */ jsx(
1484
- "div",
1485
- {
1486
- style: {
1487
- color: theme2.colors.textSecondary,
1488
- fontFamily: theme2.fonts.body,
1489
- fontSize: theme2.fontSizes[1],
1490
- lineHeight: 1.5,
1491
- wordBreak: "break-word"
1492
- },
1493
- children: pr.body
1494
- }
1495
- )
1496
- ] })
1378
+ /* @__PURE__ */ jsxs(
1379
+ "button",
1380
+ {
1381
+ type: "button",
1382
+ onClick: (e) => {
1383
+ e.stopPropagation();
1384
+ setIsExpanded(!isExpanded);
1385
+ },
1386
+ style: {
1387
+ display: "inline-flex",
1388
+ alignItems: "center",
1389
+ gap: "4px",
1390
+ padding: 0,
1391
+ border: "none",
1392
+ backgroundColor: "transparent",
1393
+ color: theme2.colors.textSecondary,
1394
+ fontFamily: theme2.fonts.body,
1395
+ fontSize: theme2.fontSizes[0],
1396
+ cursor: "pointer"
1397
+ },
1398
+ children: [
1399
+ isExpanded ? /* @__PURE__ */ jsx(ChevronUp, { size: 14 }) : /* @__PURE__ */ jsx(ChevronDown, { size: 14 }),
1400
+ isExpanded ? "Collapse" : "Expand"
1401
+ ]
1402
+ }
1403
+ ),
1404
+ isExpanded && /* @__PURE__ */ jsxs(
1405
+ "div",
1406
+ {
1407
+ style: {
1408
+ display: "flex",
1409
+ flexDirection: "column",
1410
+ gap: "10px"
1411
+ },
1412
+ children: [
1413
+ /* @__PURE__ */ jsxs(
1414
+ "span",
1415
+ {
1416
+ style: {
1417
+ display: "inline-flex",
1418
+ alignItems: "center",
1419
+ gap: "6px",
1420
+ color: theme2.colors.textSecondary,
1421
+ fontFamily: theme2.fonts.monospace,
1422
+ fontSize: theme2.fontSizes[0]
1423
+ },
1424
+ children: [
1425
+ /* @__PURE__ */ jsx(GitBranch, { size: 14 }),
1426
+ ((_b = pr.head) == null ? void 0 : _b.ref) ?? "unknown",
1427
+ " → ",
1428
+ ((_c = pr.base) == null ? void 0 : _c.ref) ?? "unknown"
1429
+ ]
1430
+ }
1431
+ ),
1432
+ pr.body && /* @__PURE__ */ jsx(
1433
+ "div",
1434
+ {
1435
+ style: {
1436
+ color: theme2.colors.textSecondary,
1437
+ fontFamily: theme2.fonts.body,
1438
+ fontSize: theme2.fontSizes[1],
1439
+ lineHeight: 1.5,
1440
+ wordBreak: "break-word"
1441
+ },
1442
+ children: pr.body
1443
+ }
1444
+ )
1445
+ ]
1446
+ }
1447
+ )
1497
1448
  ]
1498
1449
  }
1499
1450
  );