Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

Update command shortcuts

Terry Sutton9c47b85b6fd2
diff --git a/packages/ui/src/components/Command/Command.utils.tsx b/packages/ui/src/components/Command/Command.utils.tsx
index 412db2b27d9..47abbd5e05f 100644
--- a/packages/ui/src/components/Command/Command.utils.tsx
+++ b/packages/ui/src/components/Command/Command.utils.tsx
@@ -88,7 +88,7 @@ export const CommandInput = React.forwardRef<
className={cn(
'flex h-11 w-full rounded-md bg-transparent px-4 py-7 text-sm outline-none',
'focus:shadow-none focus:ring-transparent',
- 'placeholder:text-scale-800 dark:placeholder:text-scale-800 disabled:cursor-not-allowed disabled:opacity-50 dark:text-scale-1200 border-0',
+ 'text-scale-1100 placeholder:text-scale-800 dark:placeholder:text-scale-800 disabled:cursor-not-allowed disabled:opacity-50 dark:text-scale-1200 border-0',
className
)}
{...props}
@@ -258,18 +258,33 @@ export const CommandItemStale = React.forwardRef<CommandPrimitiveItemElement, Co
CommandItemStale.displayName = 'CommandItemStale'
-export const CommandShortcut = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => {
+interface CommandShortcutProps {
+ className?: string
+ children?: React.ReactNode
+ onClick?: () => void
+ type?: 'default' | 'breadcrumb'
+}
+
+export const CommandShortcut = ({
+ className,
+ children,
+ onClick,
+ type = 'default',
+}: CommandShortcutProps) => {
return (
- <div
+ <button
+ onClick={onClick}
className={cn(
- '[&:not(:last-child)]:hover:bg-scale-600 [&:not(:last-child)]:hover:cursor-pointer',
- 'cursor-default bg-scale-500 px-1.5 py-0.5 rounded text-xs text-scale-900',
- 'last:bg-scale-600 last:text-scale-900',
+ 'cursor-default px-1.5 py-0.5 rounded text-xs [&:not(:last-child)]:hover:cursor-pointer',
'justify-end',
+ type === 'breadcrumb'
+ ? 'text-scale-900'
+ : 'bg-scale-500 text-scale-900 [&:not(:last-child)]:hover:bg-scale-600 last:bg-scale-600 last:text-scale-900',
className
)}
- {...props}
- />
+ >
+ {children}
+ </button>
)
}
@@ -298,7 +313,10 @@ export const TextHighlighter = ({ text, query, ...props }: TextHighlighterProps)
}
const regex = new RegExp(query, 'gi')
- return text.replace(regex, (match) => `<span class="font-bold text-scale-1200">${match}</span>`)
+ return text.replace(
+ regex,
+ (match) => `<span class="font-semibold text-scale-1200">${match}</span>`
+ )
}
return <span dangerouslySetInnerHTML={{ __html: highlightMatches(text) }} {...props} />
diff --git a/packages/ui/src/components/Command/CommandMenuShortcuts.tsx b/packages/ui/src/components/Command/CommandMenuShortcuts.tsx
index 6d091370050..f5f0e72bf18 100644
--- a/packages/ui/src/components/Command/CommandMenuShortcuts.tsx
+++ b/packages/ui/src/components/Command/CommandMenuShortcuts.tsx
@@ -1,15 +1,23 @@
import React from 'react'
+import { IconArrowLeft } from '../Icon/icons/IconArrowLeft'
import { CommandShortcut } from './Command.utils'
import { useCommandMenu } from './CommandMenuProvider'
export default function CommandMenuShortcuts() {
- const { setPages, pages } = useCommandMenu()
+ const { setPages, pages, currentPage } = useCommandMenu()
+
return (
- <div className="flex w-full gap-2 px-4 pt-4 justify-items-start flex-row">
- <CommandShortcut onClick={() => setPages([])}>{'Home'}</CommandShortcut>
+ <div className="flex w-full gap-2 px-4 pt-4 justify-items-start flex-row items-center">
+ <CommandShortcut onClick={() => setPages([])}>
+ <div className="flex items-center gap-2">
+ <IconArrowLeft width={15} height={15} />
+ </div>
+ </CommandShortcut>
+
{pages.map((page, index) => (
<CommandShortcut
+ type={page === currentPage ? 'breadcrumb' : 'default'}
key={page}
onClick={() => {
if (index === pages.length - 1) {
diff --git a/packages/ui/src/components/Command/DocsSearch.tsx b/packages/ui/src/components/Command/DocsSearch.tsx
index 967cec0b250..64225778084 100644
--- a/packages/ui/src/components/Command/DocsSearch.tsx
+++ b/packages/ui/src/components/Command/DocsSearch.tsx
@@ -223,7 +223,7 @@ const DocsSearch = () => {
</CommandGroup>
)
})}
- {!results && !hasSearchError && (
+ {!results && !hasSearchError && !isLoading && (
<CommandGroup forceMount>
{questions.map((question) => {
const key = question.replace(/\s+/g, '_')
@@ -253,7 +253,7 @@ const DocsSearch = () => {
</div>
)}
{results && results.length === 0 && (
- <div className="p-6 flex flex-col items-center gap-6 mt-4">
+ <div className="p-6 flex flex-col items-center gap-6 mt-4 text-scale-1100">
<IconAlertTriangle strokeWidth={1.5} size={40} />
<p className="text-lg text-center">No results found.</p>
<Button size="tiny" type="secondary" onClick={handleResetPrompt}>