Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature add transcrption 4 widgets 957 #968

Merged
merged 4 commits into from
Jul 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added src/assets/copyImageGrey.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/copyImageWhite.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 7 additions & 7 deletions src/components/molecules/card/AnyWayCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ interface IProps {
information?: string;
organizationData?: OrgLogoData;
subtitle?: string;
BoxText?:string;
transcription?:string;
}

const getSizeFactor = (options: CardSizeOptions | undefined): number => (options?.size ? options.size : DEFAULTE_SIZE);
Expand Down Expand Up @@ -79,7 +79,7 @@ const AnyWayCard: FC<IProps> = ({
information,
organizationData,
subtitle,
BoxText
transcription
}) => {
const [element, setElement] = useState({});
const [isOpen, setOpen] = useState(false);
Expand Down Expand Up @@ -107,7 +107,7 @@ const AnyWayCard: FC<IProps> = ({
switch(widgateOpen){

case 'TextBox':
Widget = <TextBox isOpen={isOpen} onClose={handleCardEditorClose} widgetName={widgetName} text={BoxText} />
Widget = <TextBox isOpen={isOpen} onClose={handleCardEditorClose} widgetName={widgetName} text={transcription} />
break
case 'CardEditor':
Widget = <CardEditor isOpen={isOpen} onClose={handleCardEditorClose} widgetName={widgetName} text={title} />
Expand All @@ -130,12 +130,12 @@ const AnyWayCard: FC<IProps> = ({
</Tooltip>
</Box>
)}
<AnyWayButton className={classes.button} disableRipple={true} onClick={() =>{handleCardEditorOpen('TextBox')}}>
<TitleIcon />
</AnyWayButton>
{transcription?(
<AnyWayButton className={classes.button} disableRipple={true} onClick={() =>{handleCardEditorOpen('TextBox')}}>
<TitleIcon />
</AnyWayButton>):null}
</>
);

const refFn = (element: HTMLDivElement) => {
setElement(element);
if (getCardRef) {
Expand Down
1 change: 1 addition & 0 deletions src/components/organisms/CardEditorDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { MetaTag, ErrorBoundary, Typography, Button, Slider } from 'components/a
import widgetToImage from 'services/to-image.service';
import { useTranslation } from 'react-i18next';
import { blueVioletColor } from 'style';

import {initEditorBarOptions, barsWidgetsLabels, barsWidgetsTitle, NUM_OF_BARS} from 'utils/barChart.utils';

interface IProps {
Expand Down
41 changes: 29 additions & 12 deletions src/components/organisms/TextBox.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import React from 'react'
import React, { useState } from 'react'
import DialogWithHeader from '../molecules/DialogWithHeader';
import { AnyWayButton } from 'components/atoms/AnyWayButton';
import { Box, makeStyles} from '@material-ui/core'
import CopyImageWhite from 'assets/copyImageWhite.jpeg';
import CopyImageGrey from 'assets/copyImageGrey.jpeg';
import { useTranslation } from 'react-i18next';
import { Typography } from 'components/atoms';
import { transparent } from 'style';


interface IProps {
isOpen: boolean;
onClose: () => void;
Expand All @@ -15,9 +16,6 @@ interface IProps {
}
const TextBox: React.FC<IProps> = ({ isOpen,text,onClose}) => {

console.log('transaction ',text);


const useStyles = makeStyles((theme) => ({
text: {
position: 'relative', // for meta tags
Expand All @@ -40,19 +38,33 @@ const TextBox: React.FC<IProps> = ({ isOpen,text,onClose}) => {
backgroundColor: transparent,
},
},
img:{
height:'100px',
width:'100px'
}


copyImg:{
height:'70px',
width:'70px',
},
copyMessage:{
color:'blue'
}
}));

const { t } = useTranslation();

const [copyToClickBoard,SetCopyToClickBoard] = useState(false)
const [copyMessage,SetCopyMessage] = useState('')

const onCloseInitValues = () => {
onClose();
SetCopyMessage('')
SetCopyToClickBoard(false)
}

const copyHandler = () =>{
navigator.clipboard.writeText(text?text:'')
SetCopyToClickBoard(true)
SetCopyMessage('הטקסט העותק ללוח')
}

const classes = useStyles();

return (
Expand All @@ -64,8 +76,13 @@ const TextBox: React.FC<IProps> = ({ isOpen,text,onClose}) => {
</Typography.Body1>
</Box>
<Box>
<AnyWayButton onClick={() =>{navigator.clipboard.writeText(text?text:'asdsadasd')}} className={classes.button} >
<img className={classes.img} src="https://play-lh.googleusercontent.com/pcns8ys8bh1GJaCc0K2vSMSqJ_1cjWWRECAoXYgFN5fDJxAM5ZBHWuJqFRnMR5NVRlJp" alt="" />
<AnyWayButton onClick={copyHandler} className={classes.button}>
<Box>
<img className={classes.copyImg} src={copyToClickBoard?CopyImageGrey:CopyImageWhite} alt="" />
<Box className={classes.copyMessage}>
<Typography.Body2>{copyMessage}</Typography.Body2>
</Box>
</Box>
</AnyWayButton>
</Box>
</Box>
Expand Down
2 changes: 1 addition & 1 deletion src/components/organisms/WidgetsTemplate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const WidgetsTemplate: FC = () => {
<AnyWayCard
organizationData={organizationData}
information={widget.meta.information}
BoxText = {widget.data?.text?.transcription}
transcription = {widget.data?.text?.transcription}
widgetName={widget.name}
title={widget.data?.text?.title}
subtitle={widget.data?.text?.subtitle}
Expand Down
Loading