Skip to content

Commit

Permalink
fix: note timeline nav to hide note should accessible if logged
Browse files Browse the repository at this point in the history
Signed-off-by: Innei <i@innei.in>
  • Loading branch information
Innei committed Apr 11, 2024
1 parent 790d934 commit 6412e28
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 10 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"@milkdown/react": "7.3.6",
"@milkdown/transformer": "7.3.6",
"@milkdown/utils": "7.3.6",
"@mx-space/api-client": "1.9.0",
"@mx-space/api-client": "1.10.1",
"@prosemirror-adapter/react": "0.2.6",
"@radix-ui/react-dialog": "1.0.5",
"@radix-ui/react-label": "2.0.2",
Expand Down
8 changes: 4 additions & 4 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions src/components/modules/note/NoteTimeline.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ const NoteTimelineImpl = () => {
nid: note.nid,
title: note.title,
created: note.created,
hide: note.hide,
}
})
const noteNid = useCurrentNoteNid()
Expand All @@ -56,6 +57,7 @@ const NoteTimelineImpl = () => {
nid: note.nid,
id: note.id,
created: note.created,
hide: note.hide,
},
]
: []
Expand All @@ -72,6 +74,7 @@ const NoteTimelineImpl = () => {
active={isCurrent}
title={item.title}
nid={item.nid}
attachToken={item.hide}
/>
)
})}
Expand Down
12 changes: 7 additions & 5 deletions src/components/modules/note/NoteTimelineItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { tv } from 'tailwind-variants'
import type { Target, TargetAndTransition } from 'framer-motion'

import { LeftToRightTransitionView } from '~/components/ui/transition'
import { getToken } from '~/lib/cookie'
import { clsxm } from '~/lib/helper'
import { routeBuilder, Routes } from '~/lib/route-builder'
import { springScrollToTop } from '~/lib/scroller'
Expand All @@ -30,11 +31,15 @@ export const NoteTimelineItem = memo<{
active: boolean
title: string
nid: number
attachToken: boolean

layout?: boolean
}>((props) => {
const { active, nid, title, layout } = props
const { active, nid, title, layout, attachToken } = props

const href = routeBuilder(Routes.Note, {
id: nid,
})
return (
<m.li
layout={layout}
Expand All @@ -54,17 +59,14 @@ export const NoteTimelineItem = memo<{
)}
<Link
onClick={springScrollToTop}
prefetch={false}
className={clsxm(
active
? styles({
status: 'active',
})
: styles(),
)}
href={routeBuilder(Routes.Note, {
id: nid,
})}
href={attachToken ? `${href}?token=${getToken()}` : href}
scroll={false}
>
{title}
Expand Down

0 comments on commit 6412e28

Please sign in to comment.