Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Event UI update #536

Merged
merged 6 commits into from
Sep 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading