mirror of
https://github.com/BetterSEQTA/BetterSEQTA-Plus.git
synced 2026-12-06 19:56:45 +10:30
feat: minor fixes
This commit is contained in:
1 parent
6868964366
commit
95908baa8e
1 file changed
+13
-12
@@ -14,7 +14,7 @@ import {
|
|||||||
|
|
||||||
const STYLE_ID = "bsplus-timetable-classmates-popup-styles";
|
const STYLE_ID = "bsplus-timetable-classmates-popup-styles";
|
||||||
const CLASSMATES_VIDEO_URL =
|
const CLASSMATES_VIDEO_URL =
|
||||||
"https://raw.githubusercontent.com/BetterSEQTA/BetterSEQTA-Plus/main/src/resources/timetable-classmates-video.webm";
|
"https://raw.githubusercontent.com/BetterSEQTA/BetterSEQTA-Plus/refs/heads/main/src/resources/timetable-classmates.webm";
|
||||||
|
|
||||||
function ensurePopupStyles(): void {
|
function ensurePopupStyles(): void {
|
||||||
if (document.getElementById(STYLE_ID)) return;
|
if (document.getElementById(STYLE_ID)) return;
|
||||||
@@ -26,6 +26,8 @@ function ensurePopupStyles(): void {
|
|||||||
|
|
||||||
type ConsentPopupOptions = {
|
type ConsentPopupOptions = {
|
||||||
onDismiss?: () => void;
|
onDismiss?: () => void;
|
||||||
|
/** Fires once the popup shell is ready (Svelte mounted). */
|
||||||
|
onOpened?: () => void;
|
||||||
heroVideo?: boolean;
|
heroVideo?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -76,6 +78,7 @@ function openConsentPopup(
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
options?.onOpened?.();
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -83,22 +86,17 @@ function openConsentPopup(
|
|||||||
export function openTimetableClassmatesOptInPopup(options: {
|
export function openTimetableClassmatesOptInPopup(options: {
|
||||||
onAccepted: () => void | Promise<void>;
|
onAccepted: () => void | Promise<void>;
|
||||||
onDismiss?: () => void;
|
onDismiss?: () => void;
|
||||||
|
/** Clears post–cloud-login resume flag as soon as the modal is shown (one-shot reopen). */
|
||||||
|
onOpened?: () => void;
|
||||||
}): void {
|
}): void {
|
||||||
openConsentPopup(
|
openConsentPopup(
|
||||||
"Timetable classmates",
|
"Timetable classmates",
|
||||||
"Share class lists with opted-in students at your school",
|
"Share class lists with opted-in students at your school",
|
||||||
TimetableClassmatesOptInPopup,
|
TimetableClassmatesOptInPopup,
|
||||||
|
{ onAccepted: options.onAccepted },
|
||||||
{
|
{
|
||||||
onAccepted: async () => {
|
onDismiss: options.onDismiss,
|
||||||
clearResumeOptInAfterCloudLogin();
|
onOpened: options.onOpened,
|
||||||
await options.onAccepted();
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
onDismiss: () => {
|
|
||||||
clearResumeOptInAfterCloudLogin();
|
|
||||||
options.onDismiss?.();
|
|
||||||
},
|
|
||||||
heroVideo: true,
|
heroVideo: true,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
@@ -117,7 +115,10 @@ async function openResumeOptInIfNeeded(): Promise<void> {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
openTimetableClassmatesOptInPopup({ onAccepted: () => {} });
|
openTimetableClassmatesOptInPopup({
|
||||||
|
onAccepted: () => {},
|
||||||
|
onOpened: () => clearResumeOptInAfterCloudLogin(),
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/** After cloud OAuth refreshes the page, reopen opt-in if the user started sign-in from this flow. */
|
/** After cloud OAuth refreshes the page, reopen opt-in if the user started sign-in from this flow. */
|
||||||
|
|||||||
Reference in new issue
Block a user