diff --git a/public/_locales b/public/_locales index fcee4620..32c293e8 160000 --- a/public/_locales +++ b/public/_locales @@ -1 +1 @@ -Subproject commit fcee4620b37c91603653df74891cb58fd0381ab7 +Subproject commit 32c293e8617e9be661fc8b19912858340a1df4f1 diff --git a/public/options/options.html b/public/options/options.html index e5333f89..68c9f6fd 100644 --- a/public/options/options.html +++ b/public/options/options.html @@ -329,6 +329,17 @@ + +
+ +
+ + + +
diff --git a/public/popup.css b/public/popup.css index 86e5729b..296d6251 100644 --- a/public/popup.css +++ b/public/popup.css @@ -591,6 +591,8 @@ #sponsorTimesDonateContainer a { color: var(--sb-main-fg-color); text-decoration: none; + + padding-left: 5px; } /* diff --git a/src/components/SponsorTimeEditComponent.tsx b/src/components/SponsorTimeEditComponent.tsx index dac96d16..7994b20a 100644 --- a/src/components/SponsorTimeEditComponent.tsx +++ b/src/components/SponsorTimeEditComponent.tsx @@ -123,6 +123,8 @@ class SponsorTimeEditComponent extends React.Component e.stopPropagation()} onKeyUp={(e) => e.stopPropagation()} @@ -168,7 +170,7 @@ class SponsorTimeEditComponent extends React.Component e.stopPropagation()} onKeyUp={(e) => e.stopPropagation()} @@ -215,7 +217,7 @@ class SponsorTimeEditComponent extends React.Component this.categorySelectionChange(event)}> {this.getCategoryOptions()} @@ -240,7 +242,7 @@ class SponsorTimeEditComponent extends React.Component this.actionTypeSelectionChange(e)}> {this.getActionTypeOptions(sponsorTime)} @@ -269,7 +271,7 @@ class SponsorTimeEditComponent extends React.Component this.setState({chapterNameSelectorOpen: false})}> ; defaultCategory: Category; + segmentListDefaultTab: SegmentListDefaultTab; renderSegmentsAsChapters: boolean; forceChannelCheck: boolean; minutesSaved: number; @@ -374,6 +375,7 @@ const syncDefaults = { isVip: false, permissions: {}, defaultCategory: "chooseACategory" as Category, + segmentListDefaultTab: SegmentListDefaultTab.Segments, renderSegmentsAsChapters: false, forceChannelCheck: false, minutesSaved: 0, diff --git a/src/popup/SegmentListComponent.tsx b/src/popup/SegmentListComponent.tsx index d56b7bae..1369475c 100644 --- a/src/popup/SegmentListComponent.tsx +++ b/src/popup/SegmentListComponent.tsx @@ -1,5 +1,5 @@ import * as React from "react"; -import { ActionType, SegmentUUID, SponsorHideType, SponsorTime, VideoID } from "../types"; +import { ActionType, SegmentListDefaultTab, SegmentUUID, SponsorHideType, SponsorTime, VideoID } from "../types"; import Config from "../config"; import { waitFor } from "../../maze-utils/src"; import { shortCategoryName } from "../utils/categoryUtils"; @@ -61,12 +61,21 @@ export const SegmentListComponent = (props: SegmentListComponentProps) => { }, [props.segments]); React.useEffect(() => { - if (hasSegments){ - setTab(SegmentListTab.Segments); + const setTabBasedOnConfig = () => { + const preferChapters = Config.config.segmentListDefaultTab === SegmentListDefaultTab.Chapters; + if (preferChapters) { + setTab(hasChapters ? SegmentListTab.Chapter : SegmentListTab.Segments); + } else { + setTab(hasSegments ? SegmentListTab.Segments : SegmentListTab.Chapter); + } + }; + + if (Config.isReady()) { + setTabBasedOnConfig(); } else { - setTab(SegmentListTab.Chapter); + waitFor(() => Config.isReady()).then(setTabBasedOnConfig); } - }, [props.videoID, hasSegments]); + }, [props.videoID, hasSegments, hasChapters]); const segmentsWithNesting = React.useMemo(() => { const result: SegmentWithNesting[] = []; diff --git a/src/popup/YourWorkComponent.tsx b/src/popup/YourWorkComponent.tsx index 568931ad..e1d1978d 100644 --- a/src/popup/YourWorkComponent.tsx +++ b/src/popup/YourWorkComponent.tsx @@ -191,7 +191,7 @@ function TimeSavedMessage({ viewCount, minutesSaved }: { viewCount: number; minu function DonateMessage(props: { onClose: () => void }): JSX.Element { return ( -