mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-30 18:05:55 +01:00 
			
		
		
		
	chore(react/dialogs): add back badges for choose note type
This commit is contained in:
		| @@ -10,6 +10,7 @@ import note_types from "../../services/note_types"; | |||||||
| import { MenuCommandItem, MenuItem } from "../../menus/context_menu"; | import { MenuCommandItem, MenuItem } from "../../menus/context_menu"; | ||||||
| import { TreeCommandNames } from "../../menus/tree_context_menu"; | import { TreeCommandNames } from "../../menus/tree_context_menu"; | ||||||
| import { Suggestion } from "../../services/note_autocomplete"; | import { Suggestion } from "../../services/note_autocomplete"; | ||||||
|  | import Badge from "../react/Badge"; | ||||||
|  |  | ||||||
| export interface ChooseNoteTypeResponse { | export interface ChooseNoteTypeResponse { | ||||||
|     success: boolean; |     success: boolean; | ||||||
| @@ -89,6 +90,7 @@ function NoteTypeChooserDialogComponent({ callback }: NoteTypeChooserDialogProps | |||||||
|                 <FormList onSelect={onNoteTypeSelected}> |                 <FormList onSelect={onNoteTypeSelected}> | ||||||
|                     {noteTypes.map((_item) => { |                     {noteTypes.map((_item) => { | ||||||
|                         if (_item.title === "----") {      |                         if (_item.title === "----") {      | ||||||
|  |                             return;                        | ||||||
|                         } |                         } | ||||||
|  |  | ||||||
|                         const item = _item as MenuCommandItem<TreeCommandNames>; |                         const item = _item as MenuCommandItem<TreeCommandNames>; | ||||||
| @@ -98,8 +100,10 @@ function NoteTypeChooserDialogComponent({ callback }: NoteTypeChooserDialogProps | |||||||
|                         } else { |                         } else { | ||||||
|                             return <FormListItem |                             return <FormListItem | ||||||
|                                 value={[ item.type, item.templateNoteId ].join(",") } |                                 value={[ item.type, item.templateNoteId ].join(",") } | ||||||
|                                 icon={item.uiIcon} |                                 icon={item.uiIcon}> | ||||||
|                                 text={item.title} />;                             |                                     {item.title} | ||||||
|  |                                     {item.badges && item.badges.map((badge) => <Badge {...badge} />)} | ||||||
|  |                                 </FormListItem>;                             | ||||||
|                         } |                         } | ||||||
|                     })} |                     })} | ||||||
|                 </FormList> |                 </FormList> | ||||||
|   | |||||||
							
								
								
									
										8
									
								
								apps/client/src/widgets/react/Badge.tsx
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								apps/client/src/widgets/react/Badge.tsx
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,8 @@ | |||||||
|  | interface BadgeProps { | ||||||
|  |     className?: string; | ||||||
|  |     title: string; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | export default function Badge({ title, className }: BadgeProps) { | ||||||
|  |     return <span class={`badge ${className ?? ""}`}>{title}</span> | ||||||
|  | } | ||||||
| @@ -22,16 +22,16 @@ export default function FormList({ children, onSelect }: FormListOpts) { | |||||||
| } | } | ||||||
|  |  | ||||||
| interface FormListItemOpts { | interface FormListItemOpts { | ||||||
|     text: string; |     children: ComponentChildren; | ||||||
|     icon?: string; |     icon?: string; | ||||||
|     value?: string; |     value?: string; | ||||||
| } | } | ||||||
|  |  | ||||||
| export function FormListItem({ text, icon, value }: FormListItemOpts) { | export function FormListItem({ children, icon, value }: FormListItemOpts) { | ||||||
|     return ( |     return ( | ||||||
|         <a class="dropdown-item" data-value={value}> |         <a class="dropdown-item" data-value={value}> | ||||||
|             <Icon icon={icon} />  |             <Icon icon={icon} />  | ||||||
|             {text} |             {children} | ||||||
|         </a> |         </a> | ||||||
|     ); |     ); | ||||||
| } | } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user