Skip to content

Commit

Permalink
Merge pull request #344 from thecalcc/fix-v2
Browse files Browse the repository at this point in the history
  • Loading branch information
thecalcc authored Nov 2, 2023
2 parents 5b1e582 + 6dfab1d commit c6a8b47
Show file tree
Hide file tree
Showing 5 changed files with 113 additions and 115 deletions.
44 changes: 24 additions & 20 deletions client/components/TargetedPublishing/MetaData.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -115,26 +115,30 @@ class MetaData extends Component {
render() {
return (
<>
<ToggleBox
title="Meta data"
style="toggle-box--dark sp--dark-ui toggle-box--circle"
isOpen={true}
>
<div className="sd-list-item-group sd-shadow--z1">
<ButtonListItem
onClick={() => this.toggleOverlay("Facebook")}
label="Facebook"
/>
<ButtonListItem
onClick={() => this.toggleOverlay("Twitter")}
label="Twitter"
/>
<ButtonListItem
onClick={() => this.toggleOverlay("SEO")}
label="SEO"
/>
</div>
</ToggleBox>
{
this.props.overlayOpen === false && (
<ToggleBox
title="Meta data"
style="toggle-box--dark sp--dark-ui toggle-box--circle"
isOpen={true}
>
<div className="sd-list-item-group sd-shadow--z1">
<ButtonListItem
onClick={() => this.toggleOverlay("Facebook")}
label="Facebook"
/>
<ButtonListItem
onClick={() => this.toggleOverlay("Twitter")}
label="Twitter"
/>
<ButtonListItem
onClick={() => this.toggleOverlay("SEO")}
label="SEO"
/>
</div>
</ToggleBox>
)
}
<MetaDataOverlay
isOpen={this.props.overlayOpen}
toggle={() => this.toggleOverlay("")}
Expand Down
21 changes: 4 additions & 17 deletions client/components/TargetedPublishing/MetaDataOverlay.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React, { Component } from "react";
import classNames from "classnames";
import PropTypes from "prop-types";

import { IconButton } from "superdesk-ui-framework/react";
Expand Down Expand Up @@ -44,20 +43,8 @@ class MetaDataOverlay extends Component {
: "";
}

const styles = this.props.isOpen ? {} : {zIndex: '-1'}
const widthHeightPersistentStyle = {width: '100%', height: '100%'};

return (
<div
style={{...styles, ...widthHeightPersistentStyle}}
className={classNames("side-panel__content-block-overlay", {
"side-panel__content-block-overlay--open": this.props.isOpen,
})}
>
<div
style={widthHeightPersistentStyle}
className="side-panel"
>
return this.props.isOpen && (
<div>
<div className="side-panel__header">
<div className="side-panel__header-wrapper sd-flex--items-center">
<span className="sd-margin-l--1">
Expand Down Expand Up @@ -117,8 +104,7 @@ class MetaDataOverlay extends Component {
</div>
</div>
</div>
</div>
);
);
}
}

Expand All @@ -130,6 +116,7 @@ MetaDataOverlay.propTypes = {
setMetaData: PropTypes.func.isRequired,
uploadImage: PropTypes.func.isRequired,
isUploadingInProgress: PropTypes.bool,
isOpen: PropTypes.bool,
};

export default MetaDataOverlay;
66 changes: 34 additions & 32 deletions client/components/TargetedPublishing/RelatedArticlesStatus.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,39 +42,41 @@ class RelatedArticlesStatus extends React.Component {
}

return (
<ToggleBox
title="Related Articles"
style="toggle-box--dark sp--dark-ui"
isOpen={true}
>
{this.state.loading && <Loading />}
<ul className="simple-list simple-list--dotted simple-list--no-padding">
{this.state.relatedArticles.map(article => (
<li className="simple-list__item" key={article.title}>
<p>{article.title}</p>
{this.props.rules.map(rule => {
let index = article.tenants.findIndex(
t => t && t.code === rule.tenant.code
);
let siteDomain = rule.tenant.subdomain
? rule.tenant.subdomain + "." + rule.tenant.domain_name
: rule.tenant.domain_name;
<div hidden={this.props.hide}>
<ToggleBox
title="Related Articles"
style="toggle-box--dark sp--dark-ui"
isOpen={true}
>
{this.state.loading && <Loading />}
<ul className="simple-list simple-list--dotted simple-list--no-padding">
{this.state.relatedArticles.map(article => (
<li className="simple-list__item" key={article.title}>
<p>{article.title}</p>
{this.props.rules.map(rule => {
let index = article.tenants.findIndex(
t => t && t.code === rule.tenant.code
);
let siteDomain = rule.tenant.subdomain
? rule.tenant.subdomain + "." + rule.tenant.domain_name
: rule.tenant.domain_name;

return (
<span
key={"site" + rule.tenant.code}
className={classNames("label-icon", {
"label-icon--success": index >= 0
})}
>
<i className="icon-globe" /> {siteDomain}
</span>
);
})}
</li>
))}
</ul>
</ToggleBox>
return (
<span
key={"site" + rule.tenant.code}
className={classNames("label-icon", {
"label-icon--success": index >= 0
})}
>
<i className="icon-globe" /> {siteDomain}
</span>
);
})}
</li>
))}
</ul>
</ToggleBox>
</div>
);
}
}
Expand Down
94 changes: 48 additions & 46 deletions client/components/TargetedPublishing/TargetedPublishing.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,55 +23,57 @@ class TargetedPublishing extends React.Component {

render() {
return (
<ToggleBox
title="Web publishing"
style="toggle-box--dark sp--dark-ui toggle-box--circle"
isOpen={true}
>
{!this.props.rules.length && (
<div className="tp-alert">
No websites have been set, this article won't show up on any
website. It will go to: <br />
<span style={{ fontWeight: "500" }}>
Publisher &gt; Output Control &gt; Incoming list
</span>
</div>
)}
{this.props.rules.map((rule, index) => (
<Destination
key={rule.tenant.code}
isOpen={false}
rule={rule}
apiHeader={this.props.apiHeader}
config={this.props.config}
item={this.props.item}
cancel={() => this.setNewDestination({})}
reload={this.props.reload}
/>
))}
<div hidden={this.props.hide}>
<ToggleBox
title="Web publishing"
style="toggle-box--dark sp--dark-ui toggle-box--circle"
isOpen={true}
>
{!this.props.rules.length && (
<div className="tp-alert">
No websites have been set, this article won't show up on any
website. It will go to: <br />
<span style={{ fontWeight: "500" }}>
Publisher &gt; Output Control &gt; Incoming list
</span>
</div>
)}
{this.props.rules.map((rule, index) => (
<Destination
key={rule.tenant.code}
isOpen={false}
rule={rule}
apiHeader={this.props.apiHeader}
config={this.props.config}
item={this.props.item}
cancel={() => this.setNewDestination({})}
reload={this.props.reload}
/>
))}

{this.state.newDestination && this.state.newDestination.id && (
<Destination
key={this.state.newDestination.id}
isOpen={true}
site={this.state.newDestination}
{this.state.newDestination && this.state.newDestination.id && (
<Destination
key={this.state.newDestination.id}
isOpen={true}
site={this.state.newDestination}
apiHeader={this.props.apiHeader}
config={this.props.config}
item={this.props.item}
cancel={() => this.setNewDestination({})}
reload={this.props.reload}
/>
)}
<AddWebsite
setNewDestination={(newDestination) => {
this.props.reload();
this.setNewDestination(newDestination);
}}
apiHeader={this.props.apiHeader}
config={this.props.config}
item={this.props.item}
cancel={() => this.setNewDestination({})}
reload={this.props.reload}
apiUrl={this.props.apiUrl}
rules={[...this.props.rules, this.state.newDestination]}
/>
)}
<AddWebsite
setNewDestination={(newDestination) => {
this.props.reload();
this.setNewDestination(newDestination);
}}
apiHeader={this.props.apiHeader}
apiUrl={this.props.apiUrl}
rules={[...this.props.rules, this.state.newDestination]}
/>
</ToggleBox>
</ToggleBox>
</div>
);
}
}
Expand Down
3 changes: 3 additions & 0 deletions client/extensions/Publishing.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ class Publishing extends React.Component {
};

render() {
console.log(this.state.item)
return (
<React.Fragment>
{this.state.ninjsError && (
Expand All @@ -124,6 +125,7 @@ class Publishing extends React.Component {
!this.state.ninjsError &&
!this.state.evaluateError && (
<TargetedPublishing
hide={this.state.overlayOpen}
config={this.props.config}
rules={this.state.rules}
apiUrl={this.state.apiUrl}
Expand All @@ -136,6 +138,7 @@ class Publishing extends React.Component {
!this.state.ninjsError &&
!this.state.evaluateError && (
<RelatedArticlesStatus
hide={this.state.overlayOpen}
rules={this.state.rules}
apiUrl={this.state.apiUrl}
apiHeader={this.state.apiHeader}
Expand Down

0 comments on commit c6a8b47

Please sign in to comment.