@industry-theme/git-panels 0.1.2 → 0.1.3

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,CAyT9D,CAAC;AA4PF;;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,CA4S9D,CAAC;AAuPF;;GAEG;AACH,eAAO,MAAM,2BAA2B,EAAE,KAAK,CAAC,EAkE/C,CAAC"}
@@ -107,40 +107,48 @@ const createLucideIcon = (iconName, iconNode) => {
107
107
  * This source code is licensed under the ISC license.
108
108
  * See the LICENSE file in the root directory of this source tree.
109
109
  */
110
- const __iconNode$k = [
110
+ const __iconNode$l = [
111
111
  ["path", { d: "m12 19-7-7 7-7", key: "1l729n" }],
112
112
  ["path", { d: "M19 12H5", key: "x3x0zl" }]
113
113
  ];
114
- const ArrowLeft = createLucideIcon("arrow-left", __iconNode$k);
114
+ const ArrowLeft = createLucideIcon("arrow-left", __iconNode$l);
115
115
  /**
116
116
  * @license lucide-react v0.552.0 - ISC
117
117
  *
118
118
  * This source code is licensed under the ISC license.
119
119
  * See the LICENSE file in the root directory of this source tree.
120
120
  */
121
- const __iconNode$j = [
121
+ const __iconNode$k = [
122
122
  ["path", { d: "M8 2v4", key: "1cmpym" }],
123
123
  ["path", { d: "M16 2v4", key: "4m81vk" }],
124
124
  ["rect", { width: "18", height: "18", x: "3", y: "4", rx: "2", key: "1hopcy" }],
125
125
  ["path", { d: "M3 10h18", key: "8toen8" }]
126
126
  ];
127
- const Calendar = createLucideIcon("calendar", __iconNode$j);
127
+ const Calendar = createLucideIcon("calendar", __iconNode$k);
128
128
  /**
129
129
  * @license lucide-react v0.552.0 - ISC
130
130
  *
131
131
  * This source code is licensed under the ISC license.
132
132
  * See the LICENSE file in the root directory of this source tree.
133
133
  */
134
- const __iconNode$i = [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]];
135
- const Check = createLucideIcon("check", __iconNode$i);
134
+ const __iconNode$j = [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]];
135
+ const Check = createLucideIcon("check", __iconNode$j);
136
136
  /**
137
137
  * @license lucide-react v0.552.0 - ISC
138
138
  *
139
139
  * This source code is licensed under the ISC license.
140
140
  * See the LICENSE file in the root directory of this source tree.
141
141
  */
142
- const __iconNode$h = [["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]];
143
- const ChevronDown = createLucideIcon("chevron-down", __iconNode$h);
142
+ const __iconNode$i = [["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]];
143
+ const ChevronDown = createLucideIcon("chevron-down", __iconNode$i);
144
+ /**
145
+ * @license lucide-react v0.552.0 - ISC
146
+ *
147
+ * This source code is licensed under the ISC license.
148
+ * See the LICENSE file in the root directory of this source tree.
149
+ */
150
+ const __iconNode$h = [["path", { d: "m18 15-6-6-6 6", key: "153udz" }]];
151
+ const ChevronUp = createLucideIcon("chevron-up", __iconNode$h);
144
152
  /**
145
153
  * @license lucide-react v0.552.0 - ISC
146
154
  *
@@ -930,15 +938,13 @@ const GitPullRequestsPanel = ({
930
938
  context,
931
939
  events
932
940
  }) => {
933
- var _a, _b, _c;
941
+ var _a;
934
942
  const { theme: theme2 } = useTheme();
935
943
  const [filter, setFilter] = useState("open");
936
944
  const prSlice = context.getSlice("pullRequests");
937
945
  const hasPRs = context.hasSlice("pullRequests");
938
946
  const isLoading = context.isSliceLoading("pullRequests");
939
947
  const pullRequests = ((_a = prSlice == null ? void 0 : prSlice.data) == null ? void 0 : _a.pullRequests) ?? [];
940
- const owner = (_b = prSlice == null ? void 0 : prSlice.data) == null ? void 0 : _b.owner;
941
- const repo = (_c = prSlice == null ? void 0 : prSlice.data) == null ? void 0 : _c.repo;
942
948
  useEffect(() => {
943
949
  const unsubscribers = [
944
950
  // Tool: refresh pull requests
@@ -1102,23 +1108,7 @@ const GitPullRequestsPanel = ({
1102
1108
  },
1103
1109
  children: [
1104
1110
  /* @__PURE__ */ jsx(GitPullRequest, { size: 14 }),
1105
- "Pull Requests",
1106
- owner && repo && /* @__PURE__ */ jsxs(
1107
- "span",
1108
- {
1109
- style: {
1110
- fontWeight: 400,
1111
- textTransform: "none",
1112
- opacity: 0.7
1113
- },
1114
- children: [
1115
- "· ",
1116
- owner,
1117
- "/",
1118
- repo
1119
- ]
1120
- }
1121
- )
1111
+ "Pull Requests"
1122
1112
  ]
1123
1113
  }
1124
1114
  ),
@@ -1234,7 +1224,8 @@ const GitPullRequestsPanel = ({
1234
1224
  ] });
1235
1225
  };
1236
1226
  const PullRequestCard = ({ pr, theme: theme2, onClick }) => {
1237
- var _a, _b, _c, _d, _e;
1227
+ var _a, _b, _c;
1228
+ const [isExpanded, setIsExpanded] = useState(false);
1238
1229
  const isMerged = pr.merged_at !== null;
1239
1230
  const isOpen = pr.state === "open";
1240
1231
  const badgeColor = isOpen ? theme2.colors.success || "#22c55e" : isMerged ? theme2.colors.primary : theme2.colors.error || "#ef4444";
@@ -1261,7 +1252,8 @@ const PullRequestCard = ({ pr, theme: theme2, onClick }) => {
1261
1252
  flexDirection: "column",
1262
1253
  gap: "10px",
1263
1254
  cursor: onClick ? "pointer" : "default",
1264
- transition: "border-color 0.15s ease"
1255
+ transition: "border-color 0.15s ease",
1256
+ minWidth: 0
1265
1257
  },
1266
1258
  children: [
1267
1259
  /* @__PURE__ */ jsxs(
@@ -1269,9 +1261,11 @@ const PullRequestCard = ({ pr, theme: theme2, onClick }) => {
1269
1261
  {
1270
1262
  style: {
1271
1263
  display: "flex",
1272
- alignItems: "flex-start",
1264
+ alignItems: "center",
1273
1265
  justifyContent: "space-between",
1274
- gap: "12px"
1266
+ gap: "8px",
1267
+ flexWrap: "wrap",
1268
+ minWidth: 0
1275
1269
  },
1276
1270
  children: [
1277
1271
  /* @__PURE__ */ jsxs(
@@ -1279,244 +1273,227 @@ const PullRequestCard = ({ pr, theme: theme2, onClick }) => {
1279
1273
  {
1280
1274
  style: {
1281
1275
  display: "flex",
1282
- flexDirection: "column",
1276
+ alignItems: "center",
1283
1277
  gap: "8px",
1284
- flex: 1
1278
+ minWidth: 0,
1279
+ overflow: "hidden"
1285
1280
  },
1286
1281
  children: [
1287
1282
  /* @__PURE__ */ jsxs(
1288
- "div",
1289
- {
1290
- style: {
1291
- display: "flex",
1292
- alignItems: "center",
1293
- gap: "10px",
1294
- flexWrap: "wrap"
1295
- },
1296
- children: [
1297
- /* @__PURE__ */ jsxs(
1298
- "span",
1299
- {
1300
- style: {
1301
- display: "inline-flex",
1302
- alignItems: "center",
1303
- gap: "6px",
1304
- padding: "4px 10px",
1305
- borderRadius: "999px",
1306
- backgroundColor: badgeBg,
1307
- color: badgeColor,
1308
- fontFamily: theme2.fonts.heading,
1309
- fontSize: theme2.fontSizes[0],
1310
- fontWeight: 600,
1311
- textTransform: "uppercase",
1312
- letterSpacing: "0.02em"
1313
- },
1314
- children: [
1315
- isOpen ? "Open" : isMerged ? "Merged" : "Closed",
1316
- pr.draft && /* @__PURE__ */ jsx(
1317
- "span",
1318
- {
1319
- style: {
1320
- marginLeft: "6px",
1321
- padding: "2px 6px",
1322
- borderRadius: "8px",
1323
- backgroundColor: theme2.colors.backgroundSecondary,
1324
- color: theme2.colors.textSecondary,
1325
- fontFamily: theme2.fonts.body,
1326
- fontSize: theme2.fontSizes[0],
1327
- fontWeight: 500,
1328
- textTransform: "capitalize"
1329
- },
1330
- children: "Draft"
1331
- }
1332
- )
1333
- ]
1334
- }
1335
- ),
1336
- /* @__PURE__ */ jsxs(
1337
- "span",
1338
- {
1339
- style: {
1340
- fontFamily: theme2.fonts.heading,
1341
- fontSize: theme2.fontSizes[2],
1342
- fontWeight: 600,
1343
- color: theme2.colors.text,
1344
- display: "inline-flex",
1345
- alignItems: "center",
1346
- gap: "8px"
1347
- },
1348
- children: [
1349
- "#",
1350
- pr.number,
1351
- " ",
1352
- pr.title
1353
- ]
1354
- }
1355
- )
1356
- ]
1357
- }
1358
- ),
1359
- /* @__PURE__ */ jsxs(
1360
- "div",
1283
+ "span",
1361
1284
  {
1362
1285
  style: {
1363
- display: "flex",
1364
- alignItems: "center",
1365
- gap: "12px",
1366
- flexWrap: "wrap",
1286
+ fontFamily: theme2.fonts.heading,
1287
+ fontSize: theme2.fontSizes[1],
1288
+ fontWeight: 600,
1367
1289
  color: theme2.colors.textSecondary,
1368
- fontFamily: theme2.fonts.body,
1369
- fontSize: theme2.fontSizes[0]
1290
+ flexShrink: 0
1370
1291
  },
1371
1292
  children: [
1372
- /* @__PURE__ */ jsxs("span", { children: [
1373
- "by ",
1374
- ((_a = pr.user) == null ? void 0 : _a.login) ?? "unknown"
1375
- ] }),
1376
- /* @__PURE__ */ jsxs(
1377
- "span",
1378
- {
1379
- style: {
1380
- display: "inline-flex",
1381
- alignItems: "center",
1382
- gap: "4px"
1383
- },
1384
- children: [
1385
- /* @__PURE__ */ jsx(Calendar, { size: 12 }),
1386
- " Opened ",
1387
- formatDate(pr.created_at)
1388
- ]
1389
- }
1390
- ),
1391
- !isOpen && /* @__PURE__ */ jsxs(
1392
- "span",
1393
- {
1394
- style: {
1395
- display: "inline-flex",
1396
- alignItems: "center",
1397
- gap: "4px"
1398
- },
1399
- children: [
1400
- isMerged ? "Merged" : "Closed",
1401
- " ",
1402
- formatDate(pr.merged_at || pr.updated_at)
1403
- ]
1404
- }
1405
- ),
1406
- totalComments > 0 && /* @__PURE__ */ jsxs(
1407
- "span",
1408
- {
1409
- style: {
1410
- display: "inline-flex",
1411
- alignItems: "center",
1412
- gap: "4px"
1413
- },
1414
- children: [
1415
- /* @__PURE__ */ jsx(MessageSquare, { size: 12 }),
1416
- " ",
1417
- totalComments,
1418
- " comment",
1419
- totalComments === 1 ? "" : "s"
1420
- ]
1421
- }
1422
- )
1293
+ "#",
1294
+ pr.number
1423
1295
  ]
1424
1296
  }
1425
1297
  ),
1426
1298
  /* @__PURE__ */ jsxs(
1427
- "div",
1299
+ "span",
1428
1300
  {
1429
1301
  style: {
1430
- display: "flex",
1302
+ display: "inline-flex",
1431
1303
  alignItems: "center",
1432
- gap: "8px",
1304
+ gap: "6px",
1433
1305
  color: theme2.colors.textSecondary,
1434
1306
  fontFamily: theme2.fonts.monospace,
1435
- fontSize: theme2.fontSizes[0]
1307
+ fontSize: theme2.fontSizes[0],
1308
+ overflow: "hidden",
1309
+ textOverflow: "ellipsis",
1310
+ whiteSpace: "nowrap",
1311
+ minWidth: 0
1436
1312
  },
1437
1313
  children: [
1438
- /* @__PURE__ */ jsx(GitBranch, { size: 14 }),
1439
- /* @__PURE__ */ jsxs("span", { children: [
1440
- ((_b = pr.base) == null ? void 0 : _b.ref) ?? "unknown",
1441
- " ",
1442
- /* @__PURE__ */ jsx("span", { style: { opacity: 0.6 }, children: "←" }),
1443
- " ",
1444
- ((_c = pr.head) == null ? void 0 : _c.ref) ?? "unknown"
1445
- ] })
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"
1446
1318
  ]
1447
1319
  }
1448
- ),
1449
- pr.body && /* @__PURE__ */ jsx(
1450
- "div",
1451
- {
1452
- style: {
1453
- marginTop: "4px",
1454
- color: theme2.colors.textSecondary,
1455
- fontFamily: theme2.fonts.body,
1456
- fontSize: theme2.fontSizes[1],
1457
- lineHeight: 1.5,
1458
- maxHeight: "72px",
1459
- overflow: "hidden",
1460
- textOverflow: "ellipsis"
1461
- },
1462
- children: pr.body
1463
- }
1464
1320
  )
1465
1321
  ]
1466
1322
  }
1467
1323
  ),
1468
1324
  /* @__PURE__ */ jsxs(
1469
- "a",
1325
+ "div",
1470
1326
  {
1471
- href: pr.html_url,
1472
- target: "_blank",
1473
- rel: "noreferrer",
1474
- onClick: (e) => e.stopPropagation(),
1475
1327
  style: {
1476
- display: "inline-flex",
1328
+ display: "flex",
1477
1329
  alignItems: "center",
1478
- gap: "6px",
1479
- padding: "6px 10px",
1480
- borderRadius: "6px",
1481
- border: `1px solid ${theme2.colors.border}`,
1482
- backgroundColor: theme2.colors.backgroundSecondary,
1483
- color: theme2.colors.text,
1484
- textDecoration: "none",
1485
- fontFamily: theme2.fonts.body,
1486
- fontSize: theme2.fontSizes[1],
1487
- fontWeight: 600,
1488
- whiteSpace: "nowrap"
1330
+ gap: "8px",
1331
+ flexShrink: 0
1489
1332
  },
1490
1333
  children: [
1491
- "View",
1492
- /* @__PURE__ */ jsx(ExternalLink, { size: 14 })
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
+ )
1493
1371
  ]
1494
1372
  }
1495
1373
  )
1496
1374
  ]
1497
1375
  }
1498
1376
  ),
1499
- isMerged && /* @__PURE__ */ jsxs(
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
+ /* @__PURE__ */ jsxs(
1500
1392
  "div",
1501
1393
  {
1502
1394
  style: {
1503
1395
  display: "flex",
1504
1396
  alignItems: "center",
1505
- gap: "6px",
1506
- fontFamily: theme2.fonts.monospace,
1507
- fontSize: theme2.fontSizes[0],
1508
- color: theme2.colors.primary
1397
+ gap: "8px 12px",
1398
+ flexWrap: "wrap",
1399
+ color: theme2.colors.textSecondary,
1400
+ fontFamily: theme2.fonts.body,
1401
+ fontSize: theme2.fontSizes[0]
1509
1402
  },
1510
1403
  children: [
1511
- /* @__PURE__ */ jsx(GitMerge, { size: 14 }),
1512
- " Merged into ",
1513
- ((_d = pr.base) == null ? void 0 : _d.ref) ?? "base",
1514
- " from",
1515
- " ",
1516
- ((_e = pr.head) == null ? void 0 : _e.ref) ?? "head"
1404
+ /* @__PURE__ */ jsxs("span", { children: [
1405
+ "by ",
1406
+ ((_c = pr.user) == null ? void 0 : _c.login) ?? "unknown"
1407
+ ] }),
1408
+ /* @__PURE__ */ jsxs(
1409
+ "span",
1410
+ {
1411
+ style: {
1412
+ display: "inline-flex",
1413
+ alignItems: "center",
1414
+ gap: "4px"
1415
+ },
1416
+ children: [
1417
+ /* @__PURE__ */ jsx(Calendar, { size: 12 }),
1418
+ " ",
1419
+ formatDate(pr.created_at)
1420
+ ]
1421
+ }
1422
+ ),
1423
+ !isOpen && /* @__PURE__ */ jsxs(
1424
+ "span",
1425
+ {
1426
+ style: {
1427
+ display: "inline-flex",
1428
+ alignItems: "center",
1429
+ gap: "4px"
1430
+ },
1431
+ children: [
1432
+ isMerged ? "Merged" : "Closed",
1433
+ " ",
1434
+ formatDate(pr.merged_at || pr.updated_at)
1435
+ ]
1436
+ }
1437
+ ),
1438
+ totalComments > 0 && /* @__PURE__ */ jsxs(
1439
+ "span",
1440
+ {
1441
+ style: {
1442
+ display: "inline-flex",
1443
+ alignItems: "center",
1444
+ gap: "4px"
1445
+ },
1446
+ children: [
1447
+ /* @__PURE__ */ jsx(MessageSquare, { size: 12 }),
1448
+ " ",
1449
+ totalComments
1450
+ ]
1451
+ }
1452
+ )
1517
1453
  ]
1518
1454
  }
1519
- )
1455
+ ),
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
+ ] })
1520
1497
  ]
1521
1498
  }
1522
1499
  );