diff --git a/webclient/src/Classes.js b/webclient/src/Classes.js index 7ecafc7..e3e876f 100644 --- a/webclient/src/Classes.js +++ b/webclient/src/Classes.js @@ -453,28 +453,29 @@ export function ICalButtons(props) { const addToGoogleCalendar = (e) => { e.preventDefault(); // TODO: fill in URL from clazz properties - window.location = 'https://www.google.com/calendar/render?action=TEMPLATE&text=Title&dates=20190227/20190228' + window.open('https://www.google.com/calendar/render?action=TEMPLATE&text=Title&dates=20190227/20190228', '_blank'); }; const options = [ - { key: 'email', icon: 'mail outline', text: 'Email ICS Event', value: 'email' }, - { key: 'download', icon: 'download', text: 'Download ICS Event', value: 'download' }, - { key: 'google', icon: 'google', text: 'Add to Google Calendar', value: 'google' }, + { key: 'email', icon: 'mail outline', text: 'Email ICS Event', value: 'email', action: handleEmail }, + { key: 'download', icon: 'download', text: 'Download ICS Event', value: 'download', action: handleDownload }, + { key: 'google', icon: 'google', text: 'Add to Google Calendar', value: 'google', action: addToGoogleCalendar }, ]; - - let selectedOption = options[0]; + // TODO: get default option from local storage or default to 0 + const [selectedOption, setOption] = useState(options[0]); const onClick = (e, data) => { - selectedOption = options.filter(x => x.value === data.value)[0]; - console.log(selectedOption); - // TODO set state here - // setState({selectedOption: selectedOption}); - // TODO: change the Button onClick handler...based on selected option? + let newOption = options.filter(x => x.value === data.value)[0]; + setOption(newOption); }; return ( - + } /> + // TODO: reimplement success prompt /*<>