@industry-theme/git-panels 0.1.15 → 0.1.16

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.
package/dist/index.d.ts CHANGED
@@ -16,7 +16,7 @@ export declare const onPackageUnload: () => Promise<void>;
16
16
  * Export tools for server-safe imports.
17
17
  * Use '@principal-ade/git-panels/tools' to import without React dependencies.
18
18
  */
19
- export { commitHistoryTools, commitHistoryToolsMetadata, refreshCommitsTool, setCommitLimitTool, commitDetailTools, commitDetailToolsMetadata, selectCommitTool, deselectCommitTool, pullRequestsTools, pullRequestsToolsMetadata, refreshPullRequestsTool, setPRFilterTool, pullRequestDetailTools, pullRequestDetailToolsMetadata, selectPullRequestTool, deselectPullRequestTool, allGitPanelTools, } from './tools';
19
+ export { commitHistoryTools, commitHistoryToolsMetadata, refreshCommitsTool, setCommitLimitTool, commitDetailTools, commitDetailToolsMetadata, selectCommitTool, deselectCommitTool, pullRequestsTools, pullRequestsToolsMetadata, refreshPullRequestsTool, pullRequestDetailTools, pullRequestDetailToolsMetadata, selectPullRequestTool, deselectPullRequestTool, allGitPanelTools, } from './tools';
20
20
  /**
21
21
  * Export types for consumers
22
22
  */
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAAqB,MAAM,SAAS,CAAC;AAYlE;;;GAGG;AACH,eAAO,MAAM,MAAM,EAAE,eAAe,EAmEnC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,aAAa,qBAEzB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,eAAe,qBAE3B,CAAC;AAEF;;;GAGG;AACH,OAAO,EAEL,kBAAkB,EAClB,0BAA0B,EAC1B,kBAAkB,EAClB,kBAAkB,EAElB,iBAAiB,EACjB,yBAAyB,EACzB,gBAAgB,EAChB,kBAAkB,EAElB,iBAAiB,EACjB,yBAAyB,EACzB,uBAAuB,E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,eAAe,EACf,cAAc,GACf,MAAM,SAAS,CAAC;AAEjB;;GAEG;AACH,OAAO,EAAE,qBAAqB,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAC;AACrG,OAAO,EAAE,oBAAoB,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAClG,OAAO,EAAE,oBAAoB,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAClG,OAAO,EAAE,yBAAyB,EAAE,gCAAgC,EAAE,MAAM,oCAAoC,CAAC"}
@@ -1,13 +1,12 @@
1
1
  import React from 'react';
2
2
  import type { PanelComponentProps } from '../types';
3
3
  /**
4
- * GitPullRequestsPanel - Displays pull requests from the 'pullRequests' slice.
4
+ * GitPullRequestsPanel - Displays open pull requests from the 'pullRequests' slice.
5
5
  *
6
6
  * This panel expects the host to provide PR data through:
7
7
  * - context.getSlice<PullRequestsSliceData>('pullRequests')
8
8
  *
9
9
  * The panel supports:
10
- * - Filtering by state (all, open, closed)
11
10
  * - Refresh via context.refresh()
12
11
  * - Tool events for programmatic interaction
13
12
  */
@@ -1 +1 @@
1
- {"version":3,"file":"GitPullRequestsPanel.d.ts","sourceRoot":"","sources":["../../src/panels/GitPullRequestsPanel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAuC,MAAM,OAAO,CAAC;AAU5D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAMpD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,oBAAoB,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CA4S9D,CAAC;AAqIF;;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;AAU5D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAIpD;;;;;;;;;GASG;AACH,eAAO,MAAM,oBAAoB,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CAuR9D,CAAC;AAqIF;;GAEG;AACH,eAAO,MAAM,2BAA2B,EAAE,KAAK,CAAC,EAkE/C,CAAC"}
@@ -45150,8 +45150,8 @@ const GitPullRequestsPanel = ({
45150
45150
  }) => {
45151
45151
  var _a;
45152
45152
  const { theme: theme2 } = useTheme();
45153
- const [filter, setFilter] = useState("open");
45154
45153
  const [selectedPrId, setSelectedPrId] = useState(null);
45154
+ const [showDrafts, setShowDrafts] = useState(false);
45155
45155
  const prSlice = context.getSlice("pullRequests");
45156
45156
  const hasPRs = context.hasSlice("pullRequests");
45157
45157
  const isLoading = context.isSliceLoading("pullRequests");
@@ -45165,25 +45165,19 @@ const GitPullRequestsPanel = ({
45165
45165
  } catch (error) {
45166
45166
  console.error("[GitPullRequestsPanel] Refresh failed:", error);
45167
45167
  }
45168
- }),
45169
- // Tool: set filter
45170
- events.on("git-panels.pull-requests:set-filter", (event) => {
45171
- var _a2;
45172
- const newFilter = (_a2 = event.payload) == null ? void 0 : _a2.filter;
45173
- if (newFilter && ["open", "closed"].includes(newFilter)) {
45174
- setFilter(newFilter);
45175
- }
45176
45168
  })
45177
45169
  ];
45178
45170
  return () => unsubscribers.forEach((unsub) => unsub());
45179
45171
  }, [events, context]);
45180
45172
  const filteredPullRequests = useMemo(() => {
45181
- return pullRequests.filter((pr) => pr.state === filter);
45182
- }, [filter, pullRequests]);
45183
- const counts = useMemo(() => {
45184
- const open = pullRequests.filter((pr) => pr.state === "open").length;
45185
- const closed = pullRequests.filter((pr) => pr.state === "closed").length;
45186
- return { open, closed };
45173
+ return pullRequests.filter((pr) => {
45174
+ if (pr.state !== "open") return false;
45175
+ if (!showDrafts && pr.draft) return false;
45176
+ return true;
45177
+ });
45178
+ }, [pullRequests, showDrafts]);
45179
+ const draftCount = useMemo(() => {
45180
+ return pullRequests.filter((pr) => pr.state === "open" && pr.draft).length;
45187
45181
  }, [pullRequests]);
45188
45182
  const handleRefresh = async () => {
45189
45183
  try {
@@ -45316,83 +45310,65 @@ const GitPullRequestsPanel = ({
45316
45310
  fontWeight: 600,
45317
45311
  textTransform: "uppercase"
45318
45312
  },
45319
- children: "Pull Requests"
45313
+ children: "Open Pull Requests"
45320
45314
  }
45321
45315
  ),
45322
- /* @__PURE__ */ jsxs(
45323
- "button",
45324
- {
45325
- type: "button",
45326
- onClick: handleRefresh,
45327
- disabled: isLoading,
45328
- style: {
45329
- display: "inline-flex",
45330
- alignItems: "center",
45331
- gap: "6px",
45332
- padding: "4px 10px",
45333
- borderRadius: "4px",
45334
- border: `1px solid ${theme2.colors.border}`,
45335
- backgroundColor: theme2.colors.background,
45336
- color: theme2.colors.text,
45337
- cursor: isLoading ? "default" : "pointer",
45338
- fontFamily: theme2.fonts.body,
45339
- fontSize: theme2.fontSizes[0],
45340
- fontWeight: 500,
45341
- opacity: isLoading ? 0.7 : 1
45342
- },
45343
- children: [
45344
- isLoading ? /* @__PURE__ */ jsx(LoaderCircle, { size: 12, className: "spin" }) : /* @__PURE__ */ jsx(RefreshCcw, { size: 12 }),
45345
- isLoading ? "Refreshing..." : "Refresh"
45346
- ]
45347
- }
45348
- )
45349
- ]
45350
- }
45351
- ),
45352
- /* @__PURE__ */ jsx(
45353
- "div",
45354
- {
45355
- style: {
45356
- display: "flex",
45357
- borderBottom: `1px solid ${theme2.colors.border}`
45358
- },
45359
- children: ["open", "closed"].map((value) => {
45360
- const isActive = filter === value;
45361
- const label = value === "open" ? "Open" : "Closed";
45362
- return /* @__PURE__ */ jsxs(
45363
- "button",
45364
- {
45365
- type: "button",
45366
- onClick: () => setFilter(value),
45367
- style: {
45368
- flex: 1,
45369
- display: "flex",
45370
- alignItems: "center",
45371
- justifyContent: "center",
45372
- gap: "6px",
45373
- padding: "8px 12px",
45374
- border: "none",
45375
- borderBottom: isActive ? `2px solid ${theme2.colors.primary}` : "2px solid transparent",
45376
- backgroundColor: "transparent",
45377
- color: isActive ? theme2.colors.text : theme2.colors.textSecondary,
45378
- fontFamily: theme2.fonts.body,
45379
- fontSize: theme2.fontSizes[1],
45380
- fontWeight: isActive ? 600 : 500,
45381
- cursor: "pointer",
45382
- marginBottom: "-1px"
45383
- },
45384
- children: [
45385
- label,
45386
- /* @__PURE__ */ jsxs("span", { style: { opacity: 0.7 }, children: [
45387
- "(",
45388
- counts[value],
45316
+ /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: "8px" }, children: [
45317
+ draftCount > 0 && /* @__PURE__ */ jsxs(
45318
+ "button",
45319
+ {
45320
+ type: "button",
45321
+ onClick: () => setShowDrafts(!showDrafts),
45322
+ style: {
45323
+ display: "inline-flex",
45324
+ alignItems: "center",
45325
+ gap: "6px",
45326
+ padding: "4px 10px",
45327
+ borderRadius: "4px",
45328
+ border: `1px solid ${showDrafts ? theme2.colors.primary : theme2.colors.border}`,
45329
+ backgroundColor: showDrafts ? `${theme2.colors.primary}15` : theme2.colors.background,
45330
+ color: showDrafts ? theme2.colors.primary : theme2.colors.textSecondary,
45331
+ cursor: "pointer",
45332
+ fontFamily: theme2.fonts.body,
45333
+ fontSize: theme2.fontSizes[0],
45334
+ fontWeight: 500
45335
+ },
45336
+ children: [
45337
+ "Drafts (",
45338
+ draftCount,
45389
45339
  ")"
45390
- ] })
45391
- ]
45392
- },
45393
- value
45394
- );
45395
- })
45340
+ ]
45341
+ }
45342
+ ),
45343
+ /* @__PURE__ */ jsxs(
45344
+ "button",
45345
+ {
45346
+ type: "button",
45347
+ onClick: handleRefresh,
45348
+ disabled: isLoading,
45349
+ style: {
45350
+ display: "inline-flex",
45351
+ alignItems: "center",
45352
+ gap: "6px",
45353
+ padding: "4px 10px",
45354
+ borderRadius: "4px",
45355
+ border: `1px solid ${theme2.colors.border}`,
45356
+ backgroundColor: theme2.colors.background,
45357
+ color: theme2.colors.text,
45358
+ cursor: isLoading ? "default" : "pointer",
45359
+ fontFamily: theme2.fonts.body,
45360
+ fontSize: theme2.fontSizes[0],
45361
+ fontWeight: 500,
45362
+ opacity: isLoading ? 0.7 : 1
45363
+ },
45364
+ children: [
45365
+ isLoading ? /* @__PURE__ */ jsx(LoaderCircle, { size: 12, className: "spin" }) : /* @__PURE__ */ jsx(RefreshCcw, { size: 12 }),
45366
+ isLoading ? "Refreshing..." : "Refresh"
45367
+ ]
45368
+ }
45369
+ )
45370
+ ] })
45371
+ ]
45396
45372
  }
45397
45373
  ),
45398
45374
  /* @__PURE__ */ jsx(
@@ -45418,12 +45394,8 @@ const GitPullRequestsPanel = ({
45418
45394
  },
45419
45395
  children: [
45420
45396
  /* @__PURE__ */ jsx(GitPullRequest, { size: 32, style: { marginBottom: "12px" } }),
45421
- /* @__PURE__ */ jsx("div", { style: { fontFamily: theme2.fonts.heading, fontSize: theme2.fontSizes[1], fontWeight: 600 }, children: "No pull requests found" }),
45422
- /* @__PURE__ */ jsxs("div", { style: { marginTop: "4px", fontSize: theme2.fontSizes[0] }, children: [
45423
- "There are no ",
45424
- filter,
45425
- " pull requests to display."
45426
- ] })
45397
+ /* @__PURE__ */ jsx("div", { style: { fontFamily: theme2.fonts.heading, fontSize: theme2.fontSizes[1], fontWeight: 600 }, children: "No open pull requests" }),
45398
+ /* @__PURE__ */ jsx("div", { style: { marginTop: "4px", fontSize: theme2.fontSizes[0] }, children: draftCount > 0 && !showDrafts ? `There are ${draftCount} draft PR${draftCount === 1 ? "" : "s"} hidden.` : "There are no open pull requests to display." })
45427
45399
  ]
45428
45400
  }
45429
45401
  ) : filteredPullRequests.map((pr) => /* @__PURE__ */ jsx(PullRequestCard, { pr, theme: theme2, isSelected: selectedPrId === pr.id, onClick: () => handlePRClick(pr) }, pr.id))
@@ -46127,36 +46099,8 @@ const refreshPullRequestsTool = {
46127
46099
  event_type: "git-panels.pull-requests:refresh"
46128
46100
  }
46129
46101
  };
46130
- const setPRFilterTool = {
46131
- name: "set_pr_filter",
46132
- description: "Sets the pull request filter (all, open, or closed)",
46133
- inputs: {
46134
- type: "object",
46135
- properties: {
46136
- filter: {
46137
- type: "string",
46138
- enum: ["all", "open", "closed"],
46139
- description: "Filter to apply to pull requests"
46140
- }
46141
- },
46142
- required: ["filter"]
46143
- },
46144
- outputs: {
46145
- type: "object",
46146
- properties: {
46147
- success: { type: "boolean" },
46148
- filter: { type: "string" }
46149
- }
46150
- },
46151
- tags: ["git", "pull-requests", "filter"],
46152
- tool_call_template: {
46153
- call_template_type: "panel_event",
46154
- event_type: "git-panels.pull-requests:set-filter"
46155
- }
46156
- };
46157
46102
  const pullRequestsTools = [
46158
- refreshPullRequestsTool,
46159
- setPRFilterTool
46103
+ refreshPullRequestsTool
46160
46104
  ];
46161
46105
  const pullRequestsToolsMetadata = {
46162
46106
  id: "git-panels.pull-requests",
@@ -46379,7 +46323,6 @@ export {
46379
46323
  refreshPullRequestsTool,
46380
46324
  selectCommitTool,
46381
46325
  selectPullRequestTool,
46382
- setCommitLimitTool,
46383
- setPRFilterTool
46326
+ setCommitLimitTool
46384
46327
  };
46385
46328
  //# sourceMappingURL=panels.bundle.js.map