-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: A really basic month calendar view utilizing js functions to get days in a month and tailwind * feat(MonthCalendarView.tsx): Added hardcoded tasks to be added on button press * style(MonthCalendarView.tsx): Refactored from not using Tailwind to using Tailwind * refactor: some code change stuff * fix(file-upload): refactor fileupload to use params instead of header Just found the params field today, this change is to go with general SWE practices that a header is a field of an HTTP request or response that passes additional context and metadata about the request or response. For example, a request message can use headers to indicate it's preferred media formats, while a response can use header to indicate the media format of the returned body. * feat: I NO LONGER NEED TO LOGIN * feat: fe requests using transquery * feat: install clsx bc I like it w/ tailwind * refactor: general cleanup for fe demo * docs: readme changes * ci: remove over complicated name * docs: readme update to remove bullets from contributing section * fix: remove extra fetch after post request for med noticed that it marked the data as stale which refetches it automatically then I also manually refetched * refactor: use tan stack in file and login service routes * test: fix test * docs(pull_request_template): revert changes * refactor: general import cleanup, removing default exports, and follow coding styles mentioned in slack * refactor: remove unused hook stuff from the useMedication api hook * refactor: combine all three popup hooks into one * refactor: revert prev commit (I didnt like it) * ci: try at separating ci stuff * ci: replace prettier with node package, add paths to fe and be CI stuff :))) * ci: fix fe format? * ci: pls work * refactor: general cleanup after merge * feat: just commit lol * feat: calendar examples idk * refactor: cleanup * feat: add pt.1 calendar to main router * updated calendar2.0 * feat: ... Update calendar and added my firebase credentials. * feat: updated calendar and firebase user info * feat: updated calendar and firebase user info * feat: updated calendar and code clean up --------- Co-authored-by: Matt McCoy <[email protected]> Co-authored-by: narayansharma-21 <[email protected]>
- Loading branch information
1 parent
7ee9ce7
commit dde6f4d
Showing
10 changed files
with
301 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,6 +28,8 @@ VALUES | |
('onrQs8HVGBVMPNz4Fk1uE94bSxg1', 'Danny', 'Rollo', '[email protected]', '', ''), | ||
('8Sy7xBkGiGQv4ZKphcQfY8PxAqw1', 'Narayan', 'Sharma', '[email protected]', '', ''), | ||
('iL7PnjS4axQffmlPceobjUUZ9DF2', 'Caitlin', 'Flynn', '[email protected]', '', ''), | ||
('5JgN2PQxCRM9VoCiiFPlQPNqkL32', 'Linwood', 'Blaisdell', '[email protected]', '', '') | ||
('5JgN2PQxCRM9VoCiiFPlQPNqkL32', 'Linwood', 'Blaisdell', '[email protected]', '', ''), | ||
('9rIMSUo6qNf8ToTABkCfNqnByRv1', 'Haley', 'Martin', '[email protected]', '', '') | ||
|
||
-- End Care-Wallet Team | ||
; |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
File renamed without changes.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,155 @@ | ||
import React, { useState } from 'react'; | ||
import { Alert } from 'react-native'; | ||
|
||
import _ from 'lodash'; | ||
import { | ||
CalendarProvider, | ||
CalendarUtils, | ||
DateData, | ||
ExpandableCalendar, | ||
TimelineEventProps, | ||
TimelineList, | ||
TimelineProps | ||
} from 'react-native-calendars'; | ||
import { UpdateSources } from 'react-native-calendars/src/expandableCalendar/commons'; | ||
|
||
import { getDate, timelineEvents } from './timelineEvents'; | ||
|
||
const INITIAL_TIME = { hour: 9, minutes: 0 }; | ||
const EVENTS: TimelineEventProps[] = timelineEvents; | ||
|
||
export default function TimelineCalendarScreen() { | ||
const [currentDate, setCurrentDate] = useState(getDate()); | ||
const [eventsByDate, setEventsByDate] = useState( | ||
_.groupBy(EVENTS, (e) => CalendarUtils.getCalendarDateString(e.start)) | ||
); | ||
|
||
const marked = { | ||
[`${getDate(-1)}`]: { marked: true }, | ||
[`${getDate()}`]: { marked: true }, | ||
[`${getDate(1)}`]: { marked: true }, | ||
[`${getDate(2)}`]: { marked: true }, | ||
[`${getDate(4)}`]: { marked: true } | ||
}; | ||
|
||
const onDateChanged = (date: string, source: string) => { | ||
console.log('TimelineCalendarScreen onDateChanged: ', date, source); | ||
setCurrentDate(date); | ||
}; | ||
|
||
const onMonthChange = (month: DateData, updateSource: UpdateSources) => { | ||
console.log('TimelineCalendarScreen onMonthChange: ', month, updateSource); | ||
}; | ||
|
||
const createNewEvent: TimelineProps['onBackgroundLongPress'] = ( | ||
timeString, | ||
timeObject | ||
) => { | ||
const hourString = `${(timeObject.hour + 1).toString().padStart(2, '0')}`; | ||
const minutesString = `${timeObject.minutes.toString().padStart(2, '0')}`; | ||
|
||
const newEvent = { | ||
id: 'draft', | ||
start: `${timeString}`, | ||
end: `${timeObject.date} ${hourString}:${minutesString}:00`, | ||
title: 'New Event', | ||
color: 'white' | ||
}; | ||
|
||
if (timeObject.date) { | ||
if (eventsByDate[timeObject.date]) { | ||
setEventsByDate((prevEvents) => ({ | ||
...prevEvents, | ||
[timeObject.date as string]: [ | ||
...prevEvents[timeObject.date as string], | ||
newEvent | ||
] | ||
})); | ||
} else { | ||
setEventsByDate((prevEvents) => ({ | ||
...prevEvents, | ||
[timeObject.date as string]: [newEvent] | ||
})); | ||
} | ||
} | ||
}; | ||
|
||
const approveNewEvent: TimelineProps['onBackgroundLongPressOut'] = ( | ||
_timeString, | ||
timeObject | ||
) => { | ||
Alert.prompt('New Event', 'Enter event title', [ | ||
{ | ||
text: 'Cancel', | ||
onPress: () => { | ||
if (timeObject.date) { | ||
setEventsByDate((prevEvents) => ({ | ||
...prevEvents, | ||
[timeObject.date as string]: _.filter( | ||
prevEvents[timeObject.date as string], | ||
(e) => e.id !== 'draft' | ||
) | ||
})); | ||
} | ||
} | ||
}, | ||
{ | ||
text: 'Create', | ||
onPress: (eventTitle) => { | ||
if (timeObject.date) { | ||
const draftEvent = _.find(eventsByDate[timeObject.date], { | ||
id: 'draft' | ||
}); | ||
if (draftEvent) { | ||
draftEvent.id = undefined; | ||
draftEvent.title = eventTitle ?? 'New Event'; | ||
draftEvent.color = 'lightgreen'; | ||
setEventsByDate((prevEvents) => ({ | ||
...prevEvents, | ||
[timeObject.date as string]: [ | ||
...prevEvents[timeObject.date as string] | ||
] | ||
})); | ||
} | ||
} | ||
} | ||
} | ||
]); | ||
}; | ||
|
||
const timelineProps: Partial<TimelineProps> = { | ||
format24h: false, | ||
onBackgroundLongPress: createNewEvent, | ||
onBackgroundLongPressOut: approveNewEvent, | ||
unavailableHours: [ | ||
{ start: 0, end: 6 }, | ||
{ start: 22, end: 24 } | ||
], | ||
onEventPress: (e) => expandEvent(e), | ||
overlapEventsSpacing: 8, | ||
rightEdgeSpacing: 24 | ||
}; | ||
|
||
return ( | ||
<CalendarProvider | ||
date={currentDate} | ||
onDateChanged={onDateChanged} | ||
onMonthChange={onMonthChange} | ||
showTodayButton | ||
disabledOpacity={0.6} | ||
> | ||
<ExpandableCalendar firstDay={1} markedDates={marked} /> | ||
<TimelineList | ||
events={eventsByDate} | ||
timelineProps={timelineProps} | ||
showNowIndicator | ||
scrollToFirst | ||
initialTime={INITIAL_TIME} | ||
/> | ||
</CalendarProvider> | ||
); | ||
} | ||
|
||
function expandEvent(e: TimelineEventProps): void { | ||
console.log('expand event', e.title); | ||
} |
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 |
---|---|---|
@@ -0,0 +1,123 @@ | ||
import { CalendarUtils, TimelineEventProps } from 'react-native-calendars'; | ||
|
||
const EVENT_COLOR = '#e6add8'; | ||
const today = new Date(); | ||
export const getDate = (offset = 0) => | ||
CalendarUtils.getCalendarDateString( | ||
new Date().setDate(today.getDate() + offset) | ||
); | ||
|
||
export const timelineEvents: TimelineEventProps[] = [ | ||
{ | ||
start: `${getDate(-1)} 09:20:00`, | ||
end: `${getDate(-1)} 12:00:00`, | ||
title: 'Merge Request to React Native Calendars', | ||
summary: 'Merge Timeline Calendar to React Native Calendars' | ||
}, | ||
{ | ||
start: `${getDate()} 01:15:00`, | ||
end: `${getDate()} 02:30:00`, | ||
title: 'Meeting A', | ||
summary: 'Summary for meeting A', | ||
color: EVENT_COLOR | ||
}, | ||
{ | ||
start: `${getDate()} 01:30:00`, | ||
end: `${getDate()} 02:30:00`, | ||
title: 'Meeting B', | ||
summary: 'Summary for meeting B', | ||
color: EVENT_COLOR | ||
}, | ||
{ | ||
start: `${getDate()} 01:45:00`, | ||
end: `${getDate()} 02:45:00`, | ||
title: 'Meeting C', | ||
summary: 'Summary for meeting C', | ||
color: EVENT_COLOR | ||
}, | ||
{ | ||
start: `${getDate()} 02:40:00`, | ||
end: `${getDate()} 03:10:00`, | ||
title: 'Meeting D', | ||
summary: 'Summary for meeting D', | ||
color: EVENT_COLOR | ||
}, | ||
{ | ||
start: `${getDate()} 02:50:00`, | ||
end: `${getDate()} 03:20:00`, | ||
title: 'Meeting E', | ||
summary: 'Summary for meeting E', | ||
color: EVENT_COLOR | ||
}, | ||
{ | ||
start: `${getDate()} 04:30:00`, | ||
end: `${getDate()} 05:30:00`, | ||
title: 'Meeting F', | ||
summary: 'Summary for meeting F', | ||
color: EVENT_COLOR | ||
}, | ||
{ | ||
start: `${getDate(1)} 00:30:00`, | ||
end: `${getDate(1)} 01:30:00`, | ||
title: 'Visit Grand Mother', | ||
summary: 'Visit Grand Mother and bring some fruits.', | ||
color: 'lightblue' | ||
}, | ||
{ | ||
start: `${getDate(1)} 02:30:00`, | ||
end: `${getDate(1)} 03:20:00`, | ||
title: 'Meeting with Prof. Behjet Zuhaira', | ||
summary: 'Meeting with Prof. Behjet at 130 in her office.', | ||
color: EVENT_COLOR | ||
}, | ||
{ | ||
start: `${getDate(1)} 04:10:00`, | ||
end: `${getDate(1)} 04:40:00`, | ||
title: 'Tea Time with Dr. Hasan', | ||
summary: 'Tea Time with Dr. Hasan, Talk about Project' | ||
}, | ||
{ | ||
start: `${getDate(1)} 01:05:00`, | ||
end: `${getDate(1)} 01:35:00`, | ||
title: 'Dr. Mariana Joseph', | ||
summary: '3412 Piedmont Rd NE, GA 3032' | ||
}, | ||
{ | ||
start: `${getDate(1)} 14:30:00`, | ||
end: `${getDate(1)} 16:30:00`, | ||
title: 'Meeting Some Friends in ARMED', | ||
summary: 'Arsalan, Hasnaat, Talha, Waleed, Bilal', | ||
color: 'pink' | ||
}, | ||
{ | ||
start: `${getDate(2)} 01:40:00`, | ||
end: `${getDate(2)} 02:25:00`, | ||
title: 'Meet Sir Khurram Iqbal', | ||
summary: 'Computer Science Dept. Comsats Islamabad', | ||
color: 'orange' | ||
}, | ||
{ | ||
start: `${getDate(2)} 04:10:00`, | ||
end: `${getDate(2)} 04:40:00`, | ||
title: 'Tea Time with Colleagues', | ||
summary: 'WeRplay' | ||
}, | ||
{ | ||
start: `${getDate(2)} 00:45:00`, | ||
end: `${getDate(2)} 01:45:00`, | ||
title: 'Lets Play Apex Legends', | ||
summary: 'with Boys at Work' | ||
}, | ||
{ | ||
start: `${getDate(2)} 11:30:00`, | ||
end: `${getDate(2)} 12:30:00`, | ||
title: 'Dr. Mariana Joseph', | ||
summary: '3412 Piedmont Rd NE, GA 3032' | ||
}, | ||
{ | ||
start: `${getDate(4)} 12:10:00`, | ||
end: `${getDate(4)} 13:45:00`, | ||
title: 'Merge Request to React Native Calendars', | ||
summary: 'Merge Timeline Calendar to React Native Calendars' | ||
} | ||
]; |