diff --git a/public/locales/de/translation.json b/public/locales/de/translation.json index df04257..ab2c42f 100644 --- a/public/locales/de/translation.json +++ b/public/locales/de/translation.json @@ -162,7 +162,13 @@ "role.title": "Rolle", "groupId.title": "Gruppen ID" }, - "card": { "checkbox": { "info": "INFO", "error": "FEHLER" } }, + "card": { + "checkbox": { + "autoScroll": "Auto scroll", + "info": "INFO", + "error": "FEHLER" + } + }, "tooltip": { "previous": "Vorige", "next": "Nächste" diff --git a/public/locales/en/translation.json b/public/locales/en/translation.json index 64bb563..38ab1e6 100644 --- a/public/locales/en/translation.json +++ b/public/locales/en/translation.json @@ -162,7 +162,13 @@ "role.title": "Role", "groupId.title": "Group ID" }, - "card": { "checkbox": { "info": "INFO", "error": "ERROR" } }, + "card": { + "checkbox": { + "autoScroll": "Auto scroll", + "info": "INFO", + "error": "ERROR" + } + }, "tooltip": { "previous": "Previous", "next": "Next" diff --git a/src/Components/LogCard/index.js b/src/Components/LogCard/index.js index f5be8ff..f6d2b84 100644 --- a/src/Components/LogCard/index.js +++ b/src/Components/LogCard/index.js @@ -1,5 +1,4 @@ -import { ReloadOutlined } from "@ant-design/icons"; -import { Card, Checkbox, Col, Row, Select, Space, Spin, Tooltip } from "antd"; +import { Card, Checkbox, Col, Row, Select, Spin } from "antd"; import { useEffect, useRef, useState } from "react"; import { Constants, myFetch } from "../../utils"; import { useTranslation } from "react-i18next"; @@ -122,9 +121,13 @@ export default function LogCard({ useEffect(() => { // scroll to bottom - if (checkboxAutoScrollChecked && virtuosoRef.current !== undefined) { + if ( + checkboxAutoScrollChecked && + virtuosoRef.current !== undefined && + virtuosoRef.current.scrollToIndex !== null + ) { virtuosoRef.current.scrollToIndex({ - index: logs.length - 5, + index: logs.length - 1, align: "start", behavior: "auto", }); @@ -148,11 +151,12 @@ export default function LogCard({ setCheckboxAutoScrollChecked(e.target.checked) } > - Auto scroll + {t("logCard.card.checkbox.autoScroll")}