mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-06 19:47:04 +03:00
Submission notice now updates when sponsors are added
This commit is contained in:
@@ -133,7 +133,7 @@ class SponsorTimeEditComponent extends React.Component<SponsorTimeEditProps, Spo
|
|||||||
className="sponsorTimeDisplay"
|
className="sponsorTimeDisplay"
|
||||||
onClick={this.toggleEditTime.bind(this)}>
|
onClick={this.toggleEditTime.bind(this)}>
|
||||||
{utils.getFormattedTime(sponsorTime[0], true) +
|
{utils.getFormattedTime(sponsorTime[0], true) +
|
||||||
((sponsorTime.length >= 1) ? " " + chrome.i18n.getMessage("to") + " " + utils.getFormattedTime(sponsorTime[1], true) : "")}
|
((!isNaN(sponsorTime[1])) ? " " + chrome.i18n.getMessage("to") + " " + utils.getFormattedTime(sponsorTime[1], true) : "")}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -149,7 +149,7 @@ class SponsorTimeEditComponent extends React.Component<SponsorTimeEditProps, Spo
|
|||||||
{chrome.i18n.getMessage("delete")}
|
{chrome.i18n.getMessage("delete")}
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
{(sponsorTime.length >= 1) ? (
|
{(!isNaN(sponsorTime[1])) ? (
|
||||||
<span id={"sponsorTimePreviewButton" + this.idSuffix}
|
<span id={"sponsorTimePreviewButton" + this.idSuffix}
|
||||||
className="sponsorTimeEditButton"
|
className="sponsorTimeEditButton"
|
||||||
onClick={this.previewTime.bind(this)}>
|
onClick={this.previewTime.bind(this)}>
|
||||||
@@ -157,7 +157,7 @@ class SponsorTimeEditComponent extends React.Component<SponsorTimeEditProps, Spo
|
|||||||
</span>
|
</span>
|
||||||
): ""}
|
): ""}
|
||||||
|
|
||||||
{(sponsorTime.length >= 1) ? (
|
{(!isNaN(sponsorTime[1])) ? (
|
||||||
<span id={"sponsorTimeEditButton" + this.idSuffix}
|
<span id={"sponsorTimeEditButton" + this.idSuffix}
|
||||||
className="sponsorTimeEditButton"
|
className="sponsorTimeEditButton"
|
||||||
onClick={this.toggleEditTime.bind(this)}>
|
onClick={this.toggleEditTime.bind(this)}>
|
||||||
|
|||||||
@@ -1105,6 +1105,10 @@ function updateSponsorTimesSubmitting() {
|
|||||||
|
|
||||||
// Restart skipping schedule
|
// Restart skipping schedule
|
||||||
startSponsorSchedule();
|
startSponsorSchedule();
|
||||||
|
|
||||||
|
if (submissionNotice !== null) {
|
||||||
|
submissionNotice.update();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -9,7 +9,11 @@ class SubmissionNotice {
|
|||||||
|
|
||||||
callback: () => any;
|
callback: () => any;
|
||||||
|
|
||||||
|
noticeRef: React.MutableRefObject<SubmissionNoticeComponent>;
|
||||||
|
|
||||||
constructor(contentContainer: () => any, callback: () => any) {
|
constructor(contentContainer: () => any, callback: () => any) {
|
||||||
|
this.noticeRef = React.createRef();
|
||||||
|
|
||||||
this.contentContainer = contentContainer;
|
this.contentContainer = contentContainer;
|
||||||
this.callback = callback;
|
this.callback = callback;
|
||||||
|
|
||||||
@@ -38,10 +42,15 @@ class SubmissionNotice {
|
|||||||
ReactDOM.render(
|
ReactDOM.render(
|
||||||
<SubmissionNoticeComponent
|
<SubmissionNoticeComponent
|
||||||
contentContainer={contentContainer}
|
contentContainer={contentContainer}
|
||||||
callback={callback} />,
|
callback={callback}
|
||||||
|
ref={this.noticeRef} />,
|
||||||
noticeElement
|
noticeElement
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
update() {
|
||||||
|
this.noticeRef.current.forceUpdate();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default SubmissionNotice;
|
export default SubmissionNotice;
|
||||||
Reference in New Issue
Block a user