Browse Source

clean up debugging

imwald
Silberengel 5 months ago
parent
commit
2e4ba3ba1e
  1. 10
      src/PageManager.tsx
  2. 18
      src/components/Note/index.tsx

10
src/PageManager.tsx

@ -258,14 +258,8 @@ export function PageManager({ maxStackSize = 5 }: { maxStackSize?: number }) { @@ -258,14 +258,8 @@ export function PageManager({ maxStackSize = 5 }: { maxStackSize?: number }) {
}
const pushSecondaryPage = (url: string, index?: number) => {
console.log('🔗 pushSecondaryPage called with:', url)
setSecondaryStack((prevStack) => {
console.log('🔗 Current stack:', prevStack.map(item => ({ url: item.url, index: item.index })))
const isCurrent = isCurrentPage(prevStack, url)
console.log('🔗 Is current page?', isCurrent)
if (isCurrent) {
console.log('🔗 URL is current page, scrolling to top instead of navigating')
if (isCurrentPage(prevStack, url)) {
const currentItem = prevStack[prevStack.length - 1]
if (currentItem?.ref?.current) {
currentItem.ref.current.scrollToTop('instant')
@ -273,10 +267,8 @@ export function PageManager({ maxStackSize = 5 }: { maxStackSize?: number }) { @@ -273,10 +267,8 @@ export function PageManager({ maxStackSize = 5 }: { maxStackSize?: number }) {
return prevStack
}
console.log('🔗 Creating new page for URL:', url)
const { newStack, newItem } = pushNewPageToStack(prevStack, url, maxStackSize, index)
if (newItem) {
console.log('🔗 Pushing to history:', url)
window.history.pushState({ index: newItem.index, url }, '', url)
}
return newStack

18
src/components/Note/index.tsx

@ -149,26 +149,16 @@ export default function Note({ @@ -149,26 +149,16 @@ export default function Note({
</div>
<div className="flex items-center gap-1">
{event.kind === ExtendedKind.DISCUSSION && (
<>
{console.log('🔍 Discussion button should render:', { eventKind: event.kind, discussionKind: ExtendedKind.DISCUSSION })}
<button
<button
className="p-1 hover:bg-muted rounded transition-colors"
onClick={(e) => {
e.stopPropagation()
console.log('🔗 View in Discussions clicked:', {
eventId: event.id,
eventKind: event.kind,
noteUrl: toNote(event)
})
console.log('🔗 About to call push with:', toNote(event))
push(toNote(event))
console.log('🔗 Push called successfully')
}}
title="View in Discussions"
>
<MessageSquare className="w-4 h-4 text-blue-500" />
</button>
</>
>
<MessageSquare className="w-4 h-4 text-blue-500" />
</button>
)}
<TranslateButton event={event} className={size === 'normal' ? '' : 'pr-0'} />
{size === 'normal' && (

Loading…
Cancel
Save