mirror of
https://github.com/BreizhHardware/Jellystat.git
synced 2026-01-18 16:27:20 +01:00
fix for filtering stream type not working on emby type
This commit is contained in:
@@ -157,7 +157,9 @@ function Activity() {
|
||||
filteredData = filteredData.filter(
|
||||
(item) =>
|
||||
(libraryFilters.includes(item.ParentId) || item.ParentId == null) &&
|
||||
(streamTypeFilter == "All" ? true : item.PlayMethod === streamTypeFilter)
|
||||
(streamTypeFilter == "All"
|
||||
? true
|
||||
: item.PlayMethod === (config.settings?.IS_JELLYFIN ? streamTypeFilter : streamTypeFilter.replace("Play", "Stream")))
|
||||
);
|
||||
|
||||
return (
|
||||
@@ -183,7 +185,7 @@ function Activity() {
|
||||
<Trans i18nKey="MENU_TABS.ACTIVITY" />
|
||||
</h1>
|
||||
|
||||
<div className="d-flex flex-column flex-md-row" style={{whiteSpace: "nowrap"}}>
|
||||
<div className="d-flex flex-column flex-md-row" style={{ whiteSpace: "nowrap" }}>
|
||||
<Button onClick={() => setShowLibraryFilters(true)} className="ms-md-3 mb-3 my-md-3">
|
||||
<Trans i18nKey="MENU_TABS.LIBRARIES" />
|
||||
</Button>
|
||||
@@ -211,7 +213,7 @@ function Activity() {
|
||||
</FormSelect>
|
||||
</div>
|
||||
|
||||
<div className="d-flex flex-row w-100 ms-md-3 w-sm-100 w-md-75 mb-3 my-md-3" style={{whiteSpace: "nowrap"}}>
|
||||
<div className="d-flex flex-row w-100 ms-md-3 w-sm-100 w-md-75 mb-3 my-md-3" style={{ whiteSpace: "nowrap" }}>
|
||||
<div className="d-flex flex-col rounded-0 rounded-start align-items-center px-2 bg-primary-1">
|
||||
<Trans i18nKey="UNITS.ITEMS" />
|
||||
</div>
|
||||
|
||||
@@ -4,6 +4,7 @@ import ActivityTable from "../activity/activity-table";
|
||||
import { Trans } from "react-i18next";
|
||||
import { FormControl, FormSelect } from "react-bootstrap";
|
||||
import i18next from "i18next";
|
||||
import Config from "../../../lib/config.jsx";
|
||||
|
||||
function ItemActivity(props) {
|
||||
const [data, setData] = useState();
|
||||
@@ -11,8 +12,22 @@ function ItemActivity(props) {
|
||||
const [itemCount, setItemCount] = useState(10);
|
||||
const [searchQuery, setSearchQuery] = useState("");
|
||||
const [streamTypeFilter, setStreamTypeFilter] = useState("All");
|
||||
const [config, setConfig] = useState();
|
||||
|
||||
useEffect(() => {
|
||||
const fetchConfig = async () => {
|
||||
try {
|
||||
const newConfig = await Config.getConfig();
|
||||
setConfig(newConfig);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
};
|
||||
|
||||
if (!config) {
|
||||
fetchConfig();
|
||||
}
|
||||
|
||||
const fetchData = async () => {
|
||||
try {
|
||||
const itemData = await axios.post(
|
||||
@@ -56,7 +71,11 @@ function ItemActivity(props) {
|
||||
);
|
||||
}
|
||||
|
||||
filteredData = filteredData.filter((item) => (streamTypeFilter == "All" ? true : item.PlayMethod === streamTypeFilter));
|
||||
filteredData = filteredData.filter((item) =>
|
||||
streamTypeFilter == "All"
|
||||
? true
|
||||
: item.PlayMethod === (config.settings?.IS_JELLYFIN ? streamTypeFilter : streamTypeFilter.replace("Play", "Stream"))
|
||||
);
|
||||
|
||||
return (
|
||||
<div className="Activity">
|
||||
@@ -65,7 +84,7 @@ function ItemActivity(props) {
|
||||
<Trans i18nKey="ITEM_ACTIVITY" />
|
||||
</h1>
|
||||
|
||||
<div className="d-flex flex-column flex-md-row" style={{whiteSpace: "nowrap"}}>
|
||||
<div className="d-flex flex-column flex-md-row" style={{ whiteSpace: "nowrap" }}>
|
||||
<div className="d-flex flex-row w-100 ms-md-3 w-sm-100 w-md-75 mb-3 my-md-3">
|
||||
<div className="d-flex flex-col rounded-0 rounded-start align-items-center px-2 bg-primary-1">
|
||||
<Trans i18nKey="TYPE" />
|
||||
@@ -89,7 +108,7 @@ function ItemActivity(props) {
|
||||
</FormSelect>
|
||||
</div>
|
||||
|
||||
<div className="d-flex flex-row w-100 ms-md-3 w-sm-100 w-md-75 ms-md-3" style={{whiteSpace: "nowrap"}}>
|
||||
<div className="d-flex flex-row w-100 ms-md-3 w-sm-100 w-md-75 ms-md-3" style={{ whiteSpace: "nowrap" }}>
|
||||
<div className="d-flex flex-col rounded-0 rounded-start align-items-center px-2 bg-primary-1 my-md-3">
|
||||
<Trans i18nKey="UNITS.ITEMS" />
|
||||
</div>
|
||||
|
||||
@@ -5,6 +5,7 @@ import ActivityTable from "../activity/activity-table";
|
||||
import { Trans } from "react-i18next";
|
||||
import { FormControl, FormSelect } from "react-bootstrap";
|
||||
import i18next from "i18next";
|
||||
import Config from "../../../lib/config.jsx";
|
||||
|
||||
function LibraryActivity(props) {
|
||||
const [data, setData] = useState();
|
||||
@@ -14,6 +15,7 @@ function LibraryActivity(props) {
|
||||
const [streamTypeFilter, setStreamTypeFilter] = useState(
|
||||
localStorage.getItem("PREF_LIBRARY_ACTIVITY_StreamTypeFilter") ?? "All"
|
||||
);
|
||||
const [config, setConfig] = useState();
|
||||
|
||||
function setItemLimit(limit) {
|
||||
setItemCount(limit);
|
||||
@@ -26,6 +28,18 @@ function LibraryActivity(props) {
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
const fetchConfig = async () => {
|
||||
try {
|
||||
const newConfig = await Config.getConfig();
|
||||
setConfig(newConfig);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
};
|
||||
|
||||
if (!config) {
|
||||
fetchConfig();
|
||||
}
|
||||
const fetchData = async () => {
|
||||
try {
|
||||
const libraryrData = await axios.post(
|
||||
@@ -68,7 +82,11 @@ function LibraryActivity(props) {
|
||||
);
|
||||
}
|
||||
|
||||
filteredData = filteredData.filter((item) => (streamTypeFilter == "All" ? true : item.PlayMethod === streamTypeFilter));
|
||||
filteredData = filteredData.filter((item) =>
|
||||
streamTypeFilter == "All"
|
||||
? true
|
||||
: item.PlayMethod === (config.settings?.IS_JELLYFIN ? streamTypeFilter : streamTypeFilter.replace("Play", "Stream"))
|
||||
);
|
||||
|
||||
return (
|
||||
<div className="Activity">
|
||||
@@ -78,7 +96,7 @@ function LibraryActivity(props) {
|
||||
</h1>
|
||||
|
||||
<div className="d-flex flex-column flex-md-row">
|
||||
<div className="d-flex flex-row w-100 ms-md-3 w-sm-100 w-md-75 mb-3 my-md-3" style={{whiteSpace: "nowrap"}}>
|
||||
<div className="d-flex flex-row w-100 ms-md-3 w-sm-100 w-md-75 mb-3 my-md-3" style={{ whiteSpace: "nowrap" }}>
|
||||
<div className="d-flex flex-col rounded-0 rounded-start align-items-center px-2 bg-primary-1">
|
||||
<Trans i18nKey="TYPE" />
|
||||
</div>
|
||||
@@ -101,7 +119,7 @@ function LibraryActivity(props) {
|
||||
</FormSelect>
|
||||
</div>
|
||||
|
||||
<div className="d-flex flex-row w-100 ms-md-3 w-sm-100 w-md-75 ms-md-3" style={{whiteSpace: "nowrap"}}>
|
||||
<div className="d-flex flex-row w-100 ms-md-3 w-sm-100 w-md-75 ms-md-3" style={{ whiteSpace: "nowrap" }}>
|
||||
<div className="d-flex flex-col rounded-0 rounded-start align-items-center px-2 bg-primary-1 my-md-3">
|
||||
<Trans i18nKey="UNITS.ITEMS" />
|
||||
</div>
|
||||
|
||||
@@ -8,6 +8,7 @@ import "../../css/radius_breakpoint_css.css";
|
||||
import "../../css/users/user-activity.css";
|
||||
import i18next from "i18next";
|
||||
import LibraryFilterModal from "../library/library-filter-modal";
|
||||
import Config from "../../../lib/config.jsx";
|
||||
|
||||
function UserActivity(props) {
|
||||
const [data, setData] = useState();
|
||||
@@ -18,6 +19,25 @@ function UserActivity(props) {
|
||||
const [libraryFilters, setLibraryFilters] = useState([]);
|
||||
const [libraries, setLibraries] = useState([]);
|
||||
const [showLibraryFilters, setShowLibraryFilters] = useState(false);
|
||||
const [config, setConfig] = useState();
|
||||
|
||||
useEffect(() => {
|
||||
const fetchConfig = async () => {
|
||||
try {
|
||||
const newConfig = await Config.getConfig();
|
||||
setConfig(newConfig);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
};
|
||||
|
||||
if (!config) {
|
||||
fetchConfig();
|
||||
}
|
||||
|
||||
const intervalId = setInterval(config, 60000 * 5);
|
||||
return () => clearInterval(intervalId);
|
||||
}, [config]);
|
||||
|
||||
const handleLibraryFilter = (selectedOptions) => {
|
||||
setLibraryFilters(selectedOptions);
|
||||
@@ -101,7 +121,9 @@ function UserActivity(props) {
|
||||
filteredData = filteredData.filter(
|
||||
(item) =>
|
||||
(libraryFilters.includes(item.ParentId) || item.ParentId == null) &&
|
||||
(streamTypeFilter == "All" ? true : item.PlayMethod === streamTypeFilter)
|
||||
(streamTypeFilter == "All"
|
||||
? true
|
||||
: item.PlayMethod === (config.settings?.IS_JELLYFIN ? streamTypeFilter : streamTypeFilter.replace("Play", "Stream")))
|
||||
);
|
||||
return (
|
||||
<div className="Activity">
|
||||
@@ -126,7 +148,7 @@ function UserActivity(props) {
|
||||
<Trans i18nKey="ITEM_ACTIVITY" />
|
||||
</h1>
|
||||
|
||||
<div className="d-flex flex-column flex-md-row" style={{whiteSpace: "nowrap"}}>
|
||||
<div className="d-flex flex-column flex-md-row" style={{ whiteSpace: "nowrap" }}>
|
||||
<Button onClick={() => setShowLibraryFilters(true)} className="ms-md-3 mb-3 my-md-3">
|
||||
<Trans i18nKey="MENU_TABS.LIBRARIES" />
|
||||
</Button>
|
||||
@@ -154,7 +176,7 @@ function UserActivity(props) {
|
||||
</FormSelect>
|
||||
</div>
|
||||
|
||||
<div className="d-flex flex-row w-100 ms-md-3 w-sm-100 w-md-75 ms-md-3" style={{whiteSpace: "nowrap"}}>
|
||||
<div className="d-flex flex-row w-100 ms-md-3 w-sm-100 w-md-75 ms-md-3" style={{ whiteSpace: "nowrap" }}>
|
||||
<div className="d-flex flex-col rounded-0 rounded-start align-items-center px-2 bg-primary-1 my-md-3">
|
||||
<Trans i18nKey="UNITS.ITEMS" />
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user