This commit is contained in:
2025-06-28 15:46:38 +09:00
parent 3199c476a3
commit 934225f9e8
7 changed files with 115 additions and 36 deletions
+3 -2
View File
@@ -1,4 +1,5 @@
import axios from 'axios'
import toCamel from 'camelcase-keys'
import { useEffect, useState } from 'react'
import { Helmet } from 'react-helmet'
import ReactMarkdown from 'react-markdown'
@@ -33,7 +34,7 @@ export default () => {
void (axios.get (`${ API_BASE_URL }/wiki/title/${ encodeURIComponent (title) }`, version && { params: { version } })
.then (res => {
setWikiPage (res.data)
setWikiPage (toCamel (res.data, { deep: true }))
WikiIdBus.set (res.data.id)
})
.catch (() => setWikiPage (null)))
@@ -51,7 +52,7 @@ export default () => {
<
</Link>) : <>()</>}
<span>{wikiPage.updated_at}</span>
<span>{wikiPage.updatedAt}</span>
{wikiPage.succ ? (
<Link to={`/wiki/${ title }?version=${ wikiPage.succ }`}>
+2 -1
View File
@@ -1,4 +1,5 @@
import axios from 'axios'
import toCamel from 'camelcase-keys'
import { useEffect, useState } from 'react'
import { Helmet } from 'react-helmet'
import { Link, useLocation, useParams } from 'react-router-dom'
@@ -23,7 +24,7 @@ export default () => {
useEffect (() => {
void (axios.get (`${ API_BASE_URL }/wiki/${ id }/diff`, { params: { from, to } })
.then (res => setDiff (res.data)))
.then (res => setDiff (toCamel (res.data, { deep: true }))))
}, [])
return (
+7 -6
View File
@@ -1,4 +1,5 @@
import axios from 'axios'
import toCamel from 'camelcase-keys'
import { useEffect, useState } from 'react'
import { Helmet } from 'react-helmet'
import { Link, useLocation, useParams } from 'react-router-dom'
@@ -18,7 +19,7 @@ export default () => {
useEffect (() => {
void (axios.get (`${ API_BASE_URL }/wiki/changes`, id && { params: { id } })
.then (res => setChanges (res.data)))
.then (res => setChanges (toCamel (res.data, { deep: true }))))
}, [location.search])
return (
@@ -39,19 +40,19 @@ export default () => {
{changes.map (change => (
<tr key={change.sha}>
<td>
{change.change_type === 'update' && (
<Link to={`/wiki/${ change.wiki_page.id }/diff?from=${ change.pred }&to=${ change.sha }`}>
{change.changeType === 'update' && (
<Link to={`/wiki/${ change.wikiPage.id }/diff?from=${ change.pred }&to=${ change.sha }`}>
</Link>)}
</td>
<td className="p-2">
<Link to={`/wiki/${ encodeURIComponent (change.wiki_page.title) }?version=${ change.sha }`}>
{change.wiki_page.title}
<Link to={`/wiki/${ encodeURIComponent (change.wikiPage.title) }?version=${ change.sha }`}>
{change.wikiPage.title}
</Link>
</td>
<td className="p-2">
{(() => {
switch (change.change_type)
switch (change.changeType)
{
case 'create':
return '新規'