Skip to content

Commit

Permalink
fix: copyright
Browse files Browse the repository at this point in the history
Signed-off-by: Innei <i@innei.in>
  • Loading branch information
Innei committed Mar 8, 2024
1 parent 612efd9 commit ae65b25
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
21 changes: 14 additions & 7 deletions src/components/modules/comment/CommentBox/UniversalTextArea.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
'use client'

import { useCallback, useEffect, useRef } from 'react'
import { useIsomorphicLayoutEffect } from 'foxact/use-isomorphic-layout-effect'
import dynamic from 'next/dynamic'

import { FloatPopover } from '~/components/ui/float-popover'
Expand Down Expand Up @@ -53,13 +54,19 @@ export const UniversalTextArea: Component = ({ className }) => {
}
}, [value])

// useLayoutEffect(() => {
// // autofocus
// const $ta = taRef.current
// if (!$ta) return
// $ta.selectionStart = $ta.selectionEnd = $ta.value.length
// $ta.focus()
// }, [])
useIsomorphicLayoutEffect(() => {
if (location.hash !== '#comment') {
return
}

// autofocus
const $ta = taRef.current
if (!$ta) return
$ta.selectionStart = $ta.selectionEnd = $ta.value.length
$ta.focus()

$ta.scrollIntoView({ behavior: 'smooth', block: 'center' })
}, [])

return (
<TextArea
Expand Down
7 changes: 4 additions & 3 deletions src/components/modules/post/PostCopyright.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@ export const PostCopyright: FC = () => {
const data = useCurrentPostDataSelector(
(data) => {
if (!webUrl) return null
if (!data) return null
return {
title: data?.title,
link: new URL(location.pathname, webUrl).toString(),
date: data?.modified,
title: data.title,
link: `${webUrl}/posts/${data.category.slug}/${data.slug}`,
date: data.modified,
}
},
[webUrl],
Expand Down

0 comments on commit ae65b25

Please sign in to comment.