Skip to content

Commit

Permalink
feat(Viewer): Add isPublic prop for manage panel blocks displayed
Browse files Browse the repository at this point in the history
  • Loading branch information
Merkur39 committed Jan 29, 2024
1 parent 0dcec16 commit 7f8668a
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 10 deletions.
6 changes: 3 additions & 3 deletions react/Viewer/Footer/BottomSheetContent.jsx
Expand Up @@ -5,9 +5,9 @@ import { BottomSheetItem } from '../../BottomSheet'

import getPanelBlocks, { getPanelBlocksSpecs } from '../Panel/getPanelBlocks'

const BottomSheetContent = ({ file }) => {
const BottomSheetContent = ({ file, isPublic }) => {
const panelBlocks = getPanelBlocks({
panelBlocksSpecs: getPanelBlocksSpecs(),
panelBlocksSpecs: getPanelBlocksSpecs(isPublic),
file
})

Expand All @@ -24,7 +24,7 @@ const BottomSheetContent = ({ file }) => {

BottomSheetContent.propTypes = {
file: PropTypes.object.isRequired,
contactsFullname: PropTypes.string
isPublic: PropTypes.bool
}

export default BottomSheetContent
5 changes: 3 additions & 2 deletions react/Viewer/Footer/FooterContent.jsx
Expand Up @@ -23,7 +23,7 @@ const useStyles = makeStyles(theme => ({
}
}))

const FooterContent = ({ file, toolbarRef, children }) => {
const FooterContent = ({ file, toolbarRef, children, isPublic }) => {
const styles = useStyles()

const toolbarProps = useMemo(() => ({ ref: toolbarRef }), [toolbarRef])
Expand Down Expand Up @@ -54,7 +54,7 @@ const FooterContent = ({ file, toolbarRef, children }) => {
>
{FooterActionButtonsWithFile}
</BottomSheetHeader>
<BottomSheetContent file={file} />
<BottomSheetContent file={file} isPublic={isPublic} />
</BottomSheet>
)
}
Expand All @@ -68,6 +68,7 @@ const FooterContent = ({ file, toolbarRef, children }) => {
FooterContent.propTypes = {
file: PropTypes.object.isRequired,
toolbarRef: PropTypes.object,
isPublic: PropTypes.bool,
children: PropTypes.oneOfType([
PropTypes.node,
PropTypes.arrayOf(PropTypes.node)
Expand Down
7 changes: 4 additions & 3 deletions react/Viewer/Panel/PanelContent.jsx
Expand Up @@ -9,9 +9,9 @@ import { withViewerLocales } from '../hoc/withViewerLocales'

import getPanelBlocks, { getPanelBlocksSpecs } from './getPanelBlocks'

const PanelContent = ({ file, t }) => {
const PanelContent = ({ file, isPublic, t }) => {
const panelBlocks = getPanelBlocks({
panelBlocksSpecs: getPanelBlocksSpecs(),
panelBlocksSpecs: getPanelBlocksSpecs(isPublic),
file
})

Expand Down Expand Up @@ -43,7 +43,8 @@ const PanelContent = ({ file, t }) => {
}

PanelContent.propTypes = {
file: PropTypes.object.isRequired
file: PropTypes.object.isRequired,
isPublic: PropTypes.bool
}

export default withViewerLocales(PanelContent)
4 changes: 4 additions & 0 deletions react/Viewer/ViewerContainer.jsx
Expand Up @@ -26,6 +26,7 @@ const ViewerContainer = props => {
editPathByModelProps,
children,
componentsProps,
isPublic,
...rest
} = props
const { currentIndex, files, currentURL } = props
Expand Down Expand Up @@ -66,6 +67,7 @@ const ViewerContainer = props => {
/>
</EncryptedProvider>
<ViewerInformationsWrapper
isPublic={isPublic}
disableFooter={disableFooter}
validForPanel={validForPanel}
currentFile={currentFile}
Expand Down Expand Up @@ -107,6 +109,8 @@ ViewerContainer.propTypes = {
disablePanel: PropTypes.bool,
/** Show/Hide the panel containing more information about the file only on Phone & Tablet devices */
disableFooter: PropTypes.bool,
/** If the Viewer is in public view */
isPublic: PropTypes.bool,
/* Props passed to components with the same name */
componentsProps: PropTypes.shape({
/** Used to open an Only Office file */
Expand Down
10 changes: 8 additions & 2 deletions react/Viewer/ViewerInformationsWrapper.jsx
Expand Up @@ -15,6 +15,7 @@ const ViewerInformationsWrapper = ({
disableFooter,
validForPanel,
toolbarRef,
isPublic,
children
}) => {
const theme = useTheme()
Expand All @@ -34,14 +35,18 @@ const ViewerInformationsWrapper = ({
<>
{!disableFooter && (
<Footer>
<FooterContent file={currentFile} toolbarRef={toolbarRef}>
<FooterContent
file={currentFile}
toolbarRef={toolbarRef}
isPublic={isPublic}
>
{children}
</FooterContent>
</Footer>
)}
{validForPanel && (
<InformationPanel>
<PanelContent file={currentFile} />
<PanelContent file={currentFile} isPublic={isPublic} />
</InformationPanel>
)}
</>
Expand All @@ -53,6 +58,7 @@ ViewerInformationsWrapper.propTypes = {
disableFooter: PropTypes.bool,
validForPanel: PropTypes.bool,
toolbarRef: PropTypes.object,
isPublic: PropTypes.bool,
children: PropTypes.oneOfType([
PropTypes.node,
PropTypes.arrayOf(PropTypes.node)
Expand Down

0 comments on commit 7f8668a

Please sign in to comment.