diff --git a/src/components/Elements/MainModal/scss/modules/_modalTabContent.scss b/src/components/Elements/MainModal/scss/modules/_modalTabContent.scss index d60baa72..ac3fa013 100644 --- a/src/components/Elements/MainModal/scss/modules/_modalTabContent.scss +++ b/src/components/Elements/MainModal/scss/modules/_modalTabContent.scss @@ -149,6 +149,27 @@ table { padding: 25px; justify-content: space-between; + input[type="number"] { + @include themed() { + background: t($modal-sidebar); + box-shadow: t($boxShadow); + color: t($color); + } + text-align: center; + border-radius: 12px; + height: 40px; + font-size: 1rem; + display: flex; + align-items: center; + flex-flow: row; + justify-content: center; + gap: 20px; + transition: 0.5s; + cursor: pointer; + border: 0; + max-width: 40px; + } + @include themed { background: t($modal-sidebar); border-radius: t($borderRadius); @@ -202,3 +223,10 @@ table { flex-flow: column; gap: 25px; } + +.eventDateControl { + display: flex !important; + flex-flow: column !important; + gap: 5px !important; + text-align: center !important; +} \ No newline at end of file diff --git a/src/features/greeting/events.json b/src/features/greeting/events.json index e7648213..5952cd1a 100644 --- a/src/features/greeting/events.json +++ b/src/features/greeting/events.json @@ -1,16 +1,19 @@ [ { "id": "widgets.greeting.christmas", + "name": "Merry Christmas", "month": 12, "date": 25 }, { "id": "widgets.greeting.newyear", + "name": "Happy New Year", "month": 1, "date": 1 }, { "id": "widgets.greeting.halloween", + "name": "Happy Halloween", "month": 10, "date": 31 } diff --git a/src/features/greeting/options/GreetingOptions.jsx b/src/features/greeting/options/GreetingOptions.jsx index c15db46f..c2943a57 100644 --- a/src/features/greeting/options/GreetingOptions.jsx +++ b/src/features/greeting/options/GreetingOptions.jsx @@ -10,10 +10,16 @@ import { Section, } from 'components/Layout/Settings'; import { Checkbox, Switch, Text } from 'components/Form/Settings'; +import { TextareaAutosize } from '@mui/material'; +import { Button } from 'components/Elements'; +import defaultEvents from '../events.json'; -import { MdEventNote } from 'react-icons/md'; +import { MdEventNote, MdAdd, MdCancel, MdRefresh } from 'react-icons/md'; const GreetingOptions = () => { + const [customEvents, setCustomEvents] = useState( + JSON.parse(localStorage.getItem('customEvents')) || [], + ); const [events, setEvents] = useState(false); const [birthday, setBirthday] = useState( @@ -28,6 +34,49 @@ const GreetingOptions = () => { const GREETING_SECTION = 'modals.main.settings.sections.greeting'; + function addEvent() { + // Retrieve the current array of events from localStorage + const customEvents = JSON.parse(localStorage.getItem('customEvents')) || []; + + // Create a new event + const newEvent = { + id: 'widgets.greeting.halloween', + name: '', + month: 10, + date: 31, + }; + + // Add the new event to the array + const updatedEvents = [...customEvents, newEvent]; + + // Add the new event to the array + customEvents.push(newEvent); + + // Store the updated array back in localStorage + localStorage.setItem('customEvents', JSON.stringify(customEvents)); + + setCustomEvents(updatedEvents); + } + + function removeEvent(index) { + // Remove the event at the given index + const updatedEvents = customEvents.filter((_, i) => i !== index); + + // Store the updated array back in localStorage + localStorage.setItem('customEvents', JSON.stringify(updatedEvents)); + + // Update the state + setCustomEvents(updatedEvents); + } + + function resetEvents() { + // Reset the events array in localStorage + localStorage.setItem('customEvents', JSON.stringify(defaultEvents)); + + // Update the state + setCustomEvents(defaultEvents); + } + const AdditionalOptions = () => { return ( @@ -53,7 +102,7 @@ const GreetingOptions = () => { const BirthdayOptions = () => { return ( - + { ); }; + const CustomEventsSection = () => { + return ( + <> + + + +
+
+
+
+
+ {customEvents.map((event, index) => ( +
+
+
+ +
+
+ Event Name + this.message(e, true, index)} + varient="outlined" + style={{ padding: '0' }} + /> +
+
+
+
+
+ + +
+
+ + +
+
+
+
+ ))} +
+ {customEvents.length === 0 && ( +
+
+ + No Events + Add Some Events +
+
+ )} + + ); + }; + let header; if (events) { header = ( @@ -124,6 +238,7 @@ const GreetingOptions = () => {
{BirthdayOptions()} + {CustomEventsSection()} ) : ( diff --git a/src/utils/data/default_settings.json b/src/utils/data/default_settings.json index d90b1f13..1c0f75f9 100644 --- a/src/utils/data/default_settings.json +++ b/src/utils/data/default_settings.json @@ -270,5 +270,9 @@ { "name": "applinks", "value": "[]" + }, + { + "name": "customEvents", + "value": "[]" } ]