Skip to content

Commit c2afb6c

Browse files
authored
fix(apps/frontend-pwa): handle iframe differently for pwa login message (#5022)
1 parent dbf1577 commit c2afb6c

9 files changed

Lines changed: 183 additions & 128 deletions

File tree

GAMIFICATION_IMPROVEMENTS.md

Lines changed: 66 additions & 31 deletions
Large diffs are not rendered by default.

GAMIFICATION_RESEARCH.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -100,14 +100,14 @@ Yet narrative remains the most neglected category. Palomino and colleagues (2019
100100

101101
The table below summarizes the major meta-analyses, representing the strongest available evidence:
102102

103-
| Study | Year | Studies included | Participants | Effect size (Hedges' g) | Outcome focus |
104-
|-------|------|-----------------|-------------|------------------------|---------------|
105-
| Sailer & Homner | 2020 | 19/16/9 | 1,686–2,246 | 0.49 / 0.36 / 0.25 | Cognitive / Motivational / Behavioral |
106-
| Bai, Hew & Huang | 2020 | 30 | 3,202 | 0.504 | Academic performance |
107-
| Huang et al. | 2020 | 30 | 3,083 | 0.464 | Learning outcomes |
108-
| Li, Ma & Shi | 2023 | 41 | 5,071+ | 0.822 | Learning outcomes |
109-
| Zeng et al. | 2024 | 22 || 0.782 | Academic performance |
110-
| Li et al. | 2024 | 35 | 2,500 | 0.257 | Intrinsic motivation |
103+
| Study | Year | Studies included | Participants | Effect size (Hedges' g) | Outcome focus |
104+
| ---------------- | ---- | ---------------- | ------------ | ----------------------- | ------------------------------------- |
105+
| Sailer & Homner | 2020 | 19/16/9 | 1,686–2,246 | 0.49 / 0.36 / 0.25 | Cognitive / Motivational / Behavioral |
106+
| Bai, Hew & Huang | 2020 | 30 | 3,202 | 0.504 | Academic performance |
107+
| Huang et al. | 2020 | 30 | 3,083 | 0.464 | Learning outcomes |
108+
| Li, Ma & Shi | 2023 | 41 | 5,071+ | 0.822 | Learning outcomes |
109+
| Zeng et al. | 2024 | 22 | | 0.782 | Academic performance |
110+
| Li et al. | 2024 | 35 | 2,500 | 0.257 | Intrinsic motivation |
111111

112112
**Cognitive learning outcomes** show the most robust effects (g = 0.49, stable under high methodological rigor in Sailer & Homner's analysis). **Motivational** and **behavioral** outcomes show positive but less stable effects when restricted to high-rigor studies. **Intrinsic motivation** specifically shows a smaller effect (g = 0.257), which aligns with the theoretical concern that many implementations rely on extrinsic rather than intrinsic mechanisms.
113113

GAMIFICATION_STREAKS.md

Lines changed: 42 additions & 42 deletions
Large diffs are not rendered by default.

apps/frontend-pwa/src/components/common/Header.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,8 @@ function Header({
206206
: []),
207207
...((!router.pathname.includes('/session') ||
208208
participant?.role !== UserRole.TemporaryParticipant) &&
209-
process.env.NEXT_PUBLIC_IS_ASSESSMENT !== 'true'
209+
process.env.NEXT_PUBLIC_IS_ASSESSMENT !== 'true' &&
210+
(participant || !pageInFrame)
210211
? [
211212
{
212213
id: 'profileOrLogin',

apps/frontend-pwa/src/components/practiceQuiz/PracticeQuizOverview.tsx

Lines changed: 29 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -44,34 +44,40 @@ function PracticeQuizOverview({
4444
const router = useRouter()
4545
const { data } = useQuery(SelfDocument, { skip: previewOnly })
4646

47+
const pageInFrame =
48+
global?.window &&
49+
global?.window?.location !== global?.window?.parent.location
50+
4751
return (
4852
<div className="flex flex-col space-y-4">
4953
{!previewOnly &&
5054
(!data?.self || data.self.role === UserRole.TemporaryParticipant) && (
5155
<UserNotification type="warning">
52-
{t.rich('pwa.general.userNotLoggedIn', {
53-
login: (text) => (
54-
<Button
55-
basic
56-
className={{
57-
root: 'hover:text-primary-100 p-0! text-sm font-bold hover:bg-transparent',
58-
}}
59-
onClick={() =>
60-
router.push(
61-
`/login?expired=true&redirect_to=${
62-
encodeURIComponent(
63-
window?.location?.pathname +
64-
(window?.location?.search ?? '')
65-
) ?? '/'
66-
}`
67-
)
68-
}
69-
data={{ cy: 'login-to-student-login-collect-points' }}
70-
>
71-
{text}
72-
</Button>
73-
),
74-
})}
56+
{pageInFrame
57+
? t('pwa.general.userNotLoggedInFrame')
58+
: t.rich('pwa.general.userNotLoggedIn', {
59+
login: (text) => (
60+
<Button
61+
basic
62+
className={{
63+
root: 'hover:text-primary-100 p-0! text-sm font-bold hover:bg-transparent',
64+
}}
65+
onClick={() =>
66+
router.push(
67+
`/login?expired=true&redirect_to=${
68+
encodeURIComponent(
69+
window?.location?.pathname +
70+
(window?.location?.search ?? '')
71+
) ?? '/'
72+
}`
73+
)
74+
}
75+
data={{ cy: 'login-to-student-login-collect-points' }}
76+
>
77+
{text}
78+
</Button>
79+
),
80+
})}
7581
</UserNotification>
7682
)}
7783

apps/frontend-pwa/src/pages/course/[courseId]/microLearnings/[id]/index.tsx

Lines changed: 29 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ function MicrolearningIntroduction({
3838
const t = useTranslations()
3939
const router = useRouter()
4040

41+
const pageInFrame =
42+
global?.window &&
43+
global?.window?.location !== global?.window?.parent.location
44+
4145
useParticipantToken({
4246
participantToken,
4347
cookiesAvailable,
@@ -103,29 +107,31 @@ function MicrolearningIntroduction({
103107
/>
104108
) : (
105109
<UserNotification type="warning" className={{ root: 'mb-4' }}>
106-
{t.rich('pwa.general.userNotLoggedIn', {
107-
login: (text) => (
108-
<Button
109-
basic
110-
className={{
111-
root: 'hover:text-primary-100 p-0! font-bold hover:bg-transparent',
112-
}}
113-
onClick={() =>
114-
router.push(
115-
`/login?expired=true&redirect_to=${
116-
encodeURIComponent(
117-
window?.location?.pathname +
118-
(window?.location?.search ?? '')
119-
) ?? '/'
120-
}`
121-
)
122-
}
123-
data={{ cy: 'login-to-start-microlearning' }}
124-
>
125-
<Button.Label>{text}</Button.Label>
126-
</Button>
127-
),
128-
})}
110+
{pageInFrame
111+
? t('pwa.general.userNotLoggedInFrame')
112+
: t.rich('pwa.general.userNotLoggedIn', {
113+
login: (text) => (
114+
<Button
115+
basic
116+
className={{
117+
root: 'hover:text-primary-100 p-0! font-bold hover:bg-transparent',
118+
}}
119+
onClick={() =>
120+
router.push(
121+
`/login?expired=true&redirect_to=${
122+
encodeURIComponent(
123+
window?.location?.pathname +
124+
(window?.location?.search ?? '')
125+
) ?? '/'
126+
}`
127+
)
128+
}
129+
data={{ cy: 'login-to-start-microlearning' }}
130+
>
131+
<Button.Label>{text}</Button.Label>
132+
</Button>
133+
),
134+
})}
129135
</UserNotification>
130136
))}
131137
{microLearningPast ? (

packages/i18n/messages/de.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -536,6 +536,8 @@ export default {
536536
liveQA: 'Live-Q&A',
537537
userNotLoggedIn:
538538
'Sie sind aktuell nicht eingeloggt. <login>Loggen Sie sich bitte ein</login>, falls Sie Punkte und XP sammeln und eine Übersicht über Ihren Lernfortschritt sehen möchten.',
539+
userNotLoggedInFrame:
540+
'Sie sind aktuell nicht eingeloggt. Bitte loggen Sie sich über die Plattform ein, in der diese Seite eingebettet ist, falls Sie Punkte und XP sammeln und eine Übersicht über Ihren Lernfortschritt sehen möchten.',
539541
noLiveQuizzesActive: 'Keine Live Quizzes aktiv.',
540542
activeLiveQuizzesBy: 'Aktive Live Quizzes von {name}',
541543
activeLiveQuizzesInCourse: 'Aktive Live Quizzes in {name}',

packages/i18n/messages/en.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -534,6 +534,8 @@ export default {
534534
liveQA: 'Live-Q&A',
535535
userNotLoggedIn:
536536
'You are currently not logged in. <login>Please log in</login> if you want to collect points and XP and see an overview of your learning progress.',
537+
userNotLoggedInFrame:
538+
'You are currently not logged in. Please log in through the platform embedding this page if you want to collect points and XP and see an overview of your learning progress.',
537539
noLiveQuizzesActive: 'No live quizzes active.',
538540
activeLiveQuizzesBy: 'Active live quizzes by {name}',
539541
activeLiveQuizzesInCourse: 'Active live quizzes in {name}',

util/embedded.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<iframe
2+
src="https://pwa.klicker.com/course/7c12e44e-d083-4acf-845e-4c34aaff6b49/practiceQuizzes/4214338b-c5af-4ff7-84f9-ae5a139d6e5b"
3+
/>

0 commit comments

Comments
 (0)