fix: additional bugs

This commit is contained in:
swve 2024-02-04 19:28:45 +01:00
parent 0c6ce121b0
commit 925276dc7a
3 changed files with 16 additions and 10 deletions

View file

@ -8,7 +8,7 @@ import { revalidateTags } from "@services/utils/ts/requests";
import ActivityIndicators from "@components/Pages/Courses/ActivityIndicators"; import ActivityIndicators from "@components/Pages/Courses/ActivityIndicators";
import { useRouter } from "next/navigation"; import { useRouter } from "next/navigation";
import GeneralWrapperStyled from "@components/StyledElements/Wrappers/GeneralWrapper"; import GeneralWrapperStyled from "@components/StyledElements/Wrappers/GeneralWrapper";
import { getCourseThumbnailMediaDirectory } from "@services/media/media"; import { getCourseThumbnailMediaDirectory, getUserAvatarMediaDirectory } from "@services/media/media";
import { ArrowRight, Check, File, Sparkles, Star, Video } from "lucide-react"; import { ArrowRight, Check, File, Sparkles, Star, Video } from "lucide-react";
import Avvvatars from "avvvatars-react"; import Avvvatars from "avvvatars-react";
import { getUser } from "@services/users/users"; import { getUser } from "@services/users/users";
@ -193,7 +193,7 @@ const CourseClient = (props: any) => {
<div className="course_metadata_right space-y-3 w-72 antialiased flex flex-col ml-10 h-fit p-3 py-5 bg-white shadow-md shadow-gray-300/25 outline outline-1 outline-neutral-200/40 rounded-lg overflow-hidden"> <div className="course_metadata_right space-y-3 w-72 antialiased flex flex-col ml-10 h-fit p-3 py-5 bg-white shadow-md shadow-gray-300/25 outline outline-1 outline-neutral-200/40 rounded-lg overflow-hidden">
{user && {user &&
<div className="flex flex-col mx-auto space-y-3 px-2 py-2 items-center"> <div className="flex flex-col mx-auto space-y-3 px-2 py-2 items-center">
<UserAvatar border="border-8" avatar_url={course.authors[0].avatar_url} width={100} /> <UserAvatar border="border-8" avatar_url={getUserAvatarMediaDirectory(course.authors[0].user_uuid,course.authors[0].avatar_image)} width={100} />
<div className="-space-y-2 "> <div className="-space-y-2 ">
<div className="text-[12px] text-neutral-400 font-semibold">Author</div> <div className="text-[12px] text-neutral-400 font-semibold">Author</div>
<div className="text-xl font-bold text-neutral-800"> <div className="text-xl font-bold text-neutral-800">

View file

@ -30,6 +30,7 @@ function UserAvatar(props: UserAvatarProps) {
return predefinedAvatar return predefinedAvatar
} else { } else {
if (props.avatar_url) { if (props.avatar_url) {
console.log('avatar_url',props.avatar_url)
return props.avatar_url return props.avatar_url
} }
else { else {

View file

@ -43,11 +43,16 @@ export const AuthenticatedClientElement = (props: AuthenticatedClientElementProp
} }
function check() { function check() {
if (session.isAuthenticated === false) {
if (props.checkMethod === 'authentication') { setIsAllowed(false);
setIsAllowed(session.isAuthenticated); return;
} else if (props.checkMethod === 'roles') { }
return setIsAllowed(isUserAllowed(session.roles, props.action!, props.ressourceType!, org.org_uuid)); else {
if (props.checkMethod === 'authentication') {
setIsAllowed(session.isAuthenticated);
} else if (props.checkMethod === 'roles') {
return setIsAllowed(isUserAllowed(session.roles, props.action!, props.ressourceType!, org.org_uuid));
}
} }
} }