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

Fixed Errors and Routing Screens #88

Merged
merged 2 commits into from
Sep 6, 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
14 changes: 8 additions & 6 deletions source/frontend/app/AuthStackNavigator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,20 @@ import { Login } from "@/pages/login";
import { NavigationContainer } from "@react-navigation/native";
import MyTabs from "./MainNavigator";
import StartPage from "@/pages/startpage";
import { AuthStackParamList } from "../app/StackParamList";

const AuthStack = createStackNavigator<AuthStackParamList>();

const AuthStack = createStackNavigator();
function AuthStackNavigator() {
return (
<AuthStack.Navigator
initialRouteName="StartPage"
initialRouteName="Start"
screenOptions={{ headerShown: false }}
>
<AuthStack.Screen name="StartPage" component={StartPage} />
<AuthStack.Screen name="SignUp" component={SignUp} />
<AuthStack.Screen name="Login" component={Login} />
<AuthStack.Screen name="Main" component={MyTabs} />
<AuthStack.Screen name="Start" component={StartPage}/>
<AuthStack.Screen name="SignUp" component={SignUp}/>
<AuthStack.Screen name="Login" component={Login} options={{headerShown: true, headerTitle: "", headerBackTitleVisible: false}}/>
<AuthStack.Screen name="Main" component={MyTabs}/>
</AuthStack.Navigator>
);
}
Expand Down
14 changes: 13 additions & 1 deletion source/frontend/app/MainNavigator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ import Summary from "@/pages/summary";
import PriceWatch from "@/pages/pricewatch";
import UserValid from "@/pages/uservalid";
import History from "@/pages/history";
import { Account } from "@/pages/account";
import {Account} from "@/pages/account";
import {EditProfile} from "@/pages/editprofile";
import DetailedHistory from "@/pages/detailedhistory";
import {
SummaryStackParamList,
Expand All @@ -30,6 +31,16 @@ const HistoryStack = createStackNavigator<HistoryStackParamList>();
const AccountStack = createStackNavigator<AccountStackParamList>();

// Create stack navigators for each tab

/**
* Errors: The error below can be fixed through having both navigation and route in the props
* Type 'typeof Account' is not assignable to type 'ScreenComponentType<AccountStackParamList, "Account"> | undefined'.
Type 'typeof Account' is not assignable to type 'ComponentClass<{}, any>'.
Types of parameters 'props' and 'props' are incompatible.
Property 'onClicked' is missing in type '{}' but required in type 'AccountProps'.ts(2322)
account.tsx(7, 3): 'onClicked' is declared here.
types.d.ts(318, 5): The expected type comes from property 'component' which is declared here on type 'IntrinsicAttributes & RouteConfig<AccountStackParamList,
*/
function SummaryStackNavigator() {
return (
<SummaryStack.Navigator>
Expand Down Expand Up @@ -68,6 +79,7 @@ function AccountStackNavigator() {
return (
<AccountStack.Navigator>
<AccountStack.Screen name="Account" component={Account} />
<AccountStack.Screen name="EditProfile" component={EditProfile}/>
</AccountStack.Navigator>
);
}
Expand Down
7 changes: 7 additions & 0 deletions source/frontend/app/StackParamList.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
// Define param lists for each stack if they have unique parameters
export type AuthStackParamList = {
Start: undefined;
SignUp: undefined;
Login: undefined;
Main: undefined;
};

// Param list for the Summary stack
export type SummaryStackParamList = {
Expand Down Expand Up @@ -28,5 +34,6 @@ export type HistoryStackParamList = {
// Param list for the Account stack
export type AccountStackParamList = {
Account: undefined;
EditProfile: { view: "email" | "password"}
// Add other screens and their params in Account Stack if necessary
};
40 changes: 27 additions & 13 deletions source/frontend/components/style.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,19 +40,6 @@ export const Container = styled.View`
background-color: ${Colors.primary};
`;

// Change color of the background and border and update the text color(Edit Profile)
export const TopBar = styled.View`
flex-direction: row;
align-items: center;
justify-content: space-between;
paddinghorizontal: 20px;
paddingtop: 30px;
height: 100px;
background-color: #ffffff;
border-bottom-width: 1px;
border-bottom-color: #ddd;
`;

export const PageTitle = styled.Text`
font-size: 30px;
text-align: center;
Expand Down Expand Up @@ -120,3 +107,30 @@ export const Line = styled.View`
background-color: ${darkLight};
margin-vertical: 10px;
`;

export const CenteredView = styled.View`
flex: 1;
justifyContent: center;
alignItems: center;
marginTop: 22px;
`;

export const ModalView = styled.View`
margin: 20px;
backgroundColor: lightgreen;
borderRadius: 20px;
padding: 35px;
alignItems: center;
shadowColor: #000;
shadowOpacity: 0.25;
shadowRadius: 4px;
elevation: 5;
`;

/**
*
shadowOffset: {
width: 0px,
height: 2px,
};
*/
Loading
Loading