Skip to content
This repository has been archived by the owner on Mar 23, 2024. It is now read-only.

New branch Merge fix #39

Merged
merged 55 commits into from
Jun 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
92e4f01
add search-panel start layout
Apr 28, 2023
d73a176
move search-panel in components, add some fixes
Apr 28, 2023
6deb4f1
add and implement slice for users filters
Apr 29, 2023
95b42f2
New branch Merge fix
serranoio May 2, 2023
b9e3d18
Merge branch 'dev' into feature/redesign-search-panel
May 3, 2023
600a6a3
Merge branch 'dev' into feature/redesign-search-panel
May 3, 2023
4e39039
add countries filter functionality
May 8, 2023
4cffd1e
add some styles and range-search component
May 9, 2023
ed22931
Merge branch 'dev' into feature/teams-
nmashchenko May 23, 2023
554f084
Initial fixes
nmashchenko May 23, 2023
15a9fad
Fixes part2
nmashchenko May 24, 2023
8455470
add range functionality in component, add some styles
May 24, 2023
e03b9e2
Fixes part3
nmashchenko May 26, 2023
1a57ddd
Fixes part4
nmashchenko May 26, 2023
00ea713
Fixes part 5
nmashchenko May 27, 2023
420a388
fix range value in slice
May 28, 2023
0246d4a
fix SearchByRange component
May 28, 2023
dadd216
add tags for SearchPanel
May 28, 2023
691431b
define initial state of FilterSlice
May 28, 2023
5e34529
Fixes part6
nmashchenko May 29, 2023
cbc56f8
Fixes part 7
nmashchenko May 29, 2023
8fd482c
Added backdrops
nmashchenko May 29, 2023
c18989f
Finished logic
nmashchenko May 30, 2023
07b5c7e
Fixes part 8
nmashchenko May 30, 2023
9ead9d2
Small updates
nmashchenko May 30, 2023
6e3f2b0
Merge branch 'dev' into feature/redesign-search-panel
nmashchenko May 30, 2023
f085c4c
Small fixes + initial page setup
nmashchenko May 30, 2023
b60b294
Small fixes
nmashchenko May 30, 2023
4ee3fcf
Merge branch 'feature/redesign-search-panel' into feature/teams-
nmashchenko May 30, 2023
06c32bc
Filters setup
nmashchenko May 30, 2023
79f0d22
add grid for select
Jun 4, 2023
94d01da
Merge branch 'dev' into feature/teams-
nmashchenko Jun 6, 2023
c6cb95e
Small updates
nmashchenko Jun 6, 2023
8caa26f
Implemented logic
nmashchenko Jun 8, 2023
ddc9512
Update github-actions-demo.yml
nmashchenko Jun 8, 2023
b2e323a
initialized inifiteLoading approach for teams
nmashchenko Jun 10, 2023
2f9ecf9
Merge branch 'feature/redesign-search-panel' into feature/teams-
nmashchenko Jun 10, 2023
b505641
Updates to the main page UI
nmashchenko Jun 13, 2023
0db1f63
Main page major fixes
nmashchenko Jun 14, 2023
e22b315
Refactoring
nmashchenko Jun 15, 2023
a4f9589
fix for items of SearchByChecks
Jun 16, 2023
ef55202
Merge branch 'dev' into feature/redesign-search-panel
Jun 17, 2023
e62cfc3
isolate SearchPanel components
Jun 17, 2023
3bb19a3
add mobile filters draft functionality
Jun 17, 2023
d17348f
Merge branch 'feature/teams-' into feature/redesign-search-panel
Jun 18, 2023
b3d8120
fix SearchPanel, add bottom buttons
Jun 18, 2023
4cbae98
add tags for modal
Jun 18, 2023
58dd85c
add SearchPanel component
Jun 18, 2023
66f9d72
Fixes
nmashchenko Jun 19, 2023
c5f57f4
Fixes part2
nmashchenko Jun 19, 2023
236ec54
Made teams adaptive & bug fixes
nmashchenko Jun 20, 2023
fb3b483
Made infinite scroll for teams / adaptive fixes
nmashchenko Jun 21, 2023
dd70849
Notification modal & team modals & fixes
nmashchenko Jun 21, 2023
e7b10e2
Upload image fix
nmashchenko Jun 22, 2023
92c65ea
Finished ticket
nmashchenko Jun 22, 2023
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
5 changes: 4 additions & 1 deletion .github/workflows/github-actions-demo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: πŸͺ– Creating .dev.env for nodemailer
- name: πŸͺ– Creating .dev.env for nodemailer/aws
working-directory: ./server
run: |
touch .dev.env
Expand All @@ -26,6 +26,9 @@ jobs:
echo SMTP_USER=${{ secrets.SMTP_USER }} >> .dev.env
echo SMTP_PASS=${{ secrets.SMTP_PASS }} >> .dev.env
echo SMTP_PORT=${{ secrets.SMTP_PORT }} >> .dev.env
echo AWS_ACCESS_KEY=${{ secrets.AWS_ACCESS_KEY }} >> .dev.env
echo AWS_SECRET_ACCESS_KEY=${{ secrets.AWS_SECRET_ACCESS_KEY }} >> .dev.env
echo AWS_S3_REGION=${{ secrets.AWS_S3_REGION }} >> .dev.env
cat .dev.env
- name: 🎧 Install modules
working-directory: ./server
Expand Down
1 change: 0 additions & 1 deletion client/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Expand Down
4 changes: 2 additions & 2 deletions client/src/api/hooks/auth/useEditUserDetails.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ export const useEditUserDetails = (successHandler) => {

return useMutation(finishRegistration, {
mutationKey: 'finishRegistration',
onSuccess: () => {
onSuccess: async (data) => {
await queryClient.invalidateQueries('checkAuth', { refetchInactive: true })
successHandler()
queryClient.invalidateQueries('checkAuth', { refetchInactive: true })
},
onError: (error) => {
// set error message
Expand Down
9 changes: 6 additions & 3 deletions client/src/api/hooks/auth/useUpdateAvatar.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,14 @@ export const useUpdateAvatar = (type) => {

return useMutation(updateUserAvatar, {
mutationKey: 'updateUserAvatar',
onSuccess: () => {
queryClient.invalidateQueries('checkAuth', { refetchInactive: true })
onSuccess: async () => {
if (type === 'teams') {
await queryClient.invalidateQueries('getTeamById', { refetchInactive: true })
}

await queryClient.invalidateQueries('checkAuth', { refetchInactive: true })
},
onError: (error) => {
console.log(error)
// set error message
errorToaster(error)
},
Expand Down
22 changes: 2 additions & 20 deletions client/src/api/hooks/team/useCreateTeam.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,10 @@
import { useMutation, useQueryClient } from 'react-query'
import { useDispatch } from 'react-redux'
import { useNavigate } from 'react-router-dom'
import { useMutation } from 'react-query'

import http from '../../../http'
import { setIsFinishRegistrationStarted, setStep } from '../../../store/reducers/RegistrationAuth'
import { useUpdateAvatar } from '../auth/useUpdateAvatar'

const { api } = http

export const useCreateTeam = (teamAvatar) => {
const queryClient = useQueryClient()
const { mutate: updateAvatar } = useUpdateAvatar('teams')
const dispatch = useDispatch()

const navigate = useNavigate()
export const useCreateTeam = () => {
const createTeam = async (details) => {
const response = await api.post('/teams/create', details)

Expand All @@ -22,14 +13,5 @@ export const useCreateTeam = (teamAvatar) => {

return useMutation(createTeam, {
mutationKey: 'createTeam',
onSuccess: async (data) => {
if (teamAvatar) {
updateAvatar({ teamID: data._id, image: teamAvatar.split(',')[1] })
}
await queryClient.invalidateQueries('checkAuth', { refetchInactive: true })
dispatch(setIsFinishRegistrationStarted(false))
dispatch(setStep(1))
navigate(`/team/${data._id}`)
},
})
}
6 changes: 5 additions & 1 deletion client/src/api/hooks/team/useDelete.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { useMutation, useQueryClient } from 'react-query'
import { useNavigate } from 'react-router-dom'

import http from '../../../http'
import { errorToaster } from '../../../shared/components/Toasters/Error.toaster'

const { api } = http

Expand All @@ -18,7 +19,10 @@ export const useDelete = () => {
mutationKey: 'deleteTeam',
onSuccess: () => {
queryClient.invalidateQueries('checkAuth', { refetchInactive: true })
navigate('/team')
navigate('/teams')
},
onError: (error) => {
errorToaster(error)
},
})
}
2 changes: 0 additions & 2 deletions client/src/api/hooks/team/useGetByTag.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ import { successToaster } from '../../../shared/components/Toasters/Success.toas
const { api } = http

export const useGetByTag = () => {
const queryClient = useQueryClient()

const getTeamByTag = async (tag) => {
return await api.get(`/teams/tag/${tag}`)
}
Expand Down
18 changes: 10 additions & 8 deletions client/src/api/hooks/team/useGetTeamData.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,18 @@ const { api } = http

export const useGetTeamData = (teamId) => {
const getTeamById = async () => {
const response = await api.get(`/teams/${teamId}`)
if (teamId) {
const response = await api.get(`/teams/${teamId}`)

return response.data
return response.data
}
}

const { data, isLoading: isTeamLoading } = useQuery(['getTeamById', teamId], getTeamById, {
refetchOnMount: false,
refetchOnWindowFocus: false,
enabled: !!teamId,
})
const {
data,
isLoading: isTeamLoading,
error,
} = useQuery(['getTeamById', teamId], getTeamById, { retry: 0 })

return { data, isLoading: isTeamLoading }
return { data, isLoading: isTeamLoading, error }
}
22 changes: 15 additions & 7 deletions client/src/api/hooks/team/useInviteUser.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,34 @@
import { useMutation, useQueryClient } from 'react-query'

import http from '../../../http'
import { errorToaster } from '../../../shared/components/Toasters/Error.toaster'
import { successToaster } from '../../../shared/components/Toasters/Success.toaster'

const { api } = http

export const useInviteUser = (successHandler) => {
export const useInviteUser = () => {
const queryClient = useQueryClient()

const inviteUser = async (details) => {
const { email, teamId, userId } = details
const { email, teamid, from_user_id } = details

console.log(details)

const response = await api.post('/teams/invite', {
email,
teamid: teamId,
from_user_id: userId,
teamid: teamid,
from_user_id: from_user_id,
})
}

return useMutation(inviteUser, {
mutationKey: 'inviteUser',
onSuccess: async () => {
successHandler()
await queryClient.invalidateQueries('checkAuth', { refetchInactive: true })
onSuccess: () => {
successToaster('User was successfully invited.')
queryClient.invalidateQueries('checkAuth', { refetchInactive: true })
},
onError: (error) => {
errorToaster(error)
},
})
}
30 changes: 30 additions & 0 deletions client/src/api/hooks/team/useJoinTeam.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { useMutation, useQueryClient } from 'react-query'
import { useNavigate } from 'react-router-dom'

import http from '../../../http'
import { errorToaster } from '../../../shared/components/Toasters/Error.toaster'

const { api } = http

export const useJoinTeam = () => {
const queryClient = useQueryClient()
const navigate = useNavigate()

const joinTeam = async (details) => {
const response = await api.put('/teams/join', details)

return response.data
}

return useMutation(joinTeam, {
mutationKey: 'joinTeam',
onSuccess: async (data) => {
await queryClient.invalidateQueries('checkAuth', { refetchInactive: true })
await queryClient.invalidateQueries('getTeamById', { refetchInactive: true })
navigate(`/team/${data._id}`)
},
onError: (error) => {
errorToaster(error)
},
})
}
41 changes: 41 additions & 0 deletions client/src/api/hooks/team/useLeaveAndJoin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import { useMutation, useQueryClient } from 'react-query'
import { useNavigate } from 'react-router-dom'

import { errorToaster } from '../../../shared/components/Toasters/Error.toaster'

import { useJoinTeam } from './useJoinTeam'
import { useLeave } from './useLeaveTeam'

export const useLeaveAndJoin = () => {
const queryClient = useQueryClient()
const navigate = useNavigate()
const joinTeamMutation = useJoinTeam()
const leaveTeamMutation = useLeave()

const leaveAndJoin = async (details) => {
await leaveTeamMutation.mutateAsync(details.leaveDetails)

const joinResult = await joinTeamMutation.mutateAsync(details.joinDetails)

return joinResult
}

const onSuccess = async (joinDetails) => {
queryClient.invalidateQueries('checkAuth', { refetchInactive: true })
navigate(`/team/${joinDetails._id}`)
}

const leaveAndJoinMutation = useMutation(leaveAndJoin, {
mutationKey: 'leaveAndJoin',
onSuccess,
onError: (error) => {
errorToaster(error)
},
})

return {
leaveAndJoin: leaveAndJoinMutation,
isLeaving: leaveTeamMutation.isLoading,
isJoining: joinTeamMutation.isLoading,
}
}
29 changes: 29 additions & 0 deletions client/src/api/hooks/team/useLeaveTeam.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { useMutation, useQueryClient } from 'react-query'
import { useNavigate } from 'react-router-dom'

import http from '../../../http'
import { errorToaster } from '../../../shared/components/Toasters/Error.toaster'

const { api } = http

export const useLeave = () => {
const queryClient = useQueryClient()
const navigate = useNavigate()

const leaveTeam = async (details) => {
const response = await api.put(`/teams/leave`, details)

return response.data
}

return useMutation(leaveTeam, {
mutationKey: 'leaveTeam',
onSuccess: () => {
queryClient.invalidateQueries('checkAuth')
navigate(`/teams`)
},
onError: (error) => {
errorToaster(error)
},
})
}
69 changes: 69 additions & 0 deletions client/src/api/hooks/team/useLoadTeams.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
import { useEffect, useState } from 'react'
import { useInfiniteQuery } from 'react-query'
import { useSelector } from 'react-redux'
import qs from 'qs'
import uuid from 'uuidv4'

import http from '../../../http'
import checkEntriesForValue from '../../../utils/checkEntriesForValue'
import filteredQueryMaker from '../../../utils/filteredQueryMaker'
import { normalizeFilters } from '../../../utils/normalizeFilters'

const { api } = http

export const useLoadTeams = () => {
const [filtered, setFiltered] = useState(false)
const filters = useSelector((state) => state.teamsFilters)

const normalizedFilters = normalizeFilters(filters)
const [id, setId] = useState()

useEffect(() => {
if (checkEntriesForValue(filters)) {
setFiltered(true)
setId(uuid())
} else {
setFiltered(false)
}
}, [filters])

const getTeams = async ({ pageParam = 1 }) => {
const response = await api.get('/teams', { params: { page: pageParam } })

return response.data
}

const getTeamsFiltered = async ({ pageParam = 1 }) => {
const filtersQuery = filteredQueryMaker.teams(
normalizedFilters.countries,
normalizedFilters.people,
normalizedFilters.name,
normalizedFilters.tag,
)

let queryString = qs.stringify(filtersQuery)
const response = await api.get('/teams/filtered', {
params: { page: pageParam, filtersQuery: queryString },
})

return response.data
}

const query = useInfiniteQuery(
[filtered ? 'teamsFiltered' : 'teams', id],
filtered ? getTeamsFiltered : getTeams,
{
getNextPageParam: (lastPage, allPages) => {
return Math.ceil(lastPage.total / lastPage.limit) !== allPages.length
? allPages.length + 1
: undefined
},
refetchOnWindowFocus: false,
},
)

return {
...query,
filtered,
}
}
28 changes: 28 additions & 0 deletions client/src/api/hooks/team/useRemoveMember.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { useMutation, useQueryClient } from 'react-query'
import { useNavigate } from 'react-router-dom'

import http from '../../../http'
import { errorToaster } from '../../../shared/components/Toasters/Error.toaster'

const { api } = http

// refetch data

export const useRemoveMember = () => {
const queryClient = useQueryClient()
const removeMember = async (details) => {
const response = await api.put(`/teams/remove-member`, details)

return response.data
}

return useMutation(removeMember, {
mutationKey: 'removeMember',
onSuccess: async () => {
await queryClient.invalidateQueries('getTeamById') // useQuery key
},
onError: (error) => {
errorToaster(error)
},
})
}
Loading