Skip to content

Commit

Permalink
- Bump version number to v0.3.4
Browse files Browse the repository at this point in the history
- Introduced option to select starting day of the week for Calendar View
- Minor performance fixes
  • Loading branch information
aa-tree committed Sep 28, 2023
1 parent 1934fa3 commit fc0d521
Show file tree
Hide file tree
Showing 14 changed files with 132 additions and 15 deletions.
4 changes: 3 additions & 1 deletion COMMITMESSAGE.md
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
- Bump to v0.3.3
- Bump version number to v0.3.4
- Introduced option to select starting day of the week for Calendar View
- Minor performance fixes
Binary file removed docs/pics/screenshots/GanttView.png
Binary file not shown.
8 changes: 5 additions & 3 deletions src/components/fullcalendar/DashboardView.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { getMessageFromAPIResponse } from "@/helpers/frontend/response";
import { withRouter } from "next/router";
import { RecurrenceHelper } from "@/helpers/frontend/classes/RecurrenceHelper";
import { FULLCALENDAR_VIEWLIST } from "./FullCalendarHelper";
import { getDefaultViewForCalendar } from "@/helpers/frontend/settings";
import { getCalendarStartDay, getDefaultViewForCalendar } from "@/helpers/frontend/settings";
import { ListGroupCalDAVAccounts } from "./ListGroupCalDAVAccounts";
import { Preference_CalendarsToShow } from "@/helpers/frontend/classes/UserPreferences/Preference_CalendarsToShow";

Expand All @@ -34,7 +34,7 @@ class DashboardView extends Component {
super(props)
this.i18next = getI18nObject()
var initialViewCalendar = "timeGridDay"
this.state = { showEventEditor: false, viewValue: initialViewCalendar, events: null, eventEdited: false, eventDataDashBoard: {}, initialViewCalendar: initialViewCalendar, allEvents: {}, recurMap: {}, selectedID: "", calendarAR: props.calendarAR,showTasksChecked: false, allEventsFromServer: null, caldav_accounts:null }
this.state = { showEventEditor: false, viewValue: initialViewCalendar, events: null, eventEdited: false, eventDataDashBoard: {}, initialViewCalendar: initialViewCalendar, allEvents: {}, recurMap: {}, selectedID: "", calendarAR: props.calendarAR,showTasksChecked: false, allEventsFromServer: null, caldav_accounts:null, firstDay:"3"}
this.viewChanged = this.viewChanged.bind(this)
this.eventClick = this.eventClick.bind(this)
this.handleDateClick = this.handleDateClick.bind(this)
Expand Down Expand Up @@ -66,10 +66,11 @@ class DashboardView extends Component {
this.setState({viewValue: view})

}
this.setState({showTasksChecked: true})
this.setState({showTasksChecked: true, firstDay: getCalendarStartDay()})

}


async getCaldavAccountsfromDB() {
var caldav_accounts = await getCaldavAccountsfromServer()
if (caldav_accounts != null && caldav_accounts.success == true) {
Expand Down Expand Up @@ -653,6 +654,7 @@ class DashboardView extends Component {
rerenderEvents={this.rerenderEvents}
eventDrop={this.eventDrop}
eventResize={this.eventResize}
firstDay={this.state.firstDay}
/>
<br />
<br />
Expand Down
3 changes: 3 additions & 0 deletions src/components/page/SettingsPage/SettingsPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import DefaultCalendarViewSelect from "@/components/accounts/DefaultCalendarView
import { VERSION_NUMBER } from "@/config/constants";
import { setDefaultCalendarID } from "@/helpers/frontend/cookies";
import { getMessageFromAPIResponse } from "@/helpers/frontend/response";
import CalendarStartDayWeek from "@/components/settings/CalendarStartDayWeek";
class SettingsPage extends Component {

constructor(props) {
Expand Down Expand Up @@ -373,6 +374,8 @@ class SettingsPage extends Component {
<DefaultCalendarViewSelect />
</Col>
</Row>
<br />
<CalendarStartDayWeek />
</div>
<br />
<br />
Expand Down
71 changes: 71 additions & 0 deletions src/components/settings/CalendarStartDayWeek.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
import SettingsHelper from '@/helpers/frontend/classes/SettingsHelper';
import { setCookie } from '@/helpers/frontend/cookies';
import { getI18nObject } from '@/helpers/frontend/general';
import { SETTING_NAME_CALENDAR_START_DAY, getDefaultViewForCalendar } from '@/helpers/frontend/settings';
import { useEffect, useState } from 'react';
import Form from 'react-bootstrap/Form';
import { FULLCALENDAR_VIEWLIST } from '../fullcalendar/FullCalendarHelper';
import { DAY_ARRAY } from '@/helpers/general';
import { Col, Row } from 'react-bootstrap';

const defaultOptions = FULLCALENDAR_VIEWLIST


const i18next = getI18nObject()

function CalendarStartDayWeek(props:null){
const [valueofDDL, setValueofDDL] = useState("1")
useEffect(()=>{
const getVal = async () =>{
const settingVal:string = await SettingsHelper.getFromServer(SETTING_NAME_CALENDAR_START_DAY)
setCookie(SETTING_NAME_CALENDAR_START_DAY, settingVal)
setValueofDDL(settingVal)

}

getVal()
},[])

const newStartDaySelected = async (e) =>{
const value: string = e.target.value
console.log("value", value)
if(value!=""){
setValueofDDL(value)
//Make request to Server.
if(await SettingsHelper.setKey(SETTING_NAME_CALENDAR_START_DAY, value)==true)
{
//Save to cookie if the insert was successful.
setCookie(SETTING_NAME_CALENDAR_START_DAY, value)
}

}
}

var finalOptions: Object[] = []

for(const i in DAY_ARRAY)
{
finalOptions.push(<option key={DAY_ARRAY[i]} value={i}>{i18next.t(DAY_ARRAY[i])}</option>)
}

return(
<Row style={{display: "flex", alignItems: "center"}}>
<Col xs={3}>
{i18next.t("START_DAY_CALENDAR_WEEK")}
</Col>
<Col xs={9}>
<Form.Select value={valueofDDL} onChange={newStartDaySelected} >
{finalOptions}
</Form.Select>
</Col>
</Row>

)





}

export default CalendarStartDayWeek
2 changes: 1 addition & 1 deletion src/components/tasks/TaskUI.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export default class TaskUI extends Component {
this.setState({ taskTitle: newTaskTitle })

}catch(e){
console.error(e)
console.warn(e)
}

}
Expand Down
2 changes: 1 addition & 1 deletion src/components/tasks/TaskView.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ export function RecursivelyGetListItemforTask(props) {
}
if (toReturn != []) {

return (<div key={getRandomString(5)} style={{marginBottom: 5}}>
return (<div style={{marginBottom: 5}}>

{toReturn}

Expand Down
15 changes: 9 additions & 6 deletions src/components/tasks/TaskWithFilters.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@ import GenerateTaskUIList from "./GenerateTaskUIList";
import { MdCancel } from "react-icons/md";
import { SYSTEM_DEFAULT_LABEL_PREFIX } from "@/config/constants";
import { getI18nObject } from "@/helpers/frontend/general";
import { Loading } from "../common/Loading";
export class TaskWithFilters extends Component{
constructor(props)
{
super(props)
this.i18next= getI18nObject()
this.state ={list: this.props.list, isFiltered: false, taskList: null, showAllChecked:false}
this.state ={list: this.props.list, isFiltered: false, taskList: null, showAllChecked:false, renderedTasks: <Loading padding={20} centered={true} />}
this.getLabels = this.getLabels.bind(this)
this.childlessList
this.filterByLabelClicked = this.filterByLabelClicked.bind(this)
Expand All @@ -25,12 +26,13 @@ export class TaskWithFilters extends Component{

componentDidMount(){

if(this.state.isFiltered==false)
{
if(this.state.isFiltered==false) {
this.setLabelMenu()

}

}


//
}

showAllChanged(e)
Expand Down Expand Up @@ -190,7 +192,8 @@ export class TaskWithFilters extends Component{
</Row>

{this.state.appliedFilters}
<GenerateTaskUIList scheduleItem={this.props.scheduleItem} showDone={this.state.showAllChecked} collapseButtonClicked={this.props.collapseButtonClicked} collapsed={this.props.collapsed} fetchEvents={this.props.fetchEvents} list={this.state.list} todoList={this.props.todoList} level={-1} context={this.props.context} listColor={this.props.listColor} /> </>
<GenerateTaskUIList scheduleItem={this.props.scheduleItem} showDone={this.state.showAllChecked} collapseButtonClicked={this.props.collapseButtonClicked} collapsed={this.props.collapsed} fetchEvents={this.props.fetchEvents} list={this.state.list} todoList={this.props.todoList} level={-1} context={this.props.context} listColor={this.props.listColor} />
</>
)
}
}
4 changes: 2 additions & 2 deletions src/helpers/frontend/classes/SettingsHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export default class SettingsHelper
{


static async getFromServer(keyName: string)
static async getFromServer(keyName: string): Promise<string>
{
const authorisationData = await getAuthenticationHeadersforUser()
return new Promise( (resolve, reject) => {
Expand All @@ -32,7 +32,7 @@ export default class SettingsHelper
}else{
return resolve("")
}
}) .catch(function (error) {
}).catch(function (error) {
logError(error, "SettingsHelper.getFromServer");
return resolve("")
});
Expand Down
1 change: 1 addition & 0 deletions src/helpers/frontend/cookies.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export function deleteAllCookies(){
Cookies.remove("USERHASH")
Cookies.remove("USER_PREFERENCE_CALENDARS_TO_SHOW")
Cookies.remove("SSID")
Cookies.remove("MMDL_CALENDAR_START_DAY")



Expand Down
4 changes: 4 additions & 0 deletions src/helpers/frontend/fullcalendar.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

export default function fullDayNameToNumber(nameOfDay){

}
11 changes: 11 additions & 0 deletions src/helpers/frontend/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import Cookies from "js-cookie";
import { isValidResultArray, logError, varNotEmpty } from "../general";
import SettingsHelper from "./classes/SettingsHelper";

export const SETTING_NAME_CALENDAR_START_DAY="MMDL_CALENDAR_START_DAY"
export function getSyncTimeout()
{
var timeout = Cookies.get("USER_SETTING_SYNCTIMEOUT")
Expand All @@ -22,7 +23,17 @@ export function saveLabelArrayToCookie(labels)

}
}
export function getCalendarStartDay(){
const defaultCalendar= Cookies.get(SETTING_NAME_CALENDAR_START_DAY)

if(varNotEmpty(defaultCalendar)){
return defaultCalendar
}else{
return "1"
}


}
export function getLabelArrayFromCookie()
{
var array =[]
Expand Down
12 changes: 12 additions & 0 deletions src/helpers/general.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import moment from "moment"
import { dueDatetoUnixStamp } from "./frontend/general"

export const DAY_ARRAY = ["SUNDAY", "MONDAY", "TUESDAY", "WEDNESDAY", "THURSDAY", "FRIDAY", "SATURDAY"]
export function isValidResultArray(array)
{
if(array!=null && Array.isArray(array) && array.length>0)
Expand Down Expand Up @@ -188,3 +189,14 @@ export function getISO8601Date(date, skipTime)
}
return toReturn
}

export function dayNameFromNumber(dayNumber){

const dayArray = ["SUNDAY", "MONDAY", "TUESDAY", "WEDNESDAY", "THURSDAY", "FRIDAY", "SATURDAY", "SUNDAY"]
if(dayNumber>0 && dayNumber<dayArray.length-1){
return dayArray[dayNumber]
}

return ""

}
10 changes: 9 additions & 1 deletion src/i18n/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,15 @@
"WEEKS": "Weeks",
"WEEK_VIEW": "Week View",
"YES": "Yes",
"YOUR_FILTERS": "Your Filters"
"YOUR_FILTERS": "Your Filters",
"SUNDAY": "Sunday",
"MONDAY":"Monday",
"TUESDAY":"Tuesday",
"WEDNESDAY": "Wednesday",
"THURSDAY":"Thursday",
"FRIDAY": "Friday",
"SATURDAY": "Saturday",
"START_DAY_CALENDAR_WEEK": "Starting Day of the Week for Calendar View"
}
},
"hi":{
Expand Down

0 comments on commit fc0d521

Please sign in to comment.