Skip to content

Commit

Permalink
move the expand/compress on video one level up
Browse files Browse the repository at this point in the history
  • Loading branch information
blackforestboi committed Feb 27, 2024
1 parent 4c98891 commit ef72ed6
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 4 deletions.
2 changes: 1 addition & 1 deletion external/@worldbrain/memex-common
67 changes: 64 additions & 3 deletions src/dashboard-refactor/search-results/components/page-result.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ export default class PageResultView extends PureComponent<Props> {

state = {
matchingTextContainerHeight: 100,
confirmRemoveFromList: false,
showVideoFullSize: false,
}

componentDidMount() {
Expand Down Expand Up @@ -318,6 +320,42 @@ export default class PageResultView extends PureComponent<Props> {
}
}

private renderVideoResizeButton() {
if (!this.props.fullUrl.includes('youtube.com')) {
return
}

return (
<TooltipBox
tooltipText={
this.state.showVideoFullSize
? 'Minimize Video'
: 'Maximize Video'
}
placement="bottom"
getPortalRoot={this.props.getRootElement}
>
<Icon
heightAndWidth="22px"
filePath={
this.state.showVideoFullSize
? icons.compress
: icons.expand
}
onClick={(event) => {
{
this.setState({
showVideoFullSize: !this.state
.showVideoFullSize,
})
event.preventDefault()
}
}}
/>
</TooltipBox>
)
}

private renderRemoveFromListBtn(): JSX.Element {
if (
!this.props.isSearchFilteredByList ||
Expand All @@ -326,6 +364,28 @@ export default class PageResultView extends PureComponent<Props> {
return undefined
}

if (this.state.confirmRemoveFromList) {
return (
<TooltipBox
tooltipText={'Confirm'}
placement="bottom"
getPortalRoot={this.props.getRootElement}
>
<Icon
heightAndWidth="22px"
filePath={icons.check}
onClick={(event) => {
{
this.props.onRemoveFromListBtnClick(event)
this.setState({ confirmRemoveFromList: true })
event.preventDefault()
}
}}
/>
</TooltipBox>
)
}

return (
<TooltipBox
tooltipText={
Expand All @@ -339,10 +399,9 @@ export default class PageResultView extends PureComponent<Props> {
<Icon
heightAndWidth="22px"
filePath={icons.removeX}
darkBackground
onClick={(event) => {
{
this.props.onRemoveFromListBtnClick(event)
this.setState({ confirmRemoveFromList: true })
event.preventDefault()
}
}}
Expand Down Expand Up @@ -730,6 +789,8 @@ export default class PageResultView extends PureComponent<Props> {
filePath={icons.trash}
onClick={this.props.onTrashBtnClick}
/>
{this.renderVideoResizeButton()}
{this.renderRemoveFromListBtn()}
</ExtraButtonsActionBar>
)}

Expand All @@ -745,9 +806,9 @@ export default class PageResultView extends PureComponent<Props> {
fullTitle={this.props.fullTitle}
pdfUrl={this.props.fullPdfUrl}
favIcon={this.props.favIconURI}
showVideoFullScreen={this.state.showVideoFullSize}
inPageMode={this.props.inPageMode}
youtubeService={this.props.youtubeService}
removeFromList={this.renderRemoveFromListBtn()}
mainContentHover={
this.props.hoverState != null
? this.props.hoverState
Expand Down

0 comments on commit ef72ed6

Please sign in to comment.