File tree Expand file tree Collapse file tree
apps/web/components/admin/products
packages/components-library/src Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -49,7 +49,11 @@ export default function NewCustomer({ courseId }: NewCustomerProps) {
4949 setSystemTags ( response . tags ) ;
5050 }
5151 } catch ( err ) {
52- } finally {
52+ toast ( {
53+ title : TOAST_TITLE_ERROR ,
54+ description : err . message ,
55+ variant : "destructive" ,
56+ } ) ;
5357 }
5458 } , [ address . backend ] ) ;
5559
@@ -92,6 +96,9 @@ export default function NewCustomer({ courseId }: NewCustomerProps) {
9296 if ( response . user ) {
9397 setEmail ( "" ) ;
9498 setTags ( [ ] ) ;
99+ if ( response . user . tags ) {
100+ mergeSubmittedTagsWithSystemTags ( response . user . tags ) ;
101+ }
95102 const message = `${ response . user . email } has been invited.` ;
96103 toast ( {
97104 title : TOAST_TITLE_SUCCESS ,
@@ -108,6 +115,12 @@ export default function NewCustomer({ courseId }: NewCustomerProps) {
108115 }
109116 } ;
110117
118+ const mergeSubmittedTagsWithSystemTags = ( submittedTags : string [ ] ) => {
119+ const fullSystemTags = [ ...systemTags , ...submittedTags ] ;
120+ const uniqueSystemTags = new Set ( fullSystemTags ) ;
121+ setSystemTags ( Array . from ( uniqueSystemTags ) ) ;
122+ } ;
123+
111124 return (
112125 < div className = "flex flex-col gap-4" >
113126 < >
Original file line number Diff line number Diff line change @@ -13,7 +13,6 @@ interface ComboBoxProps {
1313 selectedOptions : Set < string > ;
1414 onChange : ( options : string [ ] ) => void ;
1515 className ?: string ;
16- side ?: "left" | "right" | "top" | "bottom" ;
1716 placeholder ?: string ;
1817}
1918
@@ -22,7 +21,6 @@ export default function ComboBox({
2221 selectedOptions,
2322 onChange,
2423 className,
25- side = "top" ,
2624 placeholder = "Select an option or create one" ,
2725} : ComboBoxProps ) {
2826 const [ internalOptions , setInternalOptions ] = useState ( options ) ;
@@ -129,6 +127,7 @@ export default function ComboBox({
129127 return (
130128 < div className = "relative w-full" >
131129 < Button
130+ type = "button"
132131 variant = "outline"
133132 role = "combobox"
134133 aria-expanded = { internalOpen }
You can’t perform that action at this time.
0 commit comments