add picture to avatar, lint fixes

Signed-off-by: Lykke Axlin <lykkeaxlin@hotmail.com>

Co-authored-by: klaraab <klarabroman@live.se>
This commit is contained in:
Lykke Axlin
2021-10-12 16:35:35 +02:00
parent 1fb1f8d758
commit af4fd48b0b
9 changed files with 18 additions and 43 deletions
@@ -51,6 +51,7 @@ exports.up = async function up(knex) {
.defaultTo(knex.fn.now())
.notNullable()
.comment('The timestamp when this member joined');
table.text('picture').comment('Link to profile picture');
});
};
@@ -50,11 +50,12 @@ export class DatabaseHandler {
.where({ entity_ref: entityRef });
}
async addMember(userId: any, entityRef: any) {
async addMember(userId: any, entityRef: any, picture?: string) {
await this.database
.insert({
entity_ref: entityRef,
user_id: userId,
picture: picture,
})
.into('public.members');
}
+2 -2
View File
@@ -52,8 +52,8 @@ export async function createRouter(
});
router.put('/member', async (request, response) => {
const { user_id, entity_ref } = request.body;
await dbHandler.addMember(user_id, entity_ref);
const { user_id, entity_ref, picture } = request.body;
await dbHandler.addMember(user_id, entity_ref, picture);
response.json({ status: 'ok' });
});
+1
View File
@@ -122,6 +122,7 @@ export class BazaarClient implements BazaarApi {
body: JSON.stringify({
entity_ref: stringifyEntityRef(entity),
user_id: this.identityApi.getUserId(),
picture: this.identityApi.getProfile()?.picture,
}),
});
}
@@ -28,6 +28,7 @@ import {
MenuList,
MenuItem,
ListItemText,
Link,
} from '@material-ui/core';
import {
Progress,
@@ -35,7 +36,6 @@ import {
IconLinkVerticalProps,
Avatar,
} from '@backstage/core-components';
import { Link } from 'react-router-dom';
import { useEntity } from '@backstage/plugin-catalog-react';
import { AboutField } from '@backstage/plugin-catalog';
import { StatusTag } from '../StatusTag';
@@ -95,6 +95,7 @@ export const EntityBazaarInfoCard = () => {
userId: obj.user_id,
entityRef: obj.entity_ref,
joinDate: obj.join_date,
picture: obj.picture,
};
return member;
@@ -299,10 +300,12 @@ export const EntityBazaarInfoCard = () => {
float: 'left',
marginRight: '0.3rem',
}}
picture={member.picture}
/>
<Link
className={classes.memberLink}
to={`http://github.com/${member.userId}`}
href={`http://github.com/${member.userId}`}
target="_blank"
>
{member?.userId}
</Link>
@@ -36,7 +36,8 @@ export const InputField = ({
placeholder,
required,
}: Props) => {
const label = inputType.charAt(0).toUpperCase() + inputType.slice(1);
const label =
inputType.charAt(0).toLocaleUpperCase('en-US') + inputType.slice(1);
return (
<Controller
@@ -30,7 +30,7 @@ type Props = {
};
export const InputSelector = ({ name, options, control, error }: Props) => {
const label = name.charAt(0).toUpperCase() + name.slice(1);
const label = name.charAt(0).toLocaleUpperCase('en-US') + name.slice(1);
return (
<Controller
+1
View File
@@ -20,6 +20,7 @@ export type Member = {
entityRef: EntityRef;
userId: string;
joinDate?: string;
picture?: string;
};
export type Status = 'ongoing' | 'proposed';
+3 -36
View File
@@ -2209,16 +2209,6 @@
"@backstage/errors" "^0.1.2"
cross-fetch "^3.0.6"
"@backstage/catalog-client@^0.4.0":
version "0.4.0"
resolved "https://registry.npmjs.org/@backstage/catalog-client/-/catalog-client-0.4.0.tgz#eb0aff31bdce8f2c12de8fbce558557b18452a00"
integrity sha512-Y2lBhsZTSKU2gbMAB0/RZ/jmFGUPdhScsDINsRIVwfLKjtTJjSgJ8iaLdsYxQS4oZq2HAT5l7fsflnVEDS6IRQ==
dependencies:
"@backstage/catalog-model" "^0.9.3"
"@backstage/config" "^0.1.10"
"@backstage/errors" "^0.1.2"
cross-fetch "^3.0.6"
"@backstage/core-api@^0.2.23":
version "0.2.23"
resolved "https://registry.npmjs.org/@backstage/core-api/-/core-api-0.2.23.tgz#c0ec13407ff7c78d376eb18e9d8e1490d54d995b"
@@ -2442,29 +2432,6 @@
react-router-dom "6.0.0-beta.0"
react-use "^17.2.4"
"@backstage/plugin-catalog@^0.6.6":
version "0.6.17"
resolved "https://registry.npmjs.org/@backstage/plugin-catalog/-/plugin-catalog-0.6.17.tgz#4a5b434b52cdd5170d459f40ec69ba5dd68de987"
integrity sha512-Ec1Nn7IdISrTjeG2sgZzBUc2G9iyUzF4NOBzQwsObIDukDv+pSYgiVDmH+2wV8Jv4Sl6sC8R9a3qfc9OkPPT7w==
dependencies:
"@backstage/catalog-client" "^0.4.0"
"@backstage/catalog-model" "^0.9.3"
"@backstage/core-components" "^0.6.0"
"@backstage/core-plugin-api" "^0.1.9"
"@backstage/integration-react" "^0.1.11"
"@backstage/plugin-catalog-react" "^0.5.1"
"@backstage/theme" "^0.2.10"
"@material-ui/core" "^4.12.2"
"@material-ui/icons" "^4.9.1"
"@material-ui/lab" "4.0.0-alpha.57"
"@types/react" "*"
lodash "^4.17.21"
react "^16.13.1"
react-dom "^16.13.1"
react-helmet "6.1.0"
react-router "6.0.0-beta.0"
react-use "^17.2.4"
"@bcoe/v8-coverage@^0.2.3":
version "0.2.3"
resolved "https://registry.npmjs.org/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39"
@@ -22979,9 +22946,9 @@ react-hook-form@^7.12.2:
integrity sha512-kcLDmSmlyLUFx2UU5bG/o4+3NeK753fhKodJa8gkplXohGkpAq0/p+TR24OWjZmkEc3ES7ppC5v5d6KUk+fJTA==
react-hook-form@^7.13.0:
version "7.17.1"
resolved "https://registry.npmjs.org/react-hook-form/-/react-hook-form-7.17.1.tgz#dc257a5e34b3c353460ecdbbba5236e066cf80b1"
integrity sha512-9nQ+qKFHFpnWzQHdDh6F4Egxa8iJkue1KU921F8qqeyUVbPPjgQZDXaQyNHABEYjRh0ndjTI24GDA+lwm2lQdg==
version "7.17.2"
resolved "https://registry.npmjs.org/react-hook-form/-/react-hook-form-7.17.2.tgz#235f15bb65c13e7a1198d33f2db24bcc9e27b303"
integrity sha512-oBaHwlYnbpzSFdNrs43QpcM+K2A0kUeNjV86ECYkCimlR1Ctl+tz4oQQd9plfGYkO7PJGLVMOVpUtL5EHjAcYQ==
react-hot-loader@^4.12.21:
version "4.13.0"