mirror of
				https://github.com/Unleash/unleash.git
				synced 2025-10-27 11:02:16 +01:00 
			
		
		
		
	feat: last project events ui polishing (#8298)
This commit is contained in:
		
							parent
							
								
									1ea63a8a1f
								
							
						
					
					
						commit
						751c2fa902
					
				@ -103,7 +103,7 @@ export const ContentGridNoProjects: React.FC<Props> = ({ owners, admins }) => {
 | 
				
			|||||||
                        </p>
 | 
					                        </p>
 | 
				
			||||||
                        <AdminList>
 | 
					                        <AdminList>
 | 
				
			||||||
                            {admins.map((admin) => (
 | 
					                            {admins.map((admin) => (
 | 
				
			||||||
                                <AdminListItem>
 | 
					                                <AdminListItem key={admin.name}>
 | 
				
			||||||
                                    <UserAvatar
 | 
					                                    <UserAvatar
 | 
				
			||||||
                                        sx={{
 | 
					                                        sx={{
 | 
				
			||||||
                                            margin: 0,
 | 
					                                            margin: 0,
 | 
				
			||||||
 | 
				
			|||||||
@ -1,22 +1,41 @@
 | 
				
			|||||||
import type { FC } from 'react';
 | 
					import type { FC } from 'react';
 | 
				
			||||||
import type { PersonalDashboardProjectDetailsSchema } from '../../openapi';
 | 
					 | 
				
			||||||
import { Markdown } from '../common/Markdown/Markdown';
 | 
					import { Markdown } from '../common/Markdown/Markdown';
 | 
				
			||||||
 | 
					import type { PersonalDashboardProjectDetailsSchema } from '../../openapi';
 | 
				
			||||||
 | 
					import { UserAvatar } from '../common/UserAvatar/UserAvatar';
 | 
				
			||||||
 | 
					import { styled } from '@mui/material';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const Events = styled('ul')(({ theme }) => ({
 | 
				
			||||||
 | 
					    padding: 0,
 | 
				
			||||||
 | 
					    alignItems: 'flex-start',
 | 
				
			||||||
 | 
					}));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const Event = styled('li')(({ theme }) => ({
 | 
				
			||||||
 | 
					    display: 'flex',
 | 
				
			||||||
 | 
					    gap: theme.spacing(2),
 | 
				
			||||||
 | 
					    listStyleType: 'none',
 | 
				
			||||||
 | 
					    padding: 0,
 | 
				
			||||||
 | 
					    marginBottom: theme.spacing(4),
 | 
				
			||||||
 | 
					}));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export const LatestProjectEvents: FC<{
 | 
					export const LatestProjectEvents: FC<{
 | 
				
			||||||
    latestEvents: PersonalDashboardProjectDetailsSchema['latestEvents'];
 | 
					    latestEvents: PersonalDashboardProjectDetailsSchema['latestEvents'];
 | 
				
			||||||
}> = ({ latestEvents }) => {
 | 
					}> = ({ latestEvents }) => {
 | 
				
			||||||
    return (
 | 
					    return (
 | 
				
			||||||
        <ul>
 | 
					        <Events>
 | 
				
			||||||
            {latestEvents.map((event) => {
 | 
					            {latestEvents.map((event) => {
 | 
				
			||||||
                return (
 | 
					                return (
 | 
				
			||||||
                    <li key={event.summary}>
 | 
					                    <Event key={event.id}>
 | 
				
			||||||
 | 
					                        <UserAvatar
 | 
				
			||||||
 | 
					                            src={event.createdByImageUrl}
 | 
				
			||||||
 | 
					                            sx={{ mt: 1 }}
 | 
				
			||||||
 | 
					                        />
 | 
				
			||||||
                        <Markdown>
 | 
					                        <Markdown>
 | 
				
			||||||
                            {event.summary ||
 | 
					                            {event.summary ||
 | 
				
			||||||
                                'No preview available for this event'}
 | 
					                                'No preview available for this event'}
 | 
				
			||||||
                        </Markdown>
 | 
					                        </Markdown>
 | 
				
			||||||
                    </li>
 | 
					                    </Event>
 | 
				
			||||||
                );
 | 
					                );
 | 
				
			||||||
            })}
 | 
					            })}
 | 
				
			||||||
        </ul>
 | 
					        </Events>
 | 
				
			||||||
    );
 | 
					    );
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
				
			|||||||
@ -15,4 +15,6 @@ export type PersonalDashboardProjectDetailsSchemaLatestEventsItem = {
 | 
				
			|||||||
     * @nullable
 | 
					     * @nullable
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    summary: string | null;
 | 
					    summary: string | null;
 | 
				
			||||||
 | 
					    id: number;
 | 
				
			||||||
 | 
					    createdByImageUrl: string;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
				
			|||||||
@ -11,9 +11,15 @@ import type { IProjectReadModel } from '../project/project-read-model-type';
 | 
				
			|||||||
import type { IPrivateProjectChecker } from '../private-project/privateProjectCheckerType';
 | 
					import type { IPrivateProjectChecker } from '../private-project/privateProjectCheckerType';
 | 
				
			||||||
import type { IEventStore } from '../../types';
 | 
					import type { IEventStore } from '../../types';
 | 
				
			||||||
import type { FeatureEventFormatter } from '../../addons/feature-event-formatter-md';
 | 
					import type { FeatureEventFormatter } from '../../addons/feature-event-formatter-md';
 | 
				
			||||||
 | 
					import { generateImageUrl } from '../../util';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type PersonalProjectDetails = {
 | 
					type PersonalProjectDetails = {
 | 
				
			||||||
    latestEvents: { summary: string; createdBy: string }[];
 | 
					    latestEvents: {
 | 
				
			||||||
 | 
					        summary: string;
 | 
				
			||||||
 | 
					        createdBy: string;
 | 
				
			||||||
 | 
					        id: number;
 | 
				
			||||||
 | 
					        createdByImageUrl: string;
 | 
				
			||||||
 | 
					    }[];
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export class PersonalDashboardService {
 | 
					export class PersonalDashboardService {
 | 
				
			||||||
@ -93,6 +99,8 @@ export class PersonalDashboardService {
 | 
				
			|||||||
        const formattedEvents = recentEvents.map((event) => ({
 | 
					        const formattedEvents = recentEvents.map((event) => ({
 | 
				
			||||||
            summary: this.featureEventFormatter.format(event).text,
 | 
					            summary: this.featureEventFormatter.format(event).text,
 | 
				
			||||||
            createdBy: event.createdBy,
 | 
					            createdBy: event.createdBy,
 | 
				
			||||||
 | 
					            id: event.id,
 | 
				
			||||||
 | 
					            createdByImageUrl: generateImageUrl({ email: event.createdBy }),
 | 
				
			||||||
        }));
 | 
					        }));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return { latestEvents: formattedEvents };
 | 
					        return { latestEvents: formattedEvents };
 | 
				
			||||||
 | 
				
			|||||||
@ -17,6 +17,11 @@ export const personalDashboardProjectDetailsSchema = {
 | 
				
			|||||||
                additionalProperties: false,
 | 
					                additionalProperties: false,
 | 
				
			||||||
                required: ['summary', 'createdBy'],
 | 
					                required: ['summary', 'createdBy'],
 | 
				
			||||||
                properties: {
 | 
					                properties: {
 | 
				
			||||||
 | 
					                    id: {
 | 
				
			||||||
 | 
					                        type: 'integer',
 | 
				
			||||||
 | 
					                        minimum: 1,
 | 
				
			||||||
 | 
					                        description: 'The ID of the event.',
 | 
				
			||||||
 | 
					                    },
 | 
				
			||||||
                    summary: {
 | 
					                    summary: {
 | 
				
			||||||
                        type: 'string',
 | 
					                        type: 'string',
 | 
				
			||||||
                        nullable: true,
 | 
					                        nullable: true,
 | 
				
			||||||
@ -28,6 +33,11 @@ export const personalDashboardProjectDetailsSchema = {
 | 
				
			|||||||
                        description: 'Which user created this event',
 | 
					                        description: 'Which user created this event',
 | 
				
			||||||
                        example: 'johndoe',
 | 
					                        example: 'johndoe',
 | 
				
			||||||
                    },
 | 
					                    },
 | 
				
			||||||
 | 
					                    createdByImageUrl: {
 | 
				
			||||||
 | 
					                        type: 'string',
 | 
				
			||||||
 | 
					                        description: `URL used for the user profile image of the event author`,
 | 
				
			||||||
 | 
					                        example: 'https://example.com/242x200.png',
 | 
				
			||||||
 | 
					                    },
 | 
				
			||||||
                },
 | 
					                },
 | 
				
			||||||
            },
 | 
					            },
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user