mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 10:26:08 +01:00 
			
		
		
		
	feat(react/bulk_actions): port delete note
This commit is contained in:
		| @@ -2,8 +2,8 @@ import { ComponentChildren } from "preact"; | |||||||
| import AbstractBulkAction from "./abstract_bulk_action"; | import AbstractBulkAction from "./abstract_bulk_action"; | ||||||
|  |  | ||||||
| interface BulkActionProps { | interface BulkActionProps { | ||||||
|     label: string;    |     label: string | ComponentChildren;    | ||||||
|     children: ComponentChildren; |     children?: ComponentChildren; | ||||||
|     helpText?: ComponentChildren; |     helpText?: ComponentChildren; | ||||||
|     bulkAction: AbstractBulkAction; |     bulkAction: AbstractBulkAction; | ||||||
| } | } | ||||||
|   | |||||||
| @@ -1,38 +0,0 @@ | |||||||
| import { t } from "../../../services/i18n.js"; |  | ||||||
| import AbstractBulkAction from "../abstract_bulk_action.js"; |  | ||||||
|  |  | ||||||
| const TPL = /*html*/` |  | ||||||
| <tr> |  | ||||||
|     <td colspan="2"> |  | ||||||
|         <span class="bx bx-trash"></span> |  | ||||||
|  |  | ||||||
|         ${t("delete_note.delete_matched_notes")} |  | ||||||
|     </td> |  | ||||||
|     <td class="button-column"> |  | ||||||
|         <div class="dropdown help-dropdown"> |  | ||||||
|             <span class="bx bx-help-circle icon-action" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false"></span> |  | ||||||
|             <div class="dropdown-menu dropdown-menu-right p-4"> |  | ||||||
|                 <p>${t("delete_note.delete_matched_notes_description")}</p> |  | ||||||
|  |  | ||||||
|                 <p>${t("delete_note.undelete_notes_instruction")}</p> |  | ||||||
|  |  | ||||||
|                 ${t("delete_note.erase_notes_instruction")} |  | ||||||
|             </div> |  | ||||||
|         </div> |  | ||||||
|  |  | ||||||
|         <span class="bx bx-x icon-action action-conf-del"></span> |  | ||||||
|     </td> |  | ||||||
| </tr>`; |  | ||||||
|  |  | ||||||
| export default class DeleteNoteBulkAction extends AbstractBulkAction { |  | ||||||
|     static get actionName() { |  | ||||||
|         return "deleteNote"; |  | ||||||
|     } |  | ||||||
|     static get actionTitle() { |  | ||||||
|         return t("delete_note.delete_note"); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     doRender() { |  | ||||||
|         return $(TPL); |  | ||||||
|     } |  | ||||||
| } |  | ||||||
							
								
								
									
										33
									
								
								apps/client/src/widgets/bulk_actions/note/delete_note.tsx
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										33
									
								
								apps/client/src/widgets/bulk_actions/note/delete_note.tsx
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,33 @@ | |||||||
|  | import { t } from "../../../services/i18n.js"; | ||||||
|  | import AbstractBulkAction from "../abstract_bulk_action.js"; | ||||||
|  | import BulkAction from "../BulkAction.jsx"; | ||||||
|  | import Icon from "../../react/Icon.jsx"; | ||||||
|  |  | ||||||
|  | function DeleteNoteBulkActionComponent({ bulkAction }: { bulkAction: AbstractBulkAction }) { | ||||||
|  |     return ( | ||||||
|  |         <BulkAction | ||||||
|  |             bulkAction={bulkAction} | ||||||
|  |             label={<><Icon icon="bx bx-trash" /> {t("delete_note.delete_matched_notes")}</>} | ||||||
|  |             helpText={<> | ||||||
|  |                 <p>${t("delete_note.delete_matched_notes_description")}</p> | ||||||
|  |  | ||||||
|  |                 <p>${t("delete_note.undelete_notes_instruction")}</p> | ||||||
|  |  | ||||||
|  |                 ${t("delete_note.erase_notes_instruction")} | ||||||
|  |             </>} | ||||||
|  |         /> | ||||||
|  |     ); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | export default class DeleteNoteBulkAction extends AbstractBulkAction { | ||||||
|  |     static get actionName() { | ||||||
|  |         return "deleteNote"; | ||||||
|  |     } | ||||||
|  |     static get actionTitle() { | ||||||
|  |         return t("delete_note.delete_note"); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     doRender() { | ||||||
|  |         return <DeleteNoteBulkActionComponent bulkAction={this} /> | ||||||
|  |     } | ||||||
|  | } | ||||||
		Reference in New Issue
	
	Block a user