Skip to content

Commit

Permalink
remove a bunch of console.log(s and add ? to optional values
Browse files Browse the repository at this point in the history
  • Loading branch information
blackforestboi committed Feb 11, 2024
1 parent ff55943 commit cd17c6b
Show file tree
Hide file tree
Showing 10 changed files with 5 additions and 26 deletions.
2 changes: 1 addition & 1 deletion external/@worldbrain/memex-common
2 changes: 0 additions & 2 deletions src/common-ui/components/dropdown-menu-small.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,6 @@ export class DropdownMenuBtn extends React.PureComponent<Props, State> {
// })
// }

console.log('items', this.props.menuItems)

return (
<MenuItemContainerUnfolded isOpen={this.state.isOpened}>
{this.props.menuItems.map((item) => (
Expand Down
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 @@ -717,7 +717,6 @@ export async function main(
)
await createPromise
} else if (window.location.href.includes('youtube.com')) {
console.log('commentText', commentText)
await inPageUI.showSidebar({
action: 'youtube_timestamp',
commentText: commentText,
Expand Down
2 changes: 1 addition & 1 deletion src/content-sharing/background/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,7 @@ export default class ContentSharingBackground {
return null
}

return contents.remoteId
return contents?.remoteId
}

ensureRemotePageId: ContentSharingInterface['ensureRemotePageId'] = async (
Expand Down
2 changes: 1 addition & 1 deletion src/dashboard-refactor/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ export class DashboardContainer extends StatefulUIElement<
const listData = getListData(listsSidebar.selectedListId, {
listsSidebar,
})
const remoteLink = listData.remoteId
const remoteLink = listData?.remoteId
? getListShareUrl({ remoteListId: listData.remoteId })
: undefined // TODO: ensure this comes with key for collab'd lists
const isOwnedList = listData.creator?.id === currentUser?.id
Expand Down
2 changes: 0 additions & 2 deletions src/search-injection/content_script.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ export async function initSearchInjection({
try {
const query = utils.fetchQuery(url)

console.log('SearchInjection: Fetching search query', query)

await handleRenderSearchInjection(
query,
requestSearcher,
Expand Down
3 changes: 0 additions & 3 deletions src/search-injection/searchInjection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ export const handleRenderSearchInjection = async (
// Calls renderComponent to render the react component

const renderComponent = async () => {
console.log('redering search injection')
// Accesses docs, totalCount from parent through closure
// Gets position from settings
// Renders React Component on the respective container
Expand Down Expand Up @@ -331,7 +330,6 @@ export const handleRenderSearchInjection = async (
})

if (isTargetNodeAdded) {
console.log('render2')
renderComponent()
}
}
Expand All @@ -346,7 +344,6 @@ export const handleRenderSearchInjection = async (
)

if (targetNode && !existingInjection) {
console.log('render1')
renderComponent()
} else {
// Configuration for the observer (which mutations to observe)
Expand Down
6 changes: 0 additions & 6 deletions src/search-injection/youtubeInterface.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -273,13 +273,9 @@ export function injectYoutubeContextMenu(annotationsFunctions: any) {
'ytp-popup ytp-contextmenu',
)
if (contextMenu.length > 0) {
console.log('contextMenu', contextMenu)
panel = contextMenu[0]?.querySelector('.ytp-panel-menu')

console.log('panel', panel)
}
if (panel) {
console.log('panel', panel)
renderYoutubeMenuButton(panel, annotationsFunctions, icon)
return
}
Expand All @@ -289,10 +285,8 @@ export function injectYoutubeContextMenu(annotationsFunctions: any) {
const targetElement = targetObject.target as HTMLElement
if (targetElement.classList.contains('ytp-contextmenu')) {
const targetChildren = targetElement.children
console.log('targetChildren', targetChildren)

for (let i = 0; i < targetChildren.length; i++) {
console.log('targetChildren[i]', targetChildren[i])
if (targetChildren[i].classList.contains('ytp-panel')) {
const potentialPanel = targetChildren[i].querySelector(
'.ytp-panel-menu',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1895,8 +1895,6 @@ export class AnnotationsSidebar extends React.Component<
)
}

console.log('this.props.', this.props.hasKey)

return (
<AISidebarContainer>
{this.props.sidebarContext === 'in-page' &&
Expand Down
9 changes: 2 additions & 7 deletions src/sidebar/annotations-sidebar/containers/logic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -857,16 +857,13 @@ export class SidebarContainerLogic extends UILogic<
const openAIKey = await this.syncSettings.openAI.get('apiKey')
const hasAPIKey = openAIKey && openAIKey.trim().startsWith('sk-')

console.log('openAIKey', '"', openAIKey.trim(), '"')
this.emitMutation({
hasKey: { $set: hasAPIKey },
})
const signupDate = new Date(
await (await this.options.authBG.getCurrentUser()).creationTime,
).getTime()

console.log('signupDate', signupDate)

this.emitMutation({
signupDate: { $set: signupDate },
isTrial: { $set: await enforceTrialPeriod30Days(signupDate) },
Expand Down Expand Up @@ -2568,7 +2565,7 @@ export class SidebarContainerLogic extends UILogic<
{
comment: existing.comment,
body: existing.body,
remoteId: sharingState.remoteId
remoteId: sharingState?.remoteId
? sharingState.remoteId.toString()
: existing.remoteId,
unifiedId: event.unifiedAnnotationId,
Expand Down Expand Up @@ -2947,8 +2944,6 @@ export class SidebarContainerLogic extends UILogic<
await this.updateSuggestionResults(results)
}

console.log('model', previousState.AImodel)

const response = await this.options.summarizeBG.startPageSummaryStream({
fullPageUrl:
isPagePDF || previousState.fetchLocalHTML
Expand Down Expand Up @@ -4722,7 +4717,7 @@ export class SidebarContainerLogic extends UILogic<
.filter((id) => !!id)

annotationsCache.updateAnnotation({
remoteId: sharingState.remoteId
remoteId: sharingState?.remoteId
? sharingState.remoteId.toString()
: undefined,
unifiedId: annotation.unifiedId,
Expand Down

0 comments on commit cd17c6b

Please sign in to comment.