| @@ -10,9 +10,9 @@ import axios from 'axios' | |||||
| import toCamel from 'camelcase-keys' | import toCamel from 'camelcase-keys' | ||||
| import { AnimatePresence, motion } from 'framer-motion' | import { AnimatePresence, motion } from 'framer-motion' | ||||
| import { useEffect, useRef, useState } from 'react' | import { useEffect, useRef, useState } from 'react' | ||||
| import { Link } from 'react-router-dom' | |||||
| import DraggableDroppableTagRow from '@/components/DraggableDroppableTagRow' | import DraggableDroppableTagRow from '@/components/DraggableDroppableTagRow' | ||||
| import PrefetchLink from '@/components/PrefetchLink' | |||||
| import TagLink from '@/components/TagLink' | import TagLink from '@/components/TagLink' | ||||
| import TagSearch from '@/components/TagSearch' | import TagSearch from '@/components/TagSearch' | ||||
| import SectionTitle from '@/components/common/SectionTitle' | import SectionTitle from '@/components/common/SectionTitle' | ||||
| @@ -389,7 +389,7 @@ export default (({ post }: Props) => { | |||||
| </>)} | </>)} | ||||
| </li> | </li> | ||||
| <li> | <li> | ||||
| <Link to={`/posts/changes?id=${ post.id }`}>履歴</Link> | |||||
| <PrefetchLink to={`/posts/changes?id=${ post.id }`}>履歴</PrefetchLink> | |||||
| </li> | </li> | ||||
| </ul> | </ul> | ||||
| </div>)} | </div>)} | ||||
| @@ -1,6 +1,5 @@ | |||||
| import axios from 'axios' | import axios from 'axios' | ||||
| import { useEffect, useState } from 'react' | import { useEffect, useState } from 'react' | ||||
| import { Link } from 'react-router-dom' | |||||
| import PrefetchLink from '@/components/PrefetchLink' | import PrefetchLink from '@/components/PrefetchLink' | ||||
| import { API_BASE_URL } from '@/config' | import { API_BASE_URL } from '@/config' | ||||
| @@ -18,10 +17,14 @@ type CommonProps = { tag: Tag | |||||
| prefetch?: boolean } | prefetch?: boolean } | ||||
| type PropsWithLink = | type PropsWithLink = | ||||
| CommonProps & { linkFlg?: true } & Partial<ComponentProps<typeof Link>> | |||||
| & CommonProps | |||||
| & { linkFlg?: true } | |||||
| & Partial<ComponentProps<typeof PrefetchLink>> | |||||
| type PropsWithoutLink = | type PropsWithoutLink = | ||||
| CommonProps & { linkFlg: false } & Partial<HTMLAttributes<HTMLSpanElement>> | |||||
| & CommonProps | |||||
| & { linkFlg: false } | |||||
| & Partial<HTMLAttributes<HTMLSpanElement>> | |||||
| type Props = PropsWithLink | PropsWithoutLink | type Props = PropsWithLink | PropsWithoutLink | ||||
| @@ -76,17 +79,17 @@ export default (({ tag, | |||||
| <span className="mr-1"> | <span className="mr-1"> | ||||
| {havingWiki | {havingWiki | ||||
| ? ( | ? ( | ||||
| <Link to={`/wiki/${ encodeURIComponent (tag.name) }`} | |||||
| <PrefetchLink to={`/wiki/${ encodeURIComponent (tag.name) }`} | |||||
| className={linkClass}> | className={linkClass}> | ||||
| ? | ? | ||||
| </Link>) | |||||
| </PrefetchLink>) | |||||
| : ( | : ( | ||||
| <Link to={`/wiki/${ encodeURIComponent (tag.name) }`} | |||||
| <PrefetchLink to={`/wiki/${ encodeURIComponent (tag.name) }`} | |||||
| className="animate-[wiki-blink_.25s_steps(2,end)_infinite] | className="animate-[wiki-blink_.25s_steps(2,end)_infinite] | ||||
| dark:animate-[wiki-blink-dark_.25s_steps(2,end)_infinite]" | dark:animate-[wiki-blink-dark_.25s_steps(2,end)_infinite]" | ||||
| title={`${ tag.name } Wiki が存在しません.`}> | title={`${ tag.name } Wiki が存在しません.`}> | ||||
| ! | ! | ||||
| </Link>)} | |||||
| </PrefetchLink>)} | |||||
| </span>)} | </span>)} | ||||
| {nestLevel > 0 && ( | {nestLevel > 0 && ( | ||||
| <span | <span | ||||
| @@ -110,12 +113,12 @@ export default (({ tag, | |||||
| {...props}> | {...props}> | ||||
| {tag.name} | {tag.name} | ||||
| </PrefetchLink> | </PrefetchLink> | ||||
| : <Link | |||||
| : <PrefetchLink | |||||
| to={`/posts?${ (new URLSearchParams ({ tags: tag.name })).toString () }`} | to={`/posts?${ (new URLSearchParams ({ tags: tag.name })).toString () }`} | ||||
| className={linkClass} | className={linkClass} | ||||
| {...props}> | {...props}> | ||||
| {tag.name} | {tag.name} | ||||
| </Link>) | |||||
| </PrefetchLink>) | |||||
| : ( | : ( | ||||
| <span className={spanClass} | <span className={spanClass} | ||||
| {...props}> | {...props}> | ||||
| @@ -1,6 +1,5 @@ | |||||
| import { Link } from 'react-router-dom' | |||||
| import Separator from '@/components/MenuSeparator' | import Separator from '@/components/MenuSeparator' | ||||
| import PrefetchLink from '@/components/PrefetchLink' | |||||
| import { cn } from '@/lib/utils' | import { cn } from '@/lib/utils' | ||||
| import type { FC } from 'react' | import type { FC } from 'react' | ||||
| @@ -24,9 +23,9 @@ export default (({ user, sp }: Props) => { | |||||
| return ( | return ( | ||||
| <> | <> | ||||
| {sp && <Separator/>} | {sp && <Separator/>} | ||||
| <Link to="/users/settings" | |||||
| <PrefetchLink to="/users/settings" | |||||
| className={className}> | className={className}> | ||||
| {user.name || '名もなきニジラー'} | {user.name || '名もなきニジラー'} | ||||
| </Link> | |||||
| </PrefetchLink> | |||||
| </>) | </>) | ||||
| }) satisfies FC<Props> | }) satisfies FC<Props> | ||||
| @@ -2,9 +2,9 @@ import axios from 'axios' | |||||
| import toCamel from 'camelcase-keys' | import toCamel from 'camelcase-keys' | ||||
| import { useEffect, useMemo, useState } from 'react' | import { useEffect, useMemo, useState } from 'react' | ||||
| import ReactMarkdown from 'react-markdown' | import ReactMarkdown from 'react-markdown' | ||||
| import { Link } from 'react-router-dom' | |||||
| import remarkGFM from 'remark-gfm' | import remarkGFM from 'remark-gfm' | ||||
| import PrefetchLink from '@/components/PrefetchLink' | |||||
| import SectionTitle from '@/components/common/SectionTitle' | import SectionTitle from '@/components/common/SectionTitle' | ||||
| import SubsectionTitle from '@/components/common/SubsectionTitle' | import SubsectionTitle from '@/components/common/SubsectionTitle' | ||||
| import { API_BASE_URL } from '@/config' | import { API_BASE_URL } from '@/config' | ||||
| @@ -24,7 +24,7 @@ const mdComponents = { h1: ({ children }) => <SectionTitle>{children}</SectionT | |||||
| ul: ({ children }) => <ul className="list-disc pl-6">{children}</ul>, | ul: ({ children }) => <ul className="list-disc pl-6">{children}</ul>, | ||||
| a: (({ href, children }) => ( | a: (({ href, children }) => ( | ||||
| ['/', '.'].some (e => href?.startsWith (e)) | ['/', '.'].some (e => href?.startsWith (e)) | ||||
| ? <Link to={href!}>{children}</Link> | |||||
| ? <PrefetchLink to={href!}>{children}</PrefetchLink> | |||||
| : ( | : ( | ||||
| <a href={href} | <a href={href} | ||||
| target="_blank" | target="_blank" | ||||
| @@ -2,9 +2,10 @@ import axios from 'axios' | |||||
| import toCamel from 'camelcase-keys' | import toCamel from 'camelcase-keys' | ||||
| import { useEffect, useState } from 'react' | import { useEffect, useState } from 'react' | ||||
| import { Helmet } from 'react-helmet-async' | import { Helmet } from 'react-helmet-async' | ||||
| import { Link, useLocation } from 'react-router-dom' | |||||
| import { useLocation } from 'react-router-dom' | |||||
| import TagLink from '@/components/TagLink' | import TagLink from '@/components/TagLink' | ||||
| import PrefetchLink from '@/components/PrefetchLink' | |||||
| import PageTitle from '@/components/common/PageTitle' | import PageTitle from '@/components/common/PageTitle' | ||||
| import Pagination from '@/components/common/Pagination' | import Pagination from '@/components/common/Pagination' | ||||
| import MainArea from '@/components/layout/MainArea' | import MainArea from '@/components/layout/MainArea' | ||||
| @@ -48,7 +49,7 @@ export default (() => { | |||||
| <PageTitle> | <PageTitle> | ||||
| 耕作履歴 | 耕作履歴 | ||||
| {id && <>: 投稿 {<Link to={`/posts/${ id }`}>#{id}</Link>}</>} | |||||
| {id && <>: 投稿 {<PrefetchLink to={`/posts/${ id }`}>#{id}</PrefetchLink>}</>} | |||||
| </PageTitle> | </PageTitle> | ||||
| <table className="table-auto w-full border-collapse"> | <table className="table-auto w-full border-collapse"> | ||||
| @@ -75,12 +76,12 @@ export default (() => { | |||||
| <tr key={`${ change.timestamp }-${ change.post.id }-${ change.tag.id }`}> | <tr key={`${ change.timestamp }-${ change.post.id }-${ change.tag.id }`}> | ||||
| {withPost && ( | {withPost && ( | ||||
| <td className="align-top" rowSpan={rowsCnt}> | <td className="align-top" rowSpan={rowsCnt}> | ||||
| <Link to={`/posts/${ change.post.id }`}> | |||||
| <PrefetchLink to={`/posts/${ change.post.id }`}> | |||||
| <img src={change.post.thumbnail || change.post.thumbnailBase || undefined} | <img src={change.post.thumbnail || change.post.thumbnailBase || undefined} | ||||
| alt={change.post.title || change.post.url} | alt={change.post.title || change.post.url} | ||||
| title={change.post.title || change.post.url || undefined} | title={change.post.title || change.post.url || undefined} | ||||
| className="w-40"/> | className="w-40"/> | ||||
| </Link> | |||||
| </PrefetchLink> | |||||
| </td>)} | </td>)} | ||||
| <td> | <td> | ||||
| <TagLink tag={change.tag} withWiki={false} withCount={false}/> | <TagLink tag={change.tag} withWiki={false} withCount={false}/> | ||||
| @@ -88,9 +89,9 @@ export default (() => { | |||||
| </td> | </td> | ||||
| <td> | <td> | ||||
| {change.user ? ( | {change.user ? ( | ||||
| <Link to={`/users/${ change.user.id }`}> | |||||
| <PrefetchLink to={`/users/${ change.user.id }`}> | |||||
| {change.user.name} | {change.user.name} | ||||
| </Link>) : 'bot 操作'} | |||||
| </PrefetchLink>) : 'bot 操作'} | |||||
| <br/> | <br/> | ||||
| {change.timestamp} | {change.timestamp} | ||||
| </td> | </td> | ||||
| @@ -2,8 +2,9 @@ import axios from 'axios' | |||||
| import toCamel from 'camelcase-keys' | import toCamel from 'camelcase-keys' | ||||
| import { useEffect, useState } from 'react' | import { useEffect, useState } from 'react' | ||||
| import { Helmet } from 'react-helmet-async' | import { Helmet } from 'react-helmet-async' | ||||
| import { Link, useLocation } from 'react-router-dom' | |||||
| import { useLocation } from 'react-router-dom' | |||||
| import PrefetchLink from '@/components/PrefetchLink' | |||||
| import MainArea from '@/components/layout/MainArea' | import MainArea from '@/components/layout/MainArea' | ||||
| import { API_BASE_URL, SITE_TITLE } from '@/config' | import { API_BASE_URL, SITE_TITLE } from '@/config' | ||||
| @@ -44,22 +45,24 @@ export default () => { | |||||
| <tr key={change.revisionId}> | <tr key={change.revisionId}> | ||||
| <td> | <td> | ||||
| {change.pred != null && ( | {change.pred != null && ( | ||||
| <Link to={`/wiki/${ change.wikiPage.id }/diff?from=${ change.pred }&to=${ change.revisionId }`}> | |||||
| <PrefetchLink | |||||
| to={`/wiki/${ change.wikiPage.id }/diff?from=${ change.pred }&to=${ change.revisionId }`}> | |||||
| 差分 | 差分 | ||||
| </Link>)} | |||||
| </PrefetchLink>)} | |||||
| </td> | </td> | ||||
| <td className="p-2"> | <td className="p-2"> | ||||
| <Link to={`/wiki/${ encodeURIComponent (change.wikiPage.title) }?version=${ change.revisionId }`}> | |||||
| <PrefetchLink | |||||
| to={`/wiki/${ encodeURIComponent (change.wikiPage.title) }?version=${ change.revisionId }`}> | |||||
| {change.wikiPage.title} | {change.wikiPage.title} | ||||
| </Link> | |||||
| </PrefetchLink> | |||||
| </td> | </td> | ||||
| <td className="p-2"> | <td className="p-2"> | ||||
| {change.pred == null ? '新規' : '更新'} | {change.pred == null ? '新規' : '更新'} | ||||
| </td> | </td> | ||||
| <td className="p-2"> | <td className="p-2"> | ||||
| <Link to={`/users/${ change.user.id }`}> | |||||
| <PrefetchLink to={`/users/${ change.user.id }`}> | |||||
| {change.user.name} | {change.user.name} | ||||
| </Link> | |||||
| </PrefetchLink> | |||||
| <br/> | <br/> | ||||
| {change.timestamp} | {change.timestamp} | ||||
| </td> | </td> | ||||