fixes: page disable menu

This commit is contained in:
arpitnath 2023-09-29 13:38:46 +05:30
parent 905d194eb5
commit 407ea635ae
8 changed files with 13 additions and 9 deletions

View file

@ -35,7 +35,7 @@ export const GlobalSettings = ({ darkMode, showHideViewerNavigationControls, sho
</label> </label>
<hr style={{ margin: '0.75rem 0' }} /> <hr style={{ margin: '0.75rem 0' }} />
<div className="menu-options mb-0"> <div className="menu-options mb-0">
<Toggle onChange={onChange} value={!showPageViwerPageNavitation} /> <Toggle onChange={onChange} value={showPageViwerPageNavitation} />
</div> </div>
</div> </div>
</Popover.Body> </Popover.Body>

View file

@ -86,7 +86,7 @@ class ViewerComponent extends React.Component {
if (byAppSlug) { if (byAppSlug) {
appDefData.globalSettings = data.globalSettings; appDefData.globalSettings = data.globalSettings;
appDefData.homePageId = data.homePageId; appDefData.homePageId = data.homePageId;
appDefData.showHideViewerNavigation = data.showHideViewerNavigation; appDefData.showViewerNavigation = data.showViewerNavigation;
} }
this.setState({ this.setState({
@ -567,7 +567,7 @@ class ViewerComponent extends React.Component {
if (appDefinition.globalSettings?.canvasMaxWidthType === 'px') if (appDefinition.globalSettings?.canvasMaxWidthType === 'px')
computedCanvasMaxWidth = computedCanvasMaxWidth =
(+appDefinition.globalSettings?.canvasMaxWidth || 1292) - (appDefinition?.showHideViewerNavigation ? 200 : 0); (+appDefinition.globalSettings?.canvasMaxWidth || 1292) - (appDefinition?.showViewerNavigation ? 200 : 0);
else if (appDefinition.globalSettings?.canvasMaxWidthType === '%') else if (appDefinition.globalSettings?.canvasMaxWidthType === '%')
computedCanvasMaxWidth = +appDefinition.globalSettings?.canvasMaxWidth + '%'; computedCanvasMaxWidth = +appDefinition.globalSettings?.canvasMaxWidth + '%';
@ -683,7 +683,7 @@ class ViewerComponent extends React.Component {
}} }}
> >
<div className="areas d-flex flex-rows"> <div className="areas d-flex flex-rows">
{appDefinition?.showHideViewerNavigation && ( {appDefinition?.showViewerNavigation && (
<ViewerNavigation <ViewerNavigation
isMobileDevice={this.props.currentLayout === 'mobile'} isMobileDevice={this.props.currentLayout === 'mobile'}
canvasBackgroundColor={this.computeCanvasBackgroundColor()} canvasBackgroundColor={this.computeCanvasBackgroundColor()}

View file

@ -1715,7 +1715,7 @@ export const buildAppDefinition = (data) => {
const appJSON = { const appJSON = {
globalSettings: editingVersion.globalSettings, globalSettings: editingVersion.globalSettings,
homePageId: editingVersion.homePageId, homePageId: editingVersion.homePageId,
showHideViewerNavigation: editingVersion.showHideViewerNavigation ?? true, showViewerNavigation: editingVersion.showViewerNavigation ?? true,
pages: pages, pages: pages,
}; };

View file

@ -123,7 +123,7 @@ const updateFor = (appDiff, currentPageId, opts) => {
}), }),
}, },
{ {
updateTypes: ['globalSettings'], updateTypes: ['globalSettings', 'generalAppDefinitionChanged'],
processingFunction: () => ({ processingFunction: () => ({
updateDiff: appDiff, updateDiff: appDiff,
type: 'global_settings', type: 'global_settings',

View file

@ -17,7 +17,7 @@ export class UpdateAppVersionEntity1691006886222 implements MigrationInterface {
new TableColumn({ new TableColumn({
name: 'show_viewer_navigation', name: 'show_viewer_navigation',
type: 'boolean', type: 'boolean',
default: false, default: true,
isNullable: false, isNullable: false,
}) })
); );

View file

@ -152,7 +152,7 @@ export class AppsController {
pages: pagesForVersion, pages: pagesForVersion,
homePageId: versionToLoad.homePageId, homePageId: versionToLoad.homePageId,
globalSettings: versionToLoad.globalSettings, globalSettings: versionToLoad.globalSettings,
showHideViewerNavigation: versionToLoad.showViewerNavigation, showViewerNavigation: versionToLoad.showViewerNavigation,
}; };
} }

View file

@ -16,7 +16,7 @@ import { JwtAuthGuard } from '../../src/modules/auth/jwt-auth.guard';
import { AppsService } from '../services/apps.service'; import { AppsService } from '../services/apps.service';
import { camelizeKeys, decamelizeKeys } from 'humps'; import { camelizeKeys, decamelizeKeys } from 'humps';
import { AppsAbilityFactory } from 'src/modules/casl/abilities/apps-ability.factory'; import { AppsAbilityFactory } from 'src/modules/casl/abilities/apps-ability.factory';
// import { AppAuthGuard } from 'src/modules/auth/app-auth.guard';
import { App } from 'src/entities/app.entity'; import { App } from 'src/entities/app.entity';
import { User } from 'src/decorators/user.decorator'; import { User } from 'src/decorators/user.decorator';

View file

@ -919,6 +919,10 @@ export class AppsService {
}; };
} }
if (typeof body?.showViewerNavigation === 'boolean') {
editableParams['showViewerNavigation'] = body.showViewerNavigation;
}
return await this.appVersionsRepository.update(version.id, editableParams); return await this.appVersionsRepository.update(version.id, editableParams);
} }