-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2719 from ever-co/develop
Release
- Loading branch information
Showing
53 changed files
with
1,319 additions
and
151 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,91 +1,94 @@ | ||
{"name": "$EXPO_PROJECT_SLUG", | ||
"displayName": "$EXPO_PROJECT_NAME", | ||
"expo": { | ||
"name": "$EXPO_PROJECT_NAME", | ||
"slug": "$EXPO_PROJECT_SLUG", | ||
"version": "0.1.0", | ||
"orientation": "portrait", | ||
"icon": "./assets/images/ever-teams-logo.png", | ||
"splash": { | ||
"image": "./assets/images/splash-ever-teams.png", | ||
"resizeMode": "cover", | ||
"backgroundColor": "#ffffff" | ||
}, | ||
"owner": "$EXPO_PROJECT_OWNER", | ||
"updates": { | ||
"fallbackToCacheTimeout": 0, | ||
"url": "https://u.expo.dev/$EXPO_PROJECT_ID" | ||
}, | ||
"jsEngine": "hermes", | ||
"assetBundlePatterns": ["**/*"], | ||
"plugins": [ | ||
[ | ||
"expo-media-library", | ||
{ | ||
"photosPermission": "Allow $(PRODUCT_NAME) to access your photos.", | ||
"savePhotosPermission": "Allow $(PRODUCT_NAME) to save photos.", | ||
"isAccessMediaLocationEnabled": true | ||
} | ||
], | ||
"sentry-expo", | ||
[ | ||
"expo-build-properties", | ||
{ | ||
"android": { | ||
"enableProguardInReleaseBuilds": true, | ||
"extraProguardRules": "-keep public class com.horcrux.svg.** {*;}", | ||
"allowBackup": false | ||
} | ||
} | ||
] | ||
], | ||
"android": { | ||
"icon": "./assets/images/app-icon-android-legacy-ever-teams.png", | ||
"package": "ever.team", | ||
"adaptiveIcon": { | ||
"foregroundImage": "./assets/images/app-icon-android-adaptive-foreground-ever.png", | ||
"backgroundImage": "./assets/images/app-icon-android-adaptive-background.png" | ||
}, | ||
"splash": { | ||
"image": "./assets/images/splash-ever-teams.png", | ||
"resizeMode": "cover", | ||
"backgroundColor": "#ffffff" | ||
}, | ||
"permissions": [ | ||
"android.permission.READ_EXTERNAL_STORAGE", | ||
"android.permission.WRITE_EXTERNAL_STORAGE", | ||
"android.permission.ACCESS_MEDIA_LOCATION" | ||
] | ||
}, | ||
"ios": { | ||
"icon": "./assets/images/app-icon-ios-ever-teams.png", | ||
"supportsTablet": true, | ||
"bundleIdentifier": "co.ever.teams", | ||
"splash": { | ||
"image": "./assets/images/splash-ever-teams.png", | ||
"tabletImage": "./assets/images/splash-logo-ever-teams-ios-tablet.png", | ||
"resizeMode": "cover", | ||
"backgroundColor": "#ffffff" | ||
}, | ||
"infoPlist": { | ||
"NSCameraUsageDescription": "This app uses the camera to scan barcodes on event tickets.", | ||
"NSPhotoLibraryUsageDescription": "Allow $(PRODUCT_NAME) to access your photos.", | ||
"NSPhotoLibraryAddUsageDescription": "Allow $(PRODUCT_NAME) to save photos." | ||
} | ||
}, | ||
"web": { | ||
"favicon": "./assets/images/app-icon-web-favicon.png", | ||
"splash": { | ||
"image": "./assets/images/splash-logo-web-ever-teams.png", | ||
"resizeMode": "contain", | ||
"backgroundColor": "#ffffff" | ||
} | ||
}, | ||
"extra": { | ||
"eas": { | ||
"projectId": "$EXPO_PROJECT_ID" | ||
} | ||
}, | ||
"runtimeVersion": "exposdk:48.0.0" | ||
} | ||
{ | ||
"name": "$EXPO_PROJECT_SLUG", | ||
"displayName": "$EXPO_PROJECT_NAME", | ||
"expo": { | ||
"name": "$EXPO_PROJECT_NAME", | ||
"slug": "$EXPO_PROJECT_SLUG", | ||
"version": "0.1.0", | ||
"orientation": "portrait", | ||
"icon": "./assets/images/ever-teams-logo.png", | ||
"splash": { | ||
"image": "./assets/images/splash-ever-teams.png", | ||
"resizeMode": "cover", | ||
"backgroundColor": "#ffffff" | ||
}, | ||
"owner": "$EXPO_PROJECT_OWNER", | ||
"updates": { | ||
"fallbackToCacheTimeout": 0, | ||
"url": "https://u.expo.dev/$EXPO_PROJECT_ID" | ||
}, | ||
"jsEngine": "hermes", | ||
"assetBundlePatterns": ["**/*"], | ||
"plugins": [ | ||
[ | ||
"expo-media-library", | ||
{ | ||
"photosPermission": "Allow $(PRODUCT_NAME) to access your photos.", | ||
"savePhotosPermission": "Allow $(PRODUCT_NAME) to save photos.", | ||
"isAccessMediaLocationEnabled": true | ||
} | ||
], | ||
"sentry-expo", | ||
[ | ||
"expo-build-properties", | ||
{ | ||
"android": { | ||
"enableProguardInReleaseBuilds": true, | ||
"extraProguardRules": "-keep public class com.horcrux.svg.** {*;}", | ||
"allowBackup": false, | ||
"minSdkVersion": 23, | ||
"targetSdkVersion": 34 | ||
} | ||
} | ||
] | ||
], | ||
"android": { | ||
"icon": "./assets/images/app-icon-android-legacy-ever-teams.png", | ||
"package": "ever.team", | ||
"adaptiveIcon": { | ||
"foregroundImage": "./assets/images/app-icon-android-adaptive-foreground-ever.png", | ||
"backgroundImage": "./assets/images/app-icon-android-adaptive-background.png" | ||
}, | ||
"splash": { | ||
"image": "./assets/images/splash-ever-teams.png", | ||
"resizeMode": "cover", | ||
"backgroundColor": "#ffffff" | ||
}, | ||
"permissions": [ | ||
"android.permission.READ_EXTERNAL_STORAGE", | ||
"android.permission.WRITE_EXTERNAL_STORAGE", | ||
"android.permission.ACCESS_MEDIA_LOCATION" | ||
] | ||
}, | ||
"ios": { | ||
"icon": "./assets/images/app-icon-ios-ever-teams.png", | ||
"supportsTablet": true, | ||
"bundleIdentifier": "co.ever.teams", | ||
"splash": { | ||
"image": "./assets/images/splash-ever-teams.png", | ||
"tabletImage": "./assets/images/splash-logo-ever-teams-ios-tablet.png", | ||
"resizeMode": "cover", | ||
"backgroundColor": "#ffffff" | ||
}, | ||
"infoPlist": { | ||
"NSCameraUsageDescription": "This app uses the camera to scan barcodes on event tickets.", | ||
"NSPhotoLibraryUsageDescription": "Allow $(PRODUCT_NAME) to access your photos.", | ||
"NSPhotoLibraryAddUsageDescription": "Allow $(PRODUCT_NAME) to save photos." | ||
} | ||
}, | ||
"web": { | ||
"favicon": "./assets/images/app-icon-web-favicon.png", | ||
"splash": { | ||
"image": "./assets/images/splash-logo-web-ever-teams.png", | ||
"resizeMode": "contain", | ||
"backgroundColor": "#ffffff" | ||
} | ||
}, | ||
"extra": { | ||
"eas": { | ||
"projectId": "$EXPO_PROJECT_ID" | ||
} | ||
}, | ||
"runtimeVersion": "exposdk:48.0.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
'use client'; | ||
|
||
import { useRouter } from 'next/navigation'; | ||
import { useRecoilValue } from 'recoil'; | ||
import { fullWidthState } from '@app/stores/fullWidth'; | ||
import { withAuthentication } from 'lib/app/authenticator'; | ||
import { Breadcrumb, Container } from 'lib/components'; | ||
import { MainHeader, MainLayout } from 'lib/layout'; | ||
import { useOrganizationAndTeamManagers } from '@app/hooks/features/useOrganizationTeamManagers'; | ||
import { useEffect } from 'react'; | ||
import { useTranslations } from 'next-intl'; | ||
import TeamMemberHeader from 'lib/features/team-member-header'; | ||
import { IssuesView } from '@app/constants'; | ||
import { HeaderTabs } from '@components/pages/all-teams/header-tabs'; | ||
import { allTeamsHeaderTabs } from '@app/stores/header-tabs'; | ||
import AllTeamsMembers from 'lib/features/all-teams-members'; | ||
import { MemberFilter } from 'lib/features/all-teams/all-team-members-filter'; | ||
|
||
function AllTeamsPage() { | ||
const t = useTranslations(); | ||
const fullWidth = useRecoilValue(fullWidthState); | ||
const view = useRecoilValue(allTeamsHeaderTabs); | ||
const { filteredTeams, userManagedTeams } = useOrganizationAndTeamManagers(); | ||
|
||
const breadcrumb = [ | ||
{ title: JSON.parse(t('pages.home.BREADCRUMB')), href: '/' }, | ||
{ title: t('common.ALL_TEAMS'), href: '/all-teams' } | ||
]; | ||
|
||
/* If the user is not a manager in any team or if he's | ||
manager in only one team, then redirect him to the home page | ||
*/ | ||
if (userManagedTeams.length < 2) return <RedirectUser />; | ||
|
||
return ( | ||
<MainLayout className="items-start"> | ||
<MainHeader fullWidth={fullWidth} className={'pb-2 pt-10 sticky top-20 z-50'}> | ||
{/* Breadcrumb */} | ||
<div className="flex flex-row items-start justify-between mb-5"> | ||
<Breadcrumb paths={breadcrumb} className="text-sm" /> | ||
<div className="flex flex-col gap-2 items-end"> | ||
<div className="flex h-10 w-max items-center justify-center gap-1"> | ||
<HeaderTabs /> | ||
</div> | ||
<MemberFilter /> | ||
</div> | ||
</div> | ||
<TeamMemberHeader view={IssuesView.CARDS} /> | ||
</MainHeader> | ||
<Container fullWidth={fullWidth} className="flex py-10 pt-20"> | ||
<AllTeamsMembers teams={filteredTeams} view={view} /> | ||
</Container> | ||
</MainLayout> | ||
); | ||
} | ||
|
||
function RedirectUser() { | ||
const router = useRouter(); | ||
useEffect(() => { | ||
router.push('/'); | ||
}, [router]); | ||
return <></>; | ||
} | ||
|
||
export default withAuthentication(AllTeamsPage, { displayName: 'AllManagedTeams' }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import AllTeamsPage from './component'; | ||
|
||
export default function Page() { | ||
return <AllTeamsPage />; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
apps/web/app/hooks/features/useOrganizationTeamManagers.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import { useRecoilValue } from 'recoil'; | ||
import { useAuthenticateUser } from './useAuthenticateUser'; | ||
import { useOrganizationTeams } from './useOrganizationTeams'; | ||
import { filterValue } from '@app/stores/all-teams'; | ||
|
||
export function useOrganizationAndTeamManagers() { | ||
const { user } = useAuthenticateUser(); | ||
const { teams } = useOrganizationTeams(); | ||
const { value: filtered } = useRecoilValue(filterValue); | ||
|
||
const userManagedTeams = teams.filter((team) => | ||
team.members.some((member) => member.employee?.user?.id === user?.id && member.role?.name === 'MANAGER') | ||
); | ||
|
||
const filteredTeams = | ||
filtered === 'all' | ||
? userManagedTeams | ||
: filtered === 'pause' | ||
? userManagedTeams.map((team) => ({ | ||
...team, | ||
members: team.members.filter((member) => member.timerStatus === 'pause') | ||
})) | ||
: filtered === 'running' | ||
? userManagedTeams.map((team) => ({ | ||
...team, | ||
members: team.members.filter((member) => member.timerStatus === 'running') | ||
})) | ||
: filtered === 'suspended' | ||
? userManagedTeams.map((team) => ({ | ||
...team, | ||
members: team.members.filter((member) => member.timerStatus === 'suspended') | ||
})) | ||
: filtered === 'invited' | ||
? userManagedTeams.map((team) => ({ | ||
...team, | ||
members: team.members.filter((member) => member.employee.acceptDate) | ||
})) | ||
: userManagedTeams; | ||
|
||
return { | ||
userManagedTeams, | ||
filteredTeams | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.