Skip to content

Commit

Permalink
fix bookmark and spaces addition buttons in the popup
Browse files Browse the repository at this point in the history
  • Loading branch information
blackforestboi committed Feb 27, 2024
1 parent 1acce0e commit feddb98
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 16 deletions.
21 changes: 10 additions & 11 deletions src/popup/bookmark-button/components/BookmarkButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,8 @@ interface StateProps {
}

interface DispatchProps {
toggleBookmark: ClickHandler<HTMLButtonElement>
toggleBookmark: (element: HTMLElement) => void
}

export type Props = OwnProps & StateProps & DispatchProps

class BookmarkButton extends PureComponent<Props> {
Expand Down Expand Up @@ -67,7 +66,11 @@ class BookmarkButton extends PureComponent<Props> {

return (
<ButtonItem
onClick={() => !isPageSaved && this.props.toggleBookmark}
onClick={(event) => {
if (!isPageSaved) {
this.props.toggleBookmark(event.currentTarget)
}
}}
disabled={this.props.isDisabled || isPageSaved}
>
<Icon
Expand Down Expand Up @@ -140,15 +143,11 @@ const mapDispatch: (dispatch, props: OwnProps) => DispatchProps = (
dispatch,
props,
) => ({
toggleBookmark: async (e) => {
{
const allowed = await pageActionAllowed(analyticsBG)

if (allowed) {
e.preventDefault()
toggleBookmark: async (element: HTMLElement) => {
const allowed = await pageActionAllowed(analyticsBG)

await dispatch(acts.toggleBookmark())
}
if (allowed) {
await dispatch(acts.toggleBookmark())
}
},
})
Expand Down
12 changes: 7 additions & 5 deletions src/popup/collections-button/components/CollectionsButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ interface StateProps {
}

interface DispatchProps {
toggleCollectionsPopup: ClickHandler<HTMLButtonElement>
toggleAllTabsPopup: ClickHandler<HTMLButtonElement>
toggleCollectionsPopup: ClickHandler<HTMLDivElement>
toggleAllTabsPopup: ClickHandler<HTMLDivElement>
}

export type Props = OwnProps & StateProps & DispatchProps
Expand Down Expand Up @@ -55,9 +55,11 @@ class CollectionsButton extends PureComponent<Props> {
render() {
return (
<ButtonItem
onClick={() =>
!this.props.isDisabled && this.props.toggleCollectionsPopup
}
onClick={(event) => {
if (!this.props.isDisabled) {
this.props.toggleCollectionsPopup(event)
}
}}
disabled={this.props.isDisabled}
>
<Icon
Expand Down

0 comments on commit feddb98

Please sign in to comment.