diff --git a/plugins/qeta-backend/src/service/CatalogMockRouter.ts b/plugins/qeta-backend/src/service/CatalogMockRouter.ts index f69e2960..a852acad 100644 --- a/plugins/qeta-backend/src/service/CatalogMockRouter.ts +++ b/plugins/qeta-backend/src/service/CatalogMockRouter.ts @@ -42,6 +42,10 @@ const entitiesResponse = [ }, ]; +const images: Record = { + thor: 'data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEASABIAAD/2wBDAAYEBQYFBAYGBQYHBwYIChAKCgkJChQODwwQFxQYGBcUFhYaHSUfGhsjHBYWICwgIyYnKSopGR8tMC0oMCUoKSj/2wBDAQcHBwoIChMKChMoGhYaKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCj/wgARCAEAAQADASIAAhEBAxEB/8QAHAAAAgIDAQEAAAAAAAAAAAAAAwQCBQABBgcI/8QAGQEAAwEBAQAAAAAAAAAAAAAAAAECAwQF/9oADAMBAAIQAxAAAAHhMFLTOch7YaQ5CBjaCcYObBUnWVgVRslUlNGYbgXQQiywFVG2VBTTQwVibaaunIgppnTF5FkCUrqszoW4ztSmMgjAOIFtk2xqaeSWZqhia62pr7tXUSZlrgPuOaopPUuRkyVy69hlSgSyOFPC4gOn1daFTbucZWdBxwOP0u559fryOAL1tJpFdqyW25lpG1UC2xFUJiiLlre7NKoqm7R5TyNLZRsj1XN9qCbOz1Gm56TTKwyCUrZhFFK/kHgzleTLofVg9n03W6pDPoK8jJaWI0Sa8rNa0rryL9AhfE25ebOHd0nN9oLzjOiqtc7mzntIbO2mBMY8tRo504tYZEZymj5n2PDVjaxJtu5ThG9rRb6KdaFmyraAOpdFv5uVR62asrSsHGvRRqOtlsUtvUdPGwYbLJugfmpHw8kNDBSeOi8myQRZfzHm8nfIykVOxAmncZRYtL/ouIsdMLcVeES2sGZ3vQ8kWNuxboLyXOr7mi6OVZ5jAzQDtWFkgyQgnJak+9UvTdo0kzFfNWZuOnW4SVWFtSanS15zr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doqWSzCyKZvTgA/j49EOFjShXXXpXWycD9r8TQ9EDuf9mW6S5eDb1Ozb1wS8LhhfM4c5kvjDp5J0amHAWzmw4fGYrDgZNAMGilcfGPQzFvQUjzP5S2mG1oaixe4b+k6IZ8DiZTyJww/wC4zLYjfF7VB6WzY+0H/QHsnA79S4ojXvz0S+VzOPLKwWHlzFxS5bVS30wZR4idjin758kwgWfrjVM5IV+7+Q9esAegm5y4jyD9TQ45fQEq+DC3Ynf/AEmS0J/8ShIA/kmz39MtzDUwB7xX6Wy//l9UVkHd8ynA7YPtEwvHhl6R95TL+u/Sv+yL9dxKNInY5inQBwDns95RquP/AGJbDLdRbqLdRbqLdRbqLdRbplumWhmKYW6i3UW6i3UW6jRwROAuFJ8E58zwRbqKeSASGeItBXSKOIRmHQjsgn//2Q==', +}; + export const createCatalogMockRouter = async (): Promise => { const router = Router(); router.use(express.json()); @@ -67,7 +71,12 @@ export const createCatalogMockRouter = async (): Promise => { .map(a => a.charAt(0).toUpperCase() + a.slice(1)) .join(' '), }, - spec: {}, + spec: { + profile: { + picture: + req.params.name in images ? images[req.params.name] : undefined, + }, + }, }); return; } diff --git a/plugins/qeta/src/components/QuestionPage/AuthorBox.tsx b/plugins/qeta/src/components/QuestionPage/AuthorBox.tsx index 66f1d325..c6d3c009 100644 --- a/plugins/qeta/src/components/QuestionPage/AuthorBox.tsx +++ b/plugins/qeta/src/components/QuestionPage/AuthorBox.tsx @@ -1,14 +1,10 @@ import { Avatar, Box, Grid, Typography } from '@material-ui/core'; -import { formatEntityName } from '../../utils/utils'; -import React, { useEffect } from 'react'; -import { useStyles } from '../../utils/hooks'; +import React from 'react'; +import { useEntityAuthor, useStyles } from '../../utils/hooks'; import { AnswerResponse, QuestionResponse, } from '@drodil/backstage-plugin-qeta-common'; -import { identityApiRef, useApi } from '@backstage/core-plugin-api'; -import { catalogApiRef } from '@backstage/plugin-catalog-react'; -import { UserEntity } from '@backstage/catalog-model'; import { RelativeTimeWithTooltip } from '../RelativeTimeWithTooltip/RelativeTimeWithTooltip'; import { AuthorLink, UpdatedByLink } from '../Links/Links'; @@ -16,45 +12,8 @@ export const AuthorBox = (props: { entity: QuestionResponse | AnswerResponse; }) => { const { entity } = props; - const catalogApi = useApi(catalogApiRef); - const identityApi = useApi(identityApiRef); - const [user, setUser] = React.useState(null); - const [currentUser, setCurrentUser] = React.useState(null); const styles = useStyles(); - const anonymous = entity.anonymous ?? false; - useEffect(() => { - if (!anonymous) { - catalogApi - .getEntityByRef(entity.author) - .catch(_ => setUser(null)) - .then(data => (data ? setUser(data as UserEntity) : setUser(null))); - } - }, [catalogApi, entity, anonymous]); - - useEffect(() => { - identityApi.getBackstageIdentity().then(res => { - setCurrentUser(res.userEntityRef ?? 'user:default/guest'); - }); - }, [identityApi]); - - let name = formatEntityName(entity.author); - if (user && user.metadata.title) { - name = user.metadata.title; - } - - if (entity.author === currentUser) { - name = 'You'; - if (anonymous) { - name += ' (anonymous)'; - } - } - - const initials = (name ?? '') - .split(' ') - .map(p => p[0]) - .join('') - .substring(0, 2) - .toUpperCase(); + const { name, initials, user } = useEntityAuthor(entity); return ( diff --git a/plugins/qeta/src/components/QuestionsContainer/QuestionListItem.tsx b/plugins/qeta/src/components/QuestionsContainer/QuestionListItem.tsx index 04a4b240..31db8cd8 100644 --- a/plugins/qeta/src/components/QuestionsContainer/QuestionListItem.tsx +++ b/plugins/qeta/src/components/QuestionsContainer/QuestionListItem.tsx @@ -1,7 +1,8 @@ import { + Avatar, + Box, Card, CardContent, - Grid, Typography, useTheme, } from '@material-ui/core'; @@ -16,8 +17,8 @@ import { userRouteRef, } from '@drodil/backstage-plugin-qeta-react'; import { RelativeTimeWithTooltip } from '../RelativeTimeWithTooltip/RelativeTimeWithTooltip'; -import { useEntityPresentation } from '@backstage/plugin-catalog-react'; import { QuestionResponse } from '@drodil/backstage-plugin-qeta-common'; +import { useEntityAuthor, useStyles } from '../../utils/hooks'; export interface QuestionListItemProps { question: QuestionResponse; @@ -26,96 +27,108 @@ export interface QuestionListItemProps { export const QuestionListItem = (props: QuestionListItemProps) => { const { question, entity } = props; + const questionRoute = useRouteRef(questionRouteRef); const userRoute = useRouteRef(userRouteRef); - const { primaryTitle: userName } = useEntityPresentation(question.author); const theme = useTheme(); + const styles = useStyles(); + const { name, initials, user } = useEntityAuthor(question); return ( - - - - - {question.title} - - - - - - {DOMPurify.sanitize( - truncate(removeMarkdownFormatting(question.content), 150), - )} - - - - - + + {question.score} score + + + {question.answersCount} answers + + + {question.views} views + + + + + - By{' '} - {question.author === 'anonymous' ? ( - 'Anonymous' - ) : ( - {userName} - )}{' '} - - - - Score: {question.score} {' | '} - - + + + {DOMPurify.sanitize( + truncate(removeMarkdownFormatting(question.content), 150), + )} + + + + - Answers: {question.answersCount} - - + {question.author === 'anonymous' ? ( + 'Anonymous' + ) : ( + {name} + )}{' '} + - {' | '} Views: {question.views} - - - - - - + {'asked '} + + + + ); diff --git a/plugins/qeta/src/utils/hooks.ts b/plugins/qeta/src/utils/hooks.ts index 13c5e4c5..cbdb3bea 100644 --- a/plugins/qeta/src/utils/hooks.ts +++ b/plugins/qeta/src/utils/hooks.ts @@ -8,10 +8,18 @@ import { } from '@backstage/core-plugin-api'; import { makeStyles } from '@material-ui/core'; import { CatalogApi } from '@backstage/catalog-client'; -import { catalogApiRef } from '@backstage/plugin-catalog-react'; +import { + catalogApiRef, + useEntityPresentation, +} from '@backstage/plugin-catalog-react'; import { trimEnd } from 'lodash'; import { useSearchParams } from 'react-router-dom'; import React, { useEffect } from 'react'; +import { UserEntity } from '@backstage/catalog-model'; +import { + AnswerResponse, + QuestionResponse, +} from '@drodil/backstage-plugin-qeta-common'; export function useQetaApi( f: (api: QetaApi) => Promise, @@ -136,6 +144,29 @@ export const useStyles = makeStyles(theme => { width: 'calc(100% - 70px)', minHeight: '160px', }, + questionListItemStats: { + width: '80px', + textAlign: 'right', + marginRight: '26px', + display: 'inline-block', + verticalAlign: 'top', + paddingTop: '10px', + }, + questionListItemContent: { + display: 'inline-block', + width: 'calc(100% - 120px)', + }, + questionListItemAuthor: { + display: 'inline', + float: 'right', + }, + questionListItemAvatar: { + display: 'inline-flex', + marginRight: '0.25rem', + fontSize: '1rem', + maxWidth: '1rem', + maxHeight: '1rem', + }, answerCardContent: { display: 'inline-block', width: 'calc(100% - 70px)', @@ -251,3 +282,48 @@ export const useBasePath = () => { const { pathname } = new URL(url, base); return trimEnd(pathname, '/'); }; + +export const useEntityAuthor = (entity: QuestionResponse | AnswerResponse) => { + const catalogApi = useApi(catalogApiRef); + const identityApi = useApi(identityApiRef); + const [user, setUser] = React.useState(null); + const [initials, setInitials] = React.useState(null); + const [currentUser, setCurrentUser] = React.useState(null); + const anonymous = entity.anonymous ?? false; + useEffect(() => { + if (!anonymous) { + catalogApi + .getEntityByRef(entity.author) + .catch(_ => setUser(null)) + .then(data => (data ? setUser(data as UserEntity) : setUser(null))); + } + }, [catalogApi, entity, anonymous]); + + useEffect(() => { + identityApi.getBackstageIdentity().then(res => { + setCurrentUser(res.userEntityRef ?? 'user:default/guest'); + }); + }, [identityApi]); + + const { primaryTitle: userName } = useEntityPresentation(entity.author); + + let name = userName; + if (entity.author === currentUser) { + name = 'You'; + if (anonymous) { + name += ' (anonymous)'; + } + } + + useEffect(() => { + const init = (name ?? '') + .split(' ') + .map(p => p[0]) + .join('') + .substring(0, 2) + .toUpperCase(); + setInitials(init); + }, [name]); + + return { name, initials, user }; +};