Skip to content

Commit

Permalink
Merge branch 'release-10.10.z' into skip-button-focus
Browse files Browse the repository at this point in the history
  • Loading branch information
rlauuzo authored Jan 5, 2025
2 parents 754d14f + e1deddc commit cf72fbb
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 46 deletions.
30 changes: 21 additions & 9 deletions src/apps/dashboard/routes/users/parentalcontrol.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ const UserParentalControl = () => {
const [ userName, setUserName ] = useState('');
const [ parentalRatings, setParentalRatings ] = useState<ParentalRating[]>([]);
const [ unratedItems, setUnratedItems ] = useState<UnratedNamedItem[]>([]);
const [ maxParentalRating, setMaxParentalRating ] = useState<string>();
const [ accessSchedules, setAccessSchedules ] = useState<AccessSchedule[]>([]);
const [ allowedTags, setAllowedTags ] = useState<string[]>([]);
const [ blockedTags, setBlockedTags ] = useState<string[]>([]);
Expand Down Expand Up @@ -163,15 +164,13 @@ const UserParentalControl = () => {
populateRatings(allParentalRatings);

let ratingValue = '';
if (user.Policy?.MaxParentalRating) {
allParentalRatings.forEach(rating => {
if (rating.Value && user.Policy?.MaxParentalRating && user.Policy.MaxParentalRating >= rating.Value) {
ratingValue = `${rating.Value}`;
}
});
}
allParentalRatings.forEach(rating => {
if (rating.Value != null && user.Policy?.MaxParentalRating != null && user.Policy.MaxParentalRating >= rating.Value) {
ratingValue = `${rating.Value}`;
}
});

(page.querySelector('#selectMaxParentalRating') as HTMLSelectElement).value = String(ratingValue);
setMaxParentalRating(ratingValue);

if (user.Policy?.IsAdministrator) {
(page.querySelector('.accessScheduleSection') as HTMLDivElement).classList.add('hide');
Expand Down Expand Up @@ -329,11 +328,24 @@ const UserParentalControl = () => {
};
}, [setAllowedTags, setBlockedTags, loadData, userId]);

useEffect(() => {
const page = element.current;

if (!page) {
console.error('[userparentalcontrol] Unexpected null page reference');
return;
}

(page.querySelector('#selectMaxParentalRating') as HTMLSelectElement).value = String(maxParentalRating);
}, [maxParentalRating, parentalRatings]);

const optionMaxParentalRating = () => {
let content = '';
content += '<option value=\'\'></option>';
for (const rating of parentalRatings) {
content += `<option value='${rating.Value}'>${escapeHTML(rating.Name)}</option>`;
if (rating.Value != null) {
content += `<option value='${rating.Value}'>${escapeHTML(rating.Name)}</option>`;
}
}
return content;
};
Expand Down
50 changes: 26 additions & 24 deletions src/components/dialogHelper/dialogHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ function tryRemoveElement(elem) {
}
}

function DialogHashHandler(dlg, hash, resolve, dlgOptions) {
function DialogHashHandler(dlg, hash, resolve) {
const self = this;
self.originalUrl = window.location.href;
const activeElement = document.activeElement;
Expand Down Expand Up @@ -158,7 +158,7 @@ function DialogHashHandler(dlg, hash, resolve, dlgOptions) {

dlg.classList.remove('hide');

addBackdropOverlay(dlg, dlgOptions);
addBackdropOverlay(dlg);

dlg.classList.add('opened');
dlg.dispatchEvent(new CustomEvent('open', {
Expand Down Expand Up @@ -193,7 +193,7 @@ function DialogHashHandler(dlg, hash, resolve, dlgOptions) {
}
}

function addBackdropOverlay(dlg, dlgOptions = {}) {
function addBackdropOverlay(dlg) {
const backdrop = document.createElement('div');
backdrop.classList.add('dialogBackdrop');

Expand All @@ -205,33 +205,35 @@ function addBackdropOverlay(dlg, dlgOptions = {}) {
void backdrop.offsetWidth;
backdrop.classList.add('dialogBackdropOpened');

if (!dlgOptions.preventCloseOnClick) {
dom.addEventListener((dlg.dialogContainer || backdrop), 'click', e => {
if (e.target === dlg.dialogContainer) {
close(dlg);
}
}, {
passive: true
});
}
let clickedElement;

if (!dlgOptions.preventCloseOnRightClick) {
dom.addEventListener((dlg.dialogContainer || backdrop), 'contextmenu', e => {
if (e.target === dlg.dialogContainer) {
// Close the application dialog menu
close(dlg);
// Prevent the default browser context menu from appearing
e.preventDefault();
}
});
}
dom.addEventListener((dlg.dialogContainer || backdrop), 'mousedown', e => {
clickedElement = e.target;
});

dom.addEventListener((dlg.dialogContainer || backdrop), 'click', e => {
if (e.target === dlg.dialogContainer && e.target == clickedElement) {
close(dlg);
}
}, {
passive: true
});

dom.addEventListener((dlg.dialogContainer || backdrop), 'contextmenu', e => {
if (e.target === dlg.dialogContainer) {
// Close the application dialog menu
close(dlg);
// Prevent the default browser context menu from appearing
e.preventDefault();
}
});
}

function isHistoryEnabled(dlg) {
return dlg.getAttribute('data-history') === 'true';
}

export function open(dlg, dlgOptions) {
export function open(dlg) {
if (globalOnOpenCallback) {
globalOnOpenCallback(dlg);
}
Expand All @@ -248,7 +250,7 @@ export function open(dlg, dlgOptions) {
document.body.appendChild(dialogContainer);

return new Promise((resolve) => {
new DialogHashHandler(dlg, `dlg${new Date().getTime()}`, resolve, dlgOptions);
new DialogHashHandler(dlg, `dlg${new Date().getTime()}`, resolve);
});
}

Expand Down
5 changes: 1 addition & 4 deletions src/components/metadataEditor/metadataEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -1099,10 +1099,7 @@ function show(itemId, serverId, resolve) {
centerFocus(dlg.querySelector('.formDialogContent'), false, true);
}

dialogHelper.open(dlg, {
preventCloseOnClick : true,
preventCloseOnRightClick : true
});
dialogHelper.open(dlg);

dlg.addEventListener('close', function () {
if (layoutManager.tv) {
Expand Down
18 changes: 9 additions & 9 deletions src/styles/videoosd.scss
Original file line number Diff line number Diff line change
Expand Up @@ -172,14 +172,8 @@
margin-left: auto;
}

@keyframes spin {
100% {
transform: rotate(360deg);
}
}

.osdMediaStatus .animate {
animation: spin 4s linear infinite;
animation: spin-clockwise 4s linear infinite;
}

@media all and (max-width: 30em) {
Expand Down Expand Up @@ -236,7 +230,7 @@

.primary-icon.spin {
font-size: 76px !important;
animation: spin 2s linear infinite;
animation: spin-counterclockwise 2s linear infinite;
}

.secondary-icon {
Expand Down Expand Up @@ -326,8 +320,14 @@
}
}

@keyframes spin {
@keyframes spin-counterclockwise {
100% {
transform: rotate(-360deg);
}
}

@keyframes spin-clockwise {
100% {
transform: rotate(360deg);
}
}

0 comments on commit cf72fbb

Please sign in to comment.