@industry-theme/file-city-panel 0.3.13 → 0.3.15

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,CAkjChD,CAAC"}
@@ -51351,10 +51351,19 @@ const TourPlayer = ({
51351
51351
  [onInteractiveAction]
51352
51352
  );
51353
51353
  useEffect(() => {
51354
- if (!(actions == null ? void 0 : actions.fetchAudioUrls) || !tourAudioContext) return;
51354
+ if (!(actions == null ? void 0 : actions.fetchAudioUrls)) {
51355
+ console.log("[TourPlayer] No fetchAudioUrls action available");
51356
+ return;
51357
+ }
51358
+ if (!tourAudioContext) {
51359
+ console.log("[TourPlayer] No tour audio context provided");
51360
+ return;
51361
+ }
51362
+ console.log("[TourPlayer] Fetching audio URLs for tour:", tourAudioContext);
51355
51363
  async function loadAudio() {
51356
51364
  try {
51357
51365
  const urls = await actions.fetchAudioUrls(tourAudioContext);
51366
+ console.log("[TourPlayer] Loaded audio URLs:", urls.size, "steps");
51358
51367
  setAudioUrls(urls);
51359
51368
  } catch (error) {
51360
51369
  console.error("[TourPlayer] Failed to fetch audio URLs:", error);
@@ -51378,15 +51387,6 @@ const TourPlayer = ({
51378
51387
  setIsAudioPaused(false);
51379
51388
  }
51380
51389
  }, [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
51390
  const playAudio = useCallback((audioUrl) => {
51391
51391
  if (audioElementRef.current) {
51392
51392
  audioElementRef.current.pause();
@@ -51449,7 +51449,7 @@ const TourPlayer = ({
51449
51449
  });
51450
51450
  }
51451
51451
  }, [isAudioPaused]);
51452
- const handleReadAloud = useCallback(() => {
51452
+ useCallback(() => {
51453
51453
  if (!audioUrls) return;
51454
51454
  const audioUrl = audioUrls.get(currentStep.id);
51455
51455
  if (!audioUrl) return;
@@ -51476,6 +51476,30 @@ const TourPlayer = ({
51476
51476
  }
51477
51477
  }
51478
51478
  }, [isAutoPlaying, audioUrls, currentStep.id, stopAudio, playAudio]);
51479
+ useEffect(() => {
51480
+ if (!isAutoPlaying) {
51481
+ console.log("[TourPlayer] Auto-play disabled");
51482
+ return;
51483
+ }
51484
+ if (!isPlaying) {
51485
+ console.log("[TourPlayer] Tour not playing");
51486
+ return;
51487
+ }
51488
+ if (!audioUrls) {
51489
+ console.log("[TourPlayer] Audio URLs not loaded yet");
51490
+ return;
51491
+ }
51492
+ const audioUrl = audioUrls.get(currentStep.id);
51493
+ if (!audioUrl) {
51494
+ console.log("[TourPlayer] No audio URL for step:", currentStep.id);
51495
+ return;
51496
+ }
51497
+ console.log("[TourPlayer] Auto-playing audio for step:", currentStep.id);
51498
+ const timer2 = setTimeout(() => {
51499
+ playAudio(audioUrl);
51500
+ }, 100);
51501
+ return () => clearTimeout(timer2);
51502
+ }, [currentStep == null ? void 0 : currentStep.id, isPlaying, audioUrls, isAutoPlaying, playAudio]);
51479
51503
  const formatTime = (seconds) => {
51480
51504
  const mins = Math.floor(seconds / 60);
51481
51505
  const secs = Math.floor(seconds % 60);
@@ -51869,38 +51893,76 @@ const TourPlayer = ({
51869
51893
  ]
51870
51894
  }
51871
51895
  ),
51872
- /* @__PURE__ */ jsxs(
51873
- "button",
51874
- {
51875
- onClick: handleExit,
51876
- style: {
51877
- display: "flex",
51878
- alignItems: "center",
51879
- gap: "4px",
51880
- padding: "6px 12px",
51881
- backgroundColor: "transparent",
51882
- color: theme2.colors.textSecondary,
51883
- border: `1px solid ${theme2.colors.border}`,
51884
- borderRadius: "6px",
51885
- fontSize: theme2.fontSizes[1],
51886
- fontFamily: theme2.fonts.body,
51887
- cursor: "pointer",
51888
- transition: "all 0.2s"
51889
- },
51890
- onMouseEnter: (e) => {
51891
- e.currentTarget.style.backgroundColor = theme2.colors.backgroundLight;
51892
- e.currentTarget.style.borderColor = theme2.colors.text;
51893
- },
51894
- onMouseLeave: (e) => {
51895
- e.currentTarget.style.backgroundColor = "transparent";
51896
- e.currentTarget.style.borderColor = theme2.colors.border;
51897
- },
51898
- children: [
51899
- /* @__PURE__ */ jsx(X, { size: 14 }),
51900
- "Exit Tour"
51901
- ]
51902
- }
51903
- )
51896
+ /* @__PURE__ */ jsxs("div", { style: { display: "flex", gap: "8px", alignItems: "center" }, children: [
51897
+ hasAudio && /* @__PURE__ */ jsxs(
51898
+ "button",
51899
+ {
51900
+ onClick: toggleAutoPlay,
51901
+ disabled: !currentStepHasAudio,
51902
+ style: {
51903
+ display: "flex",
51904
+ alignItems: "center",
51905
+ gap: "4px",
51906
+ padding: "6px 12px",
51907
+ backgroundColor: isAutoPlaying ? theme2.colors.primary : "transparent",
51908
+ color: isAutoPlaying ? "#ffffff" : theme2.colors.text,
51909
+ border: `1px solid ${isAutoPlaying ? theme2.colors.primary : theme2.colors.border}`,
51910
+ borderRadius: "6px",
51911
+ fontSize: theme2.fontSizes[1],
51912
+ fontFamily: theme2.fonts.body,
51913
+ cursor: currentStepHasAudio ? "pointer" : "not-allowed",
51914
+ opacity: currentStepHasAudio ? 1 : 0.5,
51915
+ transition: "all 0.2s"
51916
+ },
51917
+ onMouseEnter: (e) => {
51918
+ if (currentStepHasAudio) {
51919
+ e.currentTarget.style.opacity = "0.8";
51920
+ }
51921
+ },
51922
+ onMouseLeave: (e) => {
51923
+ if (currentStepHasAudio) {
51924
+ e.currentTarget.style.opacity = "1";
51925
+ }
51926
+ },
51927
+ children: [
51928
+ isAutoPlaying ? /* @__PURE__ */ jsx(Pause, { size: 14 }) : /* @__PURE__ */ jsx(Play, { size: 14 }),
51929
+ isAutoPlaying ? "Pause" : "Play"
51930
+ ]
51931
+ }
51932
+ ),
51933
+ /* @__PURE__ */ jsxs(
51934
+ "button",
51935
+ {
51936
+ onClick: handleExit,
51937
+ style: {
51938
+ display: "flex",
51939
+ alignItems: "center",
51940
+ gap: "4px",
51941
+ padding: "6px 12px",
51942
+ backgroundColor: "transparent",
51943
+ color: theme2.colors.textSecondary,
51944
+ border: `1px solid ${theme2.colors.border}`,
51945
+ borderRadius: "6px",
51946
+ fontSize: theme2.fontSizes[1],
51947
+ fontFamily: theme2.fonts.body,
51948
+ cursor: "pointer",
51949
+ transition: "all 0.2s"
51950
+ },
51951
+ onMouseEnter: (e) => {
51952
+ e.currentTarget.style.backgroundColor = theme2.colors.backgroundLight;
51953
+ e.currentTarget.style.borderColor = theme2.colors.text;
51954
+ },
51955
+ onMouseLeave: (e) => {
51956
+ e.currentTarget.style.backgroundColor = "transparent";
51957
+ e.currentTarget.style.borderColor = theme2.colors.border;
51958
+ },
51959
+ children: [
51960
+ /* @__PURE__ */ jsx(X, { size: 14 }),
51961
+ "Exit Tour"
51962
+ ]
51963
+ }
51964
+ )
51965
+ ] })
51904
51966
  ]
51905
51967
  }
51906
51968
  ),
@@ -52049,113 +52111,47 @@ const TourPlayer = ({
52049
52111
  ] })
52050
52112
  }
52051
52113
  ),
52052
- currentStepHasAudio && /* @__PURE__ */ jsxs(
52114
+ isAudioPlaying && audioDuration > 0 && /* @__PURE__ */ jsxs(
52053
52115
  "div",
52054
52116
  {
52055
52117
  style: {
52056
- padding: "12px 16px",
52118
+ padding: "8px 16px",
52057
52119
  borderTop: `1px solid ${theme2.colors.border}`,
52058
52120
  flexShrink: 0,
52059
52121
  display: "flex",
52060
- flexDirection: "column",
52122
+ alignItems: "center",
52061
52123
  gap: "8px"
52062
52124
  },
52063
52125
  children: [
52064
- /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: "8px" }, children: [
52065
- /* @__PURE__ */ jsxs(
52066
- "button",
52067
- {
52068
- onClick: handleReadAloud,
52069
- style: {
52070
- display: "flex",
52071
- alignItems: "center",
52072
- gap: "6px",
52073
- padding: "8px 12px",
52074
- backgroundColor: "transparent",
52075
- color: theme2.colors.text,
52076
- border: `1px solid ${theme2.colors.border}`,
52077
- borderRadius: "8px",
52078
- fontSize: theme2.fontSizes[2],
52079
- fontFamily: theme2.fonts.body,
52080
- cursor: "pointer",
52081
- transition: "all 0.2s"
52082
- },
52083
- onMouseEnter: (e) => {
52084
- e.currentTarget.style.backgroundColor = theme2.colors.backgroundLight;
52085
- },
52086
- onMouseLeave: (e) => {
52087
- e.currentTarget.style.backgroundColor = "transparent";
52088
- },
52089
- children: [
52090
- isAudioPlaying && /* @__PURE__ */ jsx(Volume2, { size: 16 }),
52091
- isAudioPaused && /* @__PURE__ */ jsx(VolumeX, { size: 16 }),
52092
- !isAudioPlaying && !isAudioPaused && /* @__PURE__ */ jsx(Volume2, { size: 16 }),
52093
- /* @__PURE__ */ jsx("span", { children: isAudioPlaying ? "Stop" : isAudioPaused ? "Resume" : "Read Aloud" })
52094
- ]
52095
- }
52096
- ),
52097
- canAutoPlay && /* @__PURE__ */ jsxs(
52098
- "button",
52099
- {
52100
- onClick: toggleAutoPlay,
52101
- style: {
52102
- display: "flex",
52103
- alignItems: "center",
52104
- gap: "6px",
52105
- padding: "8px 12px",
52106
- backgroundColor: isAutoPlaying ? theme2.colors.primary : "transparent",
52107
- color: isAutoPlaying ? "#ffffff" : theme2.colors.text,
52108
- border: `1px solid ${isAutoPlaying ? theme2.colors.primary : theme2.colors.border}`,
52109
- borderRadius: "8px",
52110
- fontSize: theme2.fontSizes[2],
52111
- fontFamily: theme2.fonts.body,
52112
- cursor: "pointer",
52113
- transition: "all 0.2s"
52114
- },
52115
- onMouseEnter: (e) => {
52116
- e.currentTarget.style.opacity = "0.8";
52117
- },
52118
- onMouseLeave: (e) => {
52119
- e.currentTarget.style.opacity = "1";
52120
- },
52121
- children: [
52122
- isAutoPlaying ? /* @__PURE__ */ jsx(Pause, { size: 16 }) : /* @__PURE__ */ jsx(Play, { size: 16 }),
52123
- /* @__PURE__ */ jsx("span", { children: isAutoPlaying ? "Stop Auto-Play" : "Start Auto-Play" })
52124
- ]
52125
- }
52126
- )
52127
- ] }),
52128
- isAudioPlaying && audioDuration > 0 && /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: "8px" }, children: [
52129
- /* @__PURE__ */ jsx("span", { style: { fontSize: theme2.fontSizes[1], color: theme2.colors.textSecondary, minWidth: "35px" }, children: formatTime(audioCurrentTime) }),
52130
- /* @__PURE__ */ jsx(
52131
- "div",
52132
- {
52133
- style: {
52134
- flex: 1,
52135
- height: "4px",
52136
- backgroundColor: theme2.colors.backgroundLight,
52137
- borderRadius: "2px",
52138
- overflow: "hidden"
52139
- },
52140
- children: /* @__PURE__ */ jsx(
52141
- "div",
52142
- {
52143
- style: {
52144
- height: "100%",
52145
- width: `${audioCurrentTime / audioDuration * 100}%`,
52146
- backgroundColor: theme2.colors.primary,
52147
- transition: "width 0.1s linear"
52148
- }
52126
+ /* @__PURE__ */ jsx("span", { style: { fontSize: theme2.fontSizes[1], color: theme2.colors.textSecondary, minWidth: "35px" }, children: formatTime(audioCurrentTime) }),
52127
+ /* @__PURE__ */ jsx(
52128
+ "div",
52129
+ {
52130
+ style: {
52131
+ flex: 1,
52132
+ height: "4px",
52133
+ backgroundColor: theme2.colors.backgroundLight,
52134
+ borderRadius: "2px",
52135
+ overflow: "hidden"
52136
+ },
52137
+ children: /* @__PURE__ */ jsx(
52138
+ "div",
52139
+ {
52140
+ style: {
52141
+ height: "100%",
52142
+ width: `${audioCurrentTime / audioDuration * 100}%`,
52143
+ backgroundColor: theme2.colors.primary,
52144
+ transition: "width 0.1s linear"
52149
52145
  }
52150
- )
52151
- }
52152
- ),
52153
- /* @__PURE__ */ jsx("span", { style: { fontSize: theme2.fontSizes[1], color: theme2.colors.textSecondary, minWidth: "35px" }, children: formatTime(audioDuration) })
52154
- ] })
52146
+ }
52147
+ )
52148
+ }
52149
+ ),
52150
+ /* @__PURE__ */ jsx("span", { style: { fontSize: theme2.fontSizes[1], color: theme2.colors.textSecondary, minWidth: "35px" }, children: formatTime(audioDuration) })
52155
52151
  ]
52156
52152
  }
52157
52153
  ),
52158
- /* @__PURE__ */ jsxs(
52154
+ !(isAudioPlaying && position === "top") && /* @__PURE__ */ jsxs(
52159
52155
  "div",
52160
52156
  {
52161
52157
  style: {