From fc75203fd3882a75a65f59c115eb893076473d8a Mon Sep 17 00:00:00 2001 From: Oliver Date: Tue, 30 Jul 2024 12:28:37 +0200 Subject: [PATCH 1/6] add the separator in the settings routes again --- src/options/routes.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/options/routes.js b/src/options/routes.js index 9d3849c806..78a1fc8ddd 100644 --- a/src/options/routes.js +++ b/src/options/routes.js @@ -41,6 +41,10 @@ export default [ component: Blocklist, icon: 'block', }, + { + name: null, + icon: null, + }, { name: 'My Account', pathname: '/account', From 901960208f9309f62702c09acd05904a8d529752 Mon Sep 17 00:00:00 2001 From: Oliver Date: Tue, 30 Jul 2024 14:42:03 +0200 Subject: [PATCH 2/6] Fix bug where people who were there before we implemented the editable templates could not use them anymore --- external/@worldbrain/memex-common | 2 +- .../components/prompt-templates/logic.ts | 2 +- .../annotations-sidebar/containers/logic.ts | 36 +++++++++---------- 3 files changed, 18 insertions(+), 22 deletions(-) diff --git a/external/@worldbrain/memex-common b/external/@worldbrain/memex-common index 9aea444629..2b311ac6b1 160000 --- a/external/@worldbrain/memex-common +++ b/external/@worldbrain/memex-common @@ -1 +1 @@ -Subproject commit 9aea444629b0c5b2c9ddfcb192e10a2c2926faa6 +Subproject commit 2b311ac6b112fe055ae36a2ffec93054ce0c8c1d diff --git a/src/common-ui/components/prompt-templates/logic.ts b/src/common-ui/components/prompt-templates/logic.ts index cc3cc4c13a..ca28244a29 100644 --- a/src/common-ui/components/prompt-templates/logic.ts +++ b/src/common-ui/components/prompt-templates/logic.ts @@ -95,7 +95,7 @@ export default class PromptTemplatesLogic extends UILogic< const currentTemplates = previousState.promptTemplatesArray this.dependencies.onTemplateSelect( - marked.parse(currentTemplates[selectedTemplate].text), + marked.parse(currentTemplates[selectedTemplate]?.text), ) } setTemplateEdit: EventHandler<'setTemplateEdit'> = async ({ diff --git a/src/sidebar/annotations-sidebar/containers/logic.ts b/src/sidebar/annotations-sidebar/containers/logic.ts index 802882b52c..9e5cd64cb6 100644 --- a/src/sidebar/annotations-sidebar/containers/logic.ts +++ b/src/sidebar/annotations-sidebar/containers/logic.ts @@ -119,6 +119,7 @@ import { UserReference } from '@worldbrain/memex-common/lib/web-interface/types/ import { convertLinksInAIResponse } from '@worldbrain/memex-common/lib/ai-chat/utils' import { DEFAULT_AI_MODEL } from '@worldbrain/memex-common/lib/ai-chat/constants' import { HighlightRendererInterface } from '@worldbrain/memex-common/lib/in-page-ui/highlighting/types' +import { PromptTemplate } from 'src/common-ui/components/prompt-templates/types' const md = new MarkdownIt() export type SidebarContainerOptions = SidebarContainerDependencies & { @@ -3576,14 +3577,24 @@ export class SidebarContainerLogic extends UILogic< let prompt = event.prompt if (event.prompt == null) { - const syncsettings = - (await this.syncSettings.openAI?.get('promptSuggestions')) ?? - AI_PROMPT_DEFAULTS.map((text) => ({ + let savedPrompts = await this.syncSettings.openAI?.get( + 'promptSuggestions', + ) + if (!savedPrompts) { + savedPrompts = AI_PROMPT_DEFAULTS.map((text) => ({ text, isEditing: null, isFocused: false, })) - prompt = marked.parse(syncsettings[0].text) + } else if (typeof savedPrompts[0] === 'string') { + savedPrompts = ((savedPrompts as unknown) as string[]).map( + (text) => ({ + text: text, + }), + ) + this.syncSettings.openAI?.set('promptSuggestions', savedPrompts) + } + prompt = marked.parse(savedPrompts[0].text) } if (event.textToProcess) { @@ -3609,21 +3620,6 @@ export class SidebarContainerLogic extends UILogic< } if (!event.textToProcess) { let executed = false - let prompt = event.prompt - - if (event.prompt == null) { - const syncsettings = - (await this.syncSettings.openAI?.get( - 'promptSuggestions', - )) ?? - AI_PROMPT_DEFAULTS.map((text) => ({ - text, - isEditing: null, - isFocused: false, - })) - prompt = marked.parse(syncsettings[0].text) - } - let retries = 0 const maxRetries = 100 while (!executed && retries < maxRetries) { @@ -3663,7 +3659,7 @@ export class SidebarContainerLogic extends UILogic< isEditing: null, isFocused: false, })) - prompt = syncsettings[0].text + prompt = syncsettings[0]?.text } if (previousState.activeTab === 'summary') { From 668d7f7e0916ef5d7dcca326277d102aab647c54 Mon Sep 17 00:00:00 2001 From: Oliver Date: Tue, 30 Jul 2024 16:42:21 +0200 Subject: [PATCH 3/6] fix remove ribbon button ux --- src/in-page-ui/ribbon/react/components/ribbon.tsx | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/in-page-ui/ribbon/react/components/ribbon.tsx b/src/in-page-ui/ribbon/react/components/ribbon.tsx index ec2a88b1d2..7d94b56e6e 100644 --- a/src/in-page-ui/ribbon/react/components/ribbon.tsx +++ b/src/in-page-ui/ribbon/react/components/ribbon.tsx @@ -1986,12 +1986,9 @@ export default class Ribbon extends Component { {!this.props.sidebar.isSidebarOpen && ( { - if (!this.props.showRemoveMenu) { + if (event.shiftKey) { this.props.toggleRemoveMenu() - } - }} - onMouseUp={(event) => { - if (!this.props.showRemoveMenu) { + } else { this.props.handleRemoveRibbon() } }} From 09caa76fa55d910adcd97579ed2da4610b78af76 Mon Sep 17 00:00:00 2001 From: Oliver Date: Tue, 30 Jul 2024 22:48:02 +0200 Subject: [PATCH 4/6] fix click on space pill opening the page --- .../components/result-item-spaces-segment.tsx | 9 ++++++--- src/in-page-ui/ribbon/react/components/ribbon.tsx | 14 -------------- 2 files changed, 6 insertions(+), 17 deletions(-) diff --git a/src/common-ui/components/result-item-spaces-segment.tsx b/src/common-ui/components/result-item-spaces-segment.tsx index 3d1efa11ac..6c89e7566c 100644 --- a/src/common-ui/components/result-item-spaces-segment.tsx +++ b/src/common-ui/components/result-item-spaces-segment.tsx @@ -92,9 +92,12 @@ export default function ListsSegment({ return ( { - e.stopPropagation() - onListClick(space.id) + onMouseDown={(event: React.MouseEvent) => { + event.stopPropagation() + onListClick(space.id, event) + }} + onMouseUp={(event: React.MouseEvent) => { + event.stopPropagation() }} isLoading={space.name == null && space != null} title={ diff --git a/src/in-page-ui/ribbon/react/components/ribbon.tsx b/src/in-page-ui/ribbon/react/components/ribbon.tsx index 7d94b56e6e..e7eea7fccf 100644 --- a/src/in-page-ui/ribbon/react/components/ribbon.tsx +++ b/src/in-page-ui/ribbon/react/components/ribbon.tsx @@ -1994,20 +1994,6 @@ export default class Ribbon extends Component { }} > { - // if (this.props.showRemoveMenu) { - // this.props.handleRemoveRibbon() - // } else { - // this.props.toggleRemoveMenu() - // } - // }} - // onClick={(event) => { - // if (event.shiftKey && this.props.isRibbonEnabled) { - // this.props.handleHover() - // } else { - // this.props.handleRemoveRibbon() - // } - // }} color={'greyScale5'} heightAndWidth="24px" padding="4px" From d398a5c1d691e80f3c811a51a679ea764f91a0ed Mon Sep 17 00:00:00 2001 From: Oliver Date: Tue, 30 Jul 2024 22:48:21 +0200 Subject: [PATCH 5/6] bump version to 3.20.7 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 5385f2245b..4f6b3398a8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "worldbrain-extension", - "version": "3.20.6", + "version": "3.20.7", "homepage": "https://memex.garden", "repository": "https://github.com/WorldBrain/Memex", "scripts": { From 3b7518692ede6d6ee8d1b31210228c560294e96e Mon Sep 17 00:00:00 2001 From: Oliver Date: Tue, 30 Jul 2024 22:49:31 +0200 Subject: [PATCH 6/6] fix type errors --- src/common-ui/components/result-item-spaces-segment.tsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/common-ui/components/result-item-spaces-segment.tsx b/src/common-ui/components/result-item-spaces-segment.tsx index 6c89e7566c..7da71f5a80 100644 --- a/src/common-ui/components/result-item-spaces-segment.tsx +++ b/src/common-ui/components/result-item-spaces-segment.tsx @@ -94,7 +94,7 @@ export default function ListsSegment({ key={space.id} onMouseDown={(event: React.MouseEvent) => { event.stopPropagation() - onListClick(space.id, event) + onListClick(space.id) }} onMouseUp={(event: React.MouseEvent) => { event.stopPropagation() @@ -192,7 +192,6 @@ const loading = keyframes` ` const ListSpaceContainer = styled.div<{ - onClick: React.MouseEventHandler isLoading: boolean spaceId: number }>`