mirror of
				https://github.com/superseriousbusiness/gotosocial.git
				synced 2025-10-31 09:52:26 -05:00 
			
		
		
		
	[feature] Allow users to set default interaction policies per status visibility (#3108)
* [feature] Allow users to set default interaction policies * use vars for default policies * avoid some code repetition * unfuck form binding * avoid bonkers loop * beep boop * put policyValsToAPIPolicyVals in separate function * don't bother with slices.Grow * oops
This commit is contained in:
		
					parent
					
						
							
								401098191b
							
						
					
				
			
			
				commit
				
					
						0aadc2db2a
					
				
			
		
					 36 changed files with 3178 additions and 316 deletions
				
			
		|  | @ -141,9 +141,28 @@ export interface SelectProps extends React.DetailedHTMLProps< | |||
| 	field: TextFormInputHook; | ||||
| 	children?: ReactNode; | ||||
| 	options: React.JSX.Element; | ||||
| 
 | ||||
| 	/** | ||||
| 	 * Optional callback function that is | ||||
| 	 * triggered along with the select's onChange. | ||||
| 	 *  | ||||
| 	 * _selectValue is the current value of | ||||
| 	 * the select after onChange is triggered. | ||||
| 	 *  | ||||
| 	 * @param _selectValue  | ||||
| 	 * @returns  | ||||
| 	 */ | ||||
| 	onChangeCallback?: (_selectValue: string | undefined) => void; | ||||
| } | ||||
| 
 | ||||
| export function Select({ label, field, children, options, ...props }: SelectProps) { | ||||
| export function Select({ | ||||
| 	label, | ||||
| 	field, | ||||
| 	children, | ||||
| 	options, | ||||
| 	onChangeCallback, | ||||
| 	...props | ||||
| }: SelectProps) { | ||||
| 	const { onChange, value, ref } = field; | ||||
| 
 | ||||
| 	return ( | ||||
|  | @ -152,7 +171,12 @@ export function Select({ label, field, children, options, ...props }: SelectProp | |||
| 				{label} | ||||
| 				{children} | ||||
| 				<select | ||||
| 					onChange={onChange} | ||||
| 					onChange={(e: React.ChangeEvent<HTMLSelectElement>) => { | ||||
| 						onChange(e); | ||||
| 						if (onChangeCallback !== undefined) { | ||||
| 							onChangeCallback(e.target.value); | ||||
| 						} | ||||
| 					}} | ||||
| 					value={value} | ||||
| 					ref={ref as RefObject<HTMLSelectElement>} | ||||
| 					{...props} | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue