Skip to content

Commit

Permalink
Lots o updates
Browse files Browse the repository at this point in the history
  • Loading branch information
Alder Whiteford authored and Alder Whiteford committed Jun 17, 2024
1 parent f99766b commit 7c80adc
Show file tree
Hide file tree
Showing 35 changed files with 870 additions and 558 deletions.
2 changes: 1 addition & 1 deletion backend/entities/clubs/events/transactions.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ func GetClubEvents(db *gorm.DB, clubID uuid.UUID, pageInfo fiberpaginate.PageInf
db = cache.SetUseCache(db, true)

var events []models.Event
if err := db.Where("club_id = ?", clubID).Scopes(utilities.IntoScope(pageInfo, db)).Find(&events).Error; err != nil {
if err := db.Where("host = ?", clubID).Scopes(utilities.IntoScope(pageInfo, db)).Find(&events).Error; err != nil {
return nil, err
}

Expand Down
25 changes: 2 additions & 23 deletions frontend/mobile/src/app/(app)/(tabs)/_layout.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useEffect, useRef, useState } from 'react';
import React from 'react';

import { Tabs } from 'expo-router';

Expand All @@ -7,12 +7,9 @@ import { faCalendarDays } from '@fortawesome/free-solid-svg-icons/faCalendarDays
import { faHouse } from '@fortawesome/free-solid-svg-icons/faHouse';
import { faUser } from '@fortawesome/free-solid-svg-icons/faUser';

import { EventPreview, Text } from '@/src/app/(design-system)';
import { Text } from '@/src/app/(design-system)';
import { Box } from '@/src/app/(design-system)';
import { Icon } from '@/src/app/(design-system)/components/Icon/Icon';
import { useAppDispatch, useAppSelector } from '@/src/store/store';
import BottomSheet from '@gorhom/bottom-sheet';
import { setEventShouldPreview } from '@/src/store/slices/eventSlice';

interface TabBarLabelProps {
focused: boolean;
Expand All @@ -37,23 +34,6 @@ const TabBarIcon: React.FC<TabBarIconProps> = ({ focused, icon }) => (
);

const Layout = () => {
const dispatch = useAppDispatch();
const eventPreviewRef = useRef<BottomSheet>(null);
const clubPreviewRef = useRef<BottomSheet>(null);

const { shouldPreview: eventShouldPreview, id: eventId } = useAppSelector((state) => state.event);

useEffect(() => {
dispatch(setEventShouldPreview(false));
}, [])

useEffect(() => {
if (eventShouldPreview) {
eventPreviewRef.current?.snapToIndex(0);
}
}, [eventShouldPreview]);


return (
<>
<Tabs
Expand Down Expand Up @@ -104,7 +84,6 @@ const Layout = () => {
}}
/>
</Tabs>
<EventPreview eventId={eventId} ref={eventPreviewRef} />
</>
);
};
Expand Down
18 changes: 1 addition & 17 deletions frontend/mobile/src/app/(app)/(tabs)/index.tsx
Original file line number Diff line number Diff line change
@@ -1,23 +1,7 @@
import React from 'react';
import { StyleSheet } from 'react-native';

const HomePage = () => {

return (
<></>
)
return <></>;
};

const styles = StyleSheet.create({
container: {
flex: 1,
alignItems: 'center',
justifyContent: 'center'
},
contentContainer: {
flex: 1,
alignItems: 'center'
}
});

export default HomePage;
225 changes: 139 additions & 86 deletions frontend/mobile/src/app/(app)/club/[id].tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { useRef } from 'react';
import { Dimensions, Linking } from 'react-native';
import Animated, {
interpolate,
Expand All @@ -6,19 +7,31 @@ import Animated, {
useScrollViewOffset
} from 'react-native-reanimated';

import { Arrow, Box, PageTags, RecruitmentInfo, Tag, Text } from '@/src/app/(design-system)';
import { Stack, useLocalSearchParams } from 'expo-router';

import { faExternalLink } from '@fortawesome/free-solid-svg-icons';
import BottomSheet from '@gorhom/bottom-sheet';

import {
Arrow,
Box,
PageTags,
RecruitmentInfo,
Text
} from '@/src/app/(design-system)';
import { SACColors } from '@/src/app/(design-system)';
import { Button } from '@/src/app/(design-system)/components/Button/Button';
import AnimatedImageHeader from '../../(design-system)/components/AnimatedImageHeader/AnimatedImageHeader';
import { ClubIcon } from '../../(design-system)/components/ClubIcon/ClubIcon';
import useClub from '@/src/hooks/useClub';
import { Stack, useLocalSearchParams } from 'expo-router';
import { useAppSelector } from '@/src/store/store';

import { AboutSection } from '../../(design-system)/components/AboutSection/AboutSection';
import AnimatedImageHeader from '../../(design-system)/components/AnimatedImageHeader/AnimatedImageHeader';
import { ClubIcon } from '../../(design-system)/components/ClubIcon/ClubIcon';
import { EventCard } from '../../(design-system)/components/EventCard';
import { EventCardList } from '../../(design-system)/components/EventCard/EventCardList';
import PageError from '../../(design-system)/components/PageError/PageError';
import { Description } from '../event/components/description';
import { useRef } from 'react';
import BottomSheet from '@gorhom/bottom-sheet';
import { faExternalLink } from '@fortawesome/free-solid-svg-icons';
import ClubPageSkeleton from './components/skeleton';

const color: SACColors = 'darkRed';

Expand Down Expand Up @@ -50,7 +63,7 @@ const ClubPage = () => {
});

return (
<Box height='100%' backgroundColor='white'>
<Box height="100%" backgroundColor="white">
<Stack.Screen
options={{
headerTitle: '',
Expand All @@ -63,102 +76,142 @@ const ClubPage = () => {
<Animated.View style={headerAnimatedStyle}>
<Arrow color={apiError ? 'black' : 'white'} />
</Animated.View>
),
)
}}
/>
<Animated.ScrollView
showsVerticalScrollIndicator={false}
showsHorizontalScrollIndicator={false}
scrollEventThrottle={16}
ref={scrollRef}
>
<AnimatedImageHeader
uri="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSLF3ord7lnV_5Je-pC2AUgUiesHNPcZlpI7A&s"
scrollOffset={scrollOffset}
imageHeight={IMG_HEIGHT}
aspectRatio={2.5}
/>
<Box backgroundColor="white">
<Box
flexDirection="row"
justifyContent="space-between"
marginTop="negativeXl"
alignItems="center"
paddingVertical='s'
paddingHorizontal='l'
>
<ClubIcon imageUrl={club.logo as string} />
<Box width={116}>
<Button color={color} size='sm' variant="standardButton">
Follow
</Button>
</Box>
</Box>
<Box marginHorizontal='l' marginVertical='m' gap='m'>
<Text variant="header-1">{club.name}</Text>
<PageTags tags={club.tags} color={color} />
<AboutSection
description={club.description}
onPress={() => bottomSheet.current?.snapToIndex(0)}
type='club'
>
{apiLoading ? (
<ClubPageSkeleton />
) : apiError ? (
<PageError refetch={setRetriggerFetch} />
) : (
<>
<AnimatedImageHeader
uri="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSLF3ord7lnV_5Je-pC2AUgUiesHNPcZlpI7A&s"
scrollOffset={scrollOffset}
imageHeight={IMG_HEIGHT}
aspectRatio={2.5}
/>
{club.recruitment?.is_recruiting &&
<Button
variant="iconButton"
icon={faExternalLink}
color={color}
iconPosition="right"
size="sm"
justifyContent="space-between"
<Box backgroundColor="white">
<Box
flexDirection="row"
onPress={() => Linking.openURL('')}
justifyContent="space-between"
marginTop="negativeXl"
alignItems="center"
paddingVertical="s"
paddingHorizontal="l"
>
<ClubIcon imageUrl={club.logo as string} />
<Box width={116}>
<Button
color={color}
size="sm"
variant="standardButton"
>
Follow
</Button>
</Box>
</Box>
<Box
marginHorizontal="l"
marginVertical="m"
gap="m"
>
<Box paddingBottom="xxxs" paddingTop="xxs" gap='xxs'>
<Text color="white" variant="body-1">
Application Form
<Text variant="header-1">{club.name}</Text>
<PageTags tags={club.tags} color={color} />
<AboutSection
description={club.description}
onPress={() =>
bottomSheet.current?.snapToIndex(0)
}
type="club"
/>
{club.recruitment?.is_recruiting && (
<Button
variant="iconButton"
icon={faExternalLink}
color={color}
iconPosition="right"
size="sm"
justifyContent="space-between"
flexDirection="row"
onPress={() => Linking.openURL('')}
>
<Box
paddingBottom="xxxs"
paddingTop="xxs"
gap="xxs"
>
<Text
color="white"
variant="body-1"
>
Application Form
</Text>
<Text
color="white"
variant="caption-1"
>
Google Form
</Text>
</Box>
</Button>
)}
<Box>
<Text variant="subheader-1">
Recruiting
</Text>
<Text color="white" variant="caption-1">
Google Form
<RecruitmentInfo
recruitingType={'application'}
isRecruiting={false}
recruitmentCycle={'fallSpring'}
color={color}
/>
</Box>
<Box gap="l">
<Text variant="subheader-1">
Upcoming Events
</Text>
{club.events.length > 0 ? (
<>
<EventCard
eventId={club.events[0].id}
event={club.events[0].name}
variant="big"
tags={[]}
club={club.name}
startTime={
club.events[0].start_time
}
endTime={
club.events[0].end_time
}
logo={club.logo as string}
image="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQfT6p6kCen0-GphSDogJRd2KoYjg0-QQWuAw9e5JBIBEVTc3Hxho_UwRsZ0IrEi6Ap5oo&usqp=CAU"
/>
<EventCardList
events={club.events.slice(1)}
club={club.name}
/>
</>
) : (
<></>
)}
</Box>
</Button>
}
<Box>
<Text variant="subheader-1">Recruiting</Text>
<RecruitmentInfo
recruitingType={'application'}
isRecruiting={false}
recruitmentCycle={'fallSpring'}
color={color}
/>
</Box>
</Box>

<Text variant="subheader-1">Upcoming Events</Text>
{/* <EventCard
event={events[0].name}
variant="big"
tags={tags}
club={club.name}
startTime={events[0].start_time}
endTime={events[0].end_time}
logo="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcT800M6T7YVq_f6W49g_UNL29US7gC63nTitg&s"
image="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQfT6p6kCen0-GphSDogJRd2KoYjg0-QQWuAw9e5JBIBEVTc3Hxho_UwRsZ0IrEi6Ap5oo&usqp=CAU"
/> */}
<Box height={1} backgroundColor="gray" marginVertical="m" />
{/* <EventCardList events={events} /> */}

<Text variant="subheader-1">Leadership</Text>
{/* <PointOfContactList
contacts={pointOfContacts}
color={color}
/> */}
</Box>
</Box>
</>
)}
</Animated.ScrollView>
<Description
description={club.description as string}
ref={bottomSheet}
type='club'
type="club"
/>
</Box>
);
Expand Down
Loading

0 comments on commit 7c80adc

Please sign in to comment.