コミットを比較

...

2 コミット

作成者 SHA1 メッセージ 日付
みてるぞ c9b22d346b #306 2026-06-28 06:35:07 +09:00
みてるぞ 283c20b9da #306 2026-06-28 05:59:44 +09:00
5個のファイルの変更47行の追加62行の削除
+1
ファイルの表示
@@ -58,6 +58,7 @@ export const menuOutline = (
{ name: '素材', to: '/materials', visible: true, subMenu: [
{ name: '一覧', to: '/materials' },
{ name: '追加', to: '/materials/new' },
{ name: '抑止', to: '/materials/suppressions' },
{ name: '全体履歴', to: '/materials/changes' },
{ name: 'ヘルプ', to: '/wiki/ヘルプ:素材管理' },
{ component: <Separator/>, visible: materialFlg },
+4 -9
ファイルの表示
@@ -127,17 +127,12 @@ const MaterialDetailPage: FC = () => {
<audio src={material.file} controls/>)))}
<TabGroup>
<Tab name="Wiki">
{material.tag
? (
{material.tag && (
<Tab name="Wiki">
<WikiBody
title={material.tag.name}
body={material.wikiPageBody ?? undefined}/>)
: (
<p className="text-stone-700 dark:text-stone-300">
</p>)}
</Tab>
body={material.wikiPageBody ?? undefined}/>
</Tab>)}
<Tab name="編輯">
<div className="max-w-wl space-y-4 pt-2">
-4
ファイルの表示
@@ -34,10 +34,6 @@ describe ('MaterialListPage', () => {
)
})
expect (await screen.findByText ('素材はありません。')).toBeInTheDocument ()
expect (screen.getByRole ('link', { name: '新規素材を追加' })).toHaveAttribute (
'href',
'/materials/new',
)
})
it ('shows materials in the default card view', async () => {
+8 -21
ファイルの表示
@@ -10,7 +10,7 @@ import FormField from '@/components/common/FormField'
import PageTitle from '@/components/common/PageTitle'
import Pagination from '@/components/common/Pagination'
import MainArea from '@/components/layout/MainArea'
import { API_BASE_URL, SITE_TITLE } from '@/config'
import { SITE_TITLE } from '@/config'
import { fetchMaterials, parseMaterialFilter } from '@/lib/materials'
import { materialsKeys } from '@/lib/queryKeys'
import { dateString, inputClass } from '@/lib/utils'
@@ -41,16 +41,16 @@ const MEDIA_FILTER_LABELS: Record<MaterialIndexMediaKind, string> = {
video: '動画',
audio: '音声',
file_other: 'その他ファイル',
url_only: 'URL のみ'}
url_only: '外部リンクのみ'}
const SORT_LABELS: Record<MaterialIndexSort, string> = {
created_at: '作成日時',
updated_at: '更新日時',
tag_name: 'タグ名',
media_kind: '種類',
file_byte_size: 'ファイルサイズ',
version_no: 'バージョン',
id: 'ID'}
file_byte_size: '容量',
version_no: '',
id: 'Id.'}
const setIf = (qs: URLSearchParams, key: string, value: string | null) => {
@@ -409,21 +409,8 @@ const MaterialListPage: FC = () => {
<div className="flex flex-wrap items-center justify-between gap-3">
<PageTitle className="my-auto"></PageTitle>
<div className="flex flex-wrap gap-2">
<PrefetchLink
to="/materials/new"
className="rounded-full border border-stone-300 bg-white px-4 py-2 text-sm
text-stone-900 hover:bg-stone-100 dark:border-stone-700
dark:bg-stone-900 dark:text-stone-100 dark:hover:bg-stone-800">
</PrefetchLink>
<PrefetchLink
to="/materials/suppressions"
className="rounded-full border border-stone-300 bg-white px-4 py-2 text-sm
text-stone-900 hover:bg-stone-100 dark:border-stone-700
dark:bg-stone-900 dark:text-stone-100 dark:hover:bg-stone-800">
</PrefetchLink>
<a
{/* TODO: 局所出力を可能にする */}
{/* <a
href={`${ API_BASE_URL }/materials/download.zip?profile=legacy_drive`}
target="_blank"
rel="noopener noreferrer"
@@ -431,7 +418,7 @@ const MaterialListPage: FC = () => {
text-stone-900 hover:bg-stone-100 dark:border-stone-700
dark:bg-stone-900 dark:text-stone-100 dark:hover:bg-stone-800">
ZIP をダウンロード
</a>
</a> */}
</div>
</div>
+34 -28
ファイルの表示
@@ -2,17 +2,13 @@ import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'
import { useState } from 'react'
import { Helmet } from 'react-helmet-async'
import PrefetchLink from '@/components/PrefetchLink'
import FormField from '@/components/common/FormField'
import PageTitle from '@/components/common/PageTitle'
import MainArea from '@/components/layout/MainArea'
import { Button } from '@/components/ui/button'
import { toast } from '@/components/ui/use-toast'
import { SITE_TITLE } from '@/config'
import {
createMaterialSyncSuppression,
fetchMaterialSyncSuppressions,
} from '@/lib/materials'
import { createMaterialSyncSuppression, fetchMaterialSyncSuppressions } from '@/lib/materials'
import { materialsKeys } from '@/lib/queryKeys'
import { dateString, inputClass } from '@/lib/utils'
@@ -22,11 +18,11 @@ import type { MaterialSyncSuppressionSourceKind } from '@/types'
const SOURCE_KIND_LABELS: Record<MaterialSyncSuppressionSourceKind, string> = {
uri: 'URI',
google_drive_path: 'Google Drive path',
google_drive_path_prefix: 'Google Drive path prefix',
google_drive_file: 'Google Drive file ID',
legacy_drive_path: 'Legacy Drive path',
legacy_drive_path_prefix: 'Legacy Drive path prefix'}
google_drive_path: 'Google Drive ファイル',
google_drive_path_prefix: 'Google Drive フォルダ',
google_drive_file: 'Google Drive ファイル Id.',
legacy_drive_path: '汎用ファイル',
legacy_drive_path_prefix: '汎用フォルダ' }
const REASONS = [
'copyright_high_risk',
@@ -36,7 +32,23 @@ const REASONS = [
'malware_or_dangerous_file',
'duplicate_or_low_quality',
'source_owner_request',
'other']
'other'] as const
type MaterialSyncSuppressionReason = typeof REASONS[number]
const REASON_NAMES: Record<MaterialSyncSuppressionReason, string> = {
['copyright_high_risk']: '著作権への懸念',
['copyright_takedown']: '著作者からの申出',
['adult_or_sensitive']: '成人向け',
['personal_information']: '個人情報',
['malware_or_dangerous_file']: '危険なソフトウェア',
['duplicate_or_low_quality']: '重複',
['source_owner_request']: '同期元管理者からの申出',
['other']: 'その他' } as const
const reasonName = (reason: string): string =>
REASON_NAMES[reason as MaterialSyncSuppressionReason] ?? reason
const MaterialSyncSuppressionsPage: FC = () => {
@@ -46,7 +58,7 @@ const MaterialSyncSuppressionsPage: FC = () => {
const [sourceUri, setSourceUri] = useState ('')
const [drivePath, setDrivePath] = useState ('')
const [driveFileId, setDriveFileId] = useState ('')
const [reason, setReason] = useState (REASONS[0])
const [reason, setReason] = useState<MaterialSyncSuppressionReason> (REASONS[0])
const { data, isError, isLoading } = useQuery ({
queryKey: materialsKeys.suppressions (),
@@ -82,18 +94,11 @@ const MaterialSyncSuppressionsPage: FC = () => {
return (
<MainArea>
<Helmet>
<title>{`同期抑止 | ${ SITE_TITLE }`}</title>
<title>{`素材同期抑止 | ${ SITE_TITLE }`}</title>
</Helmet>
<div className="space-y-5">
<div className="flex flex-wrap items-center justify-between gap-3">
<PageTitle></PageTitle>
<PrefetchLink
to="/materials"
className="text-sm text-sky-700 underline underline-offset-2 dark:text-sky-300">
</PrefetchLink>
</div>
<PageTitle></PageTitle>
<form
onSubmit={handleSubmit}
@@ -115,7 +120,7 @@ const MaterialSyncSuppressionsPage: FC = () => {
</select>)}
</FormField>
<FormField label="Source URI">
<FormField label="同期元 URI">
{({ invalid }) => (
<input
type="text"
@@ -124,7 +129,7 @@ const MaterialSyncSuppressionsPage: FC = () => {
className={inputClass (invalid)}/>)}
</FormField>
<FormField label="Drive path">
<FormField label="Google Drive パス">
{({ invalid }) => (
<input
type="text"
@@ -133,7 +138,7 @@ const MaterialSyncSuppressionsPage: FC = () => {
className={inputClass (invalid)}/>)}
</FormField>
<FormField label="Drive file ID">
<FormField label="Google Drive ファイル Id.">
{({ invalid }) => (
<input
type="text"
@@ -142,15 +147,15 @@ const MaterialSyncSuppressionsPage: FC = () => {
className={inputClass (invalid)}/>)}
</FormField>
<FormField label="由">
<FormField label="由">
{({ invalid }) => (
<select
value={reason}
onChange={e => setReason (e.target.value)}
onChange={e => setReason (e.target.value as MaterialSyncSuppressionReason)}
className={inputClass (invalid)}>
{REASONS.map (value => (
<option key={value} value={value}>
{value}
{REASON_NAMES[value]}
</option>))}
</select>)}
</FormField>
@@ -185,7 +190,8 @@ const MaterialSyncSuppressionsPage: FC = () => {
{suppression.normalizedSourceKey}
</div>
<div className="mt-2 text-sm text-stone-600 dark:text-stone-400">
: {suppression.reason} / : {dateString (suppression.createdAt)}
: {reasonName (suppression.reason)} /
: {dateString (suppression.createdAt)}
</div>
</article>))}
</div>