Skip to content

Commit

Permalink
PR fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
corinagum committed Aug 22, 2019
1 parent 0ea54ec commit 7493ae7
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ function stripSubmitAction(card) {
}

const AdaptiveCardAttachment = ({ adaptiveCardHostConfig, adaptiveCards, attachment: { content }, renderMarkdown }) => {
const createAdaptiveCard = useMemo(() => {
const { card } = useMemo(() => {
if (content) {
const card = new adaptiveCards.AdaptiveCard();
const errors = [];
Expand All @@ -41,8 +41,6 @@ const AdaptiveCardAttachment = ({ adaptiveCardHostConfig, adaptiveCards, attachm
}
}, [adaptiveCards, content]);

const { card } = createAdaptiveCard;

return (
<AdaptiveCardRenderer
adaptiveCard={card}
Expand Down
10 changes: 5 additions & 5 deletions packages/bundle/src/adaptiveCards/Attachment/CommonCard.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import PropTypes from 'prop-types';
import React, { useMemo } from 'react';

import { connectToWebChat } from 'botframework-webchat-component';
import AdaptiveCardBuilder from './AdaptiveCardBuilder';
import AdaptiveCardRenderer from './AdaptiveCardRenderer';

import PropTypes from 'prop-types';
import React, { useMemo } from 'react';

const CommonCard = ({ adaptiveCardHostConfig, adaptiveCards, attachment: { content }, styleSet: { options } }) => {
const buildCard = useMemo(() => {
const builtCard = useMemo(() => {
if (content) {
const builder = new AdaptiveCardBuilder(adaptiveCards, options);

Expand All @@ -18,7 +18,7 @@ const CommonCard = ({ adaptiveCardHostConfig, adaptiveCards, attachment: { conte

return (
<AdaptiveCardRenderer
adaptiveCard={buildCard}
adaptiveCard={builtCard}
adaptiveCardHostConfig={adaptiveCardHostConfig}
tapAction={content && content.tap}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,21 @@ const HeroCardAttachment = ({
attachment: { content } = {},
styleSet: { options }
}) => {
const buildCard = useMemo(() => {
const builtCard = useMemo(() => {
const builder = new AdaptiveCardBuilder(adaptiveCards, options);

(content.images || []).forEach(image => builder.addImage(image.url, null, image.tap));
if (content) {
(content.images || []).forEach(image => builder.addImage(image.url, null, image.tap));

builder.addCommon(content);
builder.addCommon(content);

return builder.card;
return builder.card;
}
}, [adaptiveCards, content, options]);

return (
<AdaptiveCardRenderer
adaptiveCard={buildCard}
adaptiveCard={builtCard}
adaptiveCardHostConfig={adaptiveCardHostConfig}
tapAction={content && content.tap}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const OAuthCardAttachment = ({
attachment: { content } = {},
styleSet: { options }
}) => {
const buildCard = useMemo(() => {
const builtCard = useMemo(() => {
if (content) {
const builder = new AdaptiveCardBuilder(adaptiveCards, options);

Expand All @@ -22,7 +22,7 @@ const OAuthCardAttachment = ({
}
}, [adaptiveCards, content, options]);

return <AdaptiveCardRenderer adaptiveCard={buildCard} adaptiveCardHostConfig={adaptiveCardHostConfig} />;
return <AdaptiveCardRenderer adaptiveCard={builtCard} adaptiveCardHostConfig={adaptiveCardHostConfig} />;
};

OAuthCardAttachment.propTypes = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const ReceiptCardAttachment = ({
language,
styleSet: { options }
}) => {
const buildCard = useMemo(() => {
const builtCard = useMemo(() => {
const builder = new AdaptiveCardBuilder(adaptiveCards, options);
const { HorizontalAlignment, TextSize, TextWeight } = adaptiveCards;
const { buttons, fact, items, tax, title, total, vat } = content;
Expand Down Expand Up @@ -106,9 +106,10 @@ const ReceiptCardAttachment = ({
});
}
}, [adaptiveCards, content, language, options]);

return (
<AdaptiveCardRenderer
adaptiveCard={buildCard}
adaptiveCard={builtCard}
adaptiveCardHostConfig={adaptiveCardHostConfig}
tapAction={content && content.tap}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const ThumbnailCardAttachment = ({
attachment: { content } = {},
styleSet: { options }
}) => {
const buildCard = useMemo(() => {
const builtCard = useMemo(() => {
if (content) {
const builder = new AdaptiveCardBuilder(adaptiveCards, options);
const { TextSize, TextWeight } = adaptiveCards;
Expand Down Expand Up @@ -43,7 +43,7 @@ const ThumbnailCardAttachment = ({

return (
<AdaptiveCardRenderer
adaptiveCard={buildCard}
adaptiveCard={builtCard}
adaptiveCardHostConfig={adaptiveCardHostConfig}
tapAction={content && content.tap}
/>
Expand Down
2 changes: 0 additions & 2 deletions packages/component/src/Composer.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* eslint react/no-unsafe: off */

import {
Composer as ScrollToBottomComposer,
FunctionContext as ScrollToBottomFunctionContext
Expand Down
2 changes: 0 additions & 2 deletions packages/component/src/SendBox/ConnectivityStatus.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* eslint react/no-unsafe: off */

import PropTypes from 'prop-types';
import React, { useCallback, useEffect, useState } from 'react';

Expand Down
2 changes: 0 additions & 2 deletions packages/component/src/Utils/AbsoluteTime.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* eslint react/no-unsafe: off */

import PropTypes from 'prop-types';
import React from 'react';

Expand Down
2 changes: 0 additions & 2 deletions packages/component/src/Utils/RelativeTime.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* eslint react/no-unsafe: off */

import PropTypes from 'prop-types';
import React, { useCallback, useState } from 'react';

Expand Down

0 comments on commit 7493ae7

Please sign in to comment.