@industry-theme/file-city-panel 0.2.73 → 0.2.74

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":"CodeCityPanel.d.ts","sourceRoot":"","sources":["../../src/panels/CodeCityPanel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4D,MAAM,OAAO,CAAC;AA8BjF,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAgBpD;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,KAAK,CAAC;QACX,GAAG,EAAE,MAAM,CAAC;QACZ,QAAQ,EAAE,MAAM,CAAC;QACjB,MAAM,EAAE,OAAO,GAAG,SAAS,GAAG,UAAU,GAAG,SAAS,GAAG,QAAQ,GAAG,SAAS,GAAG,WAAW,CAAC;QAC1F,SAAS,EAAE,MAAM,CAAC;QAClB,SAAS,EAAE,MAAM,CAAC;QAClB,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC,CAAC;IACH,aAAa,EAAE;QACb,KAAK,EAAE,MAAM,EAAE,CAAC;QAChB,QAAQ,EAAE,MAAM,EAAE,CAAC;QACnB,OAAO,EAAE,MAAM,EAAE,CAAC;QAClB,OAAO,EAAE;YAAE,QAAQ,EAAE,MAAM,CAAC;YAAC,iBAAiB,CAAC,EAAE,MAAM,CAAA;SAAE,EAAE,CAAC;KAC7D,CAAC;IACF,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,aAAa,EAAE;QACb,KAAK,EAAE,MAAM,EAAE,CAAC;QAChB,QAAQ,EAAE,MAAM,EAAE,CAAC;QACnB,OAAO,EAAE,MAAM,EAAE,CAAC;QAClB,OAAO,EAAE,MAAM,EAAE,CAAC;KACnB,CAAC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E,MAAM,CAAC;YAAC,iBAAiB,CAAC,EAAE,MAAM,CAAA;SAAE,EAAE,CAAC;KAC7D,CAAC;IACF,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,aAAa,EAAE;QACb,KAAK,EAAE,MAAM,EAAE,CAAC;QAChB,QAAQ,EAAE,MAAM,EAAE,CAAC;QACnB,OAAO,EAAE,MAAM,EAAE,CAAC;QAClB,OAAO,EAAE,MAAM,EAAE,CAAC;KACnB,CAAC;IACF,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,KAAK,CAAC,EAAE;QACN,KAAK,EAAE,MAAM,CAAC;QACd,SAAS,EAAE,MAAM,CAAC;QAClB,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC;CACH;AAGD,YAAY,EAAE,0BAA0B,EAAE,MAAM,mCAAmC,CAAC;AAmCpF;;GAEG;AACH,QAAA,MAAM,oBAAoB,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CAmiEvD,CAAC;AAEF;;;GAGG;AACH,OAAO,EAAE,oBAAoB,EAAE,CAAC;AAEhC;;;;;;;;;;GAUG;AACH,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CAEvD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,oBAAoB,EAAE,KAAK,CAAC,EA8BxC,CAAC"}
@@ -53264,27 +53264,14 @@ function parseTour(jsonString) {
53264
53264
  };
53265
53265
  }
53266
53266
  }
53267
- function findTourInFileTree(fileTree) {
53267
+ function findTourFilePathInFileTree(fileTree) {
53268
53268
  const tourFiles = fileTree.allFiles.filter((file) => {
53269
- const normalizedPath = file.path.startsWith("./") ? file.path.slice(2) : file.path;
53270
- return normalizedPath.endsWith(".tour.json") && !normalizedPath.includes("/");
53269
+ const path = file.path;
53270
+ return path.endsWith(".tour.json") && !path.includes("/");
53271
53271
  });
53272
53272
  tourFiles.sort((a, b) => a.path.localeCompare(b.path));
53273
53273
  const tourFile = tourFiles[0];
53274
- if (tourFile && tourFile.content) {
53275
- return tourFile.content;
53276
- }
53277
- return null;
53278
- }
53279
- function loadTourFromFileTree(fileTree) {
53280
- const tourContent = findTourInFileTree(fileTree);
53281
- if (!tourContent) {
53282
- return {
53283
- success: false,
53284
- errors: [new TourValidationError("No *.tour.json file found in repository root")]
53285
- };
53286
- }
53287
- return parseTour(tourContent);
53274
+ return tourFile ? tourFile.path : null;
53288
53275
  }
53289
53276
  const GIT_STATUS_COLORS = {
53290
53277
  staged: "#22c55e",
@@ -53311,7 +53298,7 @@ const CodeCityPanelContent = ({
53311
53298
  actions: _actions,
53312
53299
  events
53313
53300
  }) => {
53314
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C;
53301
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D;
53315
53302
  const { theme: theme2 } = useTheme();
53316
53303
  const [cityData, setCityData] = useState(null);
53317
53304
  const [hoverInfo, setHoverInfo] = useState(null);
@@ -53397,24 +53384,44 @@ const CodeCityPanelContent = ({
53397
53384
  }
53398
53385
  }, [currentRepoPath]);
53399
53386
  useEffect(() => {
53400
- if (!(fileTreeSlice == null ? void 0 : fileTreeSlice.data)) {
53387
+ var _a2;
53388
+ if (!(fileTreeSlice == null ? void 0 : fileTreeSlice.data) || !((_a2 = context.currentScope.repository) == null ? void 0 : _a2.path)) {
53401
53389
  setTourData(null);
53402
53390
  return;
53403
53391
  }
53404
- const tourResult = loadTourFromFileTree(fileTreeSlice.data);
53405
- if (tourResult.success && tourResult.tour) {
53406
- console.log("[Tour] Found and parsed tour.json:", tourResult.tour.title);
53407
- setTourData(tourResult.tour);
53408
- } else {
53409
- if (tourResult.errors && tourResult.errors.length > 0) {
53410
- const hasTourFile = tourResult.errors.some((e) => !e.message.includes("No tour.json file found"));
53411
- if (hasTourFile) {
53412
- console.warn("[Tour] Tour validation failed:", tourResult.errors.map((e) => e.message).join(", "));
53392
+ const loadTour = async () => {
53393
+ var _a3;
53394
+ const tourFilePath = findTourFilePathInFileTree(fileTreeSlice.data);
53395
+ if (!tourFilePath) {
53396
+ setTourData(null);
53397
+ return;
53398
+ }
53399
+ if (!((_a3 = context.adapters) == null ? void 0 : _a3.readFile)) {
53400
+ console.warn("[Tour] No readFile adapter available - cannot load tour file");
53401
+ setTourData(null);
53402
+ return;
53403
+ }
53404
+ const repoPath = context.currentScope.repository.path;
53405
+ const fullPath = `${repoPath}/${tourFilePath}`;
53406
+ try {
53407
+ const tourContent = await context.adapters.readFile(fullPath);
53408
+ const tourResult = parseTour(tourContent);
53409
+ if (tourResult.success && tourResult.tour) {
53410
+ console.log("[Tour] Found and parsed tour file:", tourResult.tour.title, `(${tourFilePath})`);
53411
+ setTourData(tourResult.tour);
53412
+ } else {
53413
+ if (tourResult.errors && tourResult.errors.length > 0) {
53414
+ console.warn("[Tour] Tour validation failed:", tourResult.errors.map((e) => e.message).join(", "));
53415
+ }
53416
+ setTourData(null);
53413
53417
  }
53418
+ } catch (error) {
53419
+ console.warn("[Tour] Failed to read tour file:", error instanceof Error ? error.message : "Unknown error");
53420
+ setTourData(null);
53414
53421
  }
53415
- setTourData(null);
53416
- }
53417
- }, [fileTreeSlice == null ? void 0 : fileTreeSlice.data]);
53422
+ };
53423
+ loadTour();
53424
+ }, [fileTreeSlice == null ? void 0 : fileTreeSlice.data, (_e = context.currentScope.repository) == null ? void 0 : _e.path, context.adapters]);
53418
53425
  const [prFilesVersion, setPrFilesVersion] = useState(0);
53419
53426
  const [commitFilesVersion, setCommitFilesVersion] = useState(0);
53420
53427
  useEffect(() => {
@@ -53543,7 +53550,7 @@ const CodeCityPanelContent = ({
53543
53550
  default:
53544
53551
  return null;
53545
53552
  }
53546
- }, [(_e = hoverInfo == null ? void 0 : hoverInfo.hoveredBuilding) == null ? void 0 : _e.path, colorMode, qualityData]);
53553
+ }, [(_f = hoverInfo == null ? void 0 : hoverInfo.hoveredBuilding) == null ? void 0 : _f.path, colorMode, qualityData]);
53547
53554
  const computedTreeStats = useMemo(() => {
53548
53555
  var _a2, _b2, _c2;
53549
53556
  if (!cityData) {
@@ -53760,7 +53767,7 @@ const CodeCityPanelContent = ({
53760
53767
  }
53761
53768
  }
53762
53769
  return layers;
53763
- }, [cityData, (_f = prFilesSlice == null ? void 0 : prFilesSlice.data) == null ? void 0 : _f.filesByStatus, prFilesVersion]);
53770
+ }, [cityData, (_g = prFilesSlice == null ? void 0 : prFilesSlice.data) == null ? void 0 : _g.filesByStatus, prFilesVersion]);
53764
53771
  const commitFilesLayers = useMemo(() => {
53765
53772
  var _a2;
53766
53773
  if (!cityData || !cityData.buildings || !((_a2 = commitFilesSlice == null ? void 0 : commitFilesSlice.data) == null ? void 0 : _a2.filesByStatus)) {
@@ -53838,7 +53845,7 @@ const CodeCityPanelContent = ({
53838
53845
  }
53839
53846
  }
53840
53847
  return layers;
53841
- }, [cityData, (_g = commitFilesSlice == null ? void 0 : commitFilesSlice.data) == null ? void 0 : _g.filesByStatus, commitFilesVersion]);
53848
+ }, [cityData, (_h = commitFilesSlice == null ? void 0 : commitFilesSlice.data) == null ? void 0 : _h.filesByStatus, commitFilesVersion]);
53842
53849
  const storyboardLayers = useMemo(() => {
53843
53850
  if (!cityData || !cityData.buildings || !(storyboardContextSlice == null ? void 0 : storyboardContextSlice.data)) {
53844
53851
  return [];
@@ -53939,7 +53946,7 @@ const CodeCityPanelContent = ({
53939
53946
  if (!((_a2 = prFilesSlice == null ? void 0 : prFilesSlice.data) == null ? void 0 : _a2.filesByStatus)) return 0;
53940
53947
  const { added, modified, removed, renamed } = prFilesSlice.data.filesByStatus;
53941
53948
  return added.length + modified.length + removed.length + renamed.length;
53942
- }, [(_h = prFilesSlice == null ? void 0 : prFilesSlice.data) == null ? void 0 : _h.filesByStatus]);
53949
+ }, [(_i = prFilesSlice == null ? void 0 : prFilesSlice.data) == null ? void 0 : _i.filesByStatus]);
53943
53950
  const legendAgentLayers = useMemo(() => {
53944
53951
  const agentLayers = highlightLayers.filter(
53945
53952
  (layer) => layer.id.startsWith("event-highlight")
@@ -54203,7 +54210,7 @@ const CodeCityPanelContent = ({
54203
54210
  } finally {
54204
54211
  setLoading(false);
54205
54212
  }
54206
- }, [fileTreeSlice == null ? void 0 : fileTreeSlice.data, fileTreeSlice == null ? void 0 : fileTreeSlice.loading, (_i = context.currentScope.repository) == null ? void 0 : _i.path]);
54213
+ }, [fileTreeSlice == null ? void 0 : fileTreeSlice.data, fileTreeSlice == null ? void 0 : fileTreeSlice.loading, (_j = context.currentScope.repository) == null ? void 0 : _j.path]);
54207
54214
  const handleFileClick = useCallback(
54208
54215
  (filePath, type) => {
54209
54216
  if (type === "file") {
@@ -54713,7 +54720,7 @@ const CodeCityPanelContent = ({
54713
54720
  textOverflow: "ellipsis",
54714
54721
  whiteSpace: "nowrap"
54715
54722
  },
54716
- children: ((_j = hoverInfo.fileTooltip) == null ? void 0 : _j.text) || ((_l = (_k = hoverInfo.hoveredDistrict) == null ? void 0 : _k.path) == null ? void 0 : _l.split("/").pop()) || ((_m = hoverInfo.hoveredDistrict) == null ? void 0 : _m.path) || "Unknown"
54723
+ children: ((_k = hoverInfo.fileTooltip) == null ? void 0 : _k.text) || ((_m = (_l = hoverInfo.hoveredDistrict) == null ? void 0 : _l.path) == null ? void 0 : _m.split("/").pop()) || ((_n = hoverInfo.hoveredDistrict) == null ? void 0 : _n.path) || "Unknown"
54717
54724
  }
54718
54725
  ),
54719
54726
  /* @__PURE__ */ jsx(
@@ -54727,7 +54734,7 @@ const CodeCityPanelContent = ({
54727
54734
  textOverflow: "ellipsis",
54728
54735
  whiteSpace: "nowrap"
54729
54736
  },
54730
- children: ((_n = hoverInfo.hoveredBuilding) == null ? void 0 : _n.path) || ((_o = hoverInfo.hoveredDistrict) == null ? void 0 : _o.path) || "/"
54737
+ children: ((_o = hoverInfo.hoveredBuilding) == null ? void 0 : _o.path) || ((_p = hoverInfo.hoveredDistrict) == null ? void 0 : _p.path) || "/"
54731
54738
  }
54732
54739
  )
54733
54740
  ]
@@ -54959,14 +54966,14 @@ const CodeCityPanelContent = ({
54959
54966
  {
54960
54967
  fileTypes: [],
54961
54968
  gitStatus: gitSlice == null ? void 0 : gitSlice.data,
54962
- prFiles: (_p = prFilesSlice == null ? void 0 : prFilesSlice.data) == null ? void 0 : _p.filesByStatus,
54963
- prFileStats: (_q = prFilesSlice == null ? void 0 : prFilesSlice.data) == null ? void 0 : _q.files,
54964
- prNumber: (_r = prFilesSlice == null ? void 0 : prFilesSlice.data) == null ? void 0 : _r.pullNumber,
54965
- commitFiles: (_s = commitFilesSlice == null ? void 0 : commitFilesSlice.data) == null ? void 0 : _s.filesByStatus,
54966
- commitHash: (_t = commitFilesSlice == null ? void 0 : commitFilesSlice.data) == null ? void 0 : _t.commitHash,
54967
- commitStats: (_u = commitFilesSlice == null ? void 0 : commitFilesSlice.data) == null ? void 0 : _u.stats,
54969
+ prFiles: (_q = prFilesSlice == null ? void 0 : prFilesSlice.data) == null ? void 0 : _q.filesByStatus,
54970
+ prFileStats: (_r = prFilesSlice == null ? void 0 : prFilesSlice.data) == null ? void 0 : _r.files,
54971
+ prNumber: (_s = prFilesSlice == null ? void 0 : prFilesSlice.data) == null ? void 0 : _s.pullNumber,
54972
+ commitFiles: (_t = commitFilesSlice == null ? void 0 : commitFilesSlice.data) == null ? void 0 : _t.filesByStatus,
54973
+ commitHash: (_u = commitFilesSlice == null ? void 0 : commitFilesSlice.data) == null ? void 0 : _u.commitHash,
54974
+ commitStats: (_v = commitFilesSlice == null ? void 0 : commitFilesSlice.data) == null ? void 0 : _v.stats,
54968
54975
  fileTree: fileTreeSlice == null ? void 0 : fileTreeSlice.data,
54969
- rootPath: (_v = context.currentScope.repository) == null ? void 0 : _v.path,
54976
+ rootPath: (_w = context.currentScope.repository) == null ? void 0 : _w.path,
54970
54977
  onGitFileClick: handleLegendFileClick,
54971
54978
  onGitNodeHover: handleGitNodeHover,
54972
54979
  onPrFileClick: handleLegendFileClick,
@@ -54989,14 +54996,14 @@ const CodeCityPanelContent = ({
54989
54996
  {
54990
54997
  fileTypes: legendFileTypes,
54991
54998
  gitStatus: gitSlice == null ? void 0 : gitSlice.data,
54992
- prFiles: (_w = prFilesSlice == null ? void 0 : prFilesSlice.data) == null ? void 0 : _w.filesByStatus,
54993
- prFileStats: (_x = prFilesSlice == null ? void 0 : prFilesSlice.data) == null ? void 0 : _x.files,
54994
- prNumber: (_y = prFilesSlice == null ? void 0 : prFilesSlice.data) == null ? void 0 : _y.pullNumber,
54995
- commitFiles: (_z = commitFilesSlice == null ? void 0 : commitFilesSlice.data) == null ? void 0 : _z.filesByStatus,
54996
- commitHash: (_A = commitFilesSlice == null ? void 0 : commitFilesSlice.data) == null ? void 0 : _A.commitHash,
54997
- commitStats: (_B = commitFilesSlice == null ? void 0 : commitFilesSlice.data) == null ? void 0 : _B.stats,
54999
+ prFiles: (_x = prFilesSlice == null ? void 0 : prFilesSlice.data) == null ? void 0 : _x.filesByStatus,
55000
+ prFileStats: (_y = prFilesSlice == null ? void 0 : prFilesSlice.data) == null ? void 0 : _y.files,
55001
+ prNumber: (_z = prFilesSlice == null ? void 0 : prFilesSlice.data) == null ? void 0 : _z.pullNumber,
55002
+ commitFiles: (_A = commitFilesSlice == null ? void 0 : commitFilesSlice.data) == null ? void 0 : _A.filesByStatus,
55003
+ commitHash: (_B = commitFilesSlice == null ? void 0 : commitFilesSlice.data) == null ? void 0 : _B.commitHash,
55004
+ commitStats: (_C = commitFilesSlice == null ? void 0 : commitFilesSlice.data) == null ? void 0 : _C.stats,
54998
55005
  fileTree: fileTreeSlice == null ? void 0 : fileTreeSlice.data,
54999
- rootPath: (_C = context.currentScope.repository) == null ? void 0 : _C.path,
55006
+ rootPath: (_D = context.currentScope.repository) == null ? void 0 : _D.path,
55000
55007
  agentLayers: legendAgentLayers,
55001
55008
  qualityMetrics: legendQualityMetrics,
55002
55009
  colorMode,