#271 表のレーアウト統一(#194)

Merged
みてるぞ merged 2 commits from feature/194 into main 1 week ago
  1. +9
    -5
      frontend/src/pages/posts/PostHistoryPage.tsx
  2. +5
    -5
      frontend/src/pages/tags/NicoTagListPage.tsx
  3. +7
    -3
      frontend/src/pages/wiki/WikiHistoryPage.tsx
  4. +6
    -5
      frontend/src/pages/wiki/WikiSearchPage.tsx

+ 9
- 5
frontend/src/pages/posts/PostHistoryPage.tsx View File

@@ -10,6 +10,7 @@ import MainArea from '@/components/layout/MainArea'
import { SITE_TITLE } from '@/config'
import { fetchPostChanges } from '@/lib/posts'
import { postsKeys } from '@/lib/queryKeys'
import { cn } from '@/lib/utils'

import type { FC } from 'react'

@@ -44,7 +45,7 @@ export default (() => {
{loading ? 'Loading...' : (
<>
<table className="table-auto w-full border-collapse">
<thead>
<thead className="border-b-2 border-black dark:border-white">
<tr>
<th className="p-2 text-left">投稿</th>
<th className="p-2 text-left">変更</th>
@@ -64,9 +65,12 @@ export default (() => {
++rowsCnt
}
return (
<tr key={`${ change.timestamp }-${ change.post.id }-${ change.tag.id }`}>
<tr key={`${ change.timestamp }-${ change.post.id }-${ change.tag.id }`}
className={cn ('even:bg-gray-100 dark:even:bg-gray-700',
withPost && 'border-t')}>
{withPost && (
<td className="align-top" rowSpan={rowsCnt}>
<td className="align-top p-2 bg-white dark:bg-[#242424] border-r"
rowSpan={rowsCnt}>
<PrefetchLink to={`/posts/${ change.post.id }`}>
<img src={change.post.thumbnail || change.post.thumbnailBase || undefined}
alt={change.post.title || change.post.url}
@@ -74,11 +78,11 @@ export default (() => {
className="w-40"/>
</PrefetchLink>
</td>)}
<td>
<td className="p-2">
<TagLink tag={change.tag} withWiki={false} withCount={false}/>
{`を${ change.changeType === 'add' ? '記載' : '消除' }`}
</td>
<td>
<td className="p-2">
{change.user ? (
<PrefetchLink to={`/users/${ change.user.id }`}>
{change.user.name}


+ 5
- 5
frontend/src/pages/tags/NicoTagListPage.tsx View File

@@ -2,7 +2,7 @@ import { useEffect, useRef, useState } from 'react'
import { Helmet } from 'react-helmet-async'

import TagLink from '@/components/TagLink'
import SectionTitle from '@/components/common/SectionTitle'
import PageTitle from '@/components/common/PageTitle'
import TextArea from '@/components/common/TextArea'
import MainArea from '@/components/layout/MainArea'
import { toast } from '@/components/ui/use-toast'
@@ -92,13 +92,13 @@ export default ({ user }: Props) => {
</Helmet>

<div className="max-w-xl">
<SectionTitle>ニコニコ連携</SectionTitle>
<PageTitle>ニコニコ連携</PageTitle>
</div>

<div className="mt-4">
{nicoTags.length > 0 && (
<table className="table-auto w-full border-collapse mb-4">
<thead>
<thead className="border-b-2 border-black dark:border-white">
<tr>
<th className="p-2 text-left">ニコニコタグ</th>
<th className="p-2 text-left">連携タグ</th>
@@ -107,7 +107,7 @@ export default ({ user }: Props) => {
</thead>
<tbody>
{nicoTags.map ((tag, i) => (
<tr key={i}>
<tr key={i} className="even:bg-gray-100 dark:even:bg-gray-700">
<td className="p-2">
<TagLink tag={tag} withWiki={false} withCount={false}/>
</td>
@@ -125,7 +125,7 @@ export default ({ user }: Props) => {
</span>))}
</td>
{memberFlg && (
<td>
<td className="p-2">
<a href="#" onClick={ev => {
ev.preventDefault ()
handleEdit (tag.id)


+ 7
- 3
frontend/src/pages/wiki/WikiHistoryPage.tsx View File

@@ -3,6 +3,7 @@ import { Helmet } from 'react-helmet-async'
import { useLocation } from 'react-router-dom'

import PrefetchLink from '@/components/PrefetchLink'
import PageTitle from '@/components/common/PageTitle'
import MainArea from '@/components/layout/MainArea'
import { SITE_TITLE } from '@/config'
import { apiGet } from '@/lib/api'
@@ -28,8 +29,11 @@ export default () => {
<Helmet>
<title>{`Wiki 変更履歴 | ${ SITE_TITLE }`}</title>
</Helmet>

<PageTitle>Wiki 履歴</PageTitle>

<table className="table-auto w-full border-collapse">
<thead>
<thead className="border-b-2 border-black dark:border-white">
<tr>
<th></th>
<th className="p-2 text-left">タイトル</th>
@@ -39,8 +43,8 @@ export default () => {
</thead>
<tbody>
{changes.map (change => (
<tr key={change.revisionId}>
<td>
<tr key={change.revisionId} className="even:bg-gray-100 dark:even:bg-gray-700">
<td className="p-2">
{change.pred != null && (
<PrefetchLink
to={`/wiki/${ change.wikiPage.id }/diff?from=${ change.pred }&to=${ change.revisionId }`}>


+ 6
- 5
frontend/src/pages/wiki/WikiSearchPage.tsx View File

@@ -2,7 +2,7 @@ import { useEffect, useState } from 'react'
import { Helmet } from 'react-helmet-async'

import PrefetchLink from '@/components/PrefetchLink'
import SectionTitle from '@/components/common/SectionTitle'
import PageTitle from '@/components/common/PageTitle'
import MainArea from '@/components/layout/MainArea'
import { SITE_TITLE } from '@/config'
import { apiGet } from '@/lib/api'
@@ -35,8 +35,9 @@ export default () => {
<Helmet>
<title>Wiki | {SITE_TITLE}</title>
</Helmet>

<div className="max-w-xl">
<SectionTitle>Wiki</SectionTitle>
<PageTitle>Wiki</PageTitle>
<form onSubmit={handleSearch} className="space-y-2">
{/* タイトル */}
<div>
@@ -68,7 +69,7 @@ export default () => {

<div className="mt-4">
<table className="table-auto w-full border-collapse">
<thead>
<thead className="border-b-2 border-black dark:border-white">
<tr>
<th className="p-2 text-left">タイトル</th>
<th className="p-2 text-left">最終更新</th>
@@ -76,13 +77,13 @@ export default () => {
</thead>
<tbody>
{results.map (page => (
<tr key={page.id}>
<tr key={page.id} className="even:bg-gray-100 dark:even:bg-gray-700">
<td className="p-2">
<PrefetchLink to={`/wiki/${ encodeURIComponent (page.title) }`}>
{page.title}
</PrefetchLink>
</td>
<td className="p-2 text-gray-100 text-sm">
<td className="p-2">
{page.updatedAt}
</td>
</tr>))}


Loading…
Cancel
Save