Skip to content

Commit

Permalink
Merge pull request #248 from amosproj/integrate-custom-instructions
Browse files Browse the repository at this point in the history
Integrate custom instructions
  • Loading branch information
lukas-varga authored Jul 8, 2024
2 parents b89ecd3 + 5064f82 commit feaa850
Show file tree
Hide file tree
Showing 9 changed files with 42 additions and 70 deletions.
Binary file not shown.
File renamed without changes.

This file was deleted.

This file was deleted.

3 changes: 2 additions & 1 deletion src/frontend/helpers/screens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ export enum Screens {
SignUp = 'SignUp',
ForgotPassword = 'ForgotPassword',
ResetPassword = 'ResetPassword',
Chat = 'Chat'
Chat = 'Chat',
CustomInstructions = 'CustomInstructions'
}
8 changes: 7 additions & 1 deletion src/frontend/routes/MainRoutes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ import { createDrawerNavigator } from '@react-navigation/drawer';
import React from 'react';
import { Header } from '../components';
import { Screens } from '../helpers';
import { ChatUI, DrawerMenu } from '../screens';
import { ChatUI, DrawerMenu, CustomInstructions } from '../screens';

export type MainDrawerParams = {
[Screens.Chat]: { chatId: string | null };
[Screens.CustomInstructions]: undefined;
};

const MainRouteDrawer = createDrawerNavigator<MainDrawerParams>();
Expand All @@ -18,6 +19,11 @@ export function MainRoutes() {
component={ChatUI}
options={{ header: (props) => <Header {...props} /> }}
/>
<MainRouteDrawer.Screen
name={Screens.CustomInstructions}
component={CustomInstructions}
options={{ header: (props) => <Header {...props} /> }}
/>
</MainRouteDrawer.Navigator>
);
}
25 changes: 25 additions & 0 deletions src/frontend/screens/CustomInstructions/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// src/frontend/screens/CustomInstructions.tsx
import React from 'react';
import { View, Text, StyleSheet } from 'react-native';
import PersonalInfoForm from '../../components/PersonalInfoForm';

export function CustomInstructions() {
return (
<View style={styles.container}>
<Text style={styles.title}>Custom Instructions</Text>
<PersonalInfoForm />
</View>
);
}

const styles = StyleSheet.create({
container: {
flex: 1,
padding: 16,
},
title: {
fontSize: 24,
fontWeight: 'bold',
marginBottom: 16,
},
});
8 changes: 7 additions & 1 deletion src/frontend/screens/DrawerMenu/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ import { Screens } from 'src/frontend/helpers';
import { LLM_MODELS, useActiveChatId, useCreateChat, useGetAllChat } from 'src/frontend/hooks';
import type { AppRoutesParams } from 'src/frontend/routes';
import type { Chat } from 'src/frontend/types';
import { MainDrawerParams } from 'src/frontend/routes/MainRoutes';

Check failure on line 19 in src/frontend/screens/DrawerMenu/index.tsx

View workflow job for this annotation

GitHub Actions / Job: Check Lint and Format TS & TSX Code

All these imports are only used as types.
import { DrawerNavigationProp } from '@react-navigation/drawer';

Check failure on line 20 in src/frontend/screens/DrawerMenu/index.tsx

View workflow job for this annotation

GitHub Actions / Job: Check Lint and Format TS & TSX Code

All these imports are only used as types.



/**
* NOTE: needs to be called DrawerMenu because Drawer is already defined in react-native-paper
Expand All @@ -26,11 +30,13 @@ export function DrawerMenu() {
const { chats, status, error } = useGetAllChat();
const { reset } = useNavigation<NativeStackNavigationProp<AppRoutesParams>>();
const { colors } = useTheme();
const navigationC = useNavigation<DrawerNavigationProp<MainDrawerParams>>();

// ------------ Define navigation functions ------------
const goToProfile = () => {
//navigation.navigate('Profile');
console.log('TODO: implement Profile Screen');

navigate('Main', { screen: Screens.CustomInstructions });
};

const { navigate } = useNavigation<NativeStackNavigationProp<AppRoutesParams>>();
Expand Down
1 change: 1 addition & 0 deletions src/frontend/screens/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ export * from './DrawerMenu';
export * from './SignUp';
export * from './ForgotPassword';
export * from './ResetPassword';
export * from './CustomInstructions';

0 comments on commit feaa850

Please sign in to comment.