Skip to content

Commit fb55903

Browse files
Merge pull request #184 from linked-planet/dev
Dev
2 parents 77936ab + fbac802 commit fb55903

File tree

5 files changed

+590
-567
lines changed

5 files changed

+590
-567
lines changed

library/src/components/Tag.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,7 @@ export function TagGroup({
365365
style,
366366
id,
367367
"data-testid": testId,
368+
"data-component": "tag-group",
368369
},
369370
children,
370371
)

library/src/components/timetable/TimeTableRows.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ function renderGroupRows<G extends TimeTableGroup, I extends TimeSlotBooking>(
170170
changedGroupRowsRef,
171171
renderCells,
172172
)
173-
throw new Error("TimeTable - group entry not found")
173+
throw new Error(`TimeTable - group ${g} entry not found`)
174174
}
175175
const nextGroupId = groupEntriesArray[g + 1]?.id ?? null
176176
const previousGroupId = groupEntriesArray[g - 1]?.id ?? null

library/src/components/tour/TourWrapper.tsx

Lines changed: 109 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ export class TourStep {
2323
onPrevious,
2424
}: {
2525
step: TourStepProps
26-
onPrepare?: () => void
27-
onInit?: () => void
28-
onExit?: () => void
29-
onPrevious?: () => void
26+
onPrepare?: () => void | Promise<void>
27+
onInit?: () => void | Promise<void>
28+
onExit?: () => void | Promise<void>
29+
onPrevious?: () => void | Promise<void>
3030
}) {
3131
const content = (
3232
<div className={this.contentClassname}>{step.content}</div>
@@ -48,13 +48,13 @@ export class TourStep {
4848
return this._step
4949
}
5050

51-
onInit?(): void
51+
onInit?(): void | Promise<void>
5252

53-
onPrepare?(): void
53+
onPrepare?(): void | Promise<void>
5454

55-
onExit?(): void
55+
onExit?(): void | Promise<void>
5656

57-
onPrevious?(): void
57+
onPrevious?(): void | Promise<void>
5858
}
5959

6060
export interface TourProps {
@@ -141,93 +141,114 @@ export function Tour({
141141

142142
const _steps = useMemo(() => steps.map((it) => it.step), [steps])
143143

144+
// this is used to prevent multiple callbacks from being called at the same time
145+
const isTransitioning = useRef(false)
146+
144147
const callback = useCallback(
145148
(joyrideState: CallBackProps) => {
146-
const { action, index, type, step } = joyrideState
147-
switch (type) {
148-
case "tour:start":
149-
beforeAll()
150-
isInit.current = true
151-
setStepIndex(0)
152-
break
153-
case "tour:end":
154-
reset()
155-
break
156-
case "step:before":
157-
steps[index]?.onPrepare?.()
158-
break
159-
case "step:after":
160-
steps[index]?.onExit?.()
161-
switch (action) {
162-
case "next":
163-
steps[index + 1]?.onInit?.()
164-
next(1)
165-
break
166-
case "prev":
167-
steps[index]?.onPrevious?.()
168-
steps[index - 1]?.onInit?.()
169-
next(-1)
170-
break
171-
case "skip":
172-
steps[index + 2]?.onInit?.()
173-
next(2)
174-
break
175-
case "close":
176-
reset()
177-
break
178-
case "reset":
179-
reset()
180-
break
181-
case "stop":
149+
(async () => {
150+
if (isTransitioning.current) return
151+
isTransitioning.current = true
152+
const { action, index, type, step } = joyrideState
153+
try {
154+
switch (type) {
155+
case "tour:start":
156+
beforeAll()
157+
isInit.current = true
158+
setStepIndex(0)
159+
await steps[0]?.onInit?.()
160+
break
161+
case "tour:end":
162+
reset()
163+
break
164+
case "step:before":
165+
await (steps[index]?.onPrepare?.())
166+
break
167+
case "step:after":
168+
await steps[index]?.onExit?.()
169+
switch (action) {
170+
case "next":
171+
await steps[index + 1]?.onInit?.()
172+
next(1)
173+
break
174+
case "prev":
175+
await steps[index]?.onPrevious?.()
176+
await steps[index - 1]?.onInit?.()
177+
next(-1)
178+
break
179+
case "skip":
180+
await steps[index + 2]?.onInit?.()
181+
next(2)
182+
break
183+
case "close":
184+
reset()
185+
break
186+
case "reset":
187+
reset()
188+
break
189+
case "stop":
190+
reset()
191+
break
192+
default:
193+
break
194+
}
195+
break
196+
case "error:target_not_found":
197+
if (skipOnError) {
198+
console.info("Skipped", joyrideState)
199+
if (showInfoAndError) {
200+
Toast.showInformationToastFlag({
201+
title: "Tour-Info",
202+
description: `Ein Step [${steps[index].step?.title ?? "Unbekannt"}] wurde übersprungen, das Element ${steps[index].step.target} wurde nicht gefunden.`,
203+
})
204+
}
205+
next(action === "next" ? 1 : -1)
206+
} else {
207+
if (showInfoAndError) {
208+
Toast.showErrorToastFlag({
209+
title: "Tour-Fehler",
210+
description: `Fehler bei Step [${steps[index].step?.title ?? "Unbekannt"}]. Das Element ${step.target} wurde nicht gefunden.`,
211+
})
212+
}
182213
reset()
183-
break
184-
default:
185-
break
186-
}
187-
break
188-
case "error:target_not_found":
189-
if (skipOnError) {
190-
console.info("Skipped", joyrideState)
191-
if (showInfoAndError) {
192-
Toast.showInformationToastFlag({
193-
title: "Tour-Info",
194-
description: `Ein Step [${steps[index].step?.title ?? "Unbekannt"}] wurde übersprungen, das Element ${steps[index].step.target} wurde nicht gefunden.`,
195-
})
196214
}
197-
next(action === "next" ? 1 : -1)
198-
} else {
199-
if (showInfoAndError) {
200-
Toast.showErrorToastFlag({
201-
title: "Tour-Fehler",
202-
description: `Fehler bei Step [${steps[index].step?.title ?? "Unbekannt"}]. Das Element ${step.target} wurde nicht gefunden.`,
203-
})
215+
break
216+
case "error":
217+
if (skipOnError) {
218+
if (showInfoAndError) {
219+
Toast.showInformationToastFlag({
220+
title: "Tour-Info",
221+
description: `Ein Step [${steps[index].step?.title ?? "Unbekannt"}] wurde übersprungen.`,
222+
})
223+
}
224+
next(action === "next" ? 1 : -1)
225+
} else {
226+
if (showInfoAndError) {
227+
Toast.showErrorToastFlag({
228+
title: "Tour-Fehler",
229+
description: `Fehler bei Step [${steps[index].step?.title ?? "Unbekannt"}].`,
230+
})
231+
}
232+
reset()
204233
}
205-
reset()
234+
break
235+
236+
default:
237+
break
206238
}
207-
break
208-
case "error":
209-
if (skipOnError) {
210-
if (showInfoAndError) {
211-
Toast.showInformationToastFlag({
212-
title: "Tour-Info",
213-
description: `Ein Step [${steps[index].step?.title ?? "Unbekannt"}] wurde übersprungen.`,
214-
})
215-
}
216-
next(action === "next" ? 1 : -1)
217-
} else {
218-
if (showInfoAndError) {
219-
Toast.showErrorToastFlag({
220-
title: "Tour-Fehler",
221-
description: `Fehler bei Step [${steps[index].step?.title ?? "Unbekannt"}].`,
222-
})
223-
}
224-
reset()
239+
} catch (e) {
240+
console.error("Joyride Tour - callback error", e)
241+
if (showInfoAndError) {
242+
Toast.showErrorToastFlag({
243+
title: "Tour-Fehler",
244+
description: "Unerwarteter Fehler im Tour-Callback.",
245+
})
225246
}
226-
break
227-
228-
default:
229-
break
230-
}
247+
reset()
248+
} finally {
249+
isTransitioning.current = false
250+
}
251+
})()
231252
},
232253
[beforeAll, reset, next, showInfoAndError, skipOnError, steps],
233254
)

package.json

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@
8383
]
8484
},
8585
"dependencies": {
86-
"@base-ui-components/react": "1.0.0-beta.2",
86+
"@base-ui-components/react": "1.0.0-beta.3",
8787
"@emotion/cache": "^11.14.0",
8888
"@emotion/css": "^11.13.5",
8989
"@emotion/react": "^11.14.0",
@@ -108,7 +108,7 @@
108108
"highlight.js": "^11.11.1",
109109
"intl-messageformat": "^10.7.16",
110110
"lowlight": "^3.3.0",
111-
"lucide-react": "^0.542.0",
111+
"lucide-react": "^0.544.0",
112112
"mime-types": "^3.0.1",
113113
"motion": "^12.23.12",
114114
"postcss": "^8.5.6",
@@ -123,29 +123,29 @@
123123
"use-resize-observer": "^9.1.0"
124124
},
125125
"devDependencies": {
126-
"@atlaskit/atlassian-navigation": "^5.3.16",
127-
"@atlaskit/css-reset": "^7.3.5",
128-
"@atlaskit/table-tree": "^12.2.7",
129-
"@atlaskit/theme": "^20.0.1",
130-
"@atlaskit/tokens": "^6.3.0",
126+
"@atlaskit/atlassian-navigation": "^5.3.17",
127+
"@atlaskit/css-reset": "^7.3.6",
128+
"@atlaskit/table-tree": "^12.2.8",
129+
"@atlaskit/theme": "^21.0.0",
130+
"@atlaskit/tokens": "^6.3.1",
131131
"@babel/generator": "^7.28.3",
132-
"@babel/parser": "^7.28.3",
133-
"@babel/traverse": "^7.28.3",
134-
"@babel/types": "^7.28.2",
135-
"@biomejs/biome": "^2.2.3",
132+
"@babel/parser": "^7.28.4",
133+
"@babel/traverse": "^7.28.4",
134+
"@babel/types": "^7.28.4",
135+
"@biomejs/biome": "^2.2.4",
136136
"@formatjs/cli": "^6.7.2",
137137
"@hello-pangea/dnd": "^18.0.1",
138138
"@monaco-editor/react": "^4.7.0",
139139
"@tailwindcss/vite": "^4.1.13",
140-
"@tanstack/react-query": "^5.87.0",
140+
"@tanstack/react-query": "^5.87.4",
141141
"@testing-library/jest-dom": "^6.8.0",
142142
"@total-typescript/ts-reset": "^0.6.1",
143143
"@types/node": "^24.3.1",
144144
"@types/react": "^18.3.24",
145145
"@types/react-dom": "^18.3.7",
146146
"@types/react-transition-group": "^4.4.12",
147147
"@vitejs/plugin-react-swc": "^4.0.1",
148-
"cypress": "^15.1.0",
148+
"cypress": "^15.2.0",
149149
"cypress-terminal-report": "^7.2.1",
150150
"dayjs": "^1.11.18",
151151
"eslint-plugin-react-refresh": "^0.4.20",
@@ -155,15 +155,15 @@
155155
"react-dom": "^18.3.1",
156156
"rollup": "~4.21.3",
157157
"rollup-plugin-polyfill-node": "^0.13.0",
158-
"stylelint": "^16.23.1",
158+
"stylelint": "^16.24.0",
159159
"stylelint-config-standard": "^39.0.0",
160160
"stylelint-config-tailwindcss": "^1.0.0",
161161
"stylelint-order": "^7.0.0",
162162
"tailwind-merge": "^3.3.1",
163163
"tailwindcss": "^4.1.13",
164164
"typescript": "^5.9.2",
165165
"typescript-plugin-css-modules": "^5.2.0",
166-
"vite": "^7.1.4",
166+
"vite": "^7.1.5",
167167
"vite-plugin-dts": "^4.5.4",
168168
"vitest": "^3.2.4"
169169
},

0 commit comments

Comments
 (0)