clairo 1.0.3 → 1.0.4

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.
Files changed (2) hide show
  1. package/dist/cli.js +28 -6
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -757,6 +757,15 @@ function getCheckIcon(check) {
757
757
  if (check.status === "COMPLETED") return "\u2713";
758
758
  return "?";
759
759
  }
760
+ function getCheckSortOrder(check) {
761
+ const conclusion = check.conclusion ?? check.state;
762
+ if (conclusion === "FAILURE" || conclusion === "ERROR") return 0;
763
+ if (conclusion === "PENDING" || check.status === "IN_PROGRESS" || check.status === "QUEUED" || check.status === "WAITING")
764
+ return 1;
765
+ if (conclusion === "SKIPPED" || conclusion === "NEUTRAL") return 2;
766
+ if (conclusion === "SUCCESS" || check.status === "COMPLETED") return 3;
767
+ return 4;
768
+ }
760
769
  function PRDetailsBox({ pr, loading, error, isFocused }) {
761
770
  var _a, _b, _c, _d, _e, _f, _g;
762
771
  const scrollRef = useRef(null);
@@ -851,12 +860,25 @@ function PRDetailsBox({ pr, loading, error, isFocused }) {
851
860
  ] }),
852
861
  (((_f = pr.statusCheckRollup) == null ? void 0 : _f.length) ?? 0) > 0 && /* @__PURE__ */ jsxs2(Box2, { marginTop: 1, flexDirection: "column", children: [
853
862
  /* @__PURE__ */ jsx2(Text2, { dimColor: true, children: "Checks:" }),
854
- (_g = pr.statusCheckRollup) == null ? void 0 : _g.map((check, idx) => /* @__PURE__ */ jsxs2(Text2, { color: getCheckColor(check), children: [
855
- " ",
856
- getCheckIcon(check),
857
- " ",
858
- check.name ?? check.context
859
- ] }, idx))
863
+ Array.from(
864
+ ((_g = pr.statusCheckRollup) == null ? void 0 : _g.reduce((acc, check) => {
865
+ const key = check.name ?? check.context ?? "";
866
+ const existing = acc.get(key);
867
+ if (!existing || (check.startedAt ?? "") > (existing.startedAt ?? "")) {
868
+ acc.set(key, check);
869
+ }
870
+ return acc;
871
+ }, /* @__PURE__ */ new Map()).values()) ?? []
872
+ ).sort((a, b) => getCheckSortOrder(a) - getCheckSortOrder(b)).map((check, idx) => {
873
+ const jobName = check.name ?? check.context;
874
+ const displayName = check.workflowName ? `${check.workflowName} / ${jobName}` : jobName;
875
+ return /* @__PURE__ */ jsxs2(Text2, { color: getCheckColor(check), children: [
876
+ " ",
877
+ getCheckIcon(check),
878
+ " ",
879
+ displayName
880
+ ] }, idx);
881
+ })
860
882
  ] }),
861
883
  pr.body && /* @__PURE__ */ jsxs2(Box2, { marginTop: 1, flexDirection: "column", children: [
862
884
  /* @__PURE__ */ jsx2(Text2, { dimColor: true, children: "Description:" }),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clairo",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",