Skip to content

Commit

Permalink
fix(apps/web): dnd관련 리펙토링에 따른 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
minseong0324 committed Feb 9, 2025
1 parent bd1eed0 commit 4c91a3c
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export const ContentItem = forwardRef<HTMLDivElement, ContentItemProps>(
onModify,
className,
isLoading,
isSelected = 'false',
isSelected = false,
...props
},
ref
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,6 @@ export function EditContent({ agentId, postGroupId }: EditPageParams) {
getItemsByStatus(POST_STATUS.READY_TO_UPLOAD).map((item) => (
<DndController.Item id={item.id} key={item.id}>
<ContentItem
key={item.id}
summary={item.summary}
updatedAt={item.updatedAt}
onRemove={() => handleDeletePost(item.id)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import { Modal } from '@repo/ui/Modal';
import { useDeletePostMutation } from '@web/store/mutation/useDeletePostMutation';
import { DetailPageContext } from '../../EditDetail';
import { DragGuide } from '../DragGuide/DragGuide';
import { ContentItem } from '@web/components/common/DNDController/compounds';

function EditSidebarContent() {
const modal = useModal();
Expand Down Expand Up @@ -157,17 +158,17 @@ function EditSidebarContent() {
<SkeletonContentItem key={item.id} />
))}
{getItemsByStatus(POST_STATUS.GENERATED).map((item) => (
<DndController.Item
key={item.id}
id={item.id}
summary={item.summary}
updatedAt={item.updatedAt}
onRemove={() => handleDeletePost(item.id)}
onModify={() => {}}
onClick={() => handleClick(item.id)}
isSelected={Number(postParam) === item.id}
isLoading={loadingPosts.includes(item.id)}
/>
<DndController.Item id={item.id} key={item.id}>
<ContentItem
summary={item.summary}
updatedAt={item.updatedAt}
onRemove={() => handleDeletePost(item.id)}
onModify={() => {}}
onClick={() => handleClick(item.id)}
isSelected={Number(postParam) === item.id}
isLoading={loadingPosts.includes(item.id)}
/>
</DndController.Item>
))}
</DndController.SortableList>
) : (
Expand Down Expand Up @@ -197,17 +198,17 @@ function EditSidebarContent() {
)}
>
{getItemsByStatus(POST_STATUS.EDITING).map((item) => (
<DndController.Item
key={item.id}
id={item.id}
summary={item.summary}
updatedAt={item.updatedAt}
onRemove={() => handleDeletePost(item.id)}
onModify={() => {}}
onClick={() => handleClick(item.id)}
isSelected={Number(postParam) === item.id}
isLoading={loadingPosts.includes(item.id)}
/>
<DndController.Item id={item.id} key={item.id}>
<ContentItem
summary={item.summary}
updatedAt={item.updatedAt}
onRemove={() => handleDeletePost(item.id)}
onModify={() => {}}
onClick={() => handleClick(item.id)}
isSelected={Number(postParam) === item.id}
isLoading={loadingPosts.includes(item.id)}
/>
</DndController.Item>
))}
</DndController.SortableList>
) : (
Expand Down Expand Up @@ -238,17 +239,17 @@ function EditSidebarContent() {
>
{getItemsByStatus(POST_STATUS.READY_TO_UPLOAD).map(
(item) => (
<DndController.Item
key={item.id}
id={item.id}
summary={item.summary}
updatedAt={item.updatedAt}
onRemove={() => handleDeletePost(item.id)}
onModify={() => {}}
onClick={() => handleClick(item.id)}
isSelected={Number(postParam) === item.id}
isLoading={loadingPosts.includes(item.id)}
/>
<DndController.Item id={item.id} key={item.id}>
<ContentItem
summary={item.summary}
updatedAt={item.updatedAt}
onRemove={() => handleDeletePost(item.id)}
onModify={() => {}}
onClick={() => handleClick(item.id)}
isSelected={Number(postParam) === item.id}
isLoading={loadingPosts.includes(item.id)}
/>
</DndController.Item>
)
)}
</DndController.SortableList>
Expand Down Expand Up @@ -316,6 +317,12 @@ export function EditSidebar() {

modifyPosts(updatedItems);
}}
renderDragOverlay={(activeItem) => (
<ContentItem
summary={activeItem.summary}
updatedAt={activeItem.updatedAt}
/>
)}
>
<EditSidebarContent />
</DndController>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {
ContentItem,
ContentItemProps,
} from '@web/components/common/DNDController/compounds/ContentItem/ContentItem';
} from '@web/app/(prompt)/edit/[agentId]/[postGroupId]/_components/ContentItem/ContentItem';
import * as style from './TableRow.css';
import { Post } from '@web/types';
import { Column } from '../ScheduleTable/types';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export { ContentItem } from './ContentItem/ContentItem';
export { ContentItem } from '../../../../app/(prompt)/edit/[agentId]/[postGroupId]/_components/ContentItem/ContentItem';
export { DraggableItem } from './DraggableItem/DraggableItem';
export { DroppableContent } from './DroppableContent/DroppableContent';

0 comments on commit 4c91a3c

Please sign in to comment.