Web: Files: fixed view for mobile devices

This commit is contained in:
Nikita Gopienko 2021-09-27 11:53:22 +03:00
parent bab3425bd1
commit 790d696a58
4 changed files with 8 additions and 4 deletions

View File

@ -2,12 +2,13 @@ import React, { useEffect } from "react";
import { inject, observer } from "mobx-react";
import RowContainer from "@appserver/components/row-container";
import SimpleFilesRow from "./SimpleFilesRow";
import { isMobile } from "react-device-detect";
const FilesRowContainer = ({ filesList, sectionWidth, viewAs, setViewAs }) => {
useEffect(() => {
if ((viewAs !== "table" && viewAs !== "row") || !sectionWidth) return;
if (sectionWidth < 1025) {
if (sectionWidth < 1025 || isMobile) {
viewAs !== "row" && setViewAs("row");
} else {
viewAs !== "table" && setViewAs("table");

View File

@ -4,6 +4,7 @@ import { inject, observer } from "mobx-react";
import TableRow from "./TableRow";
import TableHeader from "./TableHeader";
import TableBody from "@appserver/components/table-container/TableBody";
import { isMobile } from "react-device-detect";
const Table = ({ filesList, sectionWidth, viewAs, setViewAs }) => {
const ref = useRef(null);
@ -11,7 +12,7 @@ const Table = ({ filesList, sectionWidth, viewAs, setViewAs }) => {
useEffect(() => {
if ((viewAs !== "table" && viewAs !== "row") || !setViewAs) return;
if (sectionWidth < 1025) {
if (sectionWidth < 1025 || isMobile) {
viewAs !== "row" && setViewAs("row");
} else {
viewAs !== "table" && setViewAs("table");

View File

@ -3,6 +3,7 @@ import { inject, observer } from "mobx-react";
import RowContainer from "@appserver/components/row-container";
import SimpleUserRow from "./SimpleUserRow";
import EmptyScreen from "../EmptyScreen";
import { isMobile } from "react-device-detect";
const PeopleRowContainer = ({
peopleList,
@ -13,7 +14,7 @@ const PeopleRowContainer = ({
useEffect(() => {
if (viewAs !== "table" && viewAs !== "row") return;
if (sectionWidth < 1025) {
if (sectionWidth < 1025 || isMobile) {
viewAs !== "row" && setViewAs("row");
} else {
viewAs !== "table" && setViewAs("table");

View File

@ -5,13 +5,14 @@ import TableRow from "./TableRow";
import TableHeader from "./TableHeader";
import TableBody from "@appserver/components/table-container/TableBody";
import EmptyScreen from "../EmptyScreen";
import { isMobile } from "react-device-detect";
const Table = ({ peopleList, sectionWidth, viewAs, setViewAs }) => {
const ref = useRef(null);
useEffect(() => {
if (!sectionWidth) return;
if (sectionWidth < 1025) {
if (sectionWidth < 1025 || isMobile) {
viewAs !== "row" && setViewAs("row");
} else {
viewAs !== "table" && setViewAs("table");