Skip to content

Commit

Permalink
Fix port video section style
Browse files Browse the repository at this point in the history
  • Loading branch information
hanydd committed Dec 20, 2024
1 parent db9314d commit 9bff05e
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 16 deletions.
10 changes: 10 additions & 0 deletions public/popup.css
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,16 @@
background-color: #f2e4b7;
}

/*
* Port Video Sections
*/
.port-video-section {
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
}

/*
* Submit box
*/
Expand Down
8 changes: 4 additions & 4 deletions src/content.ts
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ function messageListener(
submitPortVideo(request.ytbID);
break;
case "votePortVideo":
portVideoVote(request.UUID, request.bvid, request.vote);
portVideoVote(request.UUID, request.vote);
break;
case "updatePortedSegments":
updateSegments(request.UUID);
Expand Down Expand Up @@ -1290,9 +1290,9 @@ async function submitPortVideo(ytbID: VideoID): Promise<PortVideo> {
return newPortVideo;
}

async function portVideoVote(UUID: string, bvID: VideoID, voteType: number) {
await postPortVideoVote(UUID, bvID, voteType);
await getPortVideo(this.bvID, true);
async function portVideoVote(UUID: string, voteType: number) {
await postPortVideoVote(UUID, getVideoID(), voteType);
await getPortVideo(getVideoID(), true);
}

async function updateSegments(UUID: string): Promise<FetchResponse> {
Expand Down
18 changes: 9 additions & 9 deletions src/popup/PortVideoSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,28 +85,28 @@ export class PortVideoSection extends React.Component<PortVideoProps, PortVideoS

render() {
return (
<div>
<Spin indicator={<LoadingOutlined spin />} delay={100} spinning={this.state.loading}>
{this.state.show && (
<Spin indicator={<LoadingOutlined spin />} delay={100} spinning={this.state.loading}>
<div className="port-video-section">
{this.hasPortVideo() ? (
<>
<span>{chrome.i18n.getMessage("hasbindedPortVideo")}</span>
<span>{this.state.portVideo.ytbID}</span>

<img
className="bsbVoteButton"
className="voteButton"
title={chrome.i18n.getMessage("upvote")}
src={chrome.runtime.getURL("icons/thumbs_up_blue.svg")}
src={chrome.runtime.getURL("icons/thumbs_up.svg")}
onClick={() => this.vote(1)}
></img>
<img
className="bsbVoteButton"
className="voteButton"
title={chrome.i18n.getMessage("downvote")}
src={chrome.runtime.getURL("icons/thumbs_down_blue.svg")}
src={chrome.runtime.getURL("icons/thumbs_down.svg")}
onClick={() => this.vote(0)}
></img>
<img
className="bsbVoteButton"
className="voteButton"
title={chrome.i18n.getMessage("refreshPortedSegments")}
src={chrome.runtime.getURL("icons/refresh.svg")}
onClick={() => this.updatePortedSegments()}
Expand All @@ -124,9 +124,9 @@ export class PortVideoSection extends React.Component<PortVideoProps, PortVideoS
</button>
</>
)}
</Spin>
</div>
)}
</div>
</Spin>
);
}
}
6 changes: 3 additions & 3 deletions src/render/DesciptionPortPill.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export class DescriptionPortPill {
hasDescription: boolean;
getPortVideo: (videoId: VideoID, bypassCache?: boolean) => void;
submitPortVideo: (ytbID: VideoID) => Promise<PortVideo>;
portVideoVote: (UUID: string, bvID: VideoID, voteType: number) => void;
portVideoVote: (UUID: string, voteType: number) => void;
updateSegments: (UUID: string) => Promise<FetchResponse>;
sponsorsLookup: (keepOldSubmissions: boolean, ignoreServerCache: boolean, forceUpdatePreviewBar: boolean) => void;

Expand All @@ -33,7 +33,7 @@ export class DescriptionPortPill {
constructor(
getPortVideo: (videoId: VideoID, bypassCache?: boolean) => void,
submitPortVideo: (ytbID: VideoID) => Promise<PortVideo>,
portVideoVote: (UUID: string, bvID: VideoID, voteType: number) => void,
portVideoVote: (UUID: string, voteType: number) => void,
updateSegments: (UUID: string) => Promise<FetchResponse>,
sponsorsLookup: () => void
) {
Expand Down Expand Up @@ -182,7 +182,7 @@ export class DescriptionPortPill {
return;
}

this.portVideoVote(this.portUUID, this.bvID, voteType);
this.portVideoVote(this.portUUID, voteType);
}

private async updateSegmentHandler() {
Expand Down

0 comments on commit 9bff05e

Please sign in to comment.