Skip to content

Commit

Permalink
fix(playground): ignore keyboard events in template messages for drag…
Browse files Browse the repository at this point in the history
… and drop (#4945)

* fix(playground): ignore keyboard events in template messages for drag and drop

* pull default pointer sensor from dnd-kit/dom

* update file name casing via git

* migrate to non-experimental dnd-kit

* remove unused experimental code, update naming and remove unnecessary props

* remove strategy

* fix forward ref warning
  • Loading branch information
Parker-Stafford committed Oct 11, 2024
1 parent cfee176 commit 7fd27bb
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 215 deletions.
5 changes: 0 additions & 5 deletions app/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 19 additions & 2 deletions app/src/components/dnd/DragHandle.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,27 @@
import React from "react";
import { DraggableAttributes } from "@dnd-kit/core";
import { css } from "@emotion/react";

function DragHandle() {
// This is the type of the listeners object from useSortable
// However it is not exported from @dnd-kit/core so we have to redefine it here
// eslint-disable-next-line @typescript-eslint/ban-types
type Listeners = Record<string, Function>;

function DragHandle(
{
listeners,
attributes,
}: {
listeners?: Listeners;
attributes: DraggableAttributes;
},
ref: React.Ref<HTMLButtonElement>
) {
return (
<button
data-cypress="draggable-handle"
ref={ref}
{...listeners}
{...attributes}
aria-roledescription="draggable"
aria-pressed="false"
aria-disabled="false"
Expand Down
208 changes: 0 additions & 208 deletions app/src/components/dnd/helpers/move.ts

This file was deleted.

1 change: 1 addition & 0 deletions app/src/pages/playground/PlaygroundChatTemplate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ interface PlaygroundChatTemplateProps extends PlaygroundInstanceProps {}

export function PlaygroundChatTemplate(props: PlaygroundChatTemplateProps) {
const id = props.playgroundInstanceId;

const instances = usePlaygroundContext((state) => state.instances);
const updateInstance = usePlaygroundContext((state) => state.updateInstance);
const playgroundInstance = instances.find((instance) => instance.id === id);
Expand Down

0 comments on commit 7fd27bb

Please sign in to comment.