Skip to content

Commit

Permalink
Fix dashboard AI trigger
Browse files Browse the repository at this point in the history
  • Loading branch information
blackforestboi committed May 5, 2024
1 parent d1e08f7 commit 9814a55
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 7 deletions.
2 changes: 1 addition & 1 deletion external/@worldbrain/memex-common
1 change: 0 additions & 1 deletion src/content-scripts/content_script/global.ts
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,6 @@ export async function main(

sidebarEvents.on('showPowerUpModal', async ({ limitReachedNotif }) => {
if (currentTabURL?.includes(window.location.href)) {
console.log('limit reached, showing modal', limitReachedNotif)
inPageUI.loadOnDemandInPageUI({
component: 'upgrade-modal',
options: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,13 +188,17 @@ export class AnnotationsSidebarContainer<
await this.processEvent('setActiveSidebarTab', {
tab: 'summary',
})
await this.processEvent('askAIviaInPageInteractions', null)
await this.processEvent('askAIviaInPageInteractions', {
url: newURL,
})
}
if (newURL === previousURL) {
await this.processEvent('setActiveSidebarTab', {
tab: 'summary',
})
await this.processEvent('askAIviaInPageInteractions', null)
await this.processEvent('askAIviaInPageInteractions', {
url: newURL,
})
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import type { MemexTheme } from '@worldbrain/memex-common/lib/common-ui/styles/t
import type { ImageSupportInterface } from 'src/image-support/background/types'
import styled from 'styled-components'
import type { HighlightColor } from '@worldbrain/memex-common/lib/common-ui/components/highlightColorPicker/types'
import { AnnotationsSidebarInPageEventEmitter } from '../types'
import { EventEmitter } from 'events'

type Props = SidebarContainerOptions & {
refSidebar?: React.Ref<AnnotationsSidebarContainer>
Expand All @@ -24,6 +26,7 @@ type Props = SidebarContainerOptions & {
export class AnnotationsSidebarInDashboardResults extends React.Component<
Props
> {
sidebarEvents: AnnotationsSidebarInPageEventEmitter
static defaultProps: Partial<Props> = {
showGoToAnnotationBtn: true,
sidebarContext: 'dashboard',
Expand All @@ -37,16 +40,19 @@ export class AnnotationsSidebarInDashboardResults extends React.Component<
topOffsetPx: 60,
},
})
this.sidebarEvents = new EventEmitter() as AnnotationsSidebarInPageEventEmitter
}

render() {
const { refSidebar, ...props } = this.props

return (
<SlideInWrapper id="memex-annotations-sidebar">
<AnnotationsSidebarContainer
{...props}
theme={props.theme}
ref={refSidebar}
events={this.sidebarEvents}
/>
</SlideInWrapper>
)
Expand Down
2 changes: 1 addition & 1 deletion src/sidebar/annotations-sidebar/containers/logic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3622,7 +3622,7 @@ export class SidebarContainerLogic extends UILogic<
try {
executed = this.options.events.emit(
'addPageUrlToEditor',
window.location.href,
event.url ?? window.location.href,
prompt,
event.instaExecutePrompt,
(success) => {
Expand Down
2 changes: 0 additions & 2 deletions src/util/subscriptions/storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,6 @@ async function resetOnNewMonth(currentStatusStorage) {
const currentDate = new Date(Date.now())
const currentMonth = currentDate.getMonth()
const monthInStorage = currentStatusStorage[COUNTER_STORAGE_KEY].m
console.log('currentMonth', currentMonth)
console.log('monthInStorage', monthInStorage)

let updatedStatus = {
c: currentStatusStorage[COUNTER_STORAGE_KEY].c,
Expand Down

0 comments on commit 9814a55

Please sign in to comment.