Commit ca6a7e36 by asranov0003

refactor: browser history loading and data

parent abaf3077
...@@ -10,6 +10,7 @@ import { ...@@ -10,6 +10,7 @@ import {
} from "../../stores/store"; } from "../../stores/store";
import { fetchBrowserHistory } from "../../stores/slices/browserHistorySlice"; import { fetchBrowserHistory } from "../../stores/slices/browserHistorySlice";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import CLoading from "../../components/CLoading";
const BrowserHistory: React.FC = () => { const BrowserHistory: React.FC = () => {
const today = new Date().toISOString().split("T")[0]; const today = new Date().toISOString().split("T")[0];
...@@ -52,11 +53,18 @@ const BrowserHistory: React.FC = () => { ...@@ -52,11 +53,18 @@ const BrowserHistory: React.FC = () => {
<MdInfoOutline className="browserhistory__content__header__icon" /> <MdInfoOutline className="browserhistory__content__header__icon" />
</div> </div>
{loading && <p>{t("common.loading")}</p>} {loading && (
<div className="cloading__center">
<CLoading />
</div>
)}
{error && <p className="text-danger">{error}</p>} {error && <p className="text-danger">{error}</p>}
{browserHistories.length > 0 ? ( {browserHistories.length === 0 && !loading && (
<p>{t("browserHistory.empty")}</p>
)}
<div className="browserhistory__list"> <div className="browserhistory__list">
{browserHistories.map((history, index) => { {browserHistories.map((history, index) => {
return ( return (
...@@ -71,9 +79,6 @@ const BrowserHistory: React.FC = () => { ...@@ -71,9 +79,6 @@ const BrowserHistory: React.FC = () => {
); );
})} })}
</div> </div>
) : (
<p>{t("browserHistory.empty")}</p>
)}
</div> </div>
<div className="browserhistory__filter"> <div className="browserhistory__filter">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment