Skip to content

Commit

Permalink
Merge branch 'oauth-bug-fix' of https://github.com/GenerateNU/sac int…
Browse files Browse the repository at this point in the history
…o oauth-bug-fix
  • Loading branch information
garrettladley committed Jun 16, 2024
2 parents 1116fd8 + f3ceda9 commit 6eda095
Show file tree
Hide file tree
Showing 66 changed files with 35,290 additions and 6,230 deletions.
2 changes: 1 addition & 1 deletion backend/entities/events/previews/transactions.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func processEventStubs(db *gorm.DB, events []EventStub) ([]EventPreview, error)
}

var hosts []models.Club
if err := db.Where("id IN ?", eventIDs).Find(&hosts).Error; err != nil {
if err := db.Joins("JOIN events ON events.host = clubs.id").Where("events.id IN ?", eventIDs).Find(&hosts).Error; err != nil {
return nil, err
}

Expand Down
2,176 changes: 1,215 additions & 961 deletions frontend/dashboard/yarn.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion frontend/lib/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@generatesac/lib",
"version": "0.0.164",
"version": "0.0.170",
"type": "module",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
1 change: 0 additions & 1 deletion frontend/lib/src/api/eventApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ export const eventApi = baseApi.injectEndpoints({
? result.map((event) => ({ type: "Event", id: event.id }))
: ["Event"],
transformResponse: (response) => {
console.log('here!!!!')
return z.array(eventSchema).parse(response);
},
}),
Expand Down
2 changes: 0 additions & 2 deletions frontend/lib/src/types/category.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { z } from "zod";

import { rootModelSchema } from "./root";
import { tagSchema } from "./tag";

// Schemas:
export const createCategoryRequestBodySchema = z.object({
Expand All @@ -10,7 +9,6 @@ export const createCategoryRequestBodySchema = z.object({

export const categorySchemaIntermediate = z.object({
name: z.string(),
tags: z.array(tagSchema),
});

export const categorySchema = categorySchemaIntermediate.merge(rootModelSchema);
Expand Down
4 changes: 2 additions & 2 deletions frontend/lib/src/types/club.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { z } from "zod";

import { rootModelSchema } from "./root";
import { recruitmentSchema } from "./recruitment";

// Schemas:
export const createClubRequestBodySchema = z.object({
Expand Down Expand Up @@ -35,11 +36,10 @@ const clubSchemaIntermediate = z.object({
preview: z.string().max(255),
description: z.string(),
num_members: z.number(),
is_recruiting: z.boolean(),
application_link: z.string().max(255),
logo: z.string().max(255).optional(),
weekly_time_committment: z.number().optional(),
one_word_to_describe_us: z.string().max(20).optional(),
recruitment: recruitmentSchema.optional(),
});

export const clubSchema = clubSchemaIntermediate.merge(rootModelSchema);
Expand Down
3 changes: 2 additions & 1 deletion frontend/lib/src/types/event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ const eventPreviewSchemaIntermediate = z.object({
start_time: z.string(),
end_time: z.string(),

tags: tagSchema.array(),
tags: tagSchema.array().optional().nullable(),
host_name: z.string().max(255),
host_logo: z.string().max(255).optional(),
});
Expand All @@ -76,3 +76,4 @@ export type UpdateEventRequestBody = z.infer<
>;
export type Event = z.infer<typeof eventSchema>;
export type EventPreview = z.infer<typeof eventPreviewSchema>;
export type EventType = z.infer<typeof eventTypeEnum>;
4 changes: 3 additions & 1 deletion frontend/mobile/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"@fortawesome/free-solid-svg-icons": "^6.5.2",
"@fortawesome/react-fontawesome": "^0.2.2",
"@fortawesome/react-native-fontawesome": "^0.3.2",
"@generatesac/lib": "0.0.164",
"@generatesac/lib": "0.0.170",
"@gorhom/bottom-sheet": "^4.6.3",
"@hookform/resolvers": "^3.4.2",
"@react-native-async-storage/async-storage": "^1.23.1",
Expand All @@ -37,6 +37,8 @@
"@shopify/restyle": "^2.4.4",
"@stream-io/flat-list-mvcp": "^0.10.3",
"@svgr/core": "^8.1.0",
"@tanstack/react-query": "^5.44.0",
"axios": "^1.7.2",
"expo": "~51.0.2",
"expo-dev-client": "~4.0.14",
"expo-font": "~12.0.5",
Expand Down
3 changes: 2 additions & 1 deletion frontend/mobile/src/app/(app)/(tabs)/_layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ const Layout = () => {
name="profile"
options={{
title: 'Profile',
headerShown: false,
headerShown: true,
headerTransparent: true,
tabBarLabel: ({ focused }) =>
TabBarLabel({ focused, title: 'Profile' }),
tabBarIcon: ({ focused }) =>
Expand Down
1 change: 0 additions & 1 deletion frontend/mobile/src/app/(app)/(tabs)/calendar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ const CalendarPage = () => {
setError(false);
}

console.log(data);
return parseData(startTime, endTime, data);
}
);
Expand Down
2 changes: 1 addition & 1 deletion frontend/mobile/src/app/(app)/(tabs)/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const HomePage = () => {
variant="small"
event={item.name}
club={item.host}
clubId="1"
eventId="1"
startTime={item.start_time}
endTime={item.end_time}
image="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSLF3ord7lnV_5Je-pC2AUgUiesHNPcZlpI7A&s"
Expand Down
103 changes: 91 additions & 12 deletions frontend/mobile/src/app/(app)/(tabs)/profile.tsx
Original file line number Diff line number Diff line change
@@ -1,31 +1,110 @@
import { StyleSheet, Text, View } from 'react-native';
import React from 'react';
import { StyleSheet, TouchableOpacity } from 'react-native';
import { SafeAreaView } from 'react-native-safe-area-context';

import { router } from 'expo-router';

import {
IconDefinition,
faHeart,
faSignOutAlt,
faUser
} from '@fortawesome/free-solid-svg-icons';
import { FontAwesomeIcon } from '@fortawesome/react-native-fontawesome';
import { Avatar } from '@rneui/base';

import { GlobalLayout } from '@/src/app/(design-system)/components/GlobalLayout/GlobalLayout';

import { Box, Colors, SACColors, Spacing, Text } from '../../(design-system)';

type ProfileItemProps = {
icon: IconDefinition;
text: string;
textColor?: SACColors;
onPress?: () => void;
};

const ProfileItem = ({ icon, text, textColor, onPress }: ProfileItemProps) => (
<TouchableOpacity onPress={onPress}>
<Box
gap="l"
paddingVertical="s"
flexDirection="row"
alignItems="center"
>
<FontAwesomeIcon
size={24}
color={textColor ? Colors.darkRed : Colors.gray}
icon={icon}
/>
<Text color={textColor}>{text}</Text>
</Box>
</TouchableOpacity>
);

const ProfilePage = () => {
return (
<GlobalLayout>
<View style={styles.container}>
<Text style={styles.title}>Profile</Text>
</View>
<SafeAreaView style={styles.container}>
<Box
paddingTop="xxl"
flexDirection="row"
gap="m"
alignItems="center"
>
<Avatar
source={{
uri: 'https://media1.popsugar-assets.com/files/thumbor/S6_lryTon-0orhMkLrw6m1yIFww=/1500x1500/filters:format_auto():quality(85):extract_cover()/2017/02/28/003/n/1922441/ace7eba458b602264e7940.39836479_edit_img_image_43244124_1488304081.jpg'
}}
size={60}
rounded
/>
<Box flexDirection="column" gap="xxs">
<Text variant="subheader-2">Quokka</Text>
<Text>[email protected]</Text>
</Box>
</Box>
<Box width="100%">
<ProfileItem
onPress={() => router.push('/user/detail/')}
icon={faUser}
text="Edit Profile"
/>
<ProfileItem
icon={faHeart}
onPress={() => router.push('/user/interest/')}
text="Edit Interests"
/>
<Box
width="100%"
height={1}
backgroundColor="gray"
marginVertical="s"
/>
<ProfileItem
icon={faSignOutAlt}
text="Logout"
textColor="darkRed"
/>
</Box>
</SafeAreaView>
</GlobalLayout>
);
};

const styles = StyleSheet.create({
container: {
flex: 1,
alignItems: 'center',
justifyContent: 'center'
flexDirection: 'column',
alignItems: 'flex-start',
justifyContent: 'flex-start',
marginVertical: Spacing.m,
gap: Spacing.l
},
title: {
fontSize: 20,
fontWeight: 'bold'
},
separator: {
marginVertical: 30,
height: 1,
width: '80%'
fontWeight: 'bold',
marginBottom: 20
}
});

Expand Down
8 changes: 8 additions & 0 deletions frontend/mobile/src/app/(app)/_layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@ const Layout = () => {
}
}}
/>
<Stack.Screen
name="user"
options={{
headerTitle: 'Profile',
headerTransparent: true,
headerShown: false
}}
/>
</Stack>
);
};
Expand Down
Loading

0 comments on commit 6eda095

Please sign in to comment.