コミットを比較

...

3 コミット

作成者 SHA1 メッセージ 日付
みてるぞ d721a64e33 #306 2026-06-27 19:06:28 +09:00
みてるぞ 0eb45372c3 #306 2026-06-27 18:52:50 +09:00
みてるぞ 27aa5321a1 #306 2026-06-27 18:43:40 +09:00
5個のファイルの変更15行の追加29行の削除
+2 -1
ファイルの表示
@@ -36,7 +36,8 @@ const verticalChrome = (el: HTMLElement): number => {
const setChildrenById = ( const setChildrenById = (
tags: MaterialSidebarTag[], tags: MaterialSidebarTag[],
targetId: number, targetId: number,
children: MaterialSidebarTag[]): MaterialSidebarTag[] => ( children: MaterialSidebarTag[],
): MaterialSidebarTag[] => (
tags.map (tag => { tags.map (tag => {
if (tag.id === targetId) if (tag.id === targetId)
return { ...tag, children } return { ...tag, children }
+1 -1
ファイルの表示
@@ -4,7 +4,7 @@ import { cn } from '@/lib/utils'
import type { FC } from 'react' import type { FC } from 'react'
type Props = { children: React.ReactNode } type Props = { children: React.ReactNode; className?: string }
const PageTitle: FC<Props> = ({ children, className, ...rest }) => ( const PageTitle: FC<Props> = ({ children, className, ...rest }) => (
-1
ファイルの表示
@@ -8,7 +8,6 @@ import WikiBody from '@/components/WikiBody'
import FieldError from '@/components/common/FieldError' import FieldError from '@/components/common/FieldError'
import FormField from '@/components/common/FormField' import FormField from '@/components/common/FormField'
import PageTitle from '@/components/common/PageTitle' import PageTitle from '@/components/common/PageTitle'
import PrefetchLink from '@/components/PrefetchLink'
import TabGroup, { Tab } from '@/components/common/TabGroup' import TabGroup, { Tab } from '@/components/common/TabGroup'
import TagInput from '@/components/common/TagInput' import TagInput from '@/components/common/TagInput'
import MainArea from '@/components/layout/MainArea' import MainArea from '@/components/layout/MainArea'
+3 -14
ファイルの表示
@@ -33,15 +33,11 @@ describe ('MaterialListPage', () => {
} }, } },
) )
}) })
expect (await screen.findByText ('素材はありません')).toBeInTheDocument () expect (await screen.findByText ('素材はありません')).toBeInTheDocument ()
expect (screen.getByRole ('link', { name: '新規素材を追加' })).toHaveAttribute ( expect (screen.getByRole ('link', { name: '新規素材を追加' })).toHaveAttribute (
'href', 'href',
'/materials/new', '/materials/new',
) )
expect (screen.getByRole ('link', { name: '履歴' })).toHaveAttribute (
'href',
'/materials/changes',
)
}) })
it ('shows materials in the default card view', async () => { it ('shows materials in the default card view', async () => {
@@ -159,16 +155,9 @@ describe ('MaterialListPage', () => {
(_, element) => element?.textContent === '伊地知ニジカ 配下の素材を表示中', (_, element) => element?.textContent === '伊地知ニジカ 配下の素材を表示中',
)).toBeInTheDocument () )).toBeInTheDocument ()
const addLinks = screen.getAllByRole ('link', { name: 'このタグに素材を追加' }) expect (screen.getByRole ('link', { name: '泣き' })).toHaveAttribute (
expect (addLinks[0]).toHaveAttribute (
'href', 'href',
'/materials/new?tag=%E4%BC%8A%E5%9C%B0%E7%9F%A5%E3%83%8B%E3%82%B8%E3%82%AB' '/materials?tag_id=30&include_descendants=1&group_by=parent_tag&material_filter=present',
+ '&return_to=%2Fmaterials%3Ftag_id%3D20%26include_descendants%3D1%26group_by%3Dparent_tag',
)
expect (addLinks[1]).toHaveAttribute (
'href',
'/materials/new?tag=%E6%B3%A3%E3%81%8D'
+ '&return_to=%2Fmaterials%3Ftag_id%3D20%26include_descendants%3D1%26group_by%3Dparent_tag',
) )
expect (screen.getByRole ('link', { name: 'タグ選択を解除' })).toHaveAttribute ( expect (screen.getByRole ('link', { name: 'タグ選択を解除' })).toHaveAttribute (
'href', 'href',
+9 -12
ファイルの表示
@@ -52,10 +52,6 @@ const SORT_LABELS: Record<MaterialIndexSort, string> = {
version_no: 'バージョン', version_no: 'バージョン',
id: 'ID'} id: 'ID'}
const GROUP_BY_LABELS: Record<MaterialIndexGroupBy, string> = {
none: 'オフ',
parent_tag: '親タグ'}
const setIf = (qs: URLSearchParams, key: string, value: string | null) => { const setIf = (qs: URLSearchParams, key: string, value: string | null) => {
const next = value?.trim () const next = value?.trim ()
@@ -87,21 +83,24 @@ const materialTitle = (material: Material): string =>
const groupedTagPath = ( const groupedTagPath = (
tagId: number, tagId: number,
materialFilter: MaterialFilter): string => materialFilter: MaterialFilter,
): string =>
`/materials?tag_id=${ tagId }&include_descendants=1&group_by=parent_tag` `/materials?tag_id=${ tagId }&include_descendants=1&group_by=parent_tag`
+ `&material_filter=${ materialFilter }` + `&material_filter=${ materialFilter }`
const materialNewPath = ( const materialNewPath = (
tagName: string, tagName: string,
returnTo: string): string => returnTo: string,
): string =>
`/materials/new?tag=${ encodeURIComponent (tagName) }` `/materials/new?tag=${ encodeURIComponent (tagName) }`
+ `&return_to=${ encodeURIComponent (returnTo) }` + `&return_to=${ encodeURIComponent (returnTo) }`
const clearedTagSelectionPath = ( const clearedTagSelectionPath = (
locationSearch: string, locationSearch: string,
materialFilter: MaterialFilter): string => { materialFilter: MaterialFilter,
): string => {
const qs = new URLSearchParams (locationSearch) const qs = new URLSearchParams (locationSearch)
qs.delete ('tag_id') qs.delete ('tag_id')
qs.delete ('include_descendants') qs.delete ('include_descendants')
@@ -190,10 +189,9 @@ const MaterialListItem: FC<{ material: Material }> = ({ material }) => (
const GroupHeading: FC<{ const GroupHeading: FC<{
count: number count: number
materialFilter: MaterialFilter materialFilter: MaterialFilter
returnTo: string
title: string title: string
tagId: number tagId: number
}> = ({ count, materialFilter, returnTo, title, tagId }) => ( }> = ({ count, materialFilter, title, tagId }) => (
<div className="flex items-center gap-2 border-b border-stone-200 pb-2 <div className="flex items-center gap-2 border-b border-stone-200 pb-2
dark:border-stone-700"> dark:border-stone-700">
<PrefetchLink <PrefetchLink
@@ -378,8 +376,7 @@ const MaterialListPage: FC = () => {
tagId={group.tag.id} tagId={group.tag.id}
title={group.tag.name} title={group.tag.name}
count={group.count} count={group.count}
materialFilter={materialFilter} materialFilter={materialFilter}/>
returnTo={location.pathname + location.search}/>
{renderMaterialCollection (groupMaterials)} {renderMaterialCollection (groupMaterials)}
</section>) </section>)
})} })}
@@ -601,7 +598,7 @@ const MaterialListPage: FC = () => {
{(!isLoading && !isError && materials.length === 0) && ( {(!isLoading && !isError && materials.length === 0) && (
<p> <p>
{['character', 'material'].includes (tagScope?.tag.category) && ( {(tagScope && ['character', 'material'].includes (tagScope.tag.category)) && (
<> <>
<PrefetchLink <PrefetchLink
to={materialNewPath (tagScope.tag.name, location.pathname + location.search)} to={materialNewPath (tagScope.tag.name, location.pathname + location.search)}