Skip to content

Commit

Permalink
Merge pull request neos#3681 from dlubitz/90/timeable-node-visibility
Browse files Browse the repository at this point in the history
FEATURE Add timeable node visibility
  • Loading branch information
dlubitz authored Feb 11, 2024
2 parents cb2b966 + 22be056 commit 13dccc9
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 20 deletions.
5 changes: 3 additions & 2 deletions Classes/Fusion/Helper/NodeInfoHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,9 @@ public function renderNodeWithMinimalPropertiesAndChildrenInformation(
$node->nodeAggregateId
)->isHidden,
'_hiddenInIndex' => $node->getProperty('_hiddenInIndex'),
//'_hiddenBeforeDateTime' => $node->getHiddenBeforeDateTime() instanceof \DateTimeInterface,
//'_hiddenAfterDateTime' => $node->getHiddenAfterDateTime() instanceof \DateTimeInterface,
'_hasTimeableNodeVisibility' =>
$node->getProperty('enableAfterDateTime') instanceof \DateTimeInterface
|| $node->getProperty('disableAfterDateTime') instanceof \DateTimeInterface,
];

if ($controllerContext !== null) {
Expand Down
1 change: 0 additions & 1 deletion packages/neos-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
"lodash.memoize": "^4.1.2",
"lodash.merge": "^4.6.0",
"lodash.sortby": "^4.7.0",
"moment": "^2.20.1",
"monet": "^0.9.2",
"normalize.css": "^8.0.0",
"notosans-fontface": "^1.3.0",
Expand Down
26 changes: 10 additions & 16 deletions packages/neos-ui/src/Containers/LeftSideBar/NodeTree/Node/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import {isNodeCollapsed} from '@neos-project/neos-ui-redux-store/src/CR/Nodes/he
import {neos} from '@neos-project/neos-ui-decorators';

import hashSum from 'hash-sum';
import moment from 'moment';
import {urlWithParams} from '@neos-project/utils-helpers/src/urlWithParams';

const getContextPath = node => node?.contextPath;
Expand Down Expand Up @@ -169,31 +168,26 @@ export default class Node extends PureComponent {
getCustomIconComponent() {
const {node} = this.props;

const isHidden = node?.properties?._hidden;
const isHiddenBefore = node?.properties?._hiddenBeforeDateTime;
const isHiddenAfter = node?.properties?._hiddenAfterDateTime;
const isDisabled = node?.properties?._hidden;
const hasTimeableNodeVisibility = node?.properties?._hasTimeableNodeVisibility;

if (hasTimeableNodeVisibility) {
const circleColor = isDisabled ? 'error' : 'primaryBlue';

if (isHidden) {
return (
<span className="fa-layers fa-fw">
<Icon icon={this.getIcon()} />
<Icon icon="circle" color="error" transform="shrink-3 down-6 right-4" />
<Icon icon="times" transform="shrink-7 down-6 right-4" />
<Icon icon="circle" color={circleColor} transform="shrink-5 down-6 right-4" />
<Icon icon="clock" transform="shrink-9 down-6 right-4" />
</span>
);
}

if (isHiddenBefore || isHiddenAfter) {
let isCurrentlyHidden = false;
isCurrentlyHidden = isHiddenBefore && moment(isHiddenBefore).isAfter(moment()) ? true : isCurrentlyHidden;
isCurrentlyHidden = isHiddenAfter && moment(isHiddenAfter).isBefore(moment()) ? true : isCurrentlyHidden;
const circleColor = isCurrentlyHidden ? 'error' : 'primaryBlue';

if (isDisabled) {
return (
<span className="fa-layers fa-fw">
<Icon icon={this.getIcon()} />
<Icon icon="circle" color={circleColor} transform="shrink-5 down-6 right-4" />
<Icon icon="clock" transform="shrink-9 down-6 right-4" />
<Icon icon="circle" color="error" transform="shrink-3 down-6 right-4" />
<Icon icon="times" transform="shrink-7 down-6 right-4" />
</span>
);
}
Expand Down
1 change: 0 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2644,7 +2644,6 @@ __metadata:
lodash.memoize: ^4.1.2
lodash.merge: ^4.6.0
lodash.sortby: ^4.7.0
moment: ^2.20.1
monet: ^0.9.2
normalize.css: ^8.0.0
notosans-fontface: ^1.3.0
Expand Down

0 comments on commit 13dccc9

Please sign in to comment.