-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #46 from intri-in/development
Development
- Loading branch information
Showing
14 changed files
with
606 additions
and
214 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
- Bumped up some @fullcalendar packages. Meant to fix some bugs with fullcalendar not working with NextJS. | ||
- Bug fix: Done tasks being shown in lists filtered just with Labels. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
102 changes: 102 additions & 0 deletions
102
src/components/fullcalendar/ListGroupCalDAVAccounts.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
import { getI18nObject } from '@/helpers/frontend/general'; | ||
import { useEffect, useState } from 'react'; | ||
import Button from 'react-bootstrap/Button'; | ||
import Modal from 'react-bootstrap/Modal'; | ||
import Form from 'react-bootstrap/Form'; | ||
import Cookies from 'js-cookie' | ||
import { getCalendarsToShow, isValid_UserPreference_CalendarsToShow } from '@/helpers/frontend/userpreference'; | ||
import { varNotEmpty } from '@/helpers/general'; | ||
import { Preference_CalendarsToShow } from '@/helpers/frontend/classes/UserPreferences/Preference_CalendarsToShow'; | ||
import { BsCalendarCheck } from 'react-icons/bs'; | ||
import OverlayTrigger from 'react-bootstrap/OverlayTrigger'; | ||
import Tooltip from 'react-bootstrap/Tooltip'; | ||
interface customProps{ | ||
caldav_accounts: {account:{name: string, caldav_accounts_id: number}, calendars: any }[]; | ||
onChange?: () => void; | ||
|
||
} | ||
export function ListGroupCalDAVAccounts(props: customProps ){ | ||
const [modalShow, setModalShow] = useState(false); | ||
const i18next = getI18nObject() | ||
const [prefObject, setPrefObject] =useState(getLatestPreferenceObject(props.caldav_accounts)) | ||
|
||
|
||
|
||
const onChangeChecked = (e, indexInPreferenceObject) =>{ | ||
var index = JSON.parse(e.target.id) | ||
Preference_CalendarsToShow.update(index, e.target.checked) | ||
setPrefObject(getLatestPreferenceObject(props.caldav_accounts)) | ||
if(props.onChange()!=undefined){ | ||
props.onChange() | ||
} | ||
} | ||
var output=[] | ||
if(props.caldav_accounts.length>0 ) | ||
{ | ||
for(const i in props.caldav_accounts){ | ||
|
||
output.push(<h3>{props.caldav_accounts[i].account.name}</h3>) | ||
var calendarOutput =[] | ||
if(varNotEmpty(props.caldav_accounts[i].calendars) && props.caldav_accounts[i].calendars) | ||
for(const j in props.caldav_accounts[i].calendars){ | ||
var indexInPreferenceObject = Preference_CalendarsToShow.findIndex_Calendar(prefObject, props.caldav_accounts[i].account.caldav_accounts_id, props.caldav_accounts[i].calendars[j].calendars_id) | ||
if(varNotEmpty(indexInPreferenceObject) && Array.isArray(indexInPreferenceObject) && indexInPreferenceObject.length>0) | ||
{ | ||
calendarOutput.push(<Form.Check | ||
inline type="checkbox" id={JSON.stringify(indexInPreferenceObject)} checked={prefObject[indexInPreferenceObject[0]].calendars[indexInPreferenceObject[1]].show} onClick={e => onChangeChecked( e, indexInPreferenceObject)} label={props.caldav_accounts[i].calendars[j].displayName}/>) | ||
|
||
} | ||
|
||
} | ||
|
||
output.push(<Form>{calendarOutput}</Form>) | ||
|
||
} | ||
} | ||
return( | ||
<> | ||
<Modal | ||
show={modalShow} | ||
onHide={() => setModalShow(false)} | ||
size="lg" | ||
aria-labelledby="contained-modal-title-vcenter" | ||
centered | ||
> | ||
<Modal.Header closeButton> | ||
<Modal.Title id="contained-modal-title-vcenter"> | ||
{i18next.t("SELECT_CALENDARS_TO_SHOW")} | ||
</Modal.Title> | ||
</Modal.Header> | ||
<Modal.Body> | ||
{output} | ||
</Modal.Body> | ||
<Modal.Footer> | ||
<Button onClick={() => setModalShow(false)}>Close</Button> | ||
</Modal.Footer> | ||
</Modal> | ||
<OverlayTrigger key="SELECT_CALENDARS_KEY" placement='top' | ||
overlay={ | ||
<Tooltip id='tooltip_SELECT_CALENDARS'> | ||
{i18next.t("SELECT_CALENDARS_TO_SHOW")} | ||
|
||
</Tooltip> | ||
}> | ||
<Button size='sm' variant="primary" onClick={() => setModalShow(true)}> | ||
<BsCalendarCheck size={24} /> </Button> | ||
|
||
</OverlayTrigger> | ||
</> | ||
) | ||
|
||
} | ||
|
||
|
||
function getLatestPreferenceObject(caldav_accounts: {account:{name: string, caldav_accounts_id: number}, calendars: any }[]){ | ||
var calendarstoShow = Preference_CalendarsToShow.get() | ||
if(Preference_CalendarsToShow.isValidObject(calendarstoShow) && Preference_CalendarsToShow.isUptoDate(caldav_accounts)){ | ||
return calendarstoShow | ||
}else{ | ||
var newObj=Preference_CalendarsToShow.generateFromCaldavObject(caldav_accounts) | ||
return newObj | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.