Files
supabase/apps/design-system/registry/default/example/assistant-chat-commands.tsx
T
Ivan Vasilov 56de26fe22 chore: Migrate the monorepo to use Tailwind v4 (#45318)
This PR migrates the whole monorepo to use Tailwind v4:
- Removed `@tailwindcss/container-queries` plugin since it's included by
default in v4,
- Bump all instances of Tailwind to v4. Made minimal changes to the
shared config to remove non-supported features (`alpha` mentions),
- Migrate all apps to be compatible with v4 configs,
- Fix the `typography.css` import in 3 apps,
- Add missing rules which were included by default in v3,
- Run `pnpm dlx @tailwindcss/upgrade` on all apps, which renames a lot
of classes
- Rename all misnamed classes according to
https://tailwindcss.com/docs/upgrade-guide#renamed-utilities in all
apps.

---------

Co-authored-by: Jordi Enric <jordi.err@gmail.com>
2026-04-30 10:53:24 +00:00

55 lines
1.7 KiB
TypeScript

import React, { useRef, useState } from 'react'
import { AssistantChatForm, AssistantCommandsPopover } from 'ui-patterns/AssistantChat'
export default function AssistantChatCommands() {
const [commandsOpen, setCommandsOpen] = useState<boolean>(false)
const textAreaRef = useRef<HTMLTextAreaElement>(null)
const [value, setValueState] = useState('')
const [loading, setLoading] = useState(false)
function handleSubmit(event: React.FormEvent) {
// set loading for 3 seconds and then reset
setLoading(true)
setTimeout(() => {
setLoading(false)
}, 1500)
}
const suggestions = [
'Add policy for org Inserted User Access',
'Add policy for User-Specific Todo Access',
'Add policy for Org Update Restriction',
]
return (
<div className="flex flex-col gap-3">
<AssistantCommandsPopover
open={commandsOpen}
setOpen={setCommandsOpen}
textAreaRef={textAreaRef}
value={value}
setValue={(e) => setValueState(e)}
suggestions={suggestions}
>
<AssistantChatForm
textAreaRef={textAreaRef}
value={value}
loading={loading}
disabled={loading}
onValueChange={(e) => setValueState(e.target.value)}
commandsOpen={commandsOpen}
setCommandsOpen={setCommandsOpen}
onSubmit={async (event) => {
event.preventDefault()
handleSubmit(event)
}}
/>
</AssistantCommandsPopover>
<p className="text-xs mt-3 text-foreground-lighter">
Press <span className="bg-surface-300 px-[3px] py-[2px] border rounded-sm">/</span> to open
commands
</p>
</div>
)
}