@industry-theme/github-panels 0.1.44 → 0.1.45

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":"GitHubIssuesPanel.d.ts","sourceRoot":"","sources":["../../src/panels/GitHubIssuesPanel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA6B,MAAM,OAAO,CAAC;AAYlD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAidpD;;;;;;;;GAQG;AACH,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CAE3D,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,yBAAyB;;;;;;;;CAQrC,CAAC"}
1
+ {"version":3,"file":"GitHubIssuesPanel.d.ts","sourceRoot":"","sources":["../../src/panels/GitHubIssuesPanel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAuC,MAAM,OAAO,CAAC;AAa5D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAgjBpD;;;;;;;;GAQG;AACH,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CAE3D,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,yBAAyB;;;;;;;;CAQrC,CAAC"}
@@ -2191,6 +2191,20 @@ const GitHubIssuesPanelContent = ({
2191
2191
  const repo = ((_c = issuesSlice == null ? void 0 : issuesSlice.data) == null ? void 0 : _c.repo) ?? "";
2192
2192
  const isAuthenticated = ((_d = issuesSlice == null ? void 0 : issuesSlice.data) == null ? void 0 : _d.isAuthenticated) ?? false;
2193
2193
  const sliceError = (_e = issuesSlice == null ? void 0 : issuesSlice.data) == null ? void 0 : _e.error;
2194
+ const [selectedLabel, setSelectedLabel] = useState("");
2195
+ const [isDropdownOpen, setIsDropdownOpen] = useState(false);
2196
+ const [selectedIssueId, setSelectedIssueId] = useState(null);
2197
+ const uniqueLabels = useMemo(() => {
2198
+ const labelMap = /* @__PURE__ */ new Map();
2199
+ issues.forEach((issue) => {
2200
+ issue.labels.forEach((label) => {
2201
+ if (!labelMap.has(label.name)) {
2202
+ labelMap.set(label.name, { name: label.name, color: label.color });
2203
+ }
2204
+ });
2205
+ });
2206
+ return Array.from(labelMap.values()).sort((a, b) => a.name.localeCompare(b.name));
2207
+ }, [issues]);
2194
2208
  useEffect(() => {
2195
2209
  events.emit({
2196
2210
  type: "github-issues:request",
@@ -2200,9 +2214,14 @@ const GitHubIssuesPanelContent = ({
2200
2214
  });
2201
2215
  }, [events]);
2202
2216
  const openIssues = useMemo(() => {
2203
- return issues.filter((issue) => issue.state === "open");
2204
- }, [issues]);
2217
+ return issues.filter((issue) => {
2218
+ if (issue.state !== "open") return false;
2219
+ if (selectedLabel && !issue.labels.some((l) => l.name === selectedLabel)) return false;
2220
+ return true;
2221
+ });
2222
+ }, [issues, selectedLabel]);
2205
2223
  const handleIssueClick = (issue) => {
2224
+ setSelectedIssueId(issue.id);
2206
2225
  events.emit({
2207
2226
  type: "issue:selected",
2208
2227
  source: "github-issues-panel",
@@ -2423,25 +2442,143 @@ const GitHubIssuesPanelContent = ({
2423
2442
  children: "Open Issues"
2424
2443
  }
2425
2444
  ),
2426
- /* @__PURE__ */ jsx(
2427
- "button",
2428
- {
2429
- type: "button",
2430
- onClick: handleRefresh,
2431
- disabled: isLoading,
2432
- style: {
2433
- background: "none",
2434
- border: "none",
2435
- cursor: isLoading ? "not-allowed" : "pointer",
2436
- padding: "4px",
2437
- color: theme2.colors.textSecondary,
2438
- opacity: isLoading ? 0.5 : 1,
2439
- display: "flex",
2440
- alignItems: "center"
2441
- },
2442
- children: /* @__PURE__ */ jsx(RefreshCw, { size: 14, className: isLoading ? "animate-spin" : "" })
2443
- }
2444
- )
2445
+ /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: "8px" }, children: [
2446
+ uniqueLabels.length > 0 && /* @__PURE__ */ jsxs("div", { style: { position: "relative" }, children: [
2447
+ /* @__PURE__ */ jsxs(
2448
+ "button",
2449
+ {
2450
+ type: "button",
2451
+ onClick: () => setIsDropdownOpen(!isDropdownOpen),
2452
+ style: {
2453
+ display: "flex",
2454
+ alignItems: "center",
2455
+ gap: "4px",
2456
+ padding: "4px 8px",
2457
+ borderRadius: "4px",
2458
+ border: `1px solid ${theme2.colors.border}`,
2459
+ backgroundColor: theme2.colors.surface,
2460
+ color: selectedLabel ? theme2.colors.text : theme2.colors.textSecondary,
2461
+ fontSize: `${theme2.fontSizes[0]}px`,
2462
+ cursor: "pointer"
2463
+ },
2464
+ children: [
2465
+ /* @__PURE__ */ jsx(Tag, { size: 10 }),
2466
+ /* @__PURE__ */ jsx("span", { style: { maxWidth: "80px", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children: selectedLabel || "All" }),
2467
+ /* @__PURE__ */ jsx(
2468
+ ChevronDown,
2469
+ {
2470
+ size: 10,
2471
+ style: {
2472
+ transform: isDropdownOpen ? "rotate(180deg)" : "rotate(0deg)",
2473
+ transition: "transform 0.2s"
2474
+ }
2475
+ }
2476
+ )
2477
+ ]
2478
+ }
2479
+ ),
2480
+ isDropdownOpen && /* @__PURE__ */ jsxs(
2481
+ "div",
2482
+ {
2483
+ style: {
2484
+ position: "absolute",
2485
+ top: "100%",
2486
+ right: 0,
2487
+ marginTop: "4px",
2488
+ minWidth: "150px",
2489
+ backgroundColor: theme2.colors.surface,
2490
+ border: `1px solid ${theme2.colors.border}`,
2491
+ borderRadius: "6px",
2492
+ boxShadow: "0 4px 12px rgba(0,0,0,0.15)",
2493
+ zIndex: 10,
2494
+ maxHeight: "200px",
2495
+ overflow: "auto"
2496
+ },
2497
+ children: [
2498
+ /* @__PURE__ */ jsx(
2499
+ "button",
2500
+ {
2501
+ type: "button",
2502
+ onClick: () => {
2503
+ setSelectedLabel("");
2504
+ setIsDropdownOpen(false);
2505
+ },
2506
+ style: {
2507
+ display: "block",
2508
+ width: "100%",
2509
+ padding: "8px 10px",
2510
+ border: "none",
2511
+ backgroundColor: selectedLabel === "" ? theme2.colors.backgroundLight : "transparent",
2512
+ color: theme2.colors.text,
2513
+ fontSize: `${theme2.fontSizes[1]}px`,
2514
+ textAlign: "left",
2515
+ cursor: "pointer"
2516
+ },
2517
+ children: "All labels"
2518
+ }
2519
+ ),
2520
+ uniqueLabels.map((label) => /* @__PURE__ */ jsxs(
2521
+ "button",
2522
+ {
2523
+ type: "button",
2524
+ onClick: () => {
2525
+ setSelectedLabel(label.name);
2526
+ setIsDropdownOpen(false);
2527
+ },
2528
+ style: {
2529
+ display: "flex",
2530
+ alignItems: "center",
2531
+ gap: "8px",
2532
+ width: "100%",
2533
+ padding: "8px 10px",
2534
+ border: "none",
2535
+ backgroundColor: selectedLabel === label.name ? theme2.colors.backgroundLight : "transparent",
2536
+ color: theme2.colors.text,
2537
+ fontSize: `${theme2.fontSizes[1]}px`,
2538
+ textAlign: "left",
2539
+ cursor: "pointer"
2540
+ },
2541
+ children: [
2542
+ /* @__PURE__ */ jsx(
2543
+ "span",
2544
+ {
2545
+ style: {
2546
+ width: "12px",
2547
+ height: "12px",
2548
+ borderRadius: "50%",
2549
+ backgroundColor: `#${label.color}`
2550
+ }
2551
+ }
2552
+ ),
2553
+ label.name
2554
+ ]
2555
+ },
2556
+ label.name
2557
+ ))
2558
+ ]
2559
+ }
2560
+ )
2561
+ ] }),
2562
+ /* @__PURE__ */ jsx(
2563
+ "button",
2564
+ {
2565
+ type: "button",
2566
+ onClick: handleRefresh,
2567
+ disabled: isLoading,
2568
+ style: {
2569
+ background: "none",
2570
+ border: "none",
2571
+ cursor: isLoading ? "not-allowed" : "pointer",
2572
+ padding: "4px",
2573
+ color: theme2.colors.textSecondary,
2574
+ opacity: isLoading ? 0.5 : 1,
2575
+ display: "flex",
2576
+ alignItems: "center"
2577
+ },
2578
+ children: /* @__PURE__ */ jsx(RefreshCw, { size: 14, className: isLoading ? "animate-spin" : "" })
2579
+ }
2580
+ )
2581
+ ] })
2445
2582
  ]
2446
2583
  }
2447
2584
  )
@@ -2481,129 +2618,85 @@ const GitHubIssuesPanelContent = ({
2481
2618
  "div",
2482
2619
  {
2483
2620
  style: { display: "flex", flexDirection: "column" },
2484
- children: openIssues.map((issue) => /* @__PURE__ */ jsx(
2485
- "button",
2486
- {
2487
- type: "button",
2488
- onClick: () => handleIssueClick(issue),
2489
- style: {
2490
- width: "100%",
2491
- padding: "16px 16px",
2492
- borderRadius: 0,
2493
- border: "none",
2494
- borderBottom: `1px solid ${theme2.colors.border}`,
2495
- backgroundColor: theme2.colors.surface,
2496
- cursor: "pointer",
2497
- textAlign: "left"
2621
+ children: openIssues.map((issue) => {
2622
+ const isSelected = selectedIssueId === issue.id;
2623
+ return /* @__PURE__ */ jsx(
2624
+ "button",
2625
+ {
2626
+ type: "button",
2627
+ onClick: () => handleIssueClick(issue),
2628
+ style: {
2629
+ width: "100%",
2630
+ padding: "16px 16px",
2631
+ borderRadius: 0,
2632
+ border: "none",
2633
+ borderBottom: `1px solid ${theme2.colors.border}`,
2634
+ backgroundColor: isSelected ? theme2.colors.backgroundSecondary : theme2.colors.surface,
2635
+ cursor: "pointer",
2636
+ textAlign: "left",
2637
+ transition: "background-color 0.15s ease"
2638
+ },
2639
+ children: /* @__PURE__ */ jsxs("div", { style: { minWidth: 0 }, children: [
2640
+ /* @__PURE__ */ jsx(
2641
+ "h4",
2642
+ {
2643
+ style: {
2644
+ margin: 0,
2645
+ marginBottom: "6px",
2646
+ color: theme2.colors.text,
2647
+ fontSize: `${theme2.fontSizes[2]}px`,
2648
+ fontWeight: theme2.fontWeights.semibold,
2649
+ overflow: "hidden",
2650
+ textOverflow: "ellipsis",
2651
+ whiteSpace: "nowrap"
2652
+ },
2653
+ children: issue.title
2654
+ }
2655
+ ),
2656
+ /* @__PURE__ */ jsxs(
2657
+ "div",
2658
+ {
2659
+ style: {
2660
+ display: "flex",
2661
+ alignItems: "center",
2662
+ gap: "6px",
2663
+ fontSize: `${theme2.fontSizes[0]}px`,
2664
+ color: theme2.colors.textSecondary,
2665
+ flexWrap: "wrap"
2666
+ },
2667
+ children: [
2668
+ /* @__PURE__ */ jsxs("span", { children: [
2669
+ "#",
2670
+ issue.number
2671
+ ] }),
2672
+ /* @__PURE__ */ jsxs("span", { children: [
2673
+ "Created by",
2674
+ " ",
2675
+ /* @__PURE__ */ jsx("span", { style: { color: theme2.colors.primary }, children: issue.user.login })
2676
+ ] }),
2677
+ /* @__PURE__ */ jsx("span", { children: formatDate$2(issue.created_at) }),
2678
+ issue.comments > 0 && /* @__PURE__ */ jsxs(
2679
+ "span",
2680
+ {
2681
+ style: {
2682
+ display: "flex",
2683
+ alignItems: "center",
2684
+ gap: "4px"
2685
+ },
2686
+ children: [
2687
+ /* @__PURE__ */ jsx(MessageSquare, { size: 12 }),
2688
+ issue.comments
2689
+ ]
2690
+ }
2691
+ )
2692
+ ]
2693
+ }
2694
+ )
2695
+ ] })
2498
2696
  },
2499
- children: /* @__PURE__ */ jsxs("div", { style: { minWidth: 0 }, children: [
2500
- issue.labels.length > 0 && /* @__PURE__ */ jsxs(
2501
- "div",
2502
- {
2503
- style: {
2504
- display: "flex",
2505
- alignItems: "center",
2506
- gap: "8px",
2507
- marginBottom: "6px",
2508
- flexWrap: "wrap"
2509
- },
2510
- children: [
2511
- issue.labels.slice(0, 3).map((label) => /* @__PURE__ */ jsxs(
2512
- "span",
2513
- {
2514
- style: {
2515
- display: "inline-flex",
2516
- alignItems: "center",
2517
- gap: "4px",
2518
- padding: "2px 6px",
2519
- borderRadius: "12px",
2520
- backgroundColor: `#${label.color}22`,
2521
- color: `#${label.color}`,
2522
- fontSize: `${theme2.fontSizes[0]}px`,
2523
- fontWeight: theme2.fontWeights.medium
2524
- },
2525
- children: [
2526
- /* @__PURE__ */ jsx(Tag, { size: 10 }),
2527
- label.name
2528
- ]
2529
- },
2530
- label.id
2531
- )),
2532
- issue.labels.length > 3 && /* @__PURE__ */ jsxs(
2533
- "span",
2534
- {
2535
- style: {
2536
- fontSize: `${theme2.fontSizes[0]}px`,
2537
- color: theme2.colors.textSecondary
2538
- },
2539
- children: [
2540
- "+",
2541
- issue.labels.length - 3
2542
- ]
2543
- }
2544
- )
2545
- ]
2546
- }
2547
- ),
2548
- /* @__PURE__ */ jsx(
2549
- "h4",
2550
- {
2551
- style: {
2552
- margin: 0,
2553
- marginBottom: "6px",
2554
- color: theme2.colors.text,
2555
- fontSize: `${theme2.fontSizes[2]}px`,
2556
- fontWeight: theme2.fontWeights.semibold,
2557
- overflow: "hidden",
2558
- textOverflow: "ellipsis",
2559
- whiteSpace: "nowrap"
2560
- },
2561
- children: issue.title
2562
- }
2563
- ),
2564
- /* @__PURE__ */ jsxs(
2565
- "div",
2566
- {
2567
- style: {
2568
- display: "flex",
2569
- alignItems: "center",
2570
- gap: "6px",
2571
- fontSize: `${theme2.fontSizes[0]}px`,
2572
- color: theme2.colors.textSecondary,
2573
- flexWrap: "wrap"
2574
- },
2575
- children: [
2576
- /* @__PURE__ */ jsxs("span", { children: [
2577
- "#",
2578
- issue.number
2579
- ] }),
2580
- /* @__PURE__ */ jsxs("span", { children: [
2581
- "Created by",
2582
- " ",
2583
- /* @__PURE__ */ jsx("span", { style: { color: theme2.colors.primary }, children: issue.user.login })
2584
- ] }),
2585
- /* @__PURE__ */ jsx("span", { children: formatDate$2(issue.created_at) }),
2586
- issue.comments > 0 && /* @__PURE__ */ jsxs(
2587
- "span",
2588
- {
2589
- style: {
2590
- display: "flex",
2591
- alignItems: "center",
2592
- gap: "4px"
2593
- },
2594
- children: [
2595
- /* @__PURE__ */ jsx(MessageSquare, { size: 12 }),
2596
- issue.comments
2597
- ]
2598
- }
2599
- )
2600
- ]
2601
- }
2602
- )
2603
- ] })
2604
- },
2605
- issue.id
2606
- ))
2697
+ issue.id
2698
+ );
2699
+ })
2607
2700
  }
2608
2701
  ) }),
2609
2702
  /* @__PURE__ */ jsx("style", { children: `