Display issue status in Channels card.

This commit is contained in:
Gan Eng Chin 2022-12-13 22:47:16 +08:00
parent 437ebb20a8
commit e6e6dc19ef
No known key found for this signature in database
GPG Key ID: 94D5D972860ADB01
2 changed files with 72 additions and 1 deletions

View File

@ -1,4 +1,13 @@
.woocommerce-marketing-installed-channel-card-body {
.woocommerce-marketing-installed-channel-description {
display: flex;
gap: $gap-smaller;
&__separator::before {
content: '';
}
}
.woocommerce-marketing-sync-status {
display: flex;
align-items: center;
@ -19,4 +28,20 @@
fill: #008a20;
}
}
.woocommerce-marketing-issue-status {
display: flex;
align-items: center;
gap: $gap-smallest;
&__error {
color: $alert-red;
fill: $alert-red;
}
&__warning {
color: $alert-yellow;
fill: $alert-yellow;
}
}
}

View File

@ -57,6 +57,50 @@ const SyncStatus: React.FC< SyncStatusPropsType > = ( { status } ) => {
);
};
type IssueStatusPropsType = {
installedChannel: InstalledChannel;
};
const issueStatusClassName = 'woocommerce-marketing-issue-status';
const IssueStatus: React.FC< IssueStatusPropsType > = ( {
installedChannel,
} ) => {
if ( installedChannel.issueType === 'error' ) {
return (
<div
className={ classnames(
issueStatusClassName,
`${ issueStatusClassName }__error`
) }
>
<GridiconNotice size={ iconSize } />
{ installedChannel.issueText }
</div>
);
}
if ( installedChannel.issueType === 'warning' ) {
return (
<div
className={ classnames(
issueStatusClassName,
`${ issueStatusClassName }__warning`
) }
>
<GridiconNotice size={ iconSize } />
{ installedChannel.issueText }
</div>
);
}
return (
<div className={ issueStatusClassName }>
{ installedChannel.issueText }
</div>
);
};
export const InstalledChannelCardBody: React.FC<
InstalledChannelCardBodyProps
> = ( { installedChannel } ) => {
@ -71,8 +115,10 @@ export const InstalledChannelCardBody: React.FC<
}
name={ installedChannel.title }
description={
<div>
<div className="woocommerce-marketing-installed-channel-description">
<SyncStatus status={ installedChannel.syncStatus } />
<div className="woocommerce-marketing-installed-channel-description__separator" />
<IssueStatus installedChannel={ installedChannel } />
</div>
}
button={