Ver código fonte

responsive view for files with docx and dox extensions

FE_dev
Dzenis Hadzifejzovic 3 anos atrás
pai
commit
28326285e8

+ 32
- 3
src/assets/styles/components/_files.scss Ver arquivo

margin-left: 0px; margin-left: 0px;
} }


.reset-filters{
.reset-filters {
margin-left: 30px; margin-left: 30px;
} }


width: 100% !important; width: 100% !important;
} }


// for showing pdf file on mobile phone
// .pdf-canvas canvas {
// width: 250% !important;
// }

.pg-viewer-wrapper .document-container { .pg-viewer-wrapper .document-container {
width: 100% !important; width: 100% !important;
background: none;
} }


.document-container { .document-container {
height: 100%;
background-color: transparent !important;
} }


.files-page-categories { .files-page-categories {
} }
} }


.files-viewer-custom-modal {
display: flex;
flex-direction: column;
@include media-below($bp-xl) {
width: 95% !important;
height: 90% !important;
padding: 0px;
margin: 0px;
}
}

.files-edit-note { .files-edit-note {
margin-bottom: 12px; margin-bottom: 12px;
} }
width: 105px; width: 105px;
height: 31px; height: 31px;
} }

.file-viewer-close-btn {
width: 100px;
align-self: flex-end;
margin-top: 20px;
}

.reset-filter-responsive {
align-self: flex-end;
padding: 0px;
margin-top: 15px;
text-decoration: underline;
cursor: pointer;
}

+ 1
- 1
src/components/UI/CustomModal.js Ver arquivo

top: "50%", top: "50%",
left: "50%", left: "50%",
transform: "translate(-50%, -50%)", transform: "translate(-50%, -50%)",
width: 400,
width: 1000,
bgcolor: "background.paper", bgcolor: "background.paper",
border: "2px solid #000", border: "2px solid #000",
boxShadow: 24, boxShadow: 24,

+ 105
- 41
src/pages/FilesPage/FileTable.js Ver arquivo

getFilesReq, getFilesReq,
setContent, setContent,
updateFileReq, updateFileReq,
resetFilters
resetFilters,
} from "../../store/actions/files/fileActions"; } from "../../store/actions/files/fileActions";
import { Fade, Pagination } from "@mui/material"; import { Fade, Pagination } from "@mui/material";
import FilterButton from "../../components/Button/FilterButton"; import FilterButton from "../../components/Button/FilterButton";


const displayFile = (fileStream, streamId, fileType) => { const displayFile = (fileStream, streamId, fileType) => {
setFile({ fileStream, streamId, fileType }); setFile({ fileStream, streamId, fileType });
console.log("Matches je", matches);
}; };


const getPathForFile = (fileType, fileStream) => { const getPathForFile = (fileType, fileStream) => {
}; };


const resFilters = () => { const resFilters = () => {
dispatch(resetFilters())
dispatch(resetFilters());
dispatch( dispatch(
getFilesReq({ getFilesReq({
payload: { payload: {
</div> </div>
</div> </div>
) : ( ) : (
<div>
<div style={{ display: "flex", flexDirection: "column" }}>
<ConfirmDialog <ConfirmDialog
open={fileForDelete.open} open={fileForDelete.open}
title={t("files.confirmDialogTitle")} title={t("files.confirmDialogTitle")}
setFileForDelete({ open: false, title: "", streamId: null }); setFileForDelete({ open: false, title: "", streamId: null });
}} }}
/> />
<CustomModal
classes="files-viewer-custom-modal"
open={file && matches}
onCloseModal={() => setFile(null)}
>
{file !== null ? (
<div
style={{
width: "100%",
overflowY: "auto",
overflowX: "auto",
height: "95%",
}}
>
<FileViewer
fileType={file.fileType}
filePath={getPathForFile(file.fileType, file.fileStream)}
onError={onError}
/>
</div>
) : (
""
)}
<Button
type="button"
variant="contained"
className="c-btn c-btn--primary-outlined file-viewer-close-btn"
onClick={() => setFile(null)}
>
{t("files.close")}
</Button>
</CustomModal>
<CustomModal <CustomModal
classes="files-custom-modal" classes="files-custom-modal"
open={openNoteModal.open} open={openNoteModal.open}
</IconButton> </IconButton>
)} )}
<FilterButton onShowFilters={handleToggleFiltersDrawer} /> <FilterButton onShowFilters={handleToggleFiltersDrawer} />
<IconButton
className="c-btn c-btn--primary-outlined candidate-btn reset-filters userPageBtn ml-20px no-padding custom-filter-button"
onClick={resFilters}
>
{!matches ? t("filters.resetFilters") : null}
</IconButton>
{!matches ? (
<IconButton
className="c-btn c-btn--primary-outlined candidate-btn reset-filters userPageBtn ml-20px no-padding custom-filter-button"
onClick={resFilters}
>
{t("filters.resetFilters")}
</IconButton>
) : (
""
)}
</div> </div>
</div> </div>
{matches ? (
<p
className="reset-filter-responsive"
onClick={resFilters}
style={{ alignSelf: "flex-end" }}
>
{t("filters.resetFilters")}
</p>
) : (
""
)}
<div <div
style={{ style={{
display: "flex", display: "flex",
marginTop: "39px",
marginTop: "30px",
justifyContent: "space-between", justifyContent: "space-between",
}} }}
> >
display: "flex", display: "flex",
width: matches ? "75vw" : "85vw", width: matches ? "75vw" : "85vw",
flexDirection: "row", flexDirection: "row",
justifyContent: "space-between",
}} }}
> >
<table <table
className="headingRow headingRowFiles" className="headingRow headingRowFiles"
style={{ cursor: "pointer" }} style={{ cursor: "pointer" }}
> >
{file === null ? <th>{t("files.doucmentPath")}</th> : ""}
{file === null || matches ? (
<th>{t("files.doucmentPath")}</th>
) : (
""
)}
<th>{t("files.doucmentName")}</th> <th>{t("files.doucmentName")}</th>
{file === null ? <th>{t("files.doucmentType")}</th> : ""}
{file === null ? <th>{t("files.doucmentSize")} (kB)</th> : ""}
{file === null ? <th>{t("files.deleteDocument")}</th> : ""}
{file === null ? <th>{t("files.note")}</th> : ""}
{file === null || matches ? (
<th>{t("files.doucmentType")}</th>
) : (
""
)}
{file === null || matches ? (
<th>{t("files.doucmentSize")} (kB)</th>
) : (
""
)}
<th>{t("files.deleteDocument")}</th>
{file === null || matches ? <th>{t("files.note")}</th> : ""}
<th>{t("files.downloadDocument")}</th> <th>{t("files.downloadDocument")}</th>
</tr> </tr>
</thead> </thead>
displayFile(n.file_stream, n.stream_id, n.file_type) displayFile(n.file_stream, n.stream_id, n.file_type)
} }
> >
{file === null ? (
{file === null || matches ? (
<td className="docs-name">{n.fileName}</td> <td className="docs-name">{n.fileName}</td>
) : ( ) : (
"" ""
)} )}
<td className="docs-name">{n.title}</td> <td className="docs-name">{n.title}</td>
{file === null ? <td>{n.file_type && n.file_type}</td> : ""}

{file === null ? (
<td className="profession">
{<NumericLabel>{n.cached_file_size}</NumericLabel>}
</td>
{file === null || matches ? (
<td>{n.file_type && n.file_type}</td>
) : ( ) : (
"" ""
)} )}
{file === null ? (

{file === null || matches ? (
<td className="profession"> <td className="profession">
<IconButton
className="c-btn c-btn--primary-outlined"
onClick={() =>
setFileForDelete({
open: true,
title: n.title,
streamId: n.stream_id,
})
}
>
<img
style={{ width: "12px", height: "12px" }}
src={deleteIcon}
/>
</IconButton>
{<NumericLabel>{n.cached_file_size}</NumericLabel>}
</td> </td>
) : ( ) : (
"" ""
)} )}
{file === null ? (
<td className="profession">
<IconButton
className="c-btn c-btn--primary-outlined"
onClick={() =>
setFileForDelete({
open: true,
title: n.title,
streamId: n.stream_id,
})
}
>
<img
style={{ width: "12px", height: "12px" }}
src={deleteIcon}
/>
</IconButton>
</td>

{file === null || matches ? (
<td className="profession"> <td className="profession">
<IconButton <IconButton
className="c-btn c-btn--primary-outlined" className="c-btn c-btn--primary-outlined"
))} ))}
</tbody> </tbody>
</table> </table>
{file !== null ? (
{file !== null && !matches ? (
<div <div
style={{ style={{
width: "100%",
width: "750px",
marginLeft: "30px", marginLeft: "30px",
overflowY: "auto", overflowY: "auto",
height: "350px", height: "350px",
zIndex: 1000000,
backgroundColor: "#F0F0F0",
}} }}
> >
<FileViewer <FileViewer

Carregando…
Cancelar
Salvar