Skip to content

Commit

Permalink
fix: some API fixes (#68)
Browse files Browse the repository at this point in the history
* chore(front): update dependencies

* refactor(front): rename some api slices

* refactor(front): rename profile nav screen name

* fix(front): fix experience create request parameters

* fix(evaluation): fix evaluation creation time reply

* fix(front): improve job application UX experience

* refactor(front): run prettier

* chore(front): update some translations
  • Loading branch information
Kuruyia authored Feb 12, 2024
1 parent ec5847b commit 7ddc7b8
Show file tree
Hide file tree
Showing 17 changed files with 769 additions and 579 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ class EvaluationToProto : Converter<Evaluation, EmployeeEvaluationOuterClass.Emp
.setEmployerId(source.employerId.toString())
.setScore(source.score)
.setComment(source.comment)
.setCreatedAt(source.createdAt.toEpochSecond(ZoneOffset.UTC))
.setCreatedAt(source.createdAt.toEpochSecond(ZoneOffset.UTC) * 1000)
}
}
4 changes: 2 additions & 2 deletions front/assets/translations/en_US.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@
"applyConfirm": "Do you want to apply to this job?"
},
"applied": {
"jobOfferAppliedList": "Job offer applied list"
"jobOfferAppliedList": "Applications"
}
},
"messaging": {
"messages": "Messages",
"info": {
"messageChannel": "Messages",
"textInputPlaceholer": "Your message"
"textInputPlaceholder": "Your message"
}
},
"profile": {
Expand Down
4 changes: 2 additions & 2 deletions front/assets/translations/fr_FR.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@
"applyConfirm": "Voulez-vous candidater à cette offre ?"
},
"applied": {
"jobOfferAppliedList": "Liste des offres d'emploi candidatés"
"jobOfferAppliedList": "Candidatures"
}
},
"messaging": {
"messages": "Messages",
"info": {
"messageChannel": "Messages",
"textInputPlaceholer": "Votre message"
"textInputPlaceholder": "Votre message"
}
},
"profile": {
Expand Down
1,211 changes: 701 additions & 510 deletions front/package-lock.json

Large diffs are not rendered by default.

38 changes: 19 additions & 19 deletions front/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,47 +17,47 @@
"@react-native-community/slider": "4.4.2",
"@react-navigation/material-top-tabs": "^6.6.5",
"@react-navigation/native": "^6.1.9",
"@react-navigation/native-stack": "^6.9.16",
"@reduxjs/toolkit": "^1.9.7",
"@types/color": "^3.0.5",
"@types/react": "~18.2.45",
"@react-navigation/native-stack": "^6.9.17",
"@reduxjs/toolkit": "^2.1.0",
"@types/color": "^3.0.6",
"@types/react": "~18.2.55",
"color": "^4.2.3",
"deepmerge": "^4.3.1",
"expo": "^50.0.2",
"expo": "~50.0.6",
"expo-auth-session": "~5.4.0",
"expo-crypto": "~12.8.0",
"expo-font": "~11.10.2",
"expo-localization": "~14.8.3",
"expo-splash-screen": "~0.26.3",
"expo-splash-screen": "~0.26.4",
"expo-status-bar": "~1.11.1",
"expo-system-ui": "~2.9.3",
"expo-web-browser": "~12.8.1",
"expo-web-browser": "~12.8.2",
"i18n-js": "^4.3.2",
"react": "^18.2.0",
"react-native": "0.73.2",
"react-native-pager-view": "6.2.3",
"react-native-paper": "^5.11.1",
"react-native-paper-dates": "^0.20.3",
"react-native-paper": "^5.12.3",
"react-native-paper-dates": "^0.21.8",
"react-native-paper-dropdown": "^1.0.7",
"react-native-safe-area-context": "4.8.2",
"react-native-screens": "~3.29.0",
"react-native-tab-view": "^3.5.2",
"react-redux": "^8.1.3",
"typescript": "^5.3.0",
"react-redux": "^9.1.0",
"typescript": "^5.3.3",
"expo-secure-store": "~12.8.1"
},
"devDependencies": {
"@babel/core": "^7.23.2",
"@trivago/prettier-plugin-sort-imports": "^4.2.1",
"@types/react-native-vector-icons": "^6.4.16",
"@typescript-eslint/eslint-plugin": "^6.9.0",
"eslint": "^8.52.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-jsx-a11y": "^6.7.1",
"@babel/core": "^7.23.9",
"@trivago/prettier-plugin-sort-imports": "^4.3.0",
"@types/react-native-vector-icons": "^6.4.18",
"@typescript-eslint/eslint-plugin": "^6.21.0",
"eslint": "^8.56.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-jsx-a11y": "^6.8.0",
"eslint-plugin-react": "^7.33.2",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-native": "^4.1.0",
"prettier": "^3.0.3"
"prettier": "^3.2.5"
},
"private": true
}
23 changes: 12 additions & 11 deletions front/src/components/jobOffers/JobOfferContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Alert, StyleSheet, View } from 'react-native';
import { Button, Text, useTheme } from 'react-native-paper';
import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';

import { JobOffer } from '@/models/entities/jobOffer';
import { JobOffer, JobOfferStatus } from '@/models/entities/jobOffer';
import { usePostApplyJobOfferMutation } from '@/store/api/jobOfferApiSlice';
import i18n from '@/utils/i18n';

Expand Down Expand Up @@ -67,7 +67,6 @@ const JobOfferContent: FC<JobOfferContentProps> = ({ jobOffer }) => {
{
text: i18n.t('common.confirm'),
onPress: () => applyToJobOffer(jobOffer.id),
style: 'destructive',
},
],
);
Expand Down Expand Up @@ -108,15 +107,17 @@ const JobOfferContent: FC<JobOfferContentProps> = ({ jobOffer }) => {

<Text>{`${jobOffer.description}`}</Text>

<View style={styles.verticalCentered}>
<Button
mode={'contained-tonal'}
style={styles.button}
onPress={() => handleApplyToJobOffer(jobOffer)}
>
{i18n.t('jobOffer.apply.apply')}
</Button>
</View>
{jobOffer.status === JobOfferStatus.NOT_APPLIED && (
<View style={styles.verticalCentered}>
<Button
mode={'contained-tonal'}
style={styles.button}
onPress={() => handleApplyToJobOffer(jobOffer)}
>
{i18n.t('jobOffer.apply.apply')}
</Button>
</View>
)}
</View>
);
};
Expand Down
2 changes: 1 addition & 1 deletion front/src/components/messaging/MessageTextInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const MessageTextInput: FC<MessageTextInputProps> = ({ messageChannelId }) => {
<View style={styles.container}>
<TextInput
style={styles.textInput}
placeholder={i18n.t('messaging.info.textInputPlaceholer')}
placeholder={i18n.t('messaging.info.textInputPlaceholder')}
value={content}
onChangeText={setContent}
mode={'outlined'}
Expand Down
4 changes: 2 additions & 2 deletions front/src/components/utils/StarRatingSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ const StarRatingSelector: FC<StarRatingSelectorProps> = ({
star === StarKind.FULL_STAR
? 'star'
: star === StarKind.HALF_STAR
? 'star-half-full'
: 'star-outline'
? 'star-half-full'
: 'star-outline'
}
size={24}
style={{
Expand Down
4 changes: 2 additions & 2 deletions front/src/pages/MainTabNav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export type MainTabParamList = {
Home: undefined;
Applications: undefined;
Messages: undefined;
Profile: undefined;
ProfileNav: undefined;
};

const MainTab = createMaterialBottomTabNavigator<MainTabParamList>();
Expand Down Expand Up @@ -71,7 +71,7 @@ const MainTabNav = () => {
}}
/>
<MainTab.Screen
name='Profile'
name='ProfileNav'
component={ProfileNav}
options={{
tabBarLabel: i18n.t('profile.profile'),
Expand Down
2 changes: 1 addition & 1 deletion front/src/pages/employer/EmployerEvaluationPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { EmployerEvaluationDto } from '@/models/dtos/employer/EmployerEvaluation
import {
useGetEmployerQuery,
usePostEmployerEvaluationMutation,
} from '@/store/api/employer';
} from '@/store/api/employerApiSlice';
import i18n from '@/utils/i18n';

import { MessagingStackParamList } from '../messaging/MessagingNav';
Expand Down
4 changes: 2 additions & 2 deletions front/src/pages/profile/ProfileUpdatePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import ProfileUpdateInfosForm, {
import { UpdateProfileDto } from '@/models/dtos/profile/updateProfileDto';
import { Availability } from '@/models/entities/availability';
import {
useDeleteAvailabilitiesMutation,
useDeleteAvailabilityMutation,
useGetAvailabilitiesQuery,
} from '@/store/api/availabilityApiSlice';
import {
Expand Down Expand Up @@ -52,7 +52,7 @@ const ProfileUpdatePage: FC<ProfileUpdatePageProps> = ({ navigation }) => {
const { data: profile } = useGetProfileQuery();
const { data: availabilities } = useGetAvailabilitiesQuery();
const [patchProfile] = usePatchProfileMutation();
const [deleteAvailability] = useDeleteAvailabilitiesMutation();
const [deleteAvailability] = useDeleteAvailabilityMutation();

// State
const [formData, setFormData] = useState<
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import AvailabilityForm, {
AvailabilityFormData,
} from '@/components/availabilities/AvailabilityForm';
import { CreateAvailabilityDto } from '@/models/dtos/availability/createAvailabilityDto';
import { usePostAvailabilitiesMutation } from '@/store/api/availabilityApiSlice';
import { usePostAvailabilityMutation } from '@/store/api/availabilityApiSlice';
import { useGetJobCategoriesQuery } from '@/store/api/jobApiSlice';

import { ProfileStackParamList } from '../ProfileNav';
Expand Down Expand Up @@ -42,7 +42,7 @@ const AvailabilityCreatePage: FC<AvailabilityCreatePageProps> = ({
}) => {
// API calls
const { data: jobCategories } = useGetJobCategoriesQuery();
const [postAvailability] = usePostAvailabilitiesMutation();
const [postAvailability] = usePostAvailabilityMutation();

// State
const [formData, setFormData] = useState<AvailabilityFormData>({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import AvailabilityForm, {
import { UpdateAvailabilityDto } from '@/models/dtos/availability/updateAvailabilityDto';
import {
useGetAvailabilityQuery,
usePatchAvailabilitiesMutation,
usePatchAvailabilityMutation,
} from '@/store/api/availabilityApiSlice';
import { useGetJobCategoriesQuery } from '@/store/api/jobApiSlice';

Expand Down Expand Up @@ -60,7 +60,7 @@ const AvailabilityUpdatePage: FC<AvailabilityUpdatePageProps> = ({
// API calls
const { data: availability } = useGetAvailabilityQuery(availabilityId);
const { data: jobCategories } = useGetJobCategoriesQuery();
const [patchAvailability] = usePatchAvailabilitiesMutation();
const [patchAvailability] = usePatchAvailabilityMutation();

// State
const [formData, setFormData] = useState<AvailabilityFormData | undefined>();
Expand Down
6 changes: 3 additions & 3 deletions front/src/pages/profile/experiences/ExperienceCreatePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ const ExperienceCreatePage: FC<ExperienceCreatePageProps> = ({
zipCode: '',
city: '',
companyName: '',
startDate: null,
endDate: null,
startDate: new Date().toISOString(),
endDate: new Date().toISOString(),
});

// Callbacks
Expand All @@ -61,7 +61,7 @@ const ExperienceCreatePage: FC<ExperienceCreatePageProps> = ({
company: {
name: formData.companyName,
},
jobId: '',
jobId: formData.jobId,
address: {
firstLine: formData.firstLine,
zipCode: formData.zipCode,
Expand Down
31 changes: 13 additions & 18 deletions front/src/store/api/availabilityApiSlice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,15 @@ export const extendedApiSlice = apiSlice.injectEndpoints({
query: (id) => `profile/availabilities/${id}`,
providesTags: (_result, _error, id) => [{ type: 'Availabilities', id }],
}),
postAvailabilities: builder.mutation<Availability, CreateAvailabilityDto>(
{
query: (body) => ({
url: 'profile/availabilities',
method: 'POST',
body,
}),
invalidatesTags: [{ type: 'Availabilities', id: 'LIST' }],
},
),
patchAvailabilities: builder.mutation<
Availability,
UpdateAvailabilityDto
>({
postAvailability: builder.mutation<Availability, CreateAvailabilityDto>({
query: (body) => ({
url: 'profile/availabilities',
method: 'POST',
body,
}),
invalidatesTags: [{ type: 'Availabilities', id: 'LIST' }],
}),
patchAvailability: builder.mutation<Availability, UpdateAvailabilityDto>({
query: (body) => ({
url: `profile/availabilities/${body.id}`,
method: 'PATCH',
Expand All @@ -50,7 +45,7 @@ export const extendedApiSlice = apiSlice.injectEndpoints({
{ type: 'Availabilities', id },
],
}),
deleteAvailabilities: builder.mutation<void, string>({
deleteAvailability: builder.mutation<void, string>({
query: (id) => ({
url: `profile/availabilities/${id}`,
method: 'DELETE',
Expand All @@ -67,7 +62,7 @@ export const extendedApiSlice = apiSlice.injectEndpoints({
export const {
useGetAvailabilitiesQuery,
useGetAvailabilityQuery,
usePostAvailabilitiesMutation,
usePatchAvailabilitiesMutation,
useDeleteAvailabilitiesMutation,
usePostAvailabilityMutation,
usePatchAvailabilityMutation,
useDeleteAvailabilityMutation,
} = extendedApiSlice;
File renamed without changes.
5 changes: 4 additions & 1 deletion front/src/store/api/jobOfferApiSlice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,10 @@ export const extendedApiSlice = apiSlice.injectEndpoints({
url: `jobOffers/${id}/apply`,
method: 'POST',
}),
invalidatesTags: [{ type: 'JobOffer', id: 'LIST' }],
invalidatesTags: (_result, _error, id) => [
{ type: 'JobOffer', id: 'LIST' },
{ type: 'JobOffer', id },
],
}),
}),
});
Expand Down

0 comments on commit 7ddc7b8

Please sign in to comment.