コミットを比較

..

31 コミット

作成者 SHA1 メッセージ 日付
みてるぞ 3898fbc156 #34 2026-07-07 00:38:18 +09:00
みてるぞ 6d8cab9822 #34 2026-07-07 00:07:12 +09:00
みてるぞ f2651a987a #34 2026-07-06 23:37:29 +09:00
みてるぞ 4478bc92ed #34 2026-07-06 23:25:14 +09:00
みてるぞ 5f5299ea39 #34 2026-07-06 23:18:52 +09:00
みてるぞ 2d9a79fecc #34 2026-07-06 23:08:27 +09:00
みてるぞ e74f16782b #34 2026-07-06 22:39:53 +09:00
みてるぞ 8ac56f74ce #34 2026-07-06 22:02:25 +09:00
みてるぞ 59a87c0e11 #34 2026-07-06 21:17:39 +09:00
みてるぞ f66532a55d #34 2026-07-06 21:12:49 +09:00
みてるぞ c3d2d8e1d1 #34 2026-07-06 20:46:16 +09:00
みてるぞ f4dea9b91e #34 2026-07-06 19:34:11 +09:00
みてるぞ f00e97e335 #34 2026-07-05 20:18:36 +09:00
みてるぞ a0c1b8ba31 #34 2026-07-05 20:18:16 +09:00
みてるぞ 021d13a262 #34 2026-07-05 20:00:58 +09:00
みてるぞ 1b6cac43c2 #34 2026-07-05 18:21:39 +09:00
みてるぞ b0cce4b7ee #34 2026-07-05 12:51:31 +09:00
みてるぞ 40cc3b2c0c Merge remote-tracking branch 'origin/main' into feature/034 2026-07-05 11:59:28 +09:00
みてるぞ 61ab4744bd #34 2026-07-05 11:57:29 +09:00
みてるぞ ca92c62049 #34 2026-07-05 11:27:45 +09:00
みてるぞ 4e3fb6bef7 #34 2026-07-05 03:43:37 +09:00
みてるぞ 3a9ac8af32 #34 2026-07-05 03:27:58 +09:00
みてるぞ 7bc9ee1e68 #34 2026-07-05 03:19:58 +09:00
みてるぞ 95b4db1fc2 #34 2026-07-05 02:59:48 +09:00
みてるぞ 4117bdd31e #34 2026-07-05 02:40:19 +09:00
みてるぞ fecbb4b354 #34 2026-07-05 02:04:07 +09:00
みてるぞ d0ea329887 #34 2026-07-05 01:51:07 +09:00
みてるぞ 3b29c3e10e #34 2026-07-05 00:03:13 +09:00
みてるぞ 518c5fa0f2 #34 2026-07-04 21:47:16 +09:00
みてるぞ 4cc2dc5441 #34 2026-07-04 19:50:40 +09:00
みてるぞ 6a57dc53bf #34 2026-07-04 19:03:50 +09:00
2個のファイルの変更27行の追加82行の削除
+9 -16
ファイルの表示
@@ -57,8 +57,7 @@ const DraggableDroppableTagRow: FC<Props> = ({ tag, nestLevel, pathKey, parentTa
isDragging: dragging } = useDraggable ({ id: dndId,
data: { kind: 'tag',
tagId: tag.id,
parentTagId,
nestLevel } })
parentTagId } })
const { setNodeRef: setDropRef, isOver: over } = useDroppable ({
id: dndId,
@@ -78,16 +77,12 @@ const DraggableDroppableTagRow: FC<Props> = ({ tag, nestLevel, pathKey, parentTa
return
const dx = e.clientX - p.x
const dy = e.clientY - p.y
if (dx * dx + dy * dy >= 9)
armEatNextClick ()
}}
onPointerUpCapture={() => {
downPosRef.current = null
}}
onPointerCancelCapture={() => {
downPosRef.current = null
}}
onClickCapture={e => {
if (suppressClickRef.current)
{
@@ -95,20 +90,18 @@ const DraggableDroppableTagRow: FC<Props> = ({ tag, nestLevel, pathKey, parentTa
e.stopPropagation ()
}
}}
ref={setDropRef}
ref={node => {
setDragRef (node)
setDropRef (node)
}}
style={style}
className={cn (
'min-w-0 max-w-full overflow-hidden rounded select-none',
sp && 'touch-pan-y',
over && 'ring-2 ring-offset-2')}
>
{...attributes}
{...listeners}>
<motion.div
ref={setDragRef}
style={style}
className={cn (
'inline-flex min-w-0 max-w-full items-baseline overflow-hidden',
sp && 'touch-pan-y')}
{...attributes}
{...listeners}
className="flex min-w-0 max-w-full items-baseline overflow-hidden"
transition={{ layout: layoutTransition }}
layoutId={animationMode === 'off'
? undefined
+18 -66
ファイルの表示
@@ -1,9 +1,7 @@
import { DndContext,
DragOverlay,
MeasuringStrategy,
MouseSensor,
TouchSensor,
pointerWithin,
useDroppable,
useSensor,
useSensors } from '@dnd-kit/core'
@@ -27,20 +25,13 @@ import { postsKeys, tagsKeys } from '@/lib/queryKeys'
import { useClientBehaviourSettings } from '@/lib/useClientBehaviourSettings'
import { dateString, originalCreatedAtString } from '@/lib/utils'
import type { CollisionDetection, DragEndEvent } from '@dnd-kit/core'
import type { DragEndEvent } from '@dnd-kit/core'
import type { FC, MutableRefObject, ReactNode } from 'react'
import type { Category, Post, TagWithSections } from '@/types'
type TagByCategory = { [key in Category]: TagWithSections[] }
const tagCollisionDetection: CollisionDetection = args => {
return pointerWithin (args)
}
const alwaysMeasureDroppables = {
droppable: { strategy: MeasuringStrategy.Always } } as const
const renderTagTree = (
tag: TagWithSections,
@@ -186,34 +177,12 @@ const DropSlot = ({ cat }: { cat: Category }) => {
</li>)
}
const EmptyCategoryDropSection = (
{ cat, children }: { cat: Category
children: ReactNode }) => {
const { setNodeRef, isOver: over } = useDroppable ({
id: `slot:${ cat }`,
data: { kind: 'slot', cat } })
return (
<div ref={setNodeRef} className="my-3">
{children}
<ul>
<li className="h-1">
{over && <div className="h-0.5 w-full rounded bg-sky-400"/>}
</li>
</ul>
</div>)
}
type Props = {
className?: string
post: Post
sp?: boolean }
type ActiveTagDrag = {
tagId: number
nestLevel: number }
const TagDetailSidebar: FC<Props> = ({ className, post, sp }) => {
sp = Boolean (sp)
@@ -243,7 +212,7 @@ const TagDetailSidebar: FC<Props> = ({ className, post, sp }) => {
return tagsTmp
}, [post])
const [activeTagDrag, setActiveTagDrag] = useState<ActiveTagDrag | null> (null)
const [activeTagId, setActiveTagId] = useState<number | null> (null)
const [dragging, setDragging] = useState (false)
const [saving, setSaving] = useState (false)
const [tags, setTags] = useState (baseTags)
@@ -359,18 +328,9 @@ const TagDetailSidebar: FC<Props> = ({ className, post, sp }) => {
<TagSearch/>
<DndContext
sensors={sensors}
collisionDetection={sp ? tagCollisionDetection : undefined}
measuring={sp ? alwaysMeasureDroppables : undefined}
onDragStart={e => {
if (e.active.data.current?.kind === 'tag')
{
const tagId = e.active.data.current?.tagId
const nestLevel = e.active.data.current?.nestLevel
setActiveTagDrag (
tagId == null || nestLevel == null
? null
: { tagId, nestLevel })
}
setActiveTagId (e.active.data.current?.tagId ?? null)
setDragging (true)
suppressClickRef.current = true
document.body.style.userSelect = 'none'
@@ -381,13 +341,13 @@ const TagDetailSidebar: FC<Props> = ({ className, post, sp }) => {
suppressClickRef.current = false}, { capture: true, once: true })
}}
onDragCancel={() => {
setActiveTagDrag (null)
setActiveTagId (null)
setDragging (false)
document.body.style.userSelect = ''
suppressClickRef.current = false
}}
onDragEnd={async e => {
setActiveTagDrag (null)
setActiveTagId (null)
setDragging (false)
await onDragEnd (e)
document.body.style.userSelect = ''
@@ -402,26 +362,18 @@ const TagDetailSidebar: FC<Props> = ({ className, post, sp }) => {
if (!(categoryTags.length > 0 || dragging))
return null
const sectionTitle = (
<SubsectionTitle>
<motion.div
layoutId={animationMode === 'off'
? undefined
: `tag-${ sp ? 'sp-' : '' }${ cat }`}
transition={{ layout: layoutTransition }}>
{CATEGORY_NAMES[cat]}
</motion.div>
</SubsectionTitle>)
if (!(categoryTags.length > 0))
return (
<EmptyCategoryDropSection cat={cat} key={cat}>
{sectionTitle}
</EmptyCategoryDropSection>)
return (
<div className="my-3" key={cat}>
{sectionTitle}
<SubsectionTitle>
<motion.div
layoutId={animationMode === 'off'
? undefined
: `tag-${ sp ? 'sp-' : '' }${ cat }`}
transition={{ layout: layoutTransition }}>
{CATEGORY_NAMES[cat]}
</motion.div>
</SubsectionTitle>
<ul>
{(tagRelationDisplay === 'grouped'
? (tags[cat] ?? []).flatMap (tag =>
@@ -491,9 +443,9 @@ const TagDetailSidebar: FC<Props> = ({ className, post, sp }) => {
<DragOverlay adjustScale={false}>
<div className="pointer-events-none">
{activeTagDrag != null && (() => {
const tag = findTag (tags, activeTagDrag.tagId)
return tag && <TagLink tag={tag} nestLevel={activeTagDrag.nestLevel}/>
{activeTagId != null && (() => {
const tag = findTag (tags, activeTagId)
return tag && <TagLink tag={tag}/>
}) ()}
</div>
</DragOverlay>