Files
supabase/apps/database-new/components/AllThreadsModal/MessageNode.tsx
T
fbfe910c22 Initial work on database.new visualizer (#19027)
* Initial commit.

* Remove bunch of unneeded deps.

* Fix the providers.

* Minor fixes to make the themes work.

* Fix prettier errors.

* Add default constraint.

* Midway styling

* General styling improvements

* More styling stuff

* Bit more styling

* Bit more pizzazz

* Scaffold all threads modal

* Small style fix

* Ensure loading state persist in new page until redirect

* Fix

* Test';

* Add basic validation

* Fix

* Remove console logs

* Hide show all threads button

* chore: style the blocks

* fix: stroke width

* add some shadow

* stroke width

* Update TableNode.tsx

* Swap hide chat for hide code

* more sidebar styling

* Resolve conflicts

* Some style fixeds

* Some style fixeds

* mock profile

* update user dorpdown

* Update globals.css

* Chore/db new layouts and url params (#19142)

* chore: layouts

* Fix + clean up

---------

Co-authored-by: Jonathan Summers-Muir <MildTomato@users.noreply.github.com>

* Fix header

* Scaffold profile and conversations

* Some quick styling

* Update apps/database-new/.env.local.example

Co-authored-by: Greg Richardson <greg.nmr@gmail.com>

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
Co-authored-by: Jonathan Summers-Muir <MildTomato@users.noreply.github.com>
Co-authored-by: Greg Richardson <greg.nmr@gmail.com>
2023-11-22 12:31:32 -03:30

45 lines
1.2 KiB
TypeScript

import { Handle, NodeProps, Position } from 'reactflow'
import { NODE_HEIGHT, NODE_WIDTH } from './AllThreadsModal.constants'
export interface MessageNodeData {
id: string
text: string
isStart: boolean
isEnd: boolean
onSelectMessage: () => void
}
const MessageNode = ({ data }: NodeProps<MessageNodeData>) => {
const { id, text, isStart, isEnd, onSelectMessage } = data
return (
<>
{!isStart && (
<Handle
type="target"
id="handle-t"
position={Position.Top}
style={{ background: 'transparent' }}
/>
)}
<div
className="flex flex-col gap-y-1 rounded bg-surface-100 border border-default p-3 hover:bg-surface-200 transition cursor-pointer"
style={{ width: NODE_WIDTH / 2 - 10, height: NODE_HEIGHT / 2 }}
onClick={() => onSelectMessage()}
>
<p className="text-xs text-foreground-light font-mono">{id}</p>
<p className="text-sm">{text}</p>
</div>
{!isEnd && (
<Handle
type="source"
id="handle-s"
position={Position.Bottom}
style={{ background: 'transparent' }}
/>
)}
</>
)
}
export default MessageNode