Show descriptions for generated commands, make them look better and sort better (#3023)
This commit is contained in:
Binary file not shown.
Before Width: | Height: | Size: 44 KiB After Width: | Height: | Size: 44 KiB |
@ -72,17 +72,21 @@ function CommandComboBox({
|
|||||||
<Combobox.Option
|
<Combobox.Option
|
||||||
key={option.groupId + option.name + (option.displayName || '')}
|
key={option.groupId + option.name + (option.displayName || '')}
|
||||||
value={option}
|
value={option}
|
||||||
className="flex items-center gap-2 px-4 py-1 first:mt-2 last:mb-2 ui-active:bg-primary/10 dark:ui-active:bg-chalkboard-90"
|
className="flex items-center gap-4 px-4 py-1.5 first:mt-2 last:mb-2 ui-active:bg-primary/10 dark:ui-active:bg-chalkboard-90"
|
||||||
>
|
>
|
||||||
{'icon' in option && option.icon && (
|
{'icon' in option && option.icon && (
|
||||||
<CustomIcon name={option.icon} className="w-5 h-5" />
|
<CustomIcon name={option.icon} className="w-5 h-5" />
|
||||||
)}
|
)}
|
||||||
<p className="flex-grow">{option.displayName || option.name} </p>
|
<div className="flex-grow flex flex-col">
|
||||||
|
<p className="my-0 leading-tight">
|
||||||
|
{option.displayName || option.name}{' '}
|
||||||
|
</p>
|
||||||
{option.description && (
|
{option.description && (
|
||||||
<p className="text-xs text-chalkboard-60 dark:text-chalkboard-40">
|
<p className="my-0 text-xs text-chalkboard-60 dark:text-chalkboard-50">
|
||||||
{option.description}
|
{option.description}
|
||||||
</p>
|
</p>
|
||||||
)}
|
)}
|
||||||
|
</div>
|
||||||
</Combobox.Option>
|
</Combobox.Option>
|
||||||
))}
|
))}
|
||||||
</Combobox.Options>
|
</Combobox.Options>
|
||||||
|
@ -124,6 +124,7 @@ export function createSettingsCommand({
|
|||||||
displayName: `Settings · ${decamelize(type.replaceAll('.', ' · '), {
|
displayName: `Settings · ${decamelize(type.replaceAll('.', ' · '), {
|
||||||
separator: ' ',
|
separator: ' ',
|
||||||
})}`,
|
})}`,
|
||||||
|
description: settingConfig.description,
|
||||||
groupId: 'settings',
|
groupId: 'settings',
|
||||||
icon: 'settings',
|
icon: 'settings',
|
||||||
needsReview: false,
|
needsReview: false,
|
||||||
|
@ -81,6 +81,7 @@ export function createMachineCommand<
|
|||||||
name: type,
|
name: type,
|
||||||
groupId,
|
groupId,
|
||||||
icon,
|
icon,
|
||||||
|
description: commandConfig.description,
|
||||||
needsReview: commandConfig.needsReview || false,
|
needsReview: commandConfig.needsReview || false,
|
||||||
onSubmit: (data?: S[typeof type]) => {
|
onSubmit: (data?: S[typeof type]) => {
|
||||||
if (data !== undefined && data !== null) {
|
if (data !== undefined && data !== null) {
|
||||||
|
@ -514,7 +514,9 @@ export const commandBarMachine = createMachine(
|
|||||||
)
|
)
|
||||||
|
|
||||||
function sortCommands(a: Command, b: Command) {
|
function sortCommands(a: Command, b: Command) {
|
||||||
if (b.groupId === 'auth') return -1
|
if (b.groupId === 'auth' && !(a.groupId === 'auth')) return -2
|
||||||
if (a.groupId === 'auth') return 1
|
if (a.groupId === 'auth' && !(b.groupId === 'auth')) return 2
|
||||||
|
if (b.groupId === 'settings' && !(a.groupId === 'settings')) return -1
|
||||||
|
if (a.groupId === 'settings' && !(b.groupId === 'settings')) return 1
|
||||||
return a.name.localeCompare(b.name)
|
return a.name.localeCompare(b.name)
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user