How to use genText method in Playwright Internal

Best JavaScript code snippet using playwright-internal

owndecker.js

Source:owndecker.js Github

copy

Full Screen

1import React from 'react';2import { Platform, SafeAreaView,KeyboardAvoidingView, Text, AsyncStorage , TextInput, View, Dimensions, Animated, PanResponder, ActivityIndicator, ScrollView, TouchableWithoutFeedback , TouchableOpacity} from 'react-native';3import {styles} from './assets/styles/styles'4import { Header } from 'react-navigation';5const SCREEN_HEIGHT = Dimensions.get('window').height6const SCREEN_WIDTH = Dimensions.get('window').width7import Icon from 'react-native-vector-icons/Ionicons'8import { AuthSession } from 'expo';9export default class Decker extends React.Component {10 constructor() {11 super();12 this.email = 'hi';13 this.position = new Animated.ValueXY();14 this.swipedPosition = new Animated.ValueXY({ x: -SCREEN_WIDTH-100, y:0 });15 this.gestPosition = new Animated.ValueXY();16 this.state = {17 currentIndex: 0,18 isLoading: true,19 }20 this.lastIndex = 421 this.rotate = this.position.x.interpolate({22 inputRange: [-SCREEN_WIDTH / 2, 0],23 outputRange: ['-10deg', '0deg'],24 extrapolate: 'clamp'25 })26 this.cardOpacity = this.gestPosition.x.interpolate({27 inputRange: [0,SCREEN_WIDTH / 2],28 outputRange: [1, 0.5],29 extrapolate: 'clamp'30 })31 this.cardScale = this.gestPosition.x.interpolate({32 inputRange: [0,SCREEN_WIDTH / 2],33 outputRange: [1, 0.8],34 extrapolate: 'clamp'35 })36 this.swipedRotate = this.swipedPosition.x.interpolate({37 inputRange: [-SCREEN_WIDTH / 2, 0],38 outputRange: ['-10deg','0deg'],39 extrapolate: 'clamp'40 })41 this.rotateAndTranslate = {42 opacity: this.cardOpacity, 43 44 transform: [{45 rotate: this.rotate,46 47 },48 {49 scale: this.cardScale50 },51 ...this.position.getTranslateTransform()52 ]53 }54 this.swipedTrasnform = {55 transform: [{56 rotate: this.swipedRotate57 },58 ...this.swipedPosition.getTranslateTransform()59 ]60 }61 this.nextCardOpacity = this.position.x.interpolate({62 inputRange: [-SCREEN_WIDTH / 2, 0],63 outputRange: [1, 0],64 extrapolate: 'clamp'65 })66 this.nextCardScale = this.position.x.interpolate({67 inputRange: [-SCREEN_WIDTH / 2, 0],68 outputRange: [1, 0.8],69 extrapolate: 'clamp'70 })71 }72 componentWillMount() { 73 74userMail = AsyncStorage.getItem('userMail', (err, result) => {75 76 let maill = JSON.parse(result);77 maill = maill.mail;78 this.email = maill ;79}).then(()=>{80 fetch('http://ec2-3-14-86-69.us-east-2.compute.amazonaws.com/ownprojects?email='+this.email)81 .then((response) => response.json())82 .then((responseJson) => {83 // console.log(JSON.stringify(responseJson));84 var arr = Object.keys(responseJson).map((k) => { return {id:k ,...responseJson[k]} });85 // console.log(arr);86 this.setState({87 isLoading: false,88 dataSource: arr,89 })90 this.lastIndex = arr.length - 1;91 })92 .catch((error) =>{93 console.error(error);94 }); 95});96 97 this.PanResponder = PanResponder.create({98 onStartShouldSetPanResponder: (evt, gestureState) => true,99 onPanResponderMove: (evt, gestureState) => {100 101 if(gestureState.dx<0) {102 this.position.setValue({ x: gestureState.dx, y: gestureState.dy });103 }104 else if(gestureState.dx>0 && this.state.currentIndex > 0) {105 this.swipedPosition.setValue({ x:-SCREEN_WIDTH - 100 + gestureState.dx, y: 0})106 }107 this.gestPosition.setValue({ x: gestureState.dx, y: gestureState.dy })108 },109 onPanResponderRelease: (evt, gestureState) => {110 if (gestureState.dx > 120) { // swipe right (load previous card) 111 Animated.timing(this.swipedPosition, {112 toValue: { x:0, y:0 },113 duration: 150114 }).start(() => {115 this.setState({ currentIndex: (this.state.currentIndex) ? this.state.currentIndex - 1: 0 }, () => {116 this.position.setValue({ x: 0, y: 0 })117 this.swipedPosition.setValue({ x:-SCREEN_WIDTH-100, y:0 })118 this.gestPosition.setValue({ x: 0, y: 0 })119 });120 });121 }122 else if (gestureState.dx < -120 && this.state.currentIndex < this.lastIndex) { 123 // swipe left (load next card)124 Animated.timing(this.position, {125 toValue: { x: -SCREEN_WIDTH - 100, y: gestureState.dy },126 duration: 150127 }).start(() => {128 this.setState({ currentIndex: (this.state.currentIndex<this.lastIndex) ? this.state.currentIndex + 1:this.lastIndex },129 () => {130 this.position.setValue({ x: 0, y: 0 })131 this.swipedPosition.setValue({ x:-SCREEN_WIDTH-100, y:0})132 this.gestPosition.setValue({ x: 0, y: 0 })133 });134 }); 135 }136 else {137 Animated.spring(this.position, {138 toValue: { x: 0, y: 0 },139 friction: 4140 }).start()141 Animated.spring(this.gestPosition, {142 toValue: { x: 0, y: 0 },143 friction: 4144 }).start()145 Animated.spring(this.swipedPosition, {146 toValue: { x: -SCREEN_WIDTH - 100, y: 0 },147 friction: 4148 }).start()149 }150 }151 })152 }153 onFocus = () => {154 this.setState({155 backgroundColor: 'green'156 })157 }158 onBlur = () => {159 this.setState({160 backgroundColor: '#ededed'161 })162 }163 _renderHeader= (item) => {164 return(165 <View style={styles.cardHeader}>166 <Text 167 style={styles.projectName}>{item.projectName}</Text>168 </View>169 )170 }171 _renderContent = (item) => {172 return(173 <View style={styles.cardContent}>174 <ScrollView >175 <TouchableWithoutFeedback>176 <View style={{padding:3}}>177 <Text style={styles.genText}>Short Desc- {item.shortDescription}</Text>178 {/* <Text style={styles.genText}>Account NO.- {item.accountNo}</Text>179 <Text style={styles.genText}>IFSC Code- {item.ifscCode}</Text>180 <Text style={styles.genText}>Education Qualification- {item.education}</Text> */}181 <Text style={styles.genText}>Project Status- {item.projectstatus}</Text>182 <Text style={styles.genText}>Total Amount- {item.projectbalance}</Text>183 <Text style={styles.genText}>Total Withdrawn Amount- {item.projectwithdrawn}</Text>184 <Text style={styles.genText}>Current Amount- {item.currentbalance}</Text>185 <Text style={styles.genText}>Requested Amount- {item.requestedbalance}</Text>186 <Text style={styles.genText}>Last Money Request- {item.moneystatus}</Text>187 <Text style={styles.genText}>Long Desc- {item.longDescription}</Text>188 </View>189 </TouchableWithoutFeedback>190 </ScrollView>191 </View>192 )193 }194 _renderFooter = () => {195 return(196 <View style={[styles.cardFooter,{flexDirection:'column'}]}>197 <View style={styles.cardFooter}>198 <TextInput199 adjustsFontSizeToFit={true}200 numberOfLines={1}201 placeholder="Enter Withdrawl Message"202 editable = {true}203 style={styles.textInput}204 onChangeText={(text) => this.setState({msg:text})}205 />206 </View>207 <View style={styles.cardFooter}> 208 <TextInput209 adjustsFontSizeToFit={true}210 numberOfLines={1}211 placeholder="Enter Amount"212 editable = {true}213 keyboardType = "number-pad"214 style={styles.textInput}215 onChangeText={(text) => this.setState({amount:text})}216 />217 <TouchableOpacity style={styles.submitButton}218 onPress={() => {219 console.log(this.state.dataSource[this.state.currentIndex].refID);220 fetch('http://ec2-3-14-86-69.us-east-2.compute.amazonaws.com/requestMoney?id='+this.state.dataSource[this.state.currentIndex].refID+"&id2="+this.state.amount+"&id3="+this.state.msg)221 .then(222 alert("Money Requested Successfully.")223 )224 .catch((error) =>{225 console.error(error);226 }); 227 }}228 >229 <View style={{}}>230 <Text231 style={{fontSize:15, color:'#000000'}}>Request</Text>232 </View>233 </TouchableOpacity>234 235 </View> 236 </View>237 )238 }239 renderUsers = () => {240 if(this.state.isLoading==true)241 return(242 <ActivityIndicator/>243 );244 return this.state.dataSource.map((item, i) => {245 if (i==this.state.currentIndex - 1){246 return (247 <Animated.View248 key={item.id} style={[this.swipedTrasnform, styles.card]}>249 {this._renderHeader(item)}250 {this._renderContent(item)}251 </Animated.View>252 )253 }254 else if (i == this.state.currentIndex) {255 return (256 <Animated.View257 {...this.PanResponder.panHandlers}258 key={item.id} style={[this.rotateAndTranslate, styles.card]}>259 {this._renderHeader(item)}260 {this._renderContent(item)}261 </Animated.View>262 )263 }264 else if(i == this.state.currentIndex + 1){265 266 return (267 <Animated.View268 key={item.id} style={[{269 opacity: this.nextCardOpacity,270 transform: [{ scale: this.nextCardScale }],271 272 }, styles.card]}>273 {this._renderHeader(item)}274 {this._renderContent(item)}275 </Animated.View>276 )277 }278 else 279 return null280 }).reverse()281 }282 render() {283 return (284 <KeyboardAvoidingView behavior='height' style={{ flex: 1 }} keyboardVerticalOffset = {Header.HEIGHT + 30}>285 <SafeAreaView style={{ flex:1 }}>286 <View style={{flex: 1, justifyContent: 'flex-end',flexDirection:'column'}}>287 <View style={{ backgroundColor: '#ededed',flex:1}}>288 {this.renderUsers()}289 </View>290 {this._renderFooter()}291 </View>292 </SafeAreaView>293 {/* <View style={{flex:1, justifyContent:'flex-end',flexDirection:'column', backgroundColor:'red'}}>294 <TextInput style={styles.textInput}></TextInput>295 <View style={{height:100, backgroundColor:'green'}}></View>296 </View> */}297 </KeyboardAvoidingView>298 );299 }...

Full Screen

Full Screen

receive.js

Source:receive.js Github

copy

Full Screen

...103 response = Response.genNuxMessage(this.user);104 response.push(Datos.servicios());105 } else if (payload === 'EMPRENDEDOR') {106 response = [107 Response.genText(i18n.__('datos.emprendedor')),108 Response.genText(i18n.__('datos.etapa')),109 Datos.etapa(),110 'Emprendimiento Digital'111 ];112 } else if (payload === 'TRANSF') {113 response = [114 Response.genText(i18n.__('datos.transf')),115 Response.genText(i18n.__('datos.situacion')),116 Datos.transf(),117 'Transformación Digital'118 ];119 } else if (payload === 'DISENO') {120 response = [121 Response.genText(i18n.__('datos.diseno')),122 Response.genText(i18n.__('datos.desarrollo')),123 Datos.diseno(),124 'Diseño Web'125 ];126 } else if (payload === 'ET1') {127 response = [128 Response.genText(i18n.__('datos.confirmacion', { user_first_name: this.user.firstName})),129 Response.genText(i18n.__('datos.proyecto')),130 'Idea'131 ];132 } else if (payload === 'ET2') {133 response = [134 Response.genText(i18n.__('datos.confirmacion', { user_first_name: this.user.firstName})),135 Response.genText(i18n.__('datos.proyecto')),136 'Modelo de Negocio'137 ];138 } else if (payload === 'ET3') {139 response = [140 Response.genText(i18n.__('datos.confirmacion', { user_first_name: this.user.firstName})),141 Response.genText(i18n.__('datos.proyecto')),142 'Capital semilla y/o primeras ventas'143 ];144 } else if (payload === 'TR1') {145 response = [146 Response.genText(i18n.__('datos.confirmacion', { user_first_name: this.user.firstName})),147 Response.genText(i18n.__('datos.proyecto')),148 'No tengo sistema'149 ];150 } else if (payload === 'TR2') {151 response = [152 Response.genText(i18n.__('datos.confirmacion', { user_first_name: this.user.firstName})),153 Response.genText(i18n.__('datos.proyecto')),154 'Mi sistema es insuficiente'155 ];156 } else if (payload === 'TR3') {157 response = [158 Response.genText(i18n.__('datos.confirmacion', { user_first_name: this.user.firstName})),159 Response.genText(i18n.__('datos.proyecto')),160 'Mi sistema es costoso'161 ];162 } else if (payload === 'DN1') {163 response = [164 Response.genText(i18n.__('datos.confirmacion', { user_first_name: this.user.firstName})),165 Response.genText(i18n.__('datos.proyecto')),166 'Landing Page'167 ];168 } else if (payload === 'DN2') {169 response = [170 Response.genText(i18n.__('datos.confirmacion', { user_first_name: this.user.firstName})),171 Response.genText(i18n.__('datos.proyecto')),172 'Tienda en Línea'173 ];174 } else if (payload === 'DN3') {175 response = [176 Response.genText(i18n.__('datos.confirmacion', { user_first_name: this.user.firstName})),177 Response.genText(i18n.__('datos.proyecto')),178 'Aplicación Web'179 ];180 } else if (payload.includes('@') || payload === 'MAS_TARDE') {181 response = [182 Response.genAskPhone(payload),183 payload184 ];185 } else if (payload.includes('+') || Number(payload) || payload === 'MAS_TARDE2') {186 response = [];187 response.push(Response.genText(i18n.__('despedida.pronto', { user_first_name: this.user.firstName})));188 response.push(Response.genText(i18n.__('despedida.pagina')));189 response.push(Response.urlButton(i18n.__('despedida.texto'), i18n.__('despedida.boton'), config.appUrl));190 response.push(payload);191 192 } else if (payload.includes('CHAT-PLUGIN')) {193 response = [194 Response.genText(i18n.__('chat_plugin.prompt', { user_first_name: this.user.firstName})),195 Response.genText(i18n.__('get_started.guidance')),196 Datos.servicios()197 ];198 } else {199 response = {200 text: `¡Este es un mensaje por defecto para el payload: ${payload}!`201 };202 }203 return response;204 }205 handleAttachmentMessage() {206 let response;207 // Get the attachment208 let attachment = this.webhookEvent.message.attachments[0];209 if (!(this.webhookEvent.message.sticker_id && this.webhookEvent.message.sticker_id == '369239263222822')) {210 console.log('Se recibió archivo adjunto:', `${attachment} de ${this.user.psid}`); 211 response = Response.genText(i18n.__('fallback.attachment'));212 } else {213 response = Response.genText('¡Saludos!');214 }215 return response;216 }217 sendMessage(response, delay = 0) {218 // Construct the message body219 let requestBody = {220 recipient: {221 id: this.user.psid222 },223 message: response224 };225 setTimeout(() => GraphAPI.callSendAPI(requestBody), delay);226 }227}

Full Screen

Full Screen

rappi4bUi.js

Source:rappi4bUi.js Github

copy

Full Screen

1import React,{useState} from 'react';2import{RiShoppingCartLine, RiHomeSmileLine, RiUser5Line, RiPencilLine} from 'react-icons/ri'3import {FaRegClock} from 'react-icons/fa';4import styled from 'styled-components';5import {6 InputWrapper, InputLabel, InputArea, ButtonWrapper,7 Text, HiText, NavBarWrapper, NavBarButton, FormWrapper,8 RestCardWrapper, RestImg, RestDetails, ProductCardWrapper,9 ProductCardImg, ProductCardDetails, ProductCardAddButton, 10 ProductCardCounter, ProductCardActionBar, PopupSelectWrapper,11 Select, PopupSelectButton, Option, PopupSelectShadow, OrderListenerCard,12 ClockView, ActiveOrderDetails, RadioInputWrapper, RadioSelect, RadioOption,13 RadioMark, RadioHr,OrderHIstoryCardWrapper, PersonalInfosCardWrapper, 14 InfosBox, ProfileBox, AddresBox, EditIconButton, LoadingPageWrapper, LoadingPageLogo15}from './rappi4bUi-styles'16export const AppWrapper = styled.main`17 margin: 0;18 width: auto;19 height: auto;20 display: flex;21 flex-direction: row;22 align-items: center;23 justify-content: center;24 overflow-x: hidden;25`;26export const MainWrapper = styled.main`27 width: 360px;28 min-height: 640px;29 display: flex;30 flex-direction: column;31 align-items: center;32 justify-content: center;33 overflow-y: auto;34 overflow-x: hidden;35`;36export const GenButton = ButtonWrapper;37export const GenText = Text;38export const GenHiText = HiText;39export const GenForm = FormWrapper; 40export const GenInput =(props)=>{41 42 return(43 <InputWrapper onBlur={props.onBlur}>44 <InputLabel>45 {props.inputLabel}46 </InputLabel>47 <InputArea48 minLength={props.minLength}49 id={props.id}50 name={props.name}51 title={props.title}52 pattern={props.pattern}53 onChange={props.onChange}54 value={props.value}55 placeholder={props.placeholder}56 type={props.type} 57 required={props.required === undefined && true}58 onKeyDown={props.onKeyDown}59 onClick={props.onClick}60 />61 </InputWrapper> 62 )63};64export const GenNavBar =(props)=>{65 return(66 <NavBarWrapper>67 <NavBarButton 68 pathName={props.pathName === '/home' && props.pathName} onClick={props.onClickToHome}>69 <RiHomeSmileLine/>70 </NavBarButton>71 <NavBarButton 72 pathName={props.pathName === '/cart' && props.pathName} onClick={props.onClickToCart}>73 <RiShoppingCartLine/>74 </NavBarButton>75 <NavBarButton 76 pathName={props.pathName === '/perfil' && props.pathName} onClick={props.onClickToProfile}>77 <RiUser5Line/>78 </NavBarButton>79 </NavBarWrapper>80 )81};82export const RestaurantCard =(props)=>{83 return(84 <RestCardWrapper onClick={props.openDetails}>85 <RestImg src={props.src}/>86 <RestDetails>87 <GenText salmon>{props.restaurantName}</GenText>88 </RestDetails>89 <RestDetails>90 <GenText detail>Entrega em aprox. {props.deliveryTime} min.</GenText>91 <GenText detail>Frete R$ {props.shipping}</GenText>92 </RestDetails>93 </RestCardWrapper>94 )95};96export const ProductCard =(props)=>{97 const [showSelect, setShowSelect] = useState(false);98 const [quantity, setQuantity] = useState( props.quantity ? Number(props.quantity) : 0);99 100 const optionsList=[0,1,2,3,4,5,6,7,8,9,10];101 102 const callBackAddToCart=(event)=>{103 const addToCart = props.addToCart;104 addToCart(event);105 setQuantity(event.target.value);106 setShowSelect(false);107 };108 const handleQuantitySelected = (event) => {109 setQuantity(event.target.value);110 };111 const callBackRemoveFromCart =(event)=>{112 const removeFromCart = props.removeFromCart;113 setQuantity(0)114 removeFromCart(event);115 };116 return(117 <ProductCardWrapper>118 <ProductCardImg src={props.src}/>119 <ProductCardDetails>120 <GenText minor salmon>{props.productName}</GenText>121 <GenText detail minor>{props.description}</GenText>122 <GenText minor>R$ {props.price}</GenText>123 </ProductCardDetails>124 <ProductCardActionBar>125 <ProductCardCounter 126 quantity={quantity} 127 >128 <GenText>{quantity}</GenText>129 </ProductCardCounter>130 {131 props.hiddeActionButton === undefined &&132 <ProductCardAddButton133 id={props.id} 134 quantity={quantity}135 onClick={136 quantity === 0 ? 137 () => setShowSelect(true) : callBackRemoveFromCart138 }139 >140 {141 quantity === 0 ? 'Adicionar' : 'Remover'142 }143 </ProductCardAddButton>144 }145 146 </ProductCardActionBar>147 {148 showSelect === true &&149 <PopupSelectShadow>150 <PopupSelectWrapper>151 <GenText>Selecione a quantidade desejada</GenText>152 <Select onChange={handleQuantitySelected} autoFocus>153 {optionsList.map((option, index)=>{154 return <Option key={index} value={option}>{option}</Option>155 })}156 </Select>157 <PopupSelectButton 158 id={props.id} value={quantity} 159 onClick={callBackAddToCart}160 >161 Adicionar ao carrinho162 </PopupSelectButton>163 <PopupSelectButton 164 onClick={()=> { setQuantity(0); setShowSelect(false)}}165 >166 Cancelar167 </PopupSelectButton>168 </PopupSelectWrapper>169 </PopupSelectShadow> 170 }171 </ProductCardWrapper>172 )173};174export const ListenerCard=(props)=>{175 const[hiddeCard, setHiddeCard] = useState(false);176 return(177 <OrderListenerCard 178 hidde={hiddeCard}179 onClick={()=> setHiddeCard( ! hiddeCard)} 180 >181 <ClockView >182 <GenHiText largeIcon>183 <FaRegClock/>184 </GenHiText>185 <GenText minor>Clique para esconder</GenText>186 </ClockView>187 <ActiveOrderDetails> 188 <GenText white>Pedido em andamento</GenText>189 <GenText>{props.restaurantName}</GenText>190 <GenHiText>subtotal r${props.totalPrice}</GenHiText>191 </ActiveOrderDetails>192 </OrderListenerCard>193 )194};195export const RadioInput = (props)=>{196 const optionsList = props.radioOptions !== undefined ? props.radioOptions : []197 return(198 <RadioInputWrapper>199 <GenText minor>{props.radioTitle}</GenText>200 <RadioHr/>201 {202 optionsList.map(option=>{203 return(204 <RadioOption key={option}>{option}205 <RadioSelect 206 value={207 option.toLowerCase().includes('dinheiro') ? 'money' : 'creditcard'208 }209 onClick={props.onClickOption}210 type='radio' 211 /> 212 <RadioMark/>213 </RadioOption>214 )215 })216 }217 </RadioInputWrapper>218 )219};220export const OrderHistoryCard=(props)=>{221 return(222 <OrderHIstoryCardWrapper>223 <GenText salmon>{props.restaurantName}</GenText>224 <GenText minor>{props.orderDate}</GenText>225 <GenHiText>subtotal r${props.totalPrice}</GenHiText>226 </OrderHIstoryCardWrapper>227 )228};229export const ViewProfileCard=(props)=>{230 return(231 <ProfileBox>232 <InfosBox>233 <GenText>{props.userName}</GenText>234 <GenText minor>{props.userEmail}</GenText>235 <GenText minor>{props.userCpf}</GenText>236 </InfosBox>237 <EditIconButton 238 onClick={props.editInfo}239 >240 <RiPencilLine/>241 </EditIconButton>242 </ProfileBox>243 )244};245export const ViewAdressCard=(props)=>{246 247 return(248 <AddresBox>249 <InfosBox>250 <GenText minor detail>{props.cardTitle}</GenText>251 <GenText>{props.userAddress}</GenText>252 </InfosBox>253 {254 props.showEditButton !== false &&255 <EditIconButton 256 onClick={props.editInfo}257 >258 <RiPencilLine/>259 </EditIconButton>260 }261 </AddresBox>262 )263};264export const LoadingPage=(props)=>{265 return(266 <LoadingPageWrapper>267 <LoadingPageLogo src={props.src} />268 </LoadingPageWrapper>269 )...

Full Screen

Full Screen

index.js

Source:index.js Github

copy

Full Screen

1import React, { useState, useEffect, useContext } from 'react';2import CartContext from '../../contexts/CartContext';3import api from '../../services/api'4import { useParams, useHistory } from 'react-router-dom';5import UserInfosContext from '../../contexts/UserInfosContext';6import {usePrivatePage} from '../../hooks/hooks';7import {validedToken} from '../../utils/utils';8import LogoRappiW from '../../assets/logo-rappi4-white.png';9import { MainWrapper, ProductCard, GenText, LoadingPage} from '../rappi4bUi/rappi4bUi';10import {RadioHr} from '../rappi4bUi/rappi4bUi-styles';11import { 12 Img, 13 DeliveryInfos,14 DetailContainer15} from './styles';16const RestaurantDetailPage =()=>{17 const [showLoadingPage, setShowLoadingPage] = useState(true);18 const userInfosContext = useContext(UserInfosContext);19 const token = validedToken(userInfosContext);20 usePrivatePage(token);21 const [detail, setDetail] = useState(null)22 const [products, setProducts] = useState(null) 23 24 const cartContext = useContext(CartContext);25 26 const {restaurantId} = useParams();27 28 const history = useHistory();29 30 const getSelectedProduct = (event) => {31 const productId = event.target.id;32 const productQuantity = event.target.value;33 const filteredProduct = products.filter(product => {34 return product.id === productId35 });36 const validedOrder =()=>{37 if(38 cartContext.userCart[restaurantId]!== null &&39 cartContext.userCart[restaurantId]!== undefined &&40 cartContext.userCart[restaurantId].length > 041 ){42 return {43 restaurantId: Number(restaurantId),44 currentOrder:[45 ...cartContext.userCart[restaurantId],{46 product:filteredProduct[0],quantity: productQuantity47 }]48 };49 }else{50 return {51 restaurantId: Number(restaurantId),52 currentOrder:[{53 product:filteredProduct[0],quantity: productQuantity54 }]55 };56 }57 };58 cartContext.dispatch({ 59 type: 'ADD_TO_CART', order: validedOrder()60 }); 61 };62 const removeProduct = (event) => {63 const productId = event.target.id 64 const filteredSelectedProducts = cartContext.userCart.cart.filter(selectedProduct => { 65 return selectedProduct.product.id !== productId66 }) 67 cartContext.dispatch({68 type: 'REMOVE_FROM_CART', filteredCart:filteredSelectedProducts69 }) 70 }; 71 useEffect(() => {72 api.get(`restaurants/${restaurantId}`, {73 headers: {74 auth: token75 }76 }).then((response) =>{ 77 setDetail(response.data.restaurant)78 setProducts(response.data.restaurant.products)79 })80 }, []); 81 useEffect(()=>{82 detail !== null && setShowLoadingPage(false)83 },[detail]);84 const conditionalRender = ()=>{85 if(showLoadingPage === true){86 return <LoadingPage src={LogoRappiW}/>87 }88 return <MainWrapper>89 <DetailContainer>90 <Img src={detail !== null && detail.logoUrl }/> 91 <GenText salmon>{detail !== null && detail.name}</GenText>92 <GenText detail minor>{detail !== null && detail.category}</GenText>93 <DeliveryInfos>94 <GenText detail minor>{detail !== null && `${detail.deliveryTime}min`}</GenText>95 <GenText detail minor>{detail !== null && `Frete R$${detail.shipping.toFixed(2)}`}</GenText>96 </DeliveryInfos>97 <GenText detail minor>{detail !== null && detail.address}</GenText> 98 </DetailContainer>99 <GenText onClick={() => history.goBack()} salmon>Voltar</GenText>100 <GenText alignSelfStart>{detail !== null && `Cardápio`}</GenText>101 <RadioHr/>102 <MainWrapper> 103 {104 products !== null &&105 products.map((product, index) => {106 return(107 <ProductCard108 key={index}109 src={product.photoUrl}110 productName={product.name}111 description={product.description}112 price={product.price.toFixed(2)} 113 id={product.id}114 addToCart={getSelectedProduct} 115 removeFromCart={removeProduct} 116 />117 )118 })119 }120 </MainWrapper>121 </MainWrapper>122 };123 return(124 conditionalRender()125 ) 126};...

Full Screen

Full Screen

contact.js

Source:contact.js Github

copy

Full Screen

1import React from "react"2import { Helmet } from "react-helmet"3import { useSelector } from "react-redux"4import { themeObject } from "../utils/themes"5import Layout from "../components/layout"6export default () => {7 let genText = themeObject.general8 const currentTheme = useSelector(state => ({9 theme: state.theme,10 }))11 genText = currentTheme.theme.general12 return (13 <Layout>14 <Helmet>15 <title>cassie spain | contact</title>16 <meta name="description" content="cassie spain | software engineer" />17 </Helmet>18 <div className={genText.rightContainer}>19 <div className={genText.contactsContainer}>20 <div className={genText.contactFrame}>21 <p className={genText.contact}>22 <span className={genText.greyText}> • • • </span> shoot me23 an&nbsp;24 <a25 href="mailto:cea.spain@gmail.com"26 className={genText.contactLink}27 >28 email29 </a>30 ,31 </p>32 <p className={genText.contact}>33 <span className={genText.greyText}> • • • • • • </span> connect34 with me on&nbsp;35 <a36 href="https://www.linkedin.com/in/ceaspain/"37 target="_blank"38 rel="noopener noreferrer"39 className={genText.contactLink}40 >41 linked in42 </a>43 ,44 </p>45 <p className={genText.contact}>46 <span className={genText.greyText}> • • • • • • • • • </span>47 read my articles on&nbsp;48 <a49 href="https://medium.com/@cea.spain"50 target="_blank"51 rel="noopener noreferrer"52 className={genText.contactLink}53 >54 medium55 </a>56 ,57 </p>58 <p className={genText.contact}>59 <span className={genText.greyText}>60 {" "}61 • • • • • • • • • • • •{" "}62 </span>{" "}63 & check me out on&nbsp;64 <a65 href="https://github.com/dreamwasp"66 target="_blank"67 rel="noopener noreferrer"68 className={genText.contactLink}69 >70 github71 </a>72 !73 </p>74 </div>75 </div>76 </div>77 </Layout>78 )...

Full Screen

Full Screen

project.js

Source:project.js Github

copy

Full Screen

1import React, { useState } from "react"2import Typist from "react-typist"3import { useSelector } from "react-redux"4import { themeObject } from "../utils/themes"5import Img from "gatsby-image"6export default props => {7 const [isShown, setIsShown] = useState(false)8 const [innerText, setInnerText] = useState("")9 const hoverEffect = inner => {10 setIsShown(true)11 setInnerText(inner)12 }13 let genText = themeObject.general14 const currentTheme = useSelector(state => ({15 theme: state.theme,16 }))17 genText = currentTheme.theme.general18 return (19 <div className={genText.sectionContainer}>20 <div className={genText.section}>21 <div className={genText.sectionTextContainer}>22 <h3 className={genText.sectionHeader}>{props.project.title}</h3>23 <div className={genText.sectionText}>24 <p className={genText.paragraphs}>{props.project.description}</p>25 <p className={genText.paragraphs}>{props.project.tech}</p>26 <div className={genText.logos}>27 {props.project.links.map(logo => (28 <div className={genText.logo}>29 <a30 href={logo.link}31 className={genText.logo}32 target="_blank"33 rel="noopener noreferrer"34 >35 <img36 src={logo.icon}37 onMouseEnter={() => hoverEffect(logo.desc)}38 onMouseLeave={() => setIsShown(false)}39 className={genText.resize}40 alt={logo.desc}41 />42 </a>43 </div>44 ))}45 </div>46 <div className={genText.hoverTextContainer}>47 {isShown && (48 <Typist className={genText.hoverText}>{innerText}</Typist>49 )}50 </div>51 </div>52 </div>53 <div className={genText.photoContainer}>54 <Img55 className={genText.photoFrame}56 fluid={props.image.node.childImageSharp.fluid}57 alt={props.project.alt}58 />59 </div>60 </div>61 </div>62 )...

Full Screen

Full Screen

work.js

Source:work.js Github

copy

Full Screen

1import React from "react"2import { Helmet } from "react-helmet"3import { useSelector } from "react-redux"4import { useStaticQuery, graphql } from "gatsby"5import Layout from "../components/layout"6import Project from "../components/project"7import Job from "../components/job"8import projects from "../utils/projects"9import jobs from "../utils/jobs"10import { themeObject } from "../utils/themes"11import { imageFilter } from "../utils/helperFunctions"12import genText from "../styles/genText.module.css"13export default () => {14 const data = useStaticQuery(graphql`15 query aQuery {16 allFile(filter: { extension: { regex: "/(png)/" } }) {17 edges {18 node {19 childImageSharp {20 fluid {21 ...GatsbyImageSharpFluid_tracedSVG22 }23 }24 base25 }26 }27 }28 }29 `)30 let genText = themeObject.general31 const currentTheme = useSelector(state => ({32 theme: state.theme,33 }))34 genText = currentTheme.theme.general35 return (36 <Layout>37 <Helmet>38 <title>cassie spain | work</title>39 <meta name="description" content="cassie spain | software engineer" />40 </Helmet>41 <div className={genText.rightContainer}>42 <div className={genText.sectionsContainer}>43 <div className={genText.sectionContainer}>44 <div className={genText.workHeader}>45 <h2 className={genText.workHeaderText}>projects</h2>46 </div>47 {projects.map(project => (48 <Project49 project={project}50 image={imageFilter(data.allFile.edges, project.fileName)}51 />52 ))}53 <div className={genText.sectionContainer}>54 <div className={genText.workHeader}>55 <h2 className={genText.workHeaderText}>56 professional experience57 </h2>58 </div>59 {jobs.map(job => (60 <Job job={job} />61 ))}62 </div>63 </div>64 </div>65 </div>66 </Layout>67 )...

Full Screen

Full Screen

job.js

Source:job.js Github

copy

Full Screen

1import React from "react"2import { useSelector } from "react-redux"3import { themeObject } from "../utils/themes"4export default props => {5 let genText = themeObject.general6 const currentTheme = useSelector(state => ({7 theme: state.theme,8 }))9 genText = currentTheme.theme.general10 return (11 <div>12 <div className={genText.jobTitleContainer}>13 <h3 className={genText.sectionHeader}>{props.job.title}</h3>14 <div className={genText.companyTimeContainer}>15 <h4 className={genText.companyTime}>{props.job.company}</h4>16 <h4 className={genText.companyTime}>{props.job.time}</h4>17 </div>18 </div>19 <div className={genText.section}>20 <div className={genText.sectionTextsContainer}>21 <div className={genText.sectionText}>22 <p className={genText.jobDescription}>{props.job.desc}</p>23 </div>24 </div>25 </div>26 </div>27 )...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1const { chromium } = require('playwright');2(async () => {3 const browser = await chromium.launch({ headless: false });4 const page = await browser.newPage();5 const text = await page.evaluate(() => {6 return window.playwright.internal.genText(document.body);7 });8 console.log(text);9 await browser.close();10})();

Full Screen

Playwright tutorial

LambdaTest’s Playwright tutorial will give you a broader idea about the Playwright automation framework, its unique features, and use cases with examples to exceed your understanding of Playwright testing. This tutorial will give A to Z guidance, from installing the Playwright framework to some best practices and advanced concepts.

Chapters:

  1. What is Playwright : Playwright is comparatively new but has gained good popularity. Get to know some history of the Playwright with some interesting facts connected with it.
  2. How To Install Playwright : Learn in detail about what basic configuration and dependencies are required for installing Playwright and run a test. Get a step-by-step direction for installing the Playwright automation framework.
  3. Playwright Futuristic Features: Launched in 2020, Playwright gained huge popularity quickly because of some obliging features such as Playwright Test Generator and Inspector, Playwright Reporter, Playwright auto-waiting mechanism and etc. Read up on those features to master Playwright testing.
  4. What is Component Testing: Component testing in Playwright is a unique feature that allows a tester to test a single component of a web application without integrating them with other elements. Learn how to perform Component testing on the Playwright automation framework.
  5. Inputs And Buttons In Playwright: Every website has Input boxes and buttons; learn about testing inputs and buttons with different scenarios and examples.
  6. Functions and Selectors in Playwright: Learn how to launch the Chromium browser with Playwright. Also, gain a better understanding of some important functions like “BrowserContext,” which allows you to run multiple browser sessions, and “newPage” which interacts with a page.
  7. Handling Alerts and Dropdowns in Playwright : Playwright interact with different types of alerts and pop-ups, such as simple, confirmation, and prompt, and different types of dropdowns, such as single selector and multi-selector get your hands-on with handling alerts and dropdown in Playright testing.
  8. Playwright vs Puppeteer: Get to know about the difference between two testing frameworks and how they are different than one another, which browsers they support, and what features they provide.
  9. Run Playwright Tests on LambdaTest: Playwright testing with LambdaTest leverages test performance to the utmost. You can run multiple Playwright tests in Parallel with the LammbdaTest test cloud. Get a step-by-step guide to run your Playwright test on the LambdaTest platform.
  10. Playwright Python Tutorial: Playwright automation framework support all major languages such as Python, JavaScript, TypeScript, .NET and etc. However, there are various advantages to Python end-to-end testing with Playwright because of its versatile utility. Get the hang of Playwright python testing with this chapter.
  11. Playwright End To End Testing Tutorial: Get your hands on with Playwright end-to-end testing and learn to use some exciting features such as TraceViewer, Debugging, Networking, Component testing, Visual testing, and many more.
  12. Playwright Video Tutorial: Watch the video tutorials on Playwright testing from experts and get a consecutive in-depth explanation of Playwright automation testing.

Run Playwright Internal automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful