Skip to content

Commit

Permalink
feat: propose "incompatible" color coding
Browse files Browse the repository at this point in the history
  • Loading branch information
nikku committed Dec 9, 2024
1 parent c8eb94a commit 229eee0
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 12 deletions.
18 changes: 14 additions & 4 deletions assets/element-templates.css
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
--unknown-template-background-color: var(--color-red-360-100-45);
--unknown-template-hover-background-color: var(--color-red-360-100-40);

--incompatible-template-background-color: hsl(22, 100%, 55%);
--incompatible-template-hover-background-color: hsl(22, 100%, 45%);

--select-template-information-text-color: var(--color-grey-225-10-55);

--deprecated-template-hover-background-color: var(--color-grey-225-10-50);
Expand Down Expand Up @@ -78,17 +81,24 @@
background-color: var(--deprecated-template-hover-background-color);
}

.bio-properties-panel-template-not-found .bio-properties-panel-group-header-button {
background-color: var(--unknown-template-background-color);
color: var(--select-template-label-color);
fill: var(--select-template-fill-color);
}

.bio-properties-panel-template-not-found .bio-properties-panel-group-header-button:hover {
background-color: var(--unknown-template-hover-background-color);
}

.bio-properties-panel-template-not-found .bio-properties-panel-group-header-button,
.bio-properties-panel-template-incompatible .bio-properties-panel-group-header-button {
background-color: var(--unknown-template-background-color);
background-color: var(--incompatible-template-background-color);
color: var(--select-template-label-color);
fill: var(--select-template-fill-color);
}

.bio-properties-panel-template-not-found .bio-properties-panel-group-header-button:hover,
.bio-properties-panel-template-incompatible .bio-properties-panel-group-header-button:hover {
background-color: var(--unknown-template-hover-background-color);
background-color: var(--incompatible-template-hover-background-color);
}

.bio-properties-panel-template-not-found-text,
Expand Down
29 changes: 21 additions & 8 deletions src/components/ElementTemplatesGroup.js
Original file line number Diff line number Diff line change
Expand Up @@ -258,23 +258,36 @@ function OutdatedTemplate({ element, templateState }) {
{ entry: <RemoveTemplate />, action: () => elementTemplates.removeTemplate(element) }
];

const cls = compatible
? 'bio-properties-panel-template-update-available'
: 'bio-properties-panel-template-incompatible';

const text = compatible
? translate('Update available')
: translate('Incompatible (update available)');

return (
<DropdownButton menuItems={ menuItems } class="bio-properties-panel-template-update-available">
<DropdownButton menuItems={ menuItems } class={ cls }>
<HeaderButton>
<span>{ translate('Update available') }</span>
<span>{ text }</span>
<ArrowIcon class="bio-properties-panel-arrow-down" />
</HeaderButton>
</DropdownButton>
);
}

function UpdateAvailableText({ newerTemplate }) {
function UpdateAvailableText({ newerTemplate, compatible }) {
const translate = useService('translate');

const text = translate(
'A new version of the template is available: {templateVersion}',
{ templateVersion: getVersionOrDateFromTemplate(newerTemplate) }
);
const text = compatible
? translate(
'A new version of the template is available: {templateVersion}',
{ templateVersion: getVersionOrDateFromTemplate(newerTemplate) }
)
: translate(
'A version of this template is available that supports your environment: {templateVersion}',
{ templateVersion: getVersionOrDateFromTemplate(newerTemplate) }
);

return <div class="bio-properties-panel-template-update-available-text">{text}</div>;
}
Expand Down Expand Up @@ -349,7 +362,7 @@ function IncompatibleText() {
return (
<div class="bio-properties-panel-template-incompatible-text">
{ translate(
'No version of this template compatible with your environment was found.'
'No version of this template that is compatible with your environment was found.'
) }
</div>
);
Expand Down

0 comments on commit 229eee0

Please sign in to comment.