Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/npm_and_yarn/zod-3.22.4
Browse files Browse the repository at this point in the history
  • Loading branch information
drodil authored Jan 8, 2024
2 parents 2bb143a + 04d0344 commit 29d825e
Show file tree
Hide file tree
Showing 20 changed files with 1,273 additions and 1,138 deletions.
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,23 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

### [1.16.4](https://github.com/drodil/backstage-plugin-qeta/compare/v1.16.3...v1.16.4) (2023-11-15)


### Bug Fixes

* go to q&a user page instead catalog ([bd6e6c2](https://github.com/drodil/backstage-plugin-qeta/commit/bd6e6c2a51278846e4189aac4dd97a91ec73a3d5))

### [1.16.3](https://github.com/drodil/backstage-plugin-qeta/compare/v1.16.2...v1.16.3) (2023-11-15)


### Bug Fixes

* add missing lodash types ([f98470d](https://github.com/drodil/backstage-plugin-qeta/commit/f98470db9837669ea40766c5613eaf53832b1f90))
* same button order for question page ([d8007df](https://github.com/drodil/backstage-plugin-qeta/commit/d8007dfc47552c95e7d2e7b0c09de9e4875281f3))
* set anonymous to false for old questions ([c91a90d](https://github.com/drodil/backstage-plugin-qeta/commit/c91a90d8df1e2bc28cda07956d2f451239445548))
* yarn lock ([bb5c4d1](https://github.com/drodil/backstage-plugin-qeta/commit/bb5c4d125c658ef6e485ee798eec7fc67fb29984))

### [1.16.2](https://github.com/drodil/backstage-plugin-qeta/compare/v1.16.1...v1.16.2) (2023-10-16)

### [1.16.1](https://github.com/drodil/backstage-plugin-qeta/compare/v1.16.0...v1.16.1) (2023-10-16)
Expand Down
2 changes: 1 addition & 1 deletion backstage.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"version": "1.19.0"
"version": "1.21.1"
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"@octokit/rest": "19.0.8"
},
"devDependencies": {
"@backstage/cli": "^0.23.0",
"@backstage/cli": "^0.25.0",
"@commitlint/cli": "^17.7.1",
"@commitlint/config-conventional": "^17.7.0",
"@spotify/prettier-config": "^15.0.0",
Expand Down
22 changes: 11 additions & 11 deletions plugins/qeta-backend/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@drodil/backstage-plugin-qeta-backend",
"version": "1.16.2",
"version": "1.16.4",
"description": "Backstage.io Q&A plugin backend",
"keywords": [
"backstage",
Expand Down Expand Up @@ -39,16 +39,16 @@
"tsc": "tsc"
},
"dependencies": {
"@backstage/backend-common": "^0.19.8",
"@backstage/backend-plugin-api": "^0.6.6",
"@backstage/backend-common": "^0.20.0",
"@backstage/backend-plugin-api": "^0.6.8",
"@backstage/catalog-model": "^1.4.3",
"@backstage/config": "^1.1.1",
"@backstage/errors": "^1.2.3",
"@backstage/plugin-auth-node": "^0.4.0",
"@backstage/plugin-events-node": "^0.2.15",
"@backstage/plugin-permission-common": "^0.7.9",
"@backstage/plugin-permission-node": "^0.7.17",
"@backstage/plugin-search-common": "^1.2.7",
"@backstage/plugin-auth-node": "^0.4.2",
"@backstage/plugin-events-node": "^0.2.17",
"@backstage/plugin-permission-common": "^0.7.11",
"@backstage/plugin-permission-node": "^0.7.19",
"@backstage/plugin-search-common": "^1.2.9",
"@drodil/backstage-plugin-qeta-common": "workspace:^",
"@types/express": "*",
"@types/multiparty": "^0.0.33",
Expand All @@ -59,15 +59,15 @@
"express": "^4.17.3",
"express-promise-router": "^4.1.0",
"file-type": "16.5.4",
"knex": "^2.4.0",
"knex": "^3.0.0",
"multiparty": "^4.2.3",
"uuid": "^9.0.1",
"winston": "^3.10.0",
"yn": "^4.0.0"
},
"devDependencies": {
"@backstage/backend-test-utils": "^0.2.7",
"@backstage/cli": "^0.23.0",
"@backstage/backend-test-utils": "^0.2.9",
"@backstage/cli": "^0.25.0",
"@types/supertest": "^2.0.12",
"@types/uuid": "^9.0.4",
"supertest": "^6.2.4"
Expand Down
8 changes: 4 additions & 4 deletions plugins/qeta-common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"frontend",
"backstage.io"
],
"version": "1.16.2",
"version": "1.16.4",
"main": "src/index.ts",
"types": "src/index.ts",
"prepublishOnly": "yarn tsc && yarn build",
Expand Down Expand Up @@ -39,14 +39,14 @@
"tsc": "tsc"
},
"dependencies": {
"@backstage/plugin-permission-common": "^0.7.9",
"@backstage/plugin-search-common": "^1.2.7"
"@backstage/plugin-permission-common": "^0.7.11",
"@backstage/plugin-search-common": "^1.2.9"
},
"peerDependencies": {
"@backstage/catalog-model": "^1.4.3"
},
"devDependencies": {
"@backstage/cli": "^0.23.0"
"@backstage/cli": "^0.25.0"
},
"files": [
"dist"
Expand Down
22 changes: 11 additions & 11 deletions plugins/qeta/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"frontend",
"backstage.io"
],
"version": "1.16.2",
"version": "1.16.4",
"main": "src/index.ts",
"types": "src/index.ts",
"prepublishOnly": "yarn tsc && yarn build",
Expand Down Expand Up @@ -39,15 +39,15 @@
"tsc": "tsc"
},
"dependencies": {
"@backstage/catalog-client": "^1.4.5",
"@backstage/catalog-client": "^1.5.1",
"@backstage/catalog-model": "^1.4.3",
"@backstage/config": "^1.1.1",
"@backstage/core-components": "^0.13.6",
"@backstage/core-plugin-api": "^1.7.0",
"@backstage/core-components": "^0.13.9",
"@backstage/core-plugin-api": "^1.8.1",
"@backstage/errors": "^1.2.3",
"@backstage/plugin-catalog-react": "^1.8.5",
"@backstage/plugin-home-react": "^0.1.4",
"@backstage/plugin-permission-react": "^0.4.16",
"@backstage/plugin-catalog-react": "^1.9.2",
"@backstage/plugin-home-react": "^0.1.6",
"@backstage/plugin-permission-react": "^0.4.18",
"@drodil/backstage-plugin-qeta-common": "workspace:^",
"@material-ui/core": "^4.12.2",
"@material-ui/icons": "^4.11.3",
Expand All @@ -63,7 +63,7 @@
"react-use": "^17.4.0"
},
"peerDependencies": {
"@backstage/catalog-client": "^1.4.5",
"@backstage/catalog-client": "^1.5.1",
"react": "^16.13.1 || ^17.0.0",
"react-dom": "^16.13.1 || ^17.0.0",
"react-router-dom": "^6.3.0"
Expand All @@ -72,9 +72,9 @@
"react-markdown": "8.0.7"
},
"devDependencies": {
"@backstage/cli": "^0.23.0",
"@backstage/dev-utils": "^1.0.22",
"@backstage/plugin-home": "^0.5.9",
"@backstage/cli": "^0.25.0",
"@backstage/dev-utils": "^1.0.25",
"@backstage/plugin-home": "^0.6.0",
"@testing-library/jest-dom": "^6.1.3",
"@types/dompurify": "^3.0.0",
"@types/lodash": "^4.14.199",
Expand Down
6 changes: 4 additions & 2 deletions plugins/qeta/src/components/AskPage/AskPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import React from 'react';

import { AskForm } from '../AskForm/AskForm';
import { useParams } from 'react-router-dom';
import { formatEntityName } from '../../utils/utils';
import { BackToQuestionsButton } from '../Buttons/BackToQuestionsButton';
import { EntityDisplayName } from '@backstage/plugin-catalog-react';

export const AskPage = () => {
const { id } = useParams();
Expand All @@ -15,7 +15,9 @@ export const AskPage = () => {
if (id) {
title = 'Edit question';
} else if (entity) {
title = `Ask a question about ${formatEntityName(entity)}`;
title = `Ask a question about ${(
<EntityDisplayName entityRef={entity} hideIcon defaultKind="component" />
)}`;
} else {
title = 'Ask question';
}
Expand Down
11 changes: 3 additions & 8 deletions plugins/qeta/src/components/CommentSection/CommentList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@ import { AnswerResponse, qetaApiRef, QuestionResponse } from '../../api';
import { Box, Divider, Typography } from '@material-ui/core';
import React from 'react';
import { Link, MarkdownContent } from '@backstage/core-components';
import { formatEntityName } from '../../utils/utils';
import { useStyles } from '../../utils/hooks';
import { useApi, useRouteRef } from '@backstage/core-plugin-api';
import { userRouteRef } from '../../routes';
import { useApi } from '@backstage/core-plugin-api';
import { RelativeTimeWithTooltip } from '../RelativeTimeWithTooltip/RelativeTimeWithTooltip';
import { AuthorLink } from '../Links/Links';

export const CommentList = (props: {
onCommentDelete: (
Expand All @@ -20,7 +19,6 @@ export const CommentList = (props: {
const entity = answer ?? question;
const styles = useStyles();
const qetaApi = useApi(qetaApiRef);
const userRoute = useRouteRef(userRouteRef);

const deleteComment = (id: number) => {
if (answer) {
Expand All @@ -37,7 +35,6 @@ export const CommentList = (props: {
return (
<>
{entity.comments?.map(c => {
const name = formatEntityName(c.author);
return (
<>
<Box key={c.id} className="qetaCommentBox">
Expand All @@ -47,9 +44,7 @@ export const CommentList = (props: {
className={`${styles.markdownContent} inline`}
/>
{' – '}
<Link to={`${userRoute()}/${c.author}`} className="qetaUserBtn">
{name}
</Link>{' '}
<AuthorLink entity={c} />
<Typography variant="caption" className="qetaCommentTime">
<RelativeTimeWithTooltip value={c.created} />
</Typography>
Expand Down
46 changes: 46 additions & 0 deletions plugins/qeta/src/components/Links/Links.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import {
Answer,
Comment,
Question,
} from '@drodil/backstage-plugin-qeta-common';
import React from 'react';
import { useRouteRef } from '@backstage/core-plugin-api';
import { userRouteRef } from '../../routes';
import { useEntityPresentation } from '@backstage/plugin-catalog-react';
import { Link, LinkProps } from '@backstage/core-components';

export const UserLink = (props: {
entityRef: string;
linkProps?: LinkProps;
}) => {
const { entityRef, linkProps } = props;
const userRoute = useRouteRef(userRouteRef);
const { primaryTitle: userName } = useEntityPresentation(entityRef);
if (entityRef === 'anonymous') {
return <>Anonymous</>;
}
return (
<Link to={`${userRoute()}/${entityRef}`} {...linkProps}>
{userName}
</Link>
);
};

export const AuthorLink = (props: {
entity: Question | Answer | Comment;
linkProps?: LinkProps;
}) => {
const { entity, linkProps } = props;
return <UserLink entityRef={entity.author} linkProps={linkProps} />;
};

export const UpdatedByLink = (props: {
entity: Question | Answer | Comment;
linkProps?: LinkProps;
}) => {
const { entity, linkProps } = props;
if (!entity.updatedBy) {
return null;
}
return <UserLink entityRef={entity.updatedBy} linkProps={linkProps} />;
};
27 changes: 5 additions & 22 deletions plugins/qeta/src/components/QuestionPage/AuthorBox.tsx
Original file line number Diff line number Diff line change
@@ -1,25 +1,19 @@
import { Avatar, Box, Grid, Typography } from '@material-ui/core';
import { Link } from '@backstage/core-components';
import { formatEntityName } from '../../utils/utils';
import React, { useEffect } from 'react';
import { useStyles } from '../../utils/hooks';
import { AnswerResponse, QuestionResponse } from '../../api';
import {
identityApiRef,
useApi,
useRouteRef,
} from '@backstage/core-plugin-api';
import { identityApiRef, useApi } from '@backstage/core-plugin-api';
import { catalogApiRef } from '@backstage/plugin-catalog-react';
import { UserEntity } from '@backstage/catalog-model';
import { userRouteRef } from '../../routes';
import { RelativeTimeWithTooltip } from '../RelativeTimeWithTooltip/RelativeTimeWithTooltip';
import { AuthorLink, UpdatedByLink } from '../Links/Links';

export const AuthorBox = (props: {
entity: QuestionResponse | AnswerResponse;
}) => {
const { entity } = props;
const catalogApi = useApi(catalogApiRef);
const userRoute = useRouteRef(userRouteRef);
const identityApi = useApi(identityApiRef);
const [user, setUser] = React.useState<UserEntity | null>(null);
const [currentUser, setCurrentUser] = React.useState<string | null>(null);
Expand Down Expand Up @@ -67,13 +61,11 @@ export const AuthorBox = (props: {
Posted <RelativeTimeWithTooltip value={entity.created} />
</Typography>
</Grid>
{entity.updated && (
{entity.updated && entity.updatedBy && (
<Grid item xs={12} style={{ paddingBottom: 0, paddingTop: 0 }}>
<Typography className="qetaAuthorBoxUpdated" variant="caption">
Updated <RelativeTimeWithTooltip value={entity.updated} /> by{' '}
<Link to={`${userRoute()}/${entity.updatedBy}`}>
{formatEntityName(entity.updatedBy)}
</Link>
<UpdatedByLink entity={entity} />
</Typography>
</Grid>
)}
Expand All @@ -88,16 +80,7 @@ export const AuthorBox = (props: {
</Avatar>
</Grid>
<Grid item xs={10} className={styles.authorLink}>
{name === 'Anonymous' ? (
name
) : (
<Link
className="qetaUserBtn"
to={`${userRoute()}/${entity.author}`}
>
{name}
</Link>
)}
<AuthorLink entity={entity} />
</Grid>
</Grid>
</Box>
Expand Down
27 changes: 27 additions & 0 deletions plugins/qeta/src/components/QuestionPage/EntityChip.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { Entity, getCompoundEntityRef } from '@backstage/catalog-model';
import { Chip, Tooltip } from '@material-ui/core';
import React from 'react';
import { useRouteRef } from '@backstage/core-plugin-api';
import {
entityRouteRef,
useEntityPresentation,
} from '@backstage/plugin-catalog-react';

export const EntityChip = (props: { entity: Entity }) => {
const { entity } = props;
const entityRoute = useRouteRef(entityRouteRef);
const { primaryTitle, secondaryTitle } = useEntityPresentation(entity);
return (
<Tooltip title={secondaryTitle ?? primaryTitle} arrow>
<Chip
label={primaryTitle}
size="small"
variant="outlined"
className="qetaEntityChip"
component="a"
href={entityRoute(getCompoundEntityRef(entity))}
clickable
/>
</Tooltip>
);
};
Loading

0 comments on commit 29d825e

Please sign in to comment.