diff --git a/save-frontend/src/main/kotlin/com/saveourtool/save/frontend/components/views/index/CardUser.kt b/save-frontend/src/main/kotlin/com/saveourtool/save/frontend/components/views/index/CardUser.kt index 7feba2c6ee..bbfc04ded9 100644 --- a/save-frontend/src/main/kotlin/com/saveourtool/save/frontend/components/views/index/CardUser.kt +++ b/save-frontend/src/main/kotlin/com/saveourtool/save/frontend/components/views/index/CardUser.kt @@ -9,6 +9,7 @@ import com.saveourtool.common.entities.OrganizationStatus import com.saveourtool.common.validation.FrontendCosvRoutes import com.saveourtool.common.validation.FrontendRoutes import com.saveourtool.frontend.common.components.basic.renderAvatar +import com.saveourtool.frontend.common.components.basic.renderOrganizationAvatar import com.saveourtool.frontend.common.utils.* import com.saveourtool.save.frontend.externals.i18next.useTranslation @@ -42,7 +43,7 @@ import kotlinx.datetime.toLocalDateTime val cardUser: FC = FC { props -> val (t) = useTranslation("index") val (organizations, setOrganizations) = useState(emptyList()) - val (countVulnerability, setCountVulnerability) = useState(0) + val (errorAvatars, setErrorAvatars) = useState(emptySet()) val navigate = useNavigate() @Suppress("TOO_MANY_LINES_IN_LAMBDA") @@ -56,15 +57,6 @@ val cardUser: FC = FC { props -> .decodeFromJsonString() setOrganizations(organizationsNew) - - val countVuln: Int = get( - "$apiUrl/vulnerabilities/count-by-user?userName=$it", - jsonHeaders, - loadingHandler = ::loadingHandler, - ) - .decodeFromJsonString() - - setCountVulnerability(countVuln) } } @@ -195,7 +187,11 @@ val cardUser: FC = FC { props -> div { className = ClassName("col-12 mt-2 pl-4") val renderImg: ChildrenBuilder.() -> Unit = { - renderAvatar(organization) { + renderOrganizationAvatar( + organization, + errorAvatars = errorAvatars, + setErrorAvatars = { name -> setErrorAvatars(errorAvatars.plus(name)) } + ) { height = 2.rem width = 2.rem } @@ -230,25 +226,6 @@ val cardUser: FC = FC { props -> +"${"Your statistics".t()}:" } } - div { - className = ClassName("row text-muted border-bottom border-gray mx-3") - div { - className = ClassName("col-9") - p { - +"${"Vulnerabilities".t()}: " - } - } - - div { - className = ClassName("col-3") - p { - Link { - to = "/${FrontendRoutes.PROFILE}/${props.userInfo?.name}" - +countVulnerability.toString() - } - } - } - } div { className = ClassName("row text-muted border-bottom border-gray mx-3 mt-2")