@industry-theme/file-city-panel 0.3.14 → 0.3.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.
@@ -1 +1 @@
1
- {"version":3,"file":"TourPlayer.d.ts","sourceRoot":"","sources":["../../src/components/TourPlayer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmD,MAAM,OAAO,CAAC;AAgBxE,OAAO,KAAK,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAC9F,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAG7C,MAAM,WAAW,eAAe;IAC9B,oCAAoC;IACpC,IAAI,EAAE,gBAAgB,CAAC;IAEvB,2CAA2C;IAC3C,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAE1B,iCAAiC;IACjC,YAAY,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,oBAAoB,KAAK,IAAI,CAAC;IAEvE,+BAA+B;IAC/B,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IAEpB,uDAAuD;IACvD,mBAAmB,CAAC,EAAE,CAAC,MAAM,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;IAE1E,yCAAyC;IACzC,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB,qIAAqI;IACrI,QAAQ,CAAC,EAAE,KAAK,GAAG,QAAQ,GAAG,SAAS,GAAG,MAAM,GAAG,OAAO,CAAC;IAE3D,wDAAwD;IACxD,WAAW,CAAC,EAAE,OAAO,CAAC;IAGtB,wGAAwG;IACxG,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IAEpC,6FAA6F;IAC7F,OAAO,CAAC,EAAE,YAAY,CAAC;IAEvB,yDAAyD;IACzD,aAAa,CAA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AAO,CAAC;IAGtB,wGAAwG;IACxG,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IAEpC,6FAA6F;IAC7F,OAAO,CAAC,EAAE,YAAY,CAAC;IAEvB,yDAAyD;IACzD,aAAa,CAAC,EAAE,OAAO,CAAC;IAExB,iEAAiE;IACjE,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAEhC,yEAAyE;IACzE,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAE1B,2DAA2D;IAC3D,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B;AAED;;;;;GAKG;AACH,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAwhChD,CAAC"}
@@ -18,6 +18,10 @@ interface FileCardListProps {
18
18
  onFileClick?: (filePath: string) => void;
19
19
  /** Callback when a file card is hovered */
20
20
  onFileHover?: (filePath: string | null) => void;
21
+ /** Callback when stage button is clicked (only shows for unstaged files) */
22
+ onStageFile?: (filePath: string) => void;
23
+ /** File status map for determining if file can be staged */
24
+ fileStatusMap?: Map<string, string>;
21
25
  /** Empty state message */
22
26
  emptyMessage?: string;
23
27
  /** Horizontal padding for cards */
@@ -1 +1 @@
1
- {"version":3,"file":"FileCardList.d.ts","sourceRoot":"","sources":["../../../src/panels/components/FileCardList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA+B,MAAM,OAAO,CAAC;AAQpD,MAAM,WAAW,YAAY;IAC3B,qBAAqB;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,mEAAmE;IACnE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,gEAAgE;IAChE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,wDAAwD;IACxD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,2BAA2B;IAC3B,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,UAAU,iBAAiB;IACzB,+BAA+B;IAC/B,KAAK,EAAE,YAAY,EAAE,CAAC;IACtB,2CAA2C;IAC3C,WAAW,CA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1B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,mCAAmC;IACnC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,gDAAgD;IAChD,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED;;;GAGG;AACH,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAiRpD,CAAC"}
@@ -1,7 +1,10 @@
1
1
  import React from 'react';
2
2
  import type { GitStatusWithFiles } from '@principal-ai/repository-abstraction';
3
+ import type { PanelActions } from '../../types';
3
4
  /** Git status category for selection callbacks */
4
5
  export type GitChangeSelectionStatus = 'staged' | 'unstaged' | 'untracked' | 'deleted';
6
+ /** View mode for git changes */
7
+ export type GitChangesViewMode = 'unstaged' | 'staged';
5
8
  interface GitChangesCardListProps {
6
9
  /** Git status data with categorized file paths */
7
10
  gitStatus: GitStatusWithFiles;
@@ -11,10 +14,13 @@ interface GitChangesCardListProps {
11
14
  onFileClick?: (filePath: string, status?: GitChangeSelectionStatus) => void;
12
15
  /** Callback when a file is hovered */
13
16
  onFileHover?: (filePath: string | null) => void;
17
+ /** Panel actions for git operations */
18
+ actions?: PanelActions;
14
19
  }
15
20
  /**
16
21
  * GitChangesCardList displays git changes as a flat list of file cards.
17
22
  * Each card shows the filename with a colored status badge (A, M, D, ??).
23
+ * Includes a toggle to switch between staged and unstaged views.
18
24
  */
19
25
  export declare const GitChangesCardList: React.FC<GitChangesCardListProps>;
20
26
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"GitChangesCardList.d.ts","sourceRoot":"","sources":["../../../src/panels/components/GitChangesCardList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA+B,MAAM,OAAO,CAAC;AAGpD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAE/E,kDAAkD;AAClD,MAAM,MAAM,wBAAwB,GAAG,QAAQ,GAAG,UAAU,GAAG,WAAW,GAAG,SAAS,CAAC;AAkBvF,UAAU,uBAAuB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IG;AACH,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAAE,CAAC,uBAAuB,CAmKhE,CAAC"}
@@ -48258,12 +48258,15 @@ const FileCardList = ({
48258
48258
  files: files2,
48259
48259
  onFileClick,
48260
48260
  onFileHover,
48261
+ onStageFile,
48262
+ fileStatusMap,
48261
48263
  emptyMessage = "No files",
48262
48264
  horizontalPadding = "0px",
48263
48265
  showIcons = true
48264
48266
  }) => {
48265
48267
  const { theme: theme2 } = useTheme();
48266
48268
  const [copiedPath, setCopiedPath] = React.useState(null);
48269
+ const [hoveredStageButton, setHoveredStageButton] = React.useState(null);
48267
48270
  const getFileName = useCallback((path) => {
48268
48271
  const parts = path.split("/");
48269
48272
  return parts[parts.length - 1] || path;
@@ -48449,6 +48452,37 @@ const FileCardList = ({
48449
48452
  children: file.badge
48450
48453
  }
48451
48454
  ),
48455
+ onStageFile && fileStatusMap && fileStatusMap.get(file.path) !== "staged" && /* @__PURE__ */ jsxs(
48456
+ "button",
48457
+ {
48458
+ onClick: (e) => {
48459
+ e.stopPropagation();
48460
+ onStageFile(file.path);
48461
+ },
48462
+ onMouseEnter: () => setHoveredStageButton(file.path),
48463
+ onMouseLeave: () => setHoveredStageButton(null),
48464
+ style: {
48465
+ display: "flex",
48466
+ alignItems: "center",
48467
+ gap: "4px",
48468
+ fontFamily: theme2.fonts.body,
48469
+ fontSize: theme2.fontSizes[0],
48470
+ fontWeight: 500,
48471
+ color: hoveredStageButton === file.path ? "#22c55e" : theme2.colors.textSecondary,
48472
+ backgroundColor: hoveredStageButton === file.path ? "#22c55e20" : theme2.colors.background,
48473
+ padding: "4px 8px",
48474
+ borderRadius: "4px",
48475
+ border: `1px solid ${hoveredStageButton === file.path ? "#22c55e" : theme2.colors.border}`,
48476
+ cursor: "pointer",
48477
+ flexShrink: 0,
48478
+ transition: "all 0.15s ease"
48479
+ },
48480
+ children: [
48481
+ /* @__PURE__ */ jsx(Plus, { size: 12 }),
48482
+ "Stage"
48483
+ ]
48484
+ }
48485
+ ),
48452
48486
  copiedPath === file.path && /* @__PURE__ */ jsx(
48453
48487
  "span",
48454
48488
  {
@@ -48493,9 +48527,11 @@ const GitChangesCardList = ({
48493
48527
  gitStatus,
48494
48528
  horizontalPadding = "0px",
48495
48529
  onFileClick,
48496
- onFileHover
48530
+ onFileHover,
48531
+ actions
48497
48532
  }) => {
48498
48533
  const { theme: theme2 } = useTheme();
48534
+ const [viewMode, setViewMode] = useState("unstaged");
48499
48535
  const fileStatusMap = useMemo(() => {
48500
48536
  const map = /* @__PURE__ */ new Map();
48501
48537
  gitStatus.stagedFiles.forEach((f) => map.set(f, "staged"));
@@ -48518,18 +48554,25 @@ const GitChangesCardList = ({
48518
48554
  }
48519
48555
  });
48520
48556
  };
48521
- addFiles(gitStatus.stagedFiles, "staged");
48522
- addFiles(gitStatus.modifiedFiles, "unstaged");
48523
- addFiles(gitStatus.untrackedFiles, "untracked");
48524
- addFiles(gitStatus.deletedFiles, "deleted");
48557
+ if (viewMode === "staged") {
48558
+ addFiles(gitStatus.stagedFiles, "staged");
48559
+ } else {
48560
+ addFiles(gitStatus.modifiedFiles, "unstaged");
48561
+ addFiles(gitStatus.untrackedFiles, "untracked");
48562
+ addFiles(gitStatus.deletedFiles, "deleted");
48563
+ }
48525
48564
  return items;
48526
- }, [gitStatus]);
48565
+ }, [gitStatus, viewMode]);
48527
48566
  const handleFileClick = useCallback((filePath) => {
48528
48567
  const status = fileStatusMap.get(filePath);
48529
48568
  onFileClick == null ? void 0 : onFileClick(filePath, status);
48530
48569
  }, [fileStatusMap, onFileClick]);
48531
- const hasChanges = files2.length > 0;
48532
- if (!hasChanges) {
48570
+ const handleStageFile = useCallback((filePath) => {
48571
+ var _a;
48572
+ (_a = actions == null ? void 0 : actions.stageFile) == null ? void 0 : _a.call(actions, filePath);
48573
+ }, [actions]);
48574
+ const totalChanges = gitStatus.stagedFiles.length + gitStatus.modifiedFiles.length + gitStatus.untrackedFiles.length + gitStatus.deletedFiles.length;
48575
+ if (totalChanges === 0) {
48533
48576
  return /* @__PURE__ */ jsx(
48534
48577
  "div",
48535
48578
  {
@@ -48545,17 +48588,104 @@ const GitChangesCardList = ({
48545
48588
  }
48546
48589
  );
48547
48590
  }
48548
- return /* @__PURE__ */ jsx(
48549
- FileCardList,
48550
- {
48551
- files: files2,
48552
- onFileClick: handleFileClick,
48553
- onFileHover,
48554
- horizontalPadding,
48555
- emptyMessage: "No changes detected",
48556
- showIcons: false
48557
- }
48558
- );
48591
+ return /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "8px" }, children: [
48592
+ /* @__PURE__ */ jsxs(
48593
+ "div",
48594
+ {
48595
+ style: {
48596
+ display: "flex",
48597
+ alignItems: "center",
48598
+ justifyContent: "space-between",
48599
+ padding: `0 ${horizontalPadding}`
48600
+ },
48601
+ children: [
48602
+ /* @__PURE__ */ jsx(
48603
+ "span",
48604
+ {
48605
+ style: {
48606
+ fontFamily: theme2.fonts.body,
48607
+ fontSize: theme2.fontSizes[1],
48608
+ fontWeight: 600,
48609
+ color: theme2.colors.text
48610
+ },
48611
+ children: "Git Changes"
48612
+ }
48613
+ ),
48614
+ /* @__PURE__ */ jsxs(
48615
+ "div",
48616
+ {
48617
+ style: {
48618
+ display: "flex",
48619
+ backgroundColor: theme2.colors.background,
48620
+ borderRadius: "6px",
48621
+ border: `1px solid ${theme2.colors.border}`,
48622
+ overflow: "hidden"
48623
+ },
48624
+ children: [
48625
+ /* @__PURE__ */ jsxs(
48626
+ "button",
48627
+ {
48628
+ onClick: () => setViewMode("unstaged"),
48629
+ style: {
48630
+ fontFamily: theme2.fonts.body,
48631
+ fontSize: theme2.fontSizes[0],
48632
+ fontWeight: 500,
48633
+ padding: "4px 12px",
48634
+ border: "none",
48635
+ backgroundColor: viewMode === "unstaged" ? theme2.colors.backgroundLight : "transparent",
48636
+ color: viewMode === "unstaged" ? theme2.colors.text : theme2.colors.textSecondary,
48637
+ cursor: "pointer",
48638
+ transition: "all 0.15s ease"
48639
+ },
48640
+ children: [
48641
+ "Unstaged (",
48642
+ gitStatus.modifiedFiles.length + gitStatus.untrackedFiles.length + gitStatus.deletedFiles.length,
48643
+ ")"
48644
+ ]
48645
+ }
48646
+ ),
48647
+ /* @__PURE__ */ jsxs(
48648
+ "button",
48649
+ {
48650
+ onClick: () => setViewMode("staged"),
48651
+ style: {
48652
+ fontFamily: theme2.fonts.body,
48653
+ fontSize: theme2.fontSizes[0],
48654
+ fontWeight: 500,
48655
+ padding: "4px 12px",
48656
+ border: "none",
48657
+ backgroundColor: viewMode === "staged" ? theme2.colors.backgroundLight : "transparent",
48658
+ color: viewMode === "staged" ? theme2.colors.text : theme2.colors.textSecondary,
48659
+ cursor: "pointer",
48660
+ transition: "all 0.15s ease"
48661
+ },
48662
+ children: [
48663
+ "Staged (",
48664
+ gitStatus.stagedFiles.length,
48665
+ ")"
48666
+ ]
48667
+ }
48668
+ )
48669
+ ]
48670
+ }
48671
+ )
48672
+ ]
48673
+ }
48674
+ ),
48675
+ /* @__PURE__ */ jsx(
48676
+ FileCardList,
48677
+ {
48678
+ files: files2,
48679
+ onFileClick: handleFileClick,
48680
+ onFileHover,
48681
+ onStageFile: viewMode === "unstaged" ? handleStageFile : void 0,
48682
+ fileStatusMap,
48683
+ horizontalPadding,
48684
+ emptyMessage: viewMode === "unstaged" ? "No unstaged changes" : "No staged changes",
48685
+ showIcons: false
48686
+ }
48687
+ )
48688
+ ] });
48559
48689
  };
48560
48690
  const PR_STATUS_COLORS$1 = {
48561
48691
  added: "#22c55e",
@@ -51378,15 +51508,6 @@ const TourPlayer = ({
51378
51508
  setIsAudioPaused(false);
51379
51509
  }
51380
51510
  }, [currentStepIndex, isAutoPlaying]);
51381
- useEffect(() => {
51382
- if (!autoPlayAudio || !isPlaying || !audioUrls || !isAutoPlaying) return;
51383
- const audioUrl = audioUrls.get(currentStep.id);
51384
- if (!audioUrl) return;
51385
- const timer2 = setTimeout(() => {
51386
- playAudio(audioUrl);
51387
- }, 100);
51388
- return () => clearTimeout(timer2);
51389
- }, [currentStep == null ? void 0 : currentStep.id, isPlaying, audioUrls, autoPlayAudio, isAutoPlaying]);
51390
51511
  const playAudio = useCallback((audioUrl) => {
51391
51512
  if (audioElementRef.current) {
51392
51513
  audioElementRef.current.pause();
@@ -51476,6 +51597,15 @@ const TourPlayer = ({
51476
51597
  }
51477
51598
  }
51478
51599
  }, [isAutoPlaying, audioUrls, currentStep.id, stopAudio, playAudio]);
51600
+ useEffect(() => {
51601
+ if (!isAutoPlaying || !isPlaying || !audioUrls) return;
51602
+ const audioUrl = audioUrls.get(currentStep.id);
51603
+ if (!audioUrl) return;
51604
+ const timer2 = setTimeout(() => {
51605
+ playAudio(audioUrl);
51606
+ }, 100);
51607
+ return () => clearTimeout(timer2);
51608
+ }, [currentStep == null ? void 0 : currentStep.id, isPlaying, audioUrls, isAutoPlaying, playAudio]);
51479
51609
  const formatTime = (seconds) => {
51480
51610
  const mins = Math.floor(seconds / 60);
51481
51611
  const secs = Math.floor(seconds % 60);
@@ -51870,10 +52000,11 @@ const TourPlayer = ({
51870
52000
  }
51871
52001
  ),
51872
52002
  /* @__PURE__ */ jsxs("div", { style: { display: "flex", gap: "8px", alignItems: "center" }, children: [
51873
- canAutoPlay && currentStepHasAudio && /* @__PURE__ */ jsxs(
52003
+ hasAudio && /* @__PURE__ */ jsxs(
51874
52004
  "button",
51875
52005
  {
51876
52006
  onClick: toggleAutoPlay,
52007
+ disabled: !currentStepHasAudio,
51877
52008
  style: {
51878
52009
  display: "flex",
51879
52010
  alignItems: "center",
@@ -51885,14 +52016,19 @@ const TourPlayer = ({
51885
52016
  borderRadius: "6px",
51886
52017
  fontSize: theme2.fontSizes[1],
51887
52018
  fontFamily: theme2.fonts.body,
51888
- cursor: "pointer",
52019
+ cursor: currentStepHasAudio ? "pointer" : "not-allowed",
52020
+ opacity: currentStepHasAudio ? 1 : 0.5,
51889
52021
  transition: "all 0.2s"
51890
52022
  },
51891
52023
  onMouseEnter: (e) => {
51892
- e.currentTarget.style.opacity = "0.8";
52024
+ if (currentStepHasAudio) {
52025
+ e.currentTarget.style.opacity = "0.8";
52026
+ }
51893
52027
  },
51894
52028
  onMouseLeave: (e) => {
51895
- e.currentTarget.style.opacity = "1";
52029
+ if (currentStepHasAudio) {
52030
+ e.currentTarget.style.opacity = "1";
52031
+ }
51896
52032
  },
51897
52033
  children: [
51898
52034
  isAutoPlaying ? /* @__PURE__ */ jsx(Pause, { size: 14 }) : /* @__PURE__ */ jsx(Play, { size: 14 }),