mirror of
				https://github.com/Unleash/unleash.git
				synced 2025-10-27 11:02:16 +01:00 
			
		
		
		
	feat: initial spike to use data in UI
This commit is contained in:
		
							parent
							
								
									ad3c7295be
								
							
						
					
					
						commit
						402171c307
					
				| @ -45,6 +45,8 @@ import { ProjectInsights } from './ProjectInsights/ProjectInsights'; | |||||||
| import useProjectOverview from 'hooks/api/getters/useProjectOverview/useProjectOverview'; | import useProjectOverview from 'hooks/api/getters/useProjectOverview/useProjectOverview'; | ||||||
| import { ProjectArchived } from './ArchiveProject/ProjectArchived'; | import { ProjectArchived } from './ArchiveProject/ProjectArchived'; | ||||||
| import { usePlausibleTracker } from '../../../hooks/usePlausibleTracker'; | import { usePlausibleTracker } from '../../../hooks/usePlausibleTracker'; | ||||||
|  | import { ScreenReaderOnly } from 'component/common/ScreenReaderOnly/ScreenReaderOnly'; | ||||||
|  | import { useUiFlag } from 'hooks/useUiFlag'; | ||||||
| 
 | 
 | ||||||
| const StyledBadge = styled(Badge)(({ theme }) => ({ | const StyledBadge = styled(Badge)(({ theme }) => ({ | ||||||
|     position: 'absolute', |     position: 'absolute', | ||||||
| @ -64,6 +66,41 @@ interface ITab { | |||||||
|     isEnterprise?: boolean; |     isEnterprise?: boolean; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | const NotificationIndicator = styled('div')(({ theme }) => ({ | ||||||
|  |     position: 'absolute', | ||||||
|  |     background: theme.palette.background.alternative, | ||||||
|  |     color: theme.palette.primary.contrastText, | ||||||
|  |     fontSize: theme.typography.body2.fontSize, | ||||||
|  |     top: 10, | ||||||
|  |     right: 0, | ||||||
|  |     [theme.breakpoints.down('md')]: { | ||||||
|  |         top: 2, | ||||||
|  |     }, | ||||||
|  | 
 | ||||||
|  |     width: theme.spacing(2.5), | ||||||
|  |     height: theme.spacing(2.5), | ||||||
|  |     display: 'grid', | ||||||
|  |     placeItems: 'center', | ||||||
|  |     borderRadius: '50%', | ||||||
|  | })); | ||||||
|  | 
 | ||||||
|  | const ActionableChangeRequestsIndicator = () => { | ||||||
|  |     // useSWR for this instead (maybe conditional)
 | ||||||
|  |     const count = 5; | ||||||
|  | 
 | ||||||
|  |     const renderedCount = count > 9 ? '9+' : count; | ||||||
|  | 
 | ||||||
|  |     return ( | ||||||
|  |         <NotificationIndicator> | ||||||
|  |             <ScreenReaderOnly>You can move</ScreenReaderOnly> | ||||||
|  |             {renderedCount} | ||||||
|  |             <ScreenReaderOnly> | ||||||
|  |                 change requests into their next phase. | ||||||
|  |             </ScreenReaderOnly> | ||||||
|  |         </NotificationIndicator> | ||||||
|  |     ); | ||||||
|  | }; | ||||||
|  | 
 | ||||||
| export const Project = () => { | export const Project = () => { | ||||||
|     const projectId = useRequiredPathParam('projectId'); |     const projectId = useRequiredPathParam('projectId'); | ||||||
|     const { trackEvent } = usePlausibleTracker(); |     const { trackEvent } = usePlausibleTracker(); | ||||||
| @ -78,6 +115,9 @@ export const Project = () => { | |||||||
|     const basePath = `/projects/${projectId}`; |     const basePath = `/projects/${projectId}`; | ||||||
|     const projectName = project?.name || projectId; |     const projectName = project?.name || projectId; | ||||||
|     const { favorite, unfavorite } = useFavoriteProjectsApi(); |     const { favorite, unfavorite } = useFavoriteProjectsApi(); | ||||||
|  |     const useActionableChangeRequestIndicator = useUiFlag( | ||||||
|  |         'simplifyProjectOverview', | ||||||
|  |     ); | ||||||
| 
 | 
 | ||||||
|     const [showDelDialog, setShowDelDialog] = useState(false); |     const [showDelDialog, setShowDelDialog] = useState(false); | ||||||
| 
 | 
 | ||||||
| @ -281,6 +321,11 @@ export const Project = () => { | |||||||
|                                                     </span> |                                                     </span> | ||||||
|                                                 } |                                                 } | ||||||
|                                             /> |                                             /> | ||||||
|  |                                             {useActionableChangeRequestIndicator && | ||||||
|  |                                                 tab.name === | ||||||
|  |                                                     'change-request' && ( | ||||||
|  |                                                     <ActionableChangeRequestsIndicator /> | ||||||
|  |                                                 )} | ||||||
|                                             {(tab.isEnterprise && |                                             {(tab.isEnterprise && | ||||||
|                                                 isPro() && |                                                 isPro() && | ||||||
|                                                 enterpriseIcon) || |                                                 enterpriseIcon) || | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user