Skip to content

Commit

Permalink
Bynder and Tooltip VQA Updates (#2688)
Browse files Browse the repository at this point in the history
  • Loading branch information
finnar-bin authored Apr 22, 2024
1 parent 80315be commit f90eb0f
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 14 deletions.
10 changes: 5 additions & 5 deletions cypress/e2e/content/headTags.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ describe("Head Tags", () => {

cy.contains("Create Head Tag").click();

cy.get("[data-cy=tagCard]")
cy.get("[data-cy=newTagCard]")
.last()
.find(".MuiSelect-select")
.click({ force: true });
Expand All @@ -18,15 +18,15 @@ describe("Head Tags", () => {
.click({ force: true });

//cy.get("[data-cy=tagCard]:last-child")
cy.get("[data-cy=tagCard]")
cy.get("[data-cy=newTagCard]")
.last()
.contains("Value")
.parent()
.find("input")
.clear()
.type("Changing the value of content");

cy.get("[data-cy=tagCard]")
cy.get("[data-cy=newTagCard]")
.last()
.contains("Attribute")
.parent()
Expand All @@ -35,13 +35,13 @@ describe("Head Tags", () => {
.type("newAttr");

// Saves Head Tag
cy.get("[data-cy=tagCard]").last().find("#SaveItemButton").click();
cy.get("[data-cy=newTagCard]").last().find("#SaveItemButton").click();
cy.contains("New head tag created");

// Deletes Head Tag
cy.get("[data-cy=tagCard]")
.last()
.contains("Delete Tag")
.contains("Delete Head Tag")
.invoke("show")
.click();

Expand Down
11 changes: 11 additions & 0 deletions src/apps/content-editor/src/app/components/FieldTypeMedia.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,17 @@ export const FieldTypeMedia = ({
})}
{limit > images.length && (
<Box display="flex" gap={1}>
{!isBynderSessionValid && (
<Button
size="large"
variant="outlined"
onClick={open}
startIcon={<UploadRounded />}
fullWidth
>
Upload
</Button>
)}
<Button
size="large"
variant="outlined"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,16 @@ export const TooltipBody = ({
<Typography variant="body2" fontWeight="700" pb={1}>
Common Uses
</Typography>
<Box pl={2} component="ul">
<Box pl={3} component="ul">
{commonUses.map((string, index) => (
<Typography
variant="body3"
color="text.secondary"
component="li"
key={index}
sx={{
display: "list-item",
}}
>
{string}
</Typography>
Expand Down
20 changes: 13 additions & 7 deletions src/shell/components/FieldTypeTinyMCE/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,10 @@ export const FieldTypeTinyMCE = React.memo(function FieldTypeTinyMCE({
const [isSkinLoaded, setIsSkinLoaded] = useState(false);
const [isBynderOpen, setIsBynderOpen] = useState(false);

// Checks if the bynder portal and token are set
const isBynderSessionValid =
localStorage.getItem("cvrt") && localStorage.getItem("cvad");

// NOTE: update if version changes
useEffect(() => {
setInitialValue(value);
Expand Down Expand Up @@ -428,13 +432,15 @@ export const FieldTypeTinyMCE = React.memo(function FieldTypeTinyMCE({
editor.addCommand("mceBynder", () => setIsBynderOpen(true));

// Bynder button
editor.ui.registry.addButton("bynder", {
icon: "bynder",
tooltip: "Select media from your Bynder assets",
onAction: () => {
setIsBynderOpen(true);
},
});
if (isBynderSessionValid) {
editor.ui.registry.addButton("bynder", {
icon: "bynder",
tooltip: "Select media from your Bynder assets",
onAction: () => {
setIsBynderOpen(true);
},
});
}
},
}}
/>
Expand Down
6 changes: 5 additions & 1 deletion src/shell/components/Head/HeadTag/HeadTag.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,11 @@ export const HeadTag = (props) => {

let { tag, dispatch } = props;
return (
<Card data-cy="tagCard" className={styles.HeadTag} sx={{ m: 2 }}>
<Card
data-cy={tag.hasOwnProperty("createdAt") ? "tagCard" : "newTagCard"}
className={styles.HeadTag}
sx={{ m: 2 }}
>
<CardHeader
title={
<Box
Expand Down

0 comments on commit f90eb0f

Please sign in to comment.