Skip to content

Commit f4a3ba5

Browse files
authored
Merge pull request #2112 from themeum/dev
v3.8.1 merged to master
2 parents df1b86b + 9ab43fe commit f4a3ba5

File tree

78 files changed

+2573
-2032
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+2573
-2032
lines changed

.github/workflows/phpstan.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: PHPStan
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
phpstan:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v3
10+
11+
- name: Setup PHP
12+
uses: shivammathur/setup-php@v2
13+
with:
14+
php-version: 8.1
15+
tools: composer
16+
17+
- name: Install dependencies
18+
run: composer install --no-progress --prefer-dist
19+
20+
- name: Run PHPStan on changed files
21+
run: |
22+
CHANGED_FILES=$(git diff --name-only origin/${{ github.base_ref }}...HEAD | grep '\.php$' || true)
23+
if [ -n "$CHANGED_FILES" ]; then
24+
vendor/bin/phpstan analyse $CHANGED_FILES
25+
else
26+
echo "No PHP files changed, skipping PHPStan."
27+
fi

assets/react/front/course/_spotlight-quiz.js

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
window.jQuery(document).ready($ => {
22
const { __ } = window.wp.i18n;
33

4+
// Currently only these types of question supports answer reveal mode.
5+
const revealModeSupportedQuestions = ['true_false', 'single_choice', 'multiple_choice'];
6+
47
let quiz_options = _tutorobject.quiz_options
58
let interactions = new Map();
69

@@ -271,7 +274,7 @@ window.jQuery(document).ready($ => {
271274
* @since 1.8.10
272275
*/
273276

274-
if (is_reveal_mode()) {
277+
if (is_reveal_mode() && revealModeSupportedQuestions.includes($question_wrap.data('question-type'))) {
275278
setTimeout(() => {
276279
$('.quiz-attempt-single-question').hide();
277280
$nextQuestion.show();
@@ -346,11 +349,16 @@ window.jQuery(document).ready($ => {
346349

347350
let quiz_validated = true;
348351
let feedback_validated = true;
352+
let hasAnyRevealModeQuestion = false;
349353

350354
if ($questions_wrap.length) {
351355
$questions_wrap.each(function (index, question) {
352356
quiz_validated = tutor_quiz_validation($(question), quiz_validated);
353357
feedback_validated = feedback_response($(question));
358+
359+
if (revealModeSupportedQuestions.includes($(question).data('question-type'))) {
360+
hasAnyRevealModeQuestion = true;
361+
}
354362
});
355363
}
356364
//If auto submit option is enabled after time expire submit current progress
@@ -361,7 +369,7 @@ window.jQuery(document).ready($ => {
361369

362370
if (quiz_validated && feedback_validated) {
363371
let wait = 500
364-
if (is_reveal_mode() && get_quiz_layout_view() === 'question_below_each_other') {
372+
if (is_reveal_mode() && get_quiz_layout_view() === 'question_below_each_other' && hasAnyRevealModeQuestion) {
365373
wait = get_reveal_wait_time()
366374
submitted_form.find(':submit').addClass('is-loading').attr('disabled', 'disabled')
367375
}
@@ -376,9 +384,12 @@ window.jQuery(document).ready($ => {
376384

377385
$(".tutor-quiz-submit-btn").click(function (event) {
378386
event.preventDefault();
387+
var $questions_wrap = $('.quiz-attempt-single-question');
379388

380-
if (is_reveal_mode()) {
381-
var $questions_wrap = $('.quiz-attempt-single-question');
389+
const lastQuestion = $questions_wrap[$questions_wrap.length - 1];
390+
const lastQuestionType = $(lastQuestion).data('question-type');
391+
392+
if (is_reveal_mode() && revealModeSupportedQuestions.includes(lastQuestionType)) {
382393
var validated = true;
383394
if ($questions_wrap.length) {
384395
$questions_wrap.each(function (index, question) {

assets/react/v3/entries/addon-list/components/AddonCard.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
11
import { css } from '@emotion/react';
2+
import { __ } from '@wordpress/i18n';
3+
import { useRef, useState } from 'react';
4+
25
import SVGIcon from '@TutorShared/atoms/SVGIcon';
36
import Switch from '@TutorShared/atoms/Switch';
47
import { useToast } from '@TutorShared/atoms/Toast';
58
import Tooltip from '@TutorShared/atoms/Tooltip';
9+
610
import { tutorConfig } from '@TutorShared/config/config';
711
import { borderRadius, colorTokens, fontSize, fontWeight, lineHeight, spacing } from '@TutorShared/config/styles';
812
import Show from '@TutorShared/controls/Show';
913
import { AnimationType } from '@TutorShared/hooks/useAnimation';
14+
import { POPOVER_PLACEMENTS } from '@TutorShared/hooks/usePortalPopover';
1015
import Popover from '@TutorShared/molecules/Popover';
11-
import { __ } from '@wordpress/i18n';
12-
import { useRef, useState } from 'react';
16+
1317
import { useAddonContext } from '../contexts/addon-context';
1418
import { useEnableDisableAddon, type Addon } from '../services/addons';
1519
import InstallationPopover from './InstallationPopover';
@@ -125,8 +129,7 @@ function AddonCard({ addon }: { addon: Addon }) {
125129
closePopover={() => setIsOpen(false)}
126130
animationType={AnimationType.slideUp}
127131
closeOnEscape={false}
128-
arrow="auto"
129-
hideArrow
132+
placement={POPOVER_PLACEMENTS.BOTTOM}
130133
>
131134
<Show
132135
when={!addon.required_settings}
@@ -172,7 +175,6 @@ const styles = {
172175
173176
img {
174177
max-width: 100%;
175-
border-radius: ${borderRadius.circle};
176178
}
177179
`,
178180
addonAction: css`

assets/react/v3/entries/addon-list/components/InstallationPopover.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,6 @@ const styles = {
200200
height: 32px;
201201
width: 32px;
202202
overflow: hidden;
203-
border-radius: ${borderRadius.circle};
204203
205204
img {
206205
max-width: 100%;

assets/react/v3/entries/course-builder/components/additional/LiveClass.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import ZoomMeetingForm from './meeting/ZoomMeetingForm';
3131
import liveClassPro2x from '@SharedImages/pro-placeholders/live-class-2x.webp';
3232
import liveClassPro from '@SharedImages/pro-placeholders/live-class.webp';
3333
import { withVisibilityControl } from '@TutorShared/hoc/withVisibilityControl';
34+
import { POPOVER_PLACEMENTS } from '@TutorShared/hooks/usePortalPopover';
3435

3536
const isTutorPro = !!tutorConfig.tutor_pro_url;
3637
const isZoomAddonEnabled = isAddonEnabled(Addons.TUTOR_ZOOM_INTEGRATION);
@@ -173,8 +174,7 @@ const LiveClass = () => {
173174
closePopover={noop}
174175
animationType={AnimationType.slideUp}
175176
closeOnEscape={false}
176-
arrow={CURRENT_VIEWPORT.isAboveMobile ? 'auto' : 'absoluteCenter'}
177-
hideArrow
177+
placement={CURRENT_VIEWPORT.isAboveMobile ? POPOVER_PLACEMENTS.BOTTOM : POPOVER_PLACEMENTS.ABSOLUTE_CENTER}
178178
>
179179
<ZoomMeetingForm
180180
data={null}
@@ -190,8 +190,8 @@ const LiveClass = () => {
190190
closePopover={noop}
191191
animationType={AnimationType.slideUp}
192192
closeOnEscape={false}
193-
arrow={CURRENT_VIEWPORT.isAboveMobile ? 'auto' : 'absoluteCenter'}
194-
hideArrow
193+
placement={CURRENT_VIEWPORT.isAboveMobile ? POPOVER_PLACEMENTS.BOTTOM : POPOVER_PLACEMENTS.ABSOLUTE_CENTER}
194+
arrow={false}
195195
>
196196
<GoogleMeetForm
197197
data={null}

assets/react/v3/entries/course-builder/components/additional/meeting/GoogleMeetCard.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import { DateFormats } from '@TutorShared/config/constants';
1717
import { AnimationType } from '@TutorShared/hooks/useAnimation';
1818
import { styleUtils } from '@TutorShared/utils/style-utils';
1919
import { noop } from '@TutorShared/utils/util';
20+
2021
import GoogleMeetForm from './GoogleMeetForm';
2122

2223
interface GoogleMeetMeetingCardProps {
@@ -147,8 +148,6 @@ const GoogleMeetMeetingCard = ({ data, topicId }: GoogleMeetMeetingCardProps) =>
147148
}
148149
message={__('Are you sure you want to delete this meeting? This cannot be undone.', 'tutor')}
149150
animationType={AnimationType.slideUp}
150-
arrow="auto"
151-
hideArrow
152151
isLoading={deleteGoogleMeetMeetingMutation.isPending}
153152
confirmButton={{
154153
text: __('Delete', 'tutor'),

assets/react/v3/entries/course-builder/components/additional/meeting/ZoomMeetingCard.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import { DateFormats } from '@TutorShared/config/constants';
1818
import { AnimationType } from '@TutorShared/hooks/useAnimation';
1919
import { styleUtils } from '@TutorShared/utils/style-utils';
2020
import { noop } from '@TutorShared/utils/util';
21+
2122
import ZoomMeetingForm from './ZoomMeetingForm';
2223

2324
interface ZoomMeetingCardProps {
@@ -165,8 +166,6 @@ const ZoomMeetingCard = ({ data, meetingHost, topicId }: ZoomMeetingCardProps) =
165166
}
166167
message={__('Are you sure you want to delete this meeting? This cannot be undone.', 'tutor')}
167168
animationType={AnimationType.slideUp}
168-
arrow="auto"
169-
hideArrow
170169
isLoading={deleteZoomMeetingMutation.isPending}
171170
confirmButton={{
172171
text: __('Delete', 'tutor'),

assets/react/v3/entries/course-builder/components/curriculum/Question.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,9 +165,7 @@ const Question = ({ question, index, onDuplicateQuestion, onRemoveQuestion, isOv
165165
dotsOrientation="vertical"
166166
maxWidth={isTutorPro ? '150px' : '160px'}
167167
isInverse
168-
arrowPosition="auto"
169168
size="small"
170-
hideArrow
171169
data-three-dots
172170
>
173171
{!validationError && contentType !== 'tutor_h5p_quiz' && (

assets/react/v3/entries/course-builder/components/curriculum/QuestionList.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ import { typography } from '@TutorShared/config/typography';
3636
import For from '@TutorShared/controls/For';
3737
import Show from '@TutorShared/controls/Show';
3838
import { AnimationType } from '@TutorShared/hooks/useAnimation';
39+
import { POPOVER_PLACEMENTS } from '@TutorShared/hooks/usePortalPopover';
3940
import { type IconCollection } from '@TutorShared/icons/types';
4041
import { convertedQuestion, validateQuizQuestion } from '@TutorShared/utils/quiz';
4142
import { styleUtils } from '@TutorShared/utils/style-utils';
@@ -408,11 +409,18 @@ const QuestionList = ({ isEditing }: { isEditing: boolean }) => {
408409
<Popover
409410
gap={4}
410411
maxWidth={'240px'}
411-
arrow={CURRENT_VIEWPORT.isAboveTablet ? 'top' : CURRENT_VIEWPORT.isAboveMobile ? 'right' : 'absoluteCenter'}
412+
placement={
413+
CURRENT_VIEWPORT.isAboveTablet
414+
? POPOVER_PLACEMENTS.BOTTOM
415+
: CURRENT_VIEWPORT.isAboveMobile
416+
? POPOVER_PLACEMENTS.LEFT
417+
: POPOVER_PLACEMENTS.ABSOLUTE_CENTER
418+
}
412419
triggerRef={addButtonRef}
413420
isOpen={isOpen}
414421
closePopover={() => setIsOpen(false)}
415422
animationType={AnimationType.slideUp}
423+
arrow={true}
416424
>
417425
<div css={styles.questionOptionsWrapper}>
418426
<span css={styles.questionTypeOptionsTitle}>{__('Select Question Type', 'tutor')}</span>

assets/react/v3/entries/course-builder/components/curriculum/TopicContent.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ import { borderRadius, Breakpoint, colorTokens, spacing } from '@TutorShared/con
3535
import { typography } from '@TutorShared/config/typography';
3636
import Show from '@TutorShared/controls/Show';
3737
import { AnimationType } from '@TutorShared/hooks/useAnimation';
38+
import { POPOVER_PLACEMENTS } from '@TutorShared/hooks/usePortalPopover';
3839
import { type IconCollection } from '@TutorShared/icons/types';
3940
import { styleUtils } from '@TutorShared/utils/style-utils';
4041
import type { ID, TopicContentType } from '@TutorShared/utils/types';
@@ -365,8 +366,7 @@ const TopicContent = ({ type, topic, content, listeners, isDragging = false, onC
365366
closePopover={noop}
366367
maxWidth="306px"
367368
closeOnEscape={false}
368-
arrow={CURRENT_VIEWPORT.isAboveMobile ? 'auto' : 'absoluteCenter'}
369-
hideArrow
369+
placement={CURRENT_VIEWPORT.isAboveMobile ? POPOVER_PLACEMENTS.BOTTOM : POPOVER_PLACEMENTS.ABSOLUTE_CENTER}
370370
>
371371
<Show when={meetingType === 'tutor_zoom_meeting'}>
372372
<ZoomMeetingForm
@@ -402,8 +402,6 @@ const TopicContent = ({ type, topic, content, listeners, isDragging = false, onC
402402
__('Are you sure you want to delete this content from your course? This cannot be undone.', 'tutor')
403403
}
404404
animationType={AnimationType.slideUp}
405-
arrow="auto"
406-
hideArrow
407405
confirmButton={{
408406
text: __('Delete', 'tutor'),
409407
variant: 'text',

0 commit comments

Comments
 (0)