Skip to content

Commit

Permalink
Request Auth + Frontend Reorg (#995)
Browse files Browse the repository at this point in the history
  • Loading branch information
alderwhiteford authored Jun 11, 2024
1 parent 254df35 commit a3ccf10
Show file tree
Hide file tree
Showing 115 changed files with 1,282 additions and 1,455 deletions.
2,176 changes: 961 additions & 1,215 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.12",
"version": "0.0.13",
"type": "module",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
15 changes: 8 additions & 7 deletions frontend/lib/src/api/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@ export const baseApi = createApi({
baseQuery: fetchBaseQuery({
baseUrl: API_BASE_URL,
credentials: "include",
// prepareHeaders: async (headers, { getState }) => {
// const token = (getState() as { auth: { token: string } })?.auth.token;
// if (token) {
// headers.set("Authorization", `Bearer ${token}`);
// }
// return headers;
// },
prepareHeaders: async (headers, { getState }) => {
// User slice existing must exist in all dependent apps:
const token = (getState() as { user: { accessToken: string } })?.user?.accessToken;
if (token) {
headers.set("Authorization", `Bearer ${token}`);
}
return headers;
},
}),
tagTypes: [
"User",
Expand Down
4 changes: 2 additions & 2 deletions frontend/lib/src/api/categoryApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export const categoryApi = baseApi.injectEndpoints({
transformResponse: (response: Category[]) => {
return z.array(categorySchema).parse(response);
},
providesTags: (result, _, _arg) =>
providesTags: (result) =>
result
? result.map((category) => ({
type: "Category",
Expand Down Expand Up @@ -84,7 +84,7 @@ export const categoryApi = baseApi.injectEndpoints({
),
method: "GET",
}),
providesTags: (result, _, _arg) =>
providesTags: (result) =>
result ? result.map((tag) => ({ type: "Tag", id: tag.id })) : ["Tag"],
}),
categoryTag: builder.query<Tag, { categoryID: string; tagID: string }>({
Expand Down
16 changes: 8 additions & 8 deletions frontend/lib/src/api/clubApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export const clubApi = baseApi.injectEndpoints({
url: handleQueryParams(`${CLUB_API_BASE_URL}/`, queryParams),
method: "GET",
}),
providesTags: (result, _, _arg) =>
providesTags: (result) =>
result
? result.map((club) => ({ type: "Club", id: club.id }))
: ["Club"],
Expand Down Expand Up @@ -88,7 +88,7 @@ export const clubApi = baseApi.injectEndpoints({
url: `${CLUB_API_BASE_URL}/${id}/contacts/`,
method: "GET",
}),
providesTags: (result, _, _arg) =>
providesTags: (result) =>
result
? result.map((contact) => ({
type: "Contact",
Expand Down Expand Up @@ -124,7 +124,7 @@ export const clubApi = baseApi.injectEndpoints({
),
method: "GET",
}),
providesTags: (result, _, _arg) =>
providesTags: (result) =>
result
? result.map((event) => ({ type: "Event", id: event.id }))
: ["Event"],
Expand All @@ -143,7 +143,7 @@ export const clubApi = baseApi.injectEndpoints({
),
method: "GET",
}),
providesTags: (result, _, _arg) =>
providesTags: (result) =>
result
? result.map((follower) => ({
type: "Follower",
Expand All @@ -165,7 +165,7 @@ export const clubApi = baseApi.injectEndpoints({
),
method: "GET",
}),
providesTags: (result, _, _arg) =>
providesTags: (result) =>
result
? result.map((member) => ({ type: "User", id: member.id }))
: ["User"],
Expand Down Expand Up @@ -200,7 +200,7 @@ export const clubApi = baseApi.injectEndpoints({
url: `${CLUB_API_BASE_URL}/${id}/pocs/`,
method: "GET",
}),
providesTags: (result, _, _arg) =>
providesTags: (result) =>
result
? result.map((poc) => ({
type: "PointOfContact",
Expand Down Expand Up @@ -294,7 +294,7 @@ export const clubApi = baseApi.injectEndpoints({
method: "POST",
body,
}),
invalidatesTags: (result, _, _arg) =>
invalidatesTags: (result) =>
result ? result.map((tag) => ({ type: "Tag", id: tag.id })) : ["Tag"],
transformResponse: (response) => {
return z.array(tagSchema).parse(response);
Expand All @@ -305,7 +305,7 @@ export const clubApi = baseApi.injectEndpoints({
url: `${CLUB_API_BASE_URL}/${id}/tags/`,
method: "GET",
}),
providesTags: (result, _, _arg) =>
providesTags: (result) =>
result ? result.map((tag) => ({ type: "Tag", id: tag.id })) : ["Tag"],
transformResponse: (response) => {
return z.array(tagSchema).parse(response);
Expand Down
2 changes: 1 addition & 1 deletion frontend/lib/src/api/userApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ export const userApi = baseApi.injectEndpoints({
method: "POST",
body,
}),
invalidatesTags: (result, _, _arg) =>
invalidatesTags: (result) =>
result ? result.map((tag) => ({ type: "Tag", id: tag.id })) : ["Tag"],
transformResponse: (response) => {
return z.array(tagSchema).parse(response);
Expand Down
8 changes: 4 additions & 4 deletions frontend/mobile/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
"slug": "student-activity-calendar",
"version": "1.0.3",
"orientation": "portrait",
"icon": "./assets/images/icon.png",
"icon": "./src/assets/images/icon.png",
"scheme": "myapp",
"userInterfaceStyle": "automatic",
"splash": {
"image": "./assets/images/splash.png",
"image": "./src/assets/images/splash.png",
"resizeMode": "contain",
"backgroundColor": "#ffffff"
},
Expand All @@ -23,15 +23,15 @@
},
"android": {
"adaptiveIcon": {
"foregroundImage": "./assets/images/adaptive-icon.png",
"foregroundImage": "./src/assets/images/adaptive-icon.png",
"backgroundColor": "#ffffff"
},
"package": "com.generatesac.studentactivitycalendar"
},
"web": {
"bundler": "metro",
"output": "static",
"favicon": "./assets/images/favicon.png"
"favicon": "./src/assets/images/favicon.png"
},
"plugins": [
"expo-router",
Expand Down
70 changes: 0 additions & 70 deletions frontend/mobile/hooks/use-storage-state.ts

This file was deleted.

12 changes: 0 additions & 12 deletions frontend/mobile/hooks/warmUpBrowser.tsx

This file was deleted.

2 changes: 2 additions & 0 deletions frontend/mobile/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"@generatesac/lib": "0.0.12",
"@gorhom/bottom-sheet": "^4.6.3",
"@hookform/resolvers": "^3.4.2",
"@react-native-async-storage/async-storage": "^1.23.1",
"@react-native-community/clipboard": "^1.5.1",
"@react-navigation/native": "^6.0.2",
"@reduxjs/toolkit": "^2.2.5",
Expand Down Expand Up @@ -69,6 +70,7 @@
"react-native-webview": "^11.23.1",
"react-redux": "^9.1.2",
"redux": "^5.0.1",
"redux-persist": "^6.0.0",
"zod": "^3.23.8"
},
"devDependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +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 { Text } from '@/app/(design-system)';
import { Box } from '@/app/(design-system)';
import { Icon } from '@/app/(design-system)/components/Icon/Icon';
import { Text } from '@/src/app/(design-system)';
import { Box } from '@/src/app/(design-system)';
import { Icon } from '@/src/app/(design-system)/components/Icon/Icon';

interface TabBarLabelProps {
focused: boolean;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ import { Theme } from 'react-native-calendars-sac/src/types';

import { eventApi } from '@generatesac/lib';

import { Box, Colors, createStyles } from '@/app/(design-system)';
import { Box, Colors, createStyles } from '@/src/app/(design-system)';
import Calendar, {
DAY_EPOCH_TIME,
FetchNewEventsPropsUnion
} from '@/app/(design-system)/components/Calendar/Calendar';
import { EventSection } from '@/app/(design-system)/components/Calendar/DayTimeSection';
import { parseData } from '@/app/(design-system)/components/Calendar/parser/calendarParser';
} from '@/src/app/(design-system)/components/Calendar/Calendar';
import { EventSection } from '@/src/app/(design-system)/components/Calendar/DayTimeSection';
import { parseData } from '@/src/app/(design-system)/components/Calendar/parser/calendarParser';

const TODAY = new Date();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { Pressable, StyleSheet } from 'react-native';

import { router } from 'expo-router';

import { Box, Text } from '@/app/(design-system)';
import { EventCard } from '@/app/(design-system)/components/EventCard';
import { Box, Text } from '@/src/app/(design-system)';
import { EventCard } from '@/src/app/(design-system)/components/EventCard';

const HomePage = () => {
const item = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { StyleSheet, Text, View } from 'react-native';

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

const ProfilePage = () => {
return (
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,18 @@ import { Stack, useLocalSearchParams } from 'expo-router';

import BottomSheet from '@gorhom/bottom-sheet';

import { Arrow, Box, KebabMenu } from '@/app/(design-system)';
import { SACColors } from '@/app/(design-system)';
import { Button } from '@/app/(design-system)/components/Button/Button';
import { description, events, tags } from '@/consts/event-page';
import { Arrow, Box, KebabMenu } from '@/src/app/(design-system)';
import { SACColors } from '@/src/app/(design-system)';
import { Button } from '@/src/app/(design-system)/components/Button/Button';
import { description, events, tags } from '@/src/consts/event-page';

import { AboutEvent } from '../event/components/about';
import { Location } from '../event/components/location';
import { Overview } from '../event/components/overview';
import { UpcomingEvent } from '../event/components/upcoming-events';
import { AboutEvent } from './components/about';
import { Description } from './components/description';
import { Location } from './components/location';
import { Overview } from './components/overview';
import { RegisterBottomSheet } from './components/register';
import { ShareEventBottomSheet } from './components/share-event';
import { UpcomingEvent } from './components/upcoming-events';

type EventType = 'in-person' | 'virtual' | 'hybrid';

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import {
SACColors,
Text,
textColorVariants
} from '@/app/(design-system)';
import { Tag as TagComponent } from '@/app/(design-system)';
import { Button } from '@/app/(design-system)/components/Button/Button';
} from '@/src/app/(design-system)';
import { Tag as TagComponent } from '@/src/app/(design-system)';
import { Button } from '@/src/app/(design-system)/components/Button/Button';

interface AboutEventProps {
tags: Tag[];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { forwardRef, useCallback } from 'react';

import BottomSheet, { BottomSheetBackdrop } from '@gorhom/bottom-sheet';

import { Box, Text } from '@/app/(design-system)';
import { Box, Text } from '@/src/app/(design-system)';

import { Divider } from './divider';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Box } from '@/app/(design-system)';
import { Box } from '@/src/app/(design-system)';

export const Divider = () => {
return <Box width="100%" height={1} backgroundColor="gray" />;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import MapView, { Marker } from 'react-native-maps';
import { createOpenLink } from 'react-native-open-maps';

import { Text } from '@/app/(design-system)';
import { Box } from '@/app/(design-system)';
import { Text } from '@/src/app/(design-system)';
import { Box } from '@/src/app/(design-system)';

// import Geocoder from 'react-native-geocoding';
// import { useEffect, useState } from 'react';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import {
import { FontAwesomeIcon } from '@fortawesome/react-native-fontawesome';
import { Avatar } from '@rneui/base';

import { Box, Colors, SACColors, Text } from '@/app/(design-system)';
import { firstLetterUppercase } from '@/utils/string';
import { createOptions, eventTime } from '@/utils/time';
import { Box, Colors, SACColors, Text } from '@/src/app/(design-system)';
import { firstLetterUppercase } from '@/src/utils/string';
import { createOptions, eventTime } from '@/src/utils/time';

interface OverviewProps {
logo: string;
Expand Down
Loading

0 comments on commit a3ccf10

Please sign in to comment.