mirror of
				https://github.com/inventree/InvenTree.git
				synced 2025-10-30 20:55:42 +00:00 
			
		
		
		
	* updated typing to allow either link or action * fixed typing * made it possible to use an action instead of a link * added ServerInfo Modal skeleton * fixed anchor * added content to ServerInfo * Factored database lookup out * Extended status API to CUI level * extended ServerInfo to CUI level * Made modal larger * fixed default settings * Refactored urls into seperate functions * Refactored python version into seperate function * Added endpoint and modal for PUI version modal * switched to indirect imports to reduce imports * Added copy button * Added full copy button * added default * cleaned unused vars * cleaned unused vars * Refactored auth check for InfoView * implemented suggested changes * fixed check logic
		
			
				
	
	
		
			36 lines
		
	
	
		
			758 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
			
		
		
	
	
			36 lines
		
	
	
		
			758 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
| import { ActionIcon, Menu, Tooltip } from '@mantine/core';
 | |
| 
 | |
| /**
 | |
|  * A ButtonMenu is a button that opens a menu when clicked.
 | |
|  * It features a number of actions, which can be selected by the user.
 | |
|  */
 | |
| export function ButtonMenu({
 | |
|   icon,
 | |
|   actions,
 | |
|   tooltip = '',
 | |
|   label = ''
 | |
| }: {
 | |
|   icon: any;
 | |
|   actions: any[];
 | |
|   label?: string;
 | |
|   tooltip?: string;
 | |
| }) {
 | |
|   let idx = 0;
 | |
| 
 | |
|   return (
 | |
|     <Menu shadow="xs">
 | |
|       <Menu.Target>
 | |
|         <ActionIcon>
 | |
|           <Tooltip label={tooltip}>{icon}</Tooltip>
 | |
|         </ActionIcon>
 | |
|       </Menu.Target>
 | |
|       <Menu.Dropdown>
 | |
|         {label && <Menu.Label>{label}</Menu.Label>}
 | |
|         {actions.map((action) => (
 | |
|           <Menu.Item key={idx++}>{action}</Menu.Item>
 | |
|         ))}
 | |
|       </Menu.Dropdown>
 | |
|     </Menu>
 | |
|   );
 | |
| }
 |