このコミットが含まれているのは:
2025-06-28 02:32:40 +09:00
コミット 8020586ec6
19個のファイルの変更168行の追加106行の削除
+8 -9
ファイルの表示
@@ -6,6 +6,7 @@ import axios from 'axios'
import { API_BASE_URL, SITE_TITLE } from '@/config'
import MainArea from '@/components/layout/MainArea'
import { WikiIdBus } from '@/lib/eventBus/WikiIdBus'
import PageTitle from '@/components/common/PageTitle'
import type { WikiPage } from '@/types'
@@ -45,20 +46,18 @@ export default () => {
{(wikiPage && version) && (
<div className="text-sm flex gap-3 items-center justify-center border border-gray-700 rounded px-2 py-1 mb-4">
{wikiPage.pred ? (
<Link to={`/wiki/${ title }?version=${ wikiPage.pred }`}
className="text-blue-400 hover:underline">
&lt;
</Link>) : <>&lt; </>}
<Link to={`/wiki/${ title }?version=${ wikiPage.pred }`}>
&lt;
</Link>) : <>()</>}
<span>{wikiPage.updated_at}</span>
{wikiPage.succ ? (
<Link to={`/wiki/${ title }?version=${ wikiPage.succ }`}
className="text-blue-400 hover:underline">
&gt;
</Link>) : <> &gt;</>}
<Link to={`/wiki/${ title }?version=${ wikiPage.succ }`}>
&gt;
</Link>) : <>()</>}
</div>)}
<h1>{title}</h1>
<PageTitle>{title}</PageTitle>
<div className="prose mx-auto p-4">
{wikiPage === undefined ? 'Loading...' : (
<>
+4 -2
ファイルの表示
@@ -1,7 +1,9 @@
import axios from 'axios'
import { useEffect, useState } from 'react'
import { Helmet } from 'react-helmet'
import { Link, useLocation, useParams } from 'react-router-dom'
import axios from 'axios'
import PageTitle from '@/components/common/PageTitle'
import MainArea from '@/components/layout/MainArea'
import { API_BASE_URL, SITE_TITLE } from '@/config'
@@ -29,7 +31,7 @@ export default () => {
<Helmet>
<title>{`Wiki 差分: ${ diff?.title } | ${ SITE_TITLE }`}</title>
</Helmet>
<h1>{diff?.title}</h1>
<PageTitle>{diff?.title}</PageTitle>
<div className="prose mx-auto p-4">
{diff ? (
diff.diff.map (d => (
+2 -4
ファイルの表示
@@ -44,8 +44,7 @@ export default () => {
</Link>)}
</td>
<td className="p-2">
<Link to={`/wiki/${ encodeURIComponent (change.wiki_page.title) }?version=${ change.sha }`}
className="text-blue-400 hover:underline">
<Link to={`/wiki/${ encodeURIComponent (change.wiki_page.title) }?version=${ change.sha }`}>
{change.wiki_page.title}
</Link>
</td>
@@ -63,8 +62,7 @@ export default () => {
}) ()}
</td>
<td className="p-2">
<Link to={`/users/${ change.user.id }`}
className="text-blue-400 hover:underline">
<Link to={`/users/${ change.user.id }`}>
{change.user.name}
</Link>
<br />
+3 -3
ファイルの表示
@@ -4,6 +4,7 @@ import { Link } from 'react-router-dom'
import axios from 'axios'
import MainArea from '@/components/layout/MainArea'
import { API_BASE_URL, SITE_TITLE } from '@/config'
import SectionTitle from '@/components/common/SectionTitle'
import type { Category, WikiPage } from '@/types'
@@ -34,7 +35,7 @@ export default () => {
<title>{`Wiki | ${ SITE_TITLE }`}</title>
</Helmet>
<div className="max-w-xl">
<h2 className="text-xl mb-4">Wiki</h2>
<SectionTitle className="text-xl mb-4">Wiki</SectionTitle>
<form onSubmit={handleSearch} className="space-y-2">
{/* タイトル */}
<div>
@@ -76,8 +77,7 @@ export default () => {
{results.map (page => (
<tr key={page.id}>
<td className="p-2">
<Link to={`/wiki/${ encodeURIComponent (page.title) }`}
className="text-blue-400 hover:underline">
<Link to={`/wiki/${ encodeURIComponent (page.title) }`}>
{page.title}
</Link>
</td>
+17 -18
ファイルの表示
@@ -65,7 +65,14 @@ export default ({ user }: Props) => {
setEditing (true)
}, [editing])
const url = post ? new URL (post.url) : undefined
const url = post ? new URL (post.url) : null
const nicoFlg = url?.hostname.split ('.').slice (-2).join ('.') === 'nicovideo.jp'
const videoId = (nicoFlg
? url.pathname.match (/(?<=\/watch\/)[a-zA-Z0-9]+?(?=\/|$)/)[0]
: '')
const viewedClass = (post?.viewed
? 'bg-blue-600 hover:bg-blue-700'
: 'bg-gray-500 hover:bg-gray-600')
return (
<>
@@ -76,23 +83,15 @@ export default ({ user }: Props) => {
<MainArea>
{post
? (
<div className="p-4">
{(() => {
if (url.hostname.split ('.').slice (-2).join ('.') === 'nicovideo.jp')
{
return (
<NicoViewer
id={url.pathname.match (
/(?<=\/watch\/)[a-zA-Z0-9]+?(?=\/|$)/)[0]}
width="640"
height="360" />)
}
else
return <img src={post.thumbnail} alt={post.url} className="mb-4 w-full" />
}) ()}
<>
{nicoFlg
? (
<NicoViewer id={videoId}
width="640"
height="360" />)
: <img src={post.thumbnail} alt={post.url} className="mb-4 w-full" />}
<Button onClick={changeViewedFlg}
className={cn ('text-white',
post.viewed ? 'bg-blue-600 hover:bg-blue-700' : 'bg-gray-500 hover:bg-gray-600')}>
className={cn ('text-white', viewedClass)}>
{post.viewed ? '閲覧済' : '未閲覧'}
</Button>
<TabGroup>
@@ -105,7 +104,7 @@ export default ({ user }: Props) => {
}} />
</Tab>}
</TabGroup>
</div>)
</>)
: 'Loading...'}
</MainArea>
</>)
+22 -25
ファイルの表示
@@ -8,6 +8,9 @@ import { Button } from '@/components/ui/button'
import { toast } from '@/components/ui/use-toast'
import { cn } from '@/lib/utils'
import MainArea from '@/components/layout/MainArea'
import Form from '@/components/common/Form'
import PageTitle from '@/components/common/PageTitle'
import Label from '@/components/common/Label'
import type { Post, Tag } from '@/types'
@@ -115,12 +118,12 @@ export default () => {
<Helmet>
<title>{`広場に投稿を追加 | ${ SITE_TITLE }`}</title>
</Helmet>
<div className="max-w-xl mx-auto p-4 space-y-4">
<h1 className="text-2xl font-bold mb-2">稿</h1>
<Form>
<PageTitle>稿</PageTitle>
{/* URL */}
<div>
<label className="block font-semibold mb-1">URL</label>
<Label>URL</Label>
<input type="text"
placeholder="例:https://www.nicovideo.jp/watch/..."
value={url}
@@ -131,15 +134,12 @@ export default () => {
{/* タイトル */}
<div>
<div className="flex gap-2 mb-1">
<label className="flex-1 block font-semibold"></label>
<label className="flex items-center block gap-1">
<input type="checkbox"
checked={titleAutoFlg}
onChange={e => setTitleAutoFlg (e.target.checked)} />
</label>
</div>
<Label checkBox={{
label: '自動',
checked: titleAutoFlg,
onChange: ev => setTitleAutoFlg (ev.target.checked)}}>
</Label>
<input type="text"
className="w-full border rounded p-2"
value={title}
@@ -150,15 +150,12 @@ export default () => {
{/* サムネール */}
<div>
<div className="flex gap-2 mb-1">
<label className="block font-semibold flex-1"></label>
<label className="flex items-center gap-1">
<input type="checkbox"
checked={thumbnailAutoFlg}
onChange={e => setThumbnailAutoFlg (e.target.checked)} />
</label>
</div>
<Label checkBox={{
label: '自動',
checked: thumbnailAutoFlg,
onChange: ev => setThumbnailAutoFlg (ev.target.checked)}}>
</Label>
{thumbnailAutoFlg
? (thumbnailLoading
? <p className="text-gray-500 text-sm">Loading...</p>
@@ -185,7 +182,7 @@ export default () => {
{/* タグ */}
<div>
<label className="block font-semibold"></label>
<Label></Label>
<select multiple
value={tagIds.map (String)}
onChange={e => {
@@ -201,11 +198,11 @@ export default () => {
</div>
{/* 送信 */}
<button onClick={handleSubmit}
<Button onClick={handleSubmit}
className="px-4 py-2 bg-blue-600 text-white rounded disabled:bg-gray-400"
disabled={titleLoading || thumbnailLoading}>
</button>
</div>
</Button>
</Form>
</MainArea>)
}
ファイルの表示