diff --git a/justfile b/justfile index 94c1b71..3eb086e 100644 --- a/justfile +++ b/justfile @@ -25,11 +25,15 @@ run-dev: stop-dev: @docker-compose -f docker-compose-dev.yml stop - +# register a user in the dev stack register-user localpart password *admin: docker-compose exec synapse register_new_matrix_user {{ if admin == "1" {"--admin"} else {"--no-admin"} }} -u {{ localpart }} -p {{ password }} -c /config/homeserver.yaml http://localhost:8008 - +# run yarn {fix,lint,test} commands +test: + @-yarn run fix + @-yarn run lint + @-yarn run test # run the app in a production mode run-prod: build diff --git a/src/components/AvatarField.tsx b/src/components/AvatarField.tsx index 9467664..7ec8aff 100644 --- a/src/components/AvatarField.tsx +++ b/src/components/AvatarField.tsx @@ -1,12 +1,11 @@ import { get } from "lodash"; import { Avatar, AvatarProps } from "@mui/material"; -import { useRecordContext } from "react-admin"; +import { FieldProps, useRecordContext } from "react-admin"; import { useState, useEffect, useCallback } from "react"; import { fetchAuthenticatedMedia } from "../utils/fetchMedia"; -const AvatarField = ({ source, ...rest }: AvatarProps & { source: string, label?: string }) => { +const AvatarField = ({ source, ...rest }: AvatarProps & FieldProps) => { const { alt, classes, sizes, sx, variant } = rest; - const record = useRecordContext(rest); const mxcURL = get(record, source)?.toString(); diff --git a/src/resources/users.tsx b/src/resources/users.tsx index cb06aa3..3e279d4 100644 --- a/src/resources/users.tsx +++ b/src/resources/users.tsx @@ -51,6 +51,7 @@ import { NumberField, useListContext, useNotify, + Identifier, ToolbarClasses, RaRecord, ImageInput, @@ -146,10 +147,6 @@ const UserBulkActionButtons = () => { ); }; -const usersRowClick = (id: Identifier, resource: string, record: RaRecord): string => { - return `/users/${id}`; -}; - export const UserList = (props: ListProps) => ( ( actions={} pagination={} > - }> + `/${resource}/${id}`} + bulkActionButtons={} + > @@ -211,9 +211,7 @@ const UserEditActions = () => { export const UserCreate = (props: CreateProps) => ( { - return `users/${id}`; - }} + redirect={(resource: string | undefined, id: Identifier | undefined) => `${resource}/${id}`} >