Skip to content

Commit

Permalink
Remove description on segments
Browse files Browse the repository at this point in the history
  • Loading branch information
hanydd committed Sep 14, 2024
1 parent 83db03f commit 64da228
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 35 deletions.
19 changes: 0 additions & 19 deletions src/components/SponsorTimeEditComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ export interface SponsorTimeEditState {
sponsorTimeEdits: [string, string];
selectedCategory: Category;
selectedActionType: ActionType;
description: string;
suggestedNames: SelectorOption[];
chapterNameSelectorOpen: boolean;
chapterNameSelectorHovering: boolean;
Expand Down Expand Up @@ -71,7 +70,6 @@ class SponsorTimeEditComponent extends React.Component<SponsorTimeEditProps, Spo
sponsorTimeEdits: [null, null],
selectedCategory: sponsorTime.category ?? (DEFAULT_CATEGORY as Category),
selectedActionType: sponsorTime.actionType,
description: sponsorTime.description || "",
suggestedNames: [],
chapterNameSelectorOpen: false,
chapterNameSelectorHovering: false,
Expand Down Expand Up @@ -685,8 +683,6 @@ class SponsorTimeEditComponent extends React.Component<SponsorTimeEditProps, Spo
selectedActionType: actionType,
});

sponsorTimesSubmitting[this.props.index].description = "";

Config.local.unsubmittedSegments[this.props.contentContainer().sponsorVideoID] = sponsorTimesSubmitting;
Config.forceLocalUpdate("unsubmittedSegments");

Expand Down Expand Up @@ -765,21 +761,6 @@ class SponsorTimeEditComponent extends React.Component<SponsorTimeEditProps, Spo
}
}

descriptionUpdate(description: string): void {
this.setState(
{
description,
},
() => {
this.saveEditTimes();
}
);

if (!this.fetchingSuggestions) {
this.fetchSuggestions(description);
}
}

async fetchSuggestions(description: string): Promise<void> {
if (this.props.contentContainer().channelIDInfo.status !== ChannelIDStatus.Found) return;

Expand Down
4 changes: 0 additions & 4 deletions src/content.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1384,7 +1384,6 @@ function updatePreviewBar(): void {
actionType: segment.actionType,
unsubmitted: false,
showLarger: segment.actionType === ActionType.Poi,
description: segment.description,
source: segment.source,
requiredSegment:
requiredSegment && (segment.UUID === requiredSegment || segment.UUID?.startsWith(requiredSegment)),
Expand All @@ -1400,7 +1399,6 @@ function updatePreviewBar(): void {
actionType: segment.actionType,
unsubmitted: true,
showLarger: segment.actionType === ActionType.Poi,
description: segment.description,
source: segment.source,
});
});
Expand Down Expand Up @@ -2018,7 +2016,6 @@ function updateSponsorTimesSubmitting(getFromConfig = true) {
UUID: segmentTime.UUID,
category: segmentTime.category,
actionType: segmentTime.actionType,
description: segmentTime.description,
source: segmentTime.source,
});
}
Expand Down Expand Up @@ -2589,7 +2586,6 @@ function checkForPreloadedSegment() {
UUID: generateUserID() as SegmentUUID,
category: segment.category ? segment.category : Config.config.defaultCategory,
actionType: segment.actionType ? segment.actionType : ActionType.Skip,
description: segment.description ?? "",
source: SponsorSourceType.Local,
});

Expand Down
5 changes: 2 additions & 3 deletions src/js-components/previewBar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ export interface PreviewBarSegment {
actionType: ActionType;
unsubmitted: boolean;
showLarger: boolean;
description: string;
source: SponsorSourceType;
requiredSegment?: boolean;
selectedSegment?: boolean;
Expand Down Expand Up @@ -108,7 +107,7 @@ class PreviewBar {

private setTooltipTitle(segment: PreviewBarSegment, tooltip: HTMLElement): void {
if (segment) {
const name = segment.description || shortCategoryName(segment.category);
const name = shortCategoryName(segment.category);
if (segment.unsubmitted) {
tooltip.textContent = chrome.i18n.getMessage("unsubmitted") + " " + name;
} else {
Expand Down Expand Up @@ -264,7 +263,7 @@ class PreviewBar {
elem.classList.add("sponsorChapterText");
return elem;
})()) as HTMLDivElement;
chapterCustomText.innerText = chosenSegment.description || shortCategoryName(chosenSegment.category);
chapterCustomText.innerText = shortCategoryName(chosenSegment.category);

// if (chosenSegment.actionType !== ActionType.Chapter) {
// chapterTitle.classList.add("sponsorBlock-segment-title");
Expand Down
7 changes: 1 addition & 6 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,18 +79,13 @@ export enum SponsorSourceType {
Local = 1,
YouTube = 2,
}

export interface SegmentContainer {
export interface SponsorTime {
segment: [number] | [number, number];
}

export interface SponsorTime extends SegmentContainer {
UUID: SegmentUUID;
locked?: number;

category: Category;
actionType: ActionType;
description?: string;

hidden?: SponsorHideType;
source: SponsorSourceType;
Expand Down
4 changes: 1 addition & 3 deletions src/utils/exporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export function exportTimes(segments: SponsorTime[]): string {
}

function exportTime(segment: SponsorTime): string {
const name = segment.description || shortCategoryName(segment.category);
const name = shortCategoryName(segment.category);

return `${getFormattedTime(segment.segment[0], true)}${
segment.segment[1] && segment.segment[0] !== segment.segment[1]
Expand Down Expand Up @@ -66,7 +66,6 @@ export function importTimes(data: string, videoDuration: number): SponsorTime[]
segment: [startTime, getFormattedTimeToSeconds(match[1])],
category: determinedCategory,
actionType: ActionType.Skip,
description: title,
source: SponsorSourceType.Local,
UUID: generateUserID() as SegmentUUID,
};
Expand Down Expand Up @@ -104,7 +103,6 @@ export function exportTimesAsHashParam(segments: SponsorTime[]): string {
actionType: segment.actionType,
category: segment.category,
segment: segment.segment,
...(segment.description ? { description: segment.description } : {}), // don't include the description param if empty
}));

return `#segments=${JSON.stringify(hashparamSegments)}`;
Expand Down

0 comments on commit 64da228

Please sign in to comment.