Skip to content

Commit

Permalink
Merge pull request #536 from TAMUSHPE/event-ui-update
Browse files Browse the repository at this point in the history
Event UI update
  • Loading branch information
JasonIsAzn authored Sep 16, 2024
2 parents f6a8018 + 77dc819 commit f1d065d
Show file tree
Hide file tree
Showing 5 changed files with 235 additions and 294 deletions.
23 changes: 23 additions & 0 deletions src/api/firebaseUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,29 @@ export const getUpcomingEvents = async () => {
return events;
};

export const getWeekPastEvents = async (): Promise<SHPEEvent[]> => {
const currentTime = new Date();
const twoWeeksAgo = new Date(currentTime);
twoWeeksAgo.setDate(currentTime.getDate() - 8);

const eventsRef = collection(db, "events");
const q = query(
eventsRef,
where("endTime", "<", currentTime),
where("endTime", ">", twoWeeksAgo),
orderBy("endTime", "desc")
);

const querySnapshot = await getDocs(q);
const events: SHPEEvent[] = [];

querySnapshot.forEach(doc => {
events.push({ id: doc.id, ...doc.data() } as SHPEEvent);
});

return events;
};

export const getPastEvents = async (numLimit: number, startAfterDoc: any, setEndOfData?: (endOfData: boolean) => void) => {
const currentTime = new Date();
const eventsRef = collection(db, "events");
Expand Down
3 changes: 3 additions & 0 deletions src/components/MOTMCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ const MOTMCard: React.FC<MemberCardProp> = ({ navigation }) => {
}, [currentUser])
);

if (!MOTM) {
return null;
}

return (
<View className="mx-4">
Expand Down
6 changes: 0 additions & 6 deletions src/screens/committees/CommitteeInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -348,12 +348,6 @@ const CommitteeInfo: React.FC<CommitteeInfoScreenRouteProps> = ({ route, navigat
<View className='mt-10'>
<View className='flex-row justify-between items-center mb-4'>
<Text className={`text-2xl font-bold ${darkMode ? "text-white" : "text-black"}`}>Upcoming Events</Text>
<TouchableOpacity
className='px-4'
onPress={() => navigation.getParent()?.navigate('EventsTab', { screen: 'EventsScreen', params: { filter: EventType.COMMITTEE_MEETING, committee: firebaseDocName } })}
>
<Text className='text-lg text-primary-blue font-semibold'>View all</Text>
</TouchableOpacity>
</View>

<View
Expand Down
Loading

0 comments on commit f1d065d

Please sign in to comment.