id
stringlengths 12
53
| messages
listlengths 3
3
|
|---|---|
code_formula_5e319171
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of formula/react/package.json from the formula VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"name\": \"vtex.formula\",\n \"version\": \"0.3.1\",\n \"scripts\": {\n \"lint\": \"tsc --noEmit && tslint -c tslint.json './**/*.ts'\"\n },\n \"dependencies\": {\n \"classnames\": \"^2.2.5\",\n \"formik\": \"^1.3.1\",\n \"prop-types\": \"^15.5.10\",\n \"ramda\": \"^0.25.0\",\n \"react-countdown-now\": \"^1.3.0\"\n },\n \"devDependencies\": {\n \"@types/graphql\": \"^0.13.3\",\n \"@types/node\": \"^9.4.7\",\n \"@types/prop-types\": \"^15.5.2\",\n \"@types/react\": \"^16.3.16\",\n \"@types/react-dom\": \"^16.0.5\",\n \"@types/react-helmet\": \"^5.0.5\",\n \"@types/react-intl\": \"^2.3.5\",\n \"graphql\": \"^0.13.0\",\n \"react\": \"^16.2.0\",\n \"react-apollo\": \"^2.0.4\",\n \"react-dom\": \"^16.2.0\",\n \"react-intl\": \"^2.4.0\",\n \"tslint\": \"^5.11.0\",\n \"tslint-config-vtex\": \"^2.0.0\",\n \"typescript\": \"^3.1.3\"\n }\n}\n\n```"
}
] |
code_formula_90707c82
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of formula/react/FormulaEdition.tsx from the formula VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport React, { Component, Fragment } from 'react'\nimport { Query } from 'react-apollo'\nimport { withRuntimeContext } from 'render'\n\nimport FinalistsList from './components/FinalistsList'\nimport Loading from './components/Loading'\nimport Navigation from './components/Navigation'\nimport ProjectsList from './components/ProjectsList'\n\nimport InfoQuery from './queries/info.graphql'\n\ninterface ProjectsData {\n params: any\n}\n\nclass FormulaEdition extends Component<RuntimeProps & ProjectsData> {\n constructor(props: any) {\n super(props)\n }\n\n public render() {\n const { params: { edition }, runtime } = this.props\n\n return (\n <Query query={InfoQuery} ssr={false} variables={{ edition }}>\n {({ loading, error, data }) => {\n if (loading) {\n return <Loading />\n }\n\n const state = data.info.status || 'REGISTRATION'\n\n return (\n <Fragment>\n <Navigation edition={edition} state={state} setPage={(page) => runtime.navigate({page, params: {edition}})} currentPage={runtime.page} />\n {runtime.page === 'formula/projects/list' ? <ProjectsList state={state} edition={edition} /> : <FinalistsList state={state} edition={edition} />}\n </Fragment>\n )\n }}\n </Query>\n )\n }\n}\n\nexport default withRuntimeContext(FormulaEdition)\n\n```"
}
] |
code_formula_7f642a13
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of formula/react/ProjectTemplate.tsx from the formula VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport React, { Component } from 'react'\nimport { Query } from 'react-apollo'\n\nimport ProfileQuery from './queries/profile.graphql'\n\nimport Header from './components/Header'\nimport Loading from './components/Loading'\nimport Timer from './components/Timer'\n\ninterface ProjectsData {\n params: {\n edition: string\n }\n}\n\nexport default class ProjectTemplate extends Component<{} & ProjectsData> {\n constructor(props: any) {\n super(props)\n }\n\n public render() {\n const { params: { edition } } = this.props\n return (\n <Query query={ProfileQuery} ssr={false}>\n {({ loading, error, data }) => {\n let errorMsg\n\n if (error) {\n const { graphQLErrors } = error\n const authError = graphQLErrors && graphQLErrors.length > 0 && graphQLErrors.find((e: any) => e.extensions.code === 'UNAUTHENTICATED')\n const forbiddenError = graphQLErrors && graphQLErrors.length > 0 && graphQLErrors.find((e: any) => e.extensions.code === 'FORBIDDEN')\n if (authError) {\n window.location.href = '/_v/auth-server/v1/login?ReturnUrl=' + encodeURIComponent('/formula/2018.10/projects')\n errorMsg = <div>Redirecting to login...</div>\n } else if (forbiddenError) {\n errorMsg = <div>Oops :( Formula is a VTEX-only event. Sorry!</div>\n }\n }\n\n const firstName = data && data.profile && data.profile.name\n ? data.profile.name.split(' ')[0]\n : ''\n\n return (\n <div>\n <Header name={firstName} onLogout={this.logout} />\n {!loading && !errorMsg && <Timer edition={edition}/>}\n {loading\n ? <Loading />\n : errorMsg\n ? <div className=\"flex center justify-center pa8\">{errorMsg}</div>\n : this.props.children}\n </div>\n )\n }}\n </Query>\n )\n }\n\n private logout = () => {\n window.location.href = '/admin/logout?redirectUrl=/formula'\n }\n}\n\n```"
}
] |
code_formula_95b85521
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of formula/react/Template.tsx from the formula VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport React, { Component } from 'react'\nimport { Helmet } from 'render'\n\nimport VtexIcon from './icons/VtexIcon'\n\nimport './global.css'\n\nexport default class FormulaTemplate extends Component {\n render() {\n return (\n <div className=\"container bg-muted-5\">\n <Helmet>\n <title>VTEX Formula</title>\n <link rel=\"shortcut icon\" href=\"https://io.vtex.com.br/favico/1.3.0/favico.ico\"></link>\n </Helmet>\n {this.props.children}\n <footer className=\"mw7 center gray f8\">\n <div className=\"flex items-center justify-center pa8\">\n <VtexIcon />\n <span className=\"ml3\">\n Formula - all rights reserved ©\n </span>\n </div>\n </footer>\n </div>\n )\n }\n}\n\n```"
}
] |
code_formula_5403972b
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of formula/react/locales/en.json from the formula VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"formula.title\": \"Formula\",\n \"formula.hello\": \"Hello,\",\n \"formula.signup\": \"Let's do this!\",\n \"formula.logout\": \"Logout\",\n \"formula.seeDetails\": \"Edit\",\n \"formula.team\": \"Team\",\n \"formula.back\": \"Back\",\n \"formula.save\": \"Save\",\n \"formula.join\": \"Join Team\",\n \"formula.leave\": \"Leave Team\",\n \"formula.delete\": \"Delete\",\n \"formula.newProject\": \"Create a project\",\n \"formula.status.registration\": \"It's almost time!\",\n \"formula.status.running\": \"Run, Forrest, run!\",\n \"formula.status.voting\": \"And it's a wrap!\",\n \"formula.status.voting.details\": \"Time to vote.\",\n \"formula.status.results\": \"That was great.\",\n \"formula.status.results.details\": \"Thanks!\",\n \"formula.projectDetails\": \"Project\",\n \"formula.viewDemo\": \"View Demo\"\n}\n\n```"
}
] |
code_formula_6358f056
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of formula/react/queries/joinProject.graphql from the formula VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\nmutation JoinProject(\n $edition: String!\n $id: String!\n) {\n joinProject(edition: $edition, id: $id) {\n team {\n name\n email\n }\n }\n}\n\n```"
}
] |
code_formula_fef7675a
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of formula/react/queries/finalists.graphql from the formula VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\nquery Finalists ($edition: String!) {\n finalists (edition: $edition) {\n id\n name\n description\n demoURL\n owner\n team {\n id\n email\n name\n picture\n }\n }\n}\n\n```"
}
] |
code_formula_fd7d36c0
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of formula/react/queries/info.graphql from the formula VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\nquery Info ($edition: String!) {\n info (edition: $edition) {\n status\n timeRemainingSeconds\n timeTotalSeconds\n }\n}\n\n```"
}
] |
code_formula_1733d4a5
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of formula/react/queries/leaveProject.graphql from the formula VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\nmutation LeaveProject(\n $edition: String!\n $id: String!\n) {\n leaveProject(edition: $edition, id: $id) {\n team {\n name\n email\n }\n }\n}\n\n```"
}
] |
code_formula_5bd6456c
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of formula/react/queries/profile.graphql from the formula VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\nquery Profile {\n profile {\n id\n name\n email\n picture\n }\n}\n\n```"
}
] |
code_formula_50b97e2e
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of formula/react/queries/projects.graphql from the formula VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\nquery Projects ($edition: String!) {\n profile {\n email\n }\n projects (edition: $edition) {\n id\n name\n description\n demoURL\n owner\n team {\n id\n email\n name\n picture\n }\n }\n votes (edition: $edition) {\n projectID\n execution\n relevance\n }\n}\n\n```"
}
] |
code_formula_43f85e35
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of formula/react/queries/deleteProject.graphql from the formula VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\nmutation DeleteProject(\n $edition: String!\n $id: String!\n) {\n deleteProject(edition: $edition, id: $id)\n}\n\n```"
}
] |
code_formula_a8d6ee7e
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of formula/react/queries/updateProject.graphql from the formula VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\nmutation UpdateProject(\n $edition: String!\n $id: String\n $demoURL: String\n $description: String\n $name: String!\n) {\n updateProject(edition: $edition, id: $id, demoURL: $demoURL, description: $description, name: $name) {\n id\n name\n description\n }\n}\n\n```"
}
] |
code_formula_f5cac8d0
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of formula/react/queries/project.graphql from the formula VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\nquery Project ($edition: String!, $id: String!) {\n profile {\n email\n }\n project (edition: $edition, id: $id) {\n id\n name\n description\n demoURL\n owner\n team {\n id\n email\n name\n picture\n }\n }\n}\n\n```"
}
] |
code_formula_0ad5223e
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of formula/react/queries/vote.graphql from the formula VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\nmutation Vote(\n $edition: String!\n $id: String!\n $execution: Int!\n $relevance: Int!\n) {\n updateVote(edition: $edition, projectID: $id, execution: $execution, relevance: $relevance) {\n projectID\n userID\n relevance\n execution\n }\n}\n\n```"
}
] |
code_formula_1c07a968
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of formula/react/components/ProjectCard.tsx from the formula VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport React, { Component, Fragment } from 'react'\nimport { Mutation } from 'react-apollo'\nimport { FormattedMessage } from 'react-intl'\nimport { Link } from 'render'\nimport { Button, Spinner } from 'vtex.styleguide'\n\nimport JoinProjectMutation from '../queries/joinProject.graphql'\nimport LeaveProjectMutation from '../queries/leaveProject.graphql'\nimport ProjectsQuery from '../queries/projects.graphql'\nimport voteMutation from '../queries/vote.graphql'\n\ninterface ProjectCardProps {\n email: string\n hasTeam: boolean\n}\n\nfunction getVoteClass(value, current, state, voting) {\n const activeClasses = 'br-pill bg-emphasis c-on-base--inverted flex items-center justify-center fw3 f4 mr4-ns' + (state === 'RESULTS' ? ' bg-muted-2' : '')\n const inactiveClasses = 'br-pill bg-base ba b--muted-3 c-muted-3 flex items-center justify-center fw3 f4 mr4-ns'\n let classes = value >= current ? activeClasses : inactiveClasses\n if (state === 'VOTING' && !voting) {\n classes += ' pointer'\n }\n return classes\n}\n\nexport default class ProjectCard extends Component<ProjectCardProps & Project> {\n constructor(props: any) {\n super(props)\n\n this.state = {\n votingCriteria: null,\n votingScore: null\n }\n }\n\n public render() {\n const { id, edition, name, description, owner, demoURL, team, email, hasTeam, vote, state} = this.props\n\n const refetchProjectsQuery = {\n query: ProjectsQuery,\n variables: {\n edition,\n }\n }\n\n const isOwner = owner === email\n\n const isInTeam = team && team.find((t) => t.email === email)\n\n const joinOrLeave = isInTeam ? (\n <Mutation mutation={LeaveProjectMutation} refetchQueries={[refetchProjectsQuery]}>\n {(leaveProject) => {\n return (\n <Button onClick={() => leaveProject({variables: {edition, id}})}>\n <FormattedMessage id=\"formula.leave\" />\n </Button>\n )\n }}\n </Mutation>\n ) : !hasTeam ? (\n <Mutation mutation={JoinProjectMutation} refetchQueries={[refetchProjectsQuery]}>\n {(joinProject) => {\n return (\n <Button onClick={() => joinProject({variables: {edition, id}})}>\n <FormattedMessage id=\"formula.join\" />\n </Button>\n )\n }}\n </Mutation>\n ) : null\n\n return (\n <div className=\"bg-base ma5 ba1 b-dark-silver center mw7 pa7 mt7 br2\">\n <div className=\"inline-flex w-100\">\n <div className=\"w-100\">\n <div className=\"flex justify-between items-center pb6 w-100\">\n <div className=\"f4 fw5 pb3\">{name}</div>\n {state === 'REGISTRATION' || state === 'RUNNING' || state === 'VOTING' ?\n <div className=\"h1\">\n <Link page=\"formula/projects/detail\" params={{edition, id}}>\n <svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <rect width=\"16\" height=\"16\" fill=\"white\"/>\n <path d=\"M2 14.5H14\" stroke=\"#f71963\" strokeWidth=\"1.4\" strokeMiterlimit=\"10\" strokeLinecap=\"round\" strokeLinejoin=\"round\"/>\n <path d=\"M10.1429 1.5L12.7143 4.1L5.42857 11.4667L2 12.3333L2.85714 8.86667L10.1429 1.5Z\" stroke=\"#f71963\" strokeWidth=\"1.4\" strokeMiterlimit=\"10\" strokeLinecap=\"round\" strokeLinejoin=\"round\"/>\n <path d=\"M8.42859 3.2334L11 5.8334\" stroke=\"#f71963\" strokeWidth=\"1.4\" strokeMiterlimit=\"10\" strokeLinecap=\"round\" strokeLinejoin=\"round\"/>\n </svg>\n </Link>\n </div>\n : null}\n </div>\n <div className=\"f5 bb b--muted-5 mb7 pb7 fw3 lh-copy\">{description}</div>\n {demoURL && <div className=\"f5 bb b--muted-5 mb7 pb7 fw3 lh-copy\">\n <a className=\"link c-emphasis\" href={demoURL} target=\"__blank\">\n <FormattedMessage id=\"formula.viewDemo\"/>\n </a>\n </div>}\n </div>\n </div>\n {state !== 'VOTING' ? <section>\n <div className=\"f4 fw5\"><FormattedMessage id=\"formula.team\" /></div>\n <ul className=\"list pl0 mb7 lh-copy\">\n {team && team.map((u) => <li key={u.id}>{u.name} - {u.email}</li>)}\n </ul>\n </section> : null}\n {state === 'REGISTRATION' || state === 'RUNNING' ? !isOwner && joinOrLeave : null}\n\n {state === 'VOTING' || state === 'RESULTS' ?\n <div>\n <div className=\"flex justify-between fw7\">\n <div>Evaluation</div>\n <div>Total Score: {vote.relevance + vote.execution}</div>\n </div>\n <div className=\"pt6\">\n <div className=\"c-muted-2 f5\">\n Criteria #1\n </div>\n <div className=\"f6 pt3\">\n Project impact on VTEX\n </div>\n </div>\n <div className=\"flex mt7 w-100 bb b--muted-5 pb7 justify-start-ns justify-between\">\n <Mutation mutation={voteMutation} refetchQueries={[refetchProjectsQuery]} awaitRefetchQueries>\n {(updateVote) => (\n <Fragment>\n {[1,2,3,4,5].map(this.renderVotingCriteria('relevance', updateVote))}\n </Fragment>\n )}\n </Mutation>\n </div>\n <div className=\"pt6\">\n <div className=\"c-muted-2 f5\">\n Criteria #2\n </div>\n <div className=\"f6 pt3\">\n Project quality level\n </div>\n </div>\n <div className=\"flex mt7 w-100 justify-start-ns justify-between\">\n <Mutation mutation={voteMutation} refetchQueries={[refetchProjectsQuery]} awaitRefetchQueries>\n {(updateVote) => (\n <Fragment>\n {[1,2,3,4,5].map(this.renderVotingCriteria('execution', updateVote))}\n </Fragment>\n )}\n </Mutation>\n </div>\n </div> : null}\n </div>\n )\n }\n\n private renderVotingCriteria = (criteria: string, updateVote: any) => (idx: number) => {\n const {state, vote, edition, id} = this.props\n const votingCriteria = this.state.votingCriteria === criteria\n const votingScore = this.state.votingScore\n\n const handleVoteClick = () => {\n if (this.state.votingCriteria || state !== 'VOTING') {\n return null\n }\n this.setState({\n votingCriteria: criteria,\n votingScore: idx,\n })\n return updateVote({variables: {\n edition,\n id,\n ...vote,\n [criteria]: idx,\n }}).then(() => {\n this.setState({\n votingCriteria: null,\n votingScore: null,\n })\n })\n }\n\n return (\n <div\n key={`relevance-${idx}`}\n className={getVoteClass(votingCriteria ? votingScore - 1 : vote[criteria], idx, state, votingCriteria)}\n style={{ width: '48px', height: '48px' }}\n onClick={handleVoteClick}>\n {votingCriteria && votingScore === idx ? <Spinner /> : idx}\n </div>\n )\n }\n}\n\n```"
}
] |
code_formula_e362dae3
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of formula/react/components/BlockedFinalists.tsx from the formula VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport React, { Component } from 'react'\nimport OwlIcon from '../icons/OwlIcon'\n\nexport default class FinalistsList extends Component<{}> {\n public render () {\n return (\n <div className=\"flex justify-center w-100\">\n <div className=\"bg-base ma5 ba1 b-dark-silver center mw7 pa7 mt7 br2 w-100\">\n <div className=\"flex items-center justify-center pt9\">\n <OwlIcon height=\"100\" />\n </div>\n <div className=\"f3 fw7 tc pt9\">Nothing to see here, mate</div>\n <div className=\"f5 tc pb9 pt3\">Go get some pizza and come back after Formula is done.</div>\n </div>\n </div>\n )\n }\n}\n\n```"
}
] |
code_formula_79c90f80
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of formula/react/components/ProjectsList.tsx from the formula VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport React, { Component } from 'react'\nimport { Query } from 'react-apollo'\n\nimport ProjectsQuery from '../queries/projects.graphql'\n\nimport Loading from './Loading'\nimport ProjectCard from './ProjectCard'\n\ninterface ProjectsListData {\n edition: string\n state: States\n}\n\nexport default class ProjectsList extends Component<ProjectsListData> {\n public render () {\n const { edition, state } = this.props\n return (\n <Query query={ProjectsQuery} variables={{ edition }}>\n {({ loading, error, data }) => {\n if (loading) {\n return <Loading />\n }\n\n const hasTeam = data.projects && !!data.projects.find((p: Project) => p.team && p.team.find(({ email }) => email === data.profile.email))\n return data.projects.map((p: Project) => {\n const vote = data.votes.find(current => current.projectID === p.id) || {execution: 0, relevance: 0}\n\n return <ProjectCard vote={vote} state={state} key={p.id} {...p} email={data.profile.email} edition={edition} hasTeam={hasTeam} />\n })\n }}\n </Query>\n )\n }\n}\n\n```"
}
] |
code_formula_0a1272d7
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of formula/react/components/Timer.tsx from the formula VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport React, { Component } from 'react'\nimport { Query } from 'react-apollo'\nimport Countdown from 'react-countdown-now'\nimport { FormattedMessage } from 'react-intl'\n\nimport InfoQuery from '../queries/info.graphql'\nimport Loading from './Loading'\n\ninterface TimerProps {\n edition: string\n}\n\nconst nowMillis = new Date().getTime()\n\nlet refreshTimeout: any\n\nexport default class Timer extends Component<TimerProps> {\n public render() {\n const { edition } = this.props\n return (\n <Query query={InfoQuery} ssr={false} variables={{ edition }}>\n {({ loading, error, data = {} }) => {\n if (loading || !data.info) {\n return <Loading />\n }\n\n const remaining = data && data.info && data.info.timeRemainingSeconds\n const status = data && data.info && data.info.status\n const total = data && data.info && data.info.timeTotalSeconds\n const countdownRunning = status === 'REGISTRATION' || status === 'RUNNING'\n\n if (countdownRunning && !refreshTimeout) {\n refreshTimeout = setTimeout(() => {\n console.log('Time\\'s up!')\n window.location.reload()\n }, remaining * 1000)\n }\n\n const barWidth = status === 'REGISTRATION'\n ? 0\n : status !== 'RUNNING'\n ? '100%'\n : `${Math.round(((total - remaining) / total) * 100)}%`\n\n const afterContent = status === 'VOTING'\n ? <FormattedMessage id=\"formula.status.voting.details\"/>\n : status === 'RESULTS'\n ? <FormattedMessage id=\"formula.status.results.details\"/>\n : null\n\n const countdown = countdownRunning &&\n <Countdown\n date={nowMillis + remaining * 1000}\n daysInHours={true} />\n\n return (\n <div className=\"bg-serious-black white\">\n <div className=\"center mw7 pv7 ph5\">\n <div className=\"f5 fw3\">\n <FormattedMessage id={`formula.status.${status.toLowerCase()}`} />\n </div>\n <div className=\"fw3 pb5 dn-ns db\" style={{fontSize: '5em'}}>\n { countdown || afterContent }\n </div>\n <div className=\"fw3 pb5 dn db-ns\" style={{fontSize: countdownRunning ? '10em' : '7em'}}>\n { countdown || afterContent }\n </div>\n <div className=\"w-100 bg-marine h2 relative mb7 br2\" style={{height: '0.25rem'}}>\n <div className=\"bg-rebel-pink h2 br2\" style={{width: barWidth, height: '0.25rem'}}></div>\n </div>\n </div>\n </div>\n )\n }}\n </Query>\n )\n }\n}\n\n```"
}
] |
code_formula_30284801
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of formula/react/components/ProjectForm.tsx from the formula VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport { Formik } from 'formik'\nimport React, { Component } from 'react'\nimport { Mutation } from 'react-apollo'\nimport { FormattedMessage } from 'react-intl'\nimport { withRuntimeContext } from 'render'\nimport { Button, Input, Textarea } from 'vtex.styleguide'\n\nimport DeleteProjectMutation from '../queries/deleteProject.graphql'\nimport ProjectDetailQuery from '../queries/project.graphql'\nimport ProjectsQuery from '../queries/projects.graphql'\nimport UpdateProjectMutation from '../queries/updateProject.graphql'\n\ninterface ProjectFormProps {\n initialProject: Project\n edition: string\n email: string\n}\n\ninterface ProjectFormState {\n project: Project\n}\n\nclass ProjectForm extends Component<ProjectFormProps & RuntimeProps, ProjectFormState> {\n constructor(props: any) {\n super(props)\n\n this.state = {\n project: props.initialProject || {},\n }\n }\n\n public render() {\n const { edition, email } = this.props\n const { project } = this.state\n\n const team = project && project.id && project.team && (\n <ul>\n {project.team.map((u) => <li key={u.id}>{u.name} - {u.email}</li>)}\n </ul>\n )\n\n const isOwner = project.owner === email\n\n const refetchProjectsQuery = {\n query: ProjectsQuery,\n variables: {\n edition,\n }\n }\n\n const refetchProjectDetailQuery = {\n query: ProjectDetailQuery,\n variables: {\n edition,\n id: project.id,\n }\n }\n\n const handleDeleteSuccess = () => this.props.runtime.navigate({page: 'formula/projects/list', params: {edition}})\n\n const deleteButton = isOwner && project.id && (\n <Mutation mutation={DeleteProjectMutation} refetchQueries={[refetchProjectsQuery, refetchProjectDetailQuery]}>\n {(deleteProject) => {\n return (\n <Button variation=\"tertiary\" onClick={() => deleteProject({variables: {edition, id: project.id}}).then(handleDeleteSuccess)} >\n <FormattedMessage id=\"formula.delete\" />\n </Button>\n )\n }}\n </Mutation>\n )\n\n return (\n <div className=\"bg-white ma5 ba1 b-dark-silver\">\n <Mutation mutation={UpdateProjectMutation} refetchQueries={[refetchProjectsQuery]}>\n {(updateProject, { data }) => {\n console.log('data on mutation', data)\n return (\n <Formik\n initialValues={project}\n validate={values => {\n const errors: any = {}\n if (!values.name) {\n errors.name = 'Required'\n }\n return errors\n }}\n onSubmit={(values, { setSubmitting }) => {\n updateProject({\n variables: {\n edition,\n ...project,\n ...values,\n }\n }).then((d: any) => {\n console.log('updateProject.then', d.data.updateProject.id)\n this.setState({\n project: {\n ...project,\n id: d.data.updateProject.id,\n }\n })\n setSubmitting(false)\n })\n }}\n >\n {({\n values,\n errors,\n touched,\n handleChange,\n handleBlur,\n handleSubmit,\n isSubmitting,\n }) => (\n <form onSubmit={handleSubmit}>\n <div className=\"mb5 gray f8\">\n {project.id}\n </div>\n <div className=\"mb5\">\n <Input\n label=\"Name\"\n name=\"name\"\n error={errors.name && touched.name}\n errorMessage={touched.name && errors.name}\n onChange={handleChange}\n onBlur={handleBlur}\n value={values.name} />\n </div>\n <div className=\"mb5\">\n <Textarea\n label=\"Description\"\n name=\"description\"\n type=\"textarea\"\n error={errors.description && touched.description}\n errorMessage={touched.description && errors.description}\n onChange={handleChange}\n onBlur={handleBlur}\n value={values.description} />\n </div>\n <div className=\"mb5\">\n <Input\n label=\"Demo URL\"\n name=\"demoURL\"\n error={errors.demoURL && touched.demoURL}\n errorMessage={touched.demoURL && errors.demoURL}\n onChange={handleChange}\n onBlur={handleBlur}\n value={values.demoURL} />\n </div>\n <div className=\"mb5\">\n <p>\n <FormattedMessage id=\"formula.team\" />\n </p>\n {team}\n </div>\n {deleteButton}\n <Button type=\"submit\" disabled={isSubmitting}>\n <FormattedMessage id=\"formula.save\" />\n </Button>\n </form>\n )}\n </Formik>\n )\n }}\n </Mutation>\n </div>\n )\n }\n}\n\nexport default withRuntimeContext(ProjectForm)\n\n```"
}
] |
code_formula_8e1cc488
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of formula/react/components/Header.tsx from the formula VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport React, { Component } from 'react'\nimport { FormattedMessage } from 'react-intl'\nimport { Button } from 'vtex.styleguide'\n\nimport VtexIcon from '../icons/VtexIcon'\n\ninterface HeaderProps {\n name?: string\n onLogout?: () => void\n}\n\nexport default class Header extends Component<HeaderProps> {\n public render() {\n const { name, onLogout } = this.props\n\n const title = (\n <h3><FormattedMessage id=\"formula.title\"/></h3>\n )\n\n const hello = name && (\n <div className=\"dn db-ns\">\n <FormattedMessage id=\"formula.hello\"/> {name}\n </div>\n )\n\n const logout = onLogout && (\n <Button variation=\"tertiary\" onClick={onLogout}>\n <span className=\"white\">\n <FormattedMessage id=\"formula.logout\"/>\n </span>\n </Button>\n )\n\n return (\n <header className=\"bg-serious-black pa7 white\">\n <div className=\"flex items-center justify-between\">\n <div className=\"flex items-center\">\n <VtexIcon fill=\"white\" logo/>\n <div className=\"pr3\">\n {title}\n </div>\n {hello}\n </div>\n <div>\n {logout}\n </div>\n </div>\n </header>\n )\n }\n}\n\n```"
}
] |
code_formula_d99bfae0
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of formula/react/components/Loading.tsx from the formula VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport React, { Component } from 'react'\nimport { Spinner } from 'vtex.styleguide'\n\nexport default class Timer extends Component {\n public render() {\n return (\n <div className=\"flex justify-center pa8 w-100\">\n <Spinner />\n </div>\n )\n }\n}\n\n```"
}
] |
code_formula_309a47e7
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of formula/react/components/FinalistsList.tsx from the formula VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport React, { Component } from 'react'\nimport { Query } from 'react-apollo'\n\nimport FinalistsQuery from '../queries/finalists.graphql'\n\nimport BlockedFinalists from './BlockedFinalists'\nimport Loading from './Loading'\nimport ProjectCard from './ProjectCard'\n\ninterface ProjectsListData {\n edition: string\n state: States\n}\n\nexport default class FinalistsList extends Component<ProjectsListData> {\n public count: number = 0\n\n public getWinnerIcon() {\n this.count++\n if (this.count === 3) { return '🥉 ' }\n if (this.count === 2) { return '🥈 ' }\n if (this.count === 1) { return '🥇 ' }\n\n return ''\n }\n\n public render () {\n const { edition, state } = this.props\n\n if (state !== 'RESULTS') {\n return <BlockedFinalists />\n }\n\n return (\n <Query query={FinalistsQuery} variables={{ edition }}>\n {({ loading, error, data }) => {\n if (loading) {\n return <Loading />\n }\n\n return data.finalists.map((p: Project) =>\n <ProjectCard key={p.id} {...p} email={''} edition={edition} hasTeam={true} />\n )\n }}\n </Query>\n )\n }\n}\n\n```"
}
] |
code_formula_e10914b9
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of formula/react/components/Navigation.tsx from the formula VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport React, { Component } from 'react'\nimport { FormattedMessage } from 'react-intl'\nimport { Link, withRuntimeContext } from 'render'\nimport { Button, Tab, Tabs } from 'vtex.styleguide'\n\ninterface NavigationProps {\n edition: string\n currentPage: string\n setPage: (url: string) => void\n}\n\nexport default class Navigation extends Component<NavigationProps> {\n public render() {\n const { edition, currentPage, setPage, state } = this.props\n\n return (\n <div className=\"relative mw7 center mt7\">\n <Tabs>\n <Tab label=\"Projects\" active={currentPage === 'formula/projects/list'} onClick={() => setPage('formula/projects/list')} />\n <Tab label=\"Finalists\" active={currentPage === 'formula/projects/finalists'} onClick={() => setPage('formula/projects/finalists')} />\n </Tabs>\n\n {state === 'REGISTRATION' || state === 'RUNNING' ?\n <Link page=\"formula/projects/detail\" params={{edition, id: 'new'}} className=\"absolute\" style={{right: '0em', bottom: '1em'}}>\n <Button size=\"small\" className=\"pb4\">\n <FormattedMessage id=\"formula.newProject\" />\n </Button>\n </Link>\n :null}\n </div>\n )\n }\n}\n\n```"
}
] |
code_formula_e878bbc6
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of formula/react/icons/RefreshIcon.tsx from the formula VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport React, { Component } from 'react'\n\nclass RefreshIcon extends Component {\n public render() {\n return (\n <svg width=\"16\" height=\"16\" viewBox=\"0 0 1792 1792\">\n <path d=\"M1639 1056q0 5-1 7-64 268-268 434.5t-478 166.5q-146 0-282.5-55t-243.5-157l-129 129q-19 19-45 19t-45-19-19-45v-448q0-26 19-45t45-19h448q26 0 45 19t19 45-19 45l-137 137q71 66 161 102t187 36q134 0 250-65t186-179q11-17 53-117 8-23 30-23h192q13 0 22.5 9.5t9.5 22.5zm25-800v448q0 26-19 45t-45 19h-448q-26 0-45-19t-19-45 19-45l138-138q-148-137-349-137-134 0-250 65t-186 179q-11 17-53 117-8 23-30 23h-199q-13 0-22.5-9.5t-9.5-22.5v-7q65-268 270-434.5t480-166.5q146 0 284 55.5t245 156.5l130-129q19-19 45-19t45 19 19 45z\"/>\n </svg>\n )\n }\n}\n\nexport default RefreshIcon\n\n```"
}
] |
code_formula_b0b812b1
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of formula/react/icons/SignupIcon.tsx from the formula VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport React, { Component } from 'react'\n\nclass SignupIcon extends Component {\n public render() {\n return (\n <svg height={this.props.height} width={this.props.width} version=\"1.1\" viewBox=\"0 0 64 64\" xmlns=\"http://www.w3.org/2000/svg\" x=\"0px\" y=\"0px\" xmlSpace=\"preserve\">\n <title>sign</title>\n <g fill=\"#f71963\" stroke=\"#f71963\" strokeLinecap=\"round\" strokeWidth=\"4\">\n <line fill=\"none\" x1=\"2\" x2=\"62\" y1=\"62\" y2=\"62\"/>\n <path d=\"M5,55 c0,0,3.239-13.239,6-16L45.929,4.071c2.761-2.761,7.239-2.761,10,0l0,0c2.761,2.761,2.761,7.239,0,10L21,49C18.239,51.761,5,55,5,55 z\" fill=\"none\" stroke=\"#162031\"/>\n <polyline fill=\"none\" points=\" 49,38 61,26 57,22 \"/>\n <path d=\"M10.792,39.227 C13.208,38.963,15.92,39.92,18,42l0,0c2.081,2.081,3.028,4.8,2.764,7.216\" fill=\"none\" stroke=\"#162031\"/>\n </g>\n </svg>\n )\n }\n}\n\nexport default SignupIcon\n\n```"
}
] |
code_formula_2515aaf0
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of formula/react/icons/AwardIcon.tsx from the formula VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport React, { Component } from 'react'\n\nclass AwardIcon extends Component {\n public render() {\n return (\n <svg height={this.props.height} width={this.props.width} version=\"1.1\" viewBox=\"0 0 64 64\" xmlns=\"http://www.w3.org/2000/svg\" x=\"0px\" y=\"0px\" xmlSpace=\"preserve\">\n <title>award</title>\n <g fill=\"#f71963\" stroke=\"#f71963\" strokeLinecap=\"round\" strokeWidth=\"4\">\n <polyline fill=\"none\" points=\"43,40.892 43,61 32,56 21,61 21,40.891 \"/>\n <circle cx=\"32\" cy=\"23\" fill=\"none\" r=\"8\"/>\n <circle cx=\"32\" cy=\"23\" fill=\"none\" r=\"21\" stroke=\"#162031\"/>\n </g>\n </svg>\n )\n }\n}\n\nexport default AwardIcon\n\n```"
}
] |
code_formula_72bc6018
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of formula/react/icons/DevelopIcon.tsx from the formula VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport React, { Component } from 'react'\n\nclass DevelopIcon extends Component {\n public render() {\n return (\n <svg height={this.props.height} width={this.props.width} version=\"1.1\" viewBox=\"0 0 64 64\" xmlns=\"http://www.w3.org/2000/svg\" x=\"0px\" y=\"0px\" xmlSpace=\"preserve\">\n <title>window dev</title>\n <g fill=\"#f71963\" stroke=\"#f71963\" strokeLinecap=\"round\" strokeWidth=\"4\">\n <polyline fill=\"none\" points=\" 22,34 18,38 22,42 \"/>\n <polyline fill=\"none\" points=\" 42,34 46,38 42,42 \"/>\n <line fill=\"none\" x1=\"28\" x2=\"36\" y1=\"46\" y2=\"30\"/>\n <line fill=\"none\" x1=\"10\" x2=\"14\" y1=\"13\" y2=\"13\"/>\n <line fill=\"none\" x1=\"20\" x2=\"24\" y1=\"13\" y2=\"13\"/>\n <line fill=\"none\" x1=\"43\" x2=\"54\" y1=\"13\" y2=\"13\"/>\n <line fill=\"none\" stroke=\"#162031\" x1=\"2\" x2=\"62\" y1=\"20\" y2=\"20\"/>\n <rect height=\"52\" width=\"60\" fill=\"none\" stroke=\"#162031\" x=\"2\" y=\"6\"/>\n </g>\n </svg>\n )\n }\n}\n\nexport default DevelopIcon\n\n```"
}
] |
code_formula_8667f1c2
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of formula/react/icons/OwlIcon.tsx from the formula VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport React, { Component } from 'react'\n\nclass OwlIcon extends Component {\n public render() {\n return (\n <svg height={this.props.height} width={this.props.width} version=\"1.1\" viewBox=\"0 0 64 64\" xmlns=\"http://www.w3.org/2000/svg\" x=\"0px\" y=\"0px\" xmlSpace=\"preserve\">\n <title>owl</title>\n <g fill=\"#f71963\" stroke=\"#f71963\" strokeLinecap=\"round\" strokeWidth=\"3\" transform=\"translate(0.5 0.5)\">\n <path d=\"M51.5970459,14 c-1.0246582-2.0047607-2.3737793-3.8895264-4.0406494-5.5563965C43.2606201,4.1478271,37.630249,1.9998779,32,1.9998779 S20.7393799,4.1478271,16.4436035,8.4436035C14.7767334,10.1104736,13.4276123,11.9952393,12.4029541,14\" fill=\"none\"/>\n <path d=\"M13.6785889,36.2019043 l13.0579834,22.6760254h0.0294189C27.7873535,60.7302246,29.7352295,62,32,62s4.2126465-1.2697754,5.2340088-3.1220703h0.0294189 l13.0579834-22.6760254\" fill=\"none\"/>\n <path d=\"M14.8954649,38.3150864 C11.950819,40.5018234,10,44.050396,10,48c0,2.7181396,0.9143066,5.2167969,2.4377441,7.2287598 c1.0566854-3.6444054,4.2928905-6.4931564,8.0878925-7.1365166\" fill=\"none\"/>\n <path d=\"M49.1045341,38.3150864 C52.0491829,40.5018234,54,44.050396,54,48c0,2.7181396-0.9143066,5.2167969-2.4377441,7.2287598 c-1.0566864-3.6444054-4.2928886-6.4931564-8.0878944-7.1365166\" fill=\"none\"/>\n <path d=\"M28.0673122,34.8776932 C25.9344444,36.8232307,23.1143875,38,20,38c-6.6274166,0-12-5.3725815-12-12c0-0.5396099,0.0300512-1.0280037,0.099062-1.5487537\" fill=\"none\" stroke=\"#162031\"/>\n <path d=\"M35.9304466,34.8942566 C38.0625038,36.8359375,40.88908,38,44,38c6.6274185,0,12-5.3725815,12-12c0-0.5396099-0.0300522-1.0280037-0.0990601-1.5487537\" fill=\"none\" stroke=\"#162031\"/>\n <path d=\"M32,26H13.9999876 C7.3725777,26,2,20.6274223,2,14.0000124V14h18.0000114C26.6274223,14,32,19.3725777,32,25.9999886V26z\" fill=\"none\" stroke=\"#162031\"/>\n <path d=\"M32,26h18.0000114 C56.6274223,26,62,20.6274223,62,14.0000124V14H43.9999886C37.3725777,14,32,19.3725777,32,25.9999886V26\" fill=\"none\" stroke=\"#162031\"/>\n <path d=\"M24,26 c0,2.2091389-1.7908611,4-4,4s-4-1.7908611-4-4\" fill=\"none\" stroke=\"#162031\"/>\n <path d=\"M48,26 c0,2.2091389-1.7908592,4-4,4s-4-1.7908611-4-4\" fill=\"none\" stroke=\"#162031\"/>\n <path d=\"M28,34 c0-2.2091389,1.7908611-8,4-8s4,5.7908611,4,8s-1.7908592,8-4,8S28,36.2091408,28,34z\" fill=\"none\" stroke=\"#162031\"/>\n </g>\n </svg>\n )\n }\n}\n\nexport default OwlIcon\n\n```"
}
] |
code_formula_c04644f2
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of formula/react/icons/TeamIcon.tsx from the formula VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport React, { Component } from 'react'\n\nclass TeamIcon extends Component {\n public render() {\n return (\n <svg height={this.props.height} width={this.props.width} version=\"1.1\" viewBox=\"0 0 64 64\" xmlns=\"http://www.w3.org/2000/svg\" x=\"0px\" y=\"0px\" xmlSpace=\"preserve\">\n <title>multiple 11</title>\n <g fill=\"#f71963\" stroke=\"#f71963\" strokeLinecap=\"round\" strokeWidth=\"4\">\n <path d=\"M21.427,27.439 C20.464,25.41,18.395,24,16,24H8c-3.314,0-6,2.686-6,6v8l4,2l1,14h11\" fill=\"none\"/>\n <circle cx=\"12\" cy=\"12\" fill=\"none\" r=\"6\"/>\n <path d=\"M42.573,27.439 C43.536,25.41,45.605,24,48,24h8c3.314,0,6,2.686,6,6v8l-4,2l-1,14H46\" fill=\"none\"/>\n <circle cx=\"52\" cy=\"12\" fill=\"none\" r=\"6\"/>\n <path d=\"M38,62H26l-1-16l-5-1V32 c0-4.418,3.582-8,8-8h8c4.418,0,8,3.582,8,8v13l-5,1L38,62z\" fill=\"none\" stroke=\"#162031\"/>\n <circle cx=\"32\" cy=\"10\" fill=\"none\" r=\"8\" stroke=\"#162031\"/>\n </g>\n </svg>\n )\n }\n}\n\nexport default TeamIcon\n\n```"
}
] |
code_formula_5fee8ff3
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of formula/react/icons/VtexIcon.tsx from the formula VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport React, { Component, Fragment } from 'react'\n\nclass VtexIcon extends Component<{fill?: string, logo?: boolean}> {\n public render() {\n const {fill = '#F71963', logo = null} = this.props\n const vtex = !logo && (\n <Fragment>\n <path d=\"M39.3559 0H7.58867C5.12544 0 3.54811 2.59188 4.70074 4.7466L7.87832 10.7021H2.11774C1.75293 10.7022 1.39433 10.7956 1.07667 10.9732C0.759019 11.1507 0.493077 11.4065 0.304605 11.7156C0.116133 12.0248 0.0115195 12.3769 0.000898204 12.7378C-0.00972314 13.0987 0.0740067 13.4562 0.243979 13.7757L10.4647 32.9227C10.6449 33.2595 10.9144 33.5412 11.2442 33.7378C11.5741 33.9343 11.9518 34.0381 12.3368 34.0381C12.7218 34.0381 13.0995 33.9343 13.4293 33.7378C13.7592 33.5412 14.0287 33.2595 14.2088 32.9227L16.9846 27.7507L20.4672 34.2762C21.6928 36.5714 25.0131 36.5756 26.243 34.283L42.1657 4.62638C43.2912 2.52883 41.7555 0 39.3559 0ZM25.0862 12.6711L18.2205 25.4615C18.1005 25.6854 17.9212 25.8728 17.7017 26.0034C17.4823 26.1341 17.231 26.2032 16.9749 26.2032C16.7188 26.2032 16.4675 26.1341 16.2481 26.0034C16.0286 25.8728 15.8492 25.6854 15.7292 25.4615L8.92986 12.7249C8.81622 12.5125 8.7599 12.2747 8.76636 12.0345C8.77283 11.7943 8.84185 11.5598 8.96675 11.3537C9.09166 11.1476 9.2682 10.977 9.4793 10.8582C9.69039 10.7395 9.92888 10.6768 10.1717 10.6761H23.8749C24.1116 10.6761 24.3443 10.7367 24.5503 10.8521C24.7564 10.9675 24.9287 11.1336 25.0507 11.3345C25.1726 11.5353 25.2399 11.7639 25.2462 11.9981C25.2524 12.2323 25.1973 12.4642 25.0862 12.6711Z\" fill={fill}/>\n <path d=\"M73.1448 13.7581H69.6699V25.5456C69.6697 25.653 69.6265 25.7559 69.5497 25.8319C69.473 25.9078 69.369 25.9506 69.2605 25.9508H66.5807C66.4722 25.9506 66.3681 25.9078 66.2914 25.8319C66.2147 25.7559 66.1715 25.653 66.1713 25.5456V13.7581H62.676C62.6234 13.7602 62.5708 13.7519 62.5215 13.7335C62.4722 13.7152 62.4271 13.6873 62.389 13.6513C62.3508 13.6154 62.3203 13.5723 62.2992 13.5245C62.2782 13.4767 62.2671 13.4252 62.2666 13.373V11.2881C62.2671 11.236 62.2782 11.1845 62.2992 11.1367C62.3203 11.0889 62.3508 11.0457 62.389 11.0098C62.4271 10.9739 62.4722 10.9459 62.5215 10.9276C62.5708 10.9093 62.6234 10.9009 62.676 10.9031H73.1439C73.2524 10.898 73.3585 10.9357 73.439 11.0078C73.5196 11.08 73.568 11.1807 73.5737 11.2881V13.3739C73.5678 13.4809 73.5194 13.5814 73.4391 13.6533C73.3587 13.7252 73.253 13.7629 73.1448 13.7581Z\" fill={fill}/>\n <path d=\"M84.2999 25.8659C83.5838 25.9668 82.3794 26.129 80.1701 26.129C77.531 26.129 75.1995 25.4607 75.1995 21.7759V15.0503C75.1995 11.3655 77.5523 10.7173 80.1905 10.7173C82.3989 10.7173 83.5838 10.8795 84.2999 10.9804C84.5861 11.0208 84.7093 11.1225 84.7093 11.3856V13.2713C84.709 13.3787 84.6658 13.4817 84.5891 13.5576C84.5124 13.6336 84.4084 13.6763 84.2999 13.6766H79.9866C79.0251 13.6766 78.6777 14.0002 78.6777 15.0536V16.8964H84.1368C84.2453 16.8967 84.3493 16.9394 84.426 17.0154C84.5027 17.0913 84.546 17.1943 84.5462 17.3017V19.2252C84.546 19.3326 84.5027 19.4355 84.426 19.5115C84.3493 19.5874 84.2453 19.6302 84.1368 19.6304H78.6777V21.7767C78.6777 22.8293 79.0251 23.1538 79.9866 23.1538H84.2999C84.4084 23.154 84.5124 23.1968 84.5891 23.2727C84.6658 23.3487 84.709 23.4516 84.7093 23.559V25.4422C84.7093 25.7036 84.5861 25.8255 84.2999 25.8659Z\" fill={fill}/>\n <path d=\"M99.7342 25.9466H96.4818C96.216 25.9466 96.0928 25.8625 95.9501 25.6431L93.1301 21.2117L90.5752 25.5455C90.4316 25.7885 90.2889 25.9508 90.0655 25.9508H87.0383C86.8336 25.9508 86.7317 25.8289 86.7317 25.6876C86.7356 25.6381 86.7495 25.5898 86.7724 25.5455L91.2037 18.2314L86.7266 11.2864C86.7039 11.2493 86.6899 11.2077 86.6858 11.1645C86.6931 11.0901 86.729 11.0213 86.7861 10.9724C86.8431 10.9234 86.917 10.898 86.9924 10.9014H90.2855C90.5106 10.9014 90.6745 11.104 90.7951 11.2864L93.4121 15.3764L95.945 11.2864C96.0469 11.104 96.2312 10.9014 96.4546 10.9014H99.4819C99.5573 10.898 99.6312 10.9234 99.6882 10.9724C99.7453 11.0213 99.7812 11.0901 99.7885 11.1645C99.7844 11.2077 99.7704 11.2493 99.7477 11.2864L95.2927 18.2743L99.9388 25.5455C99.9751 25.6073 99.9961 25.6768 100 25.7481C100.001 25.8658 99.8981 25.9466 99.7342 25.9466Z\" fill={fill}/>\n <path d=\"M57.3639 10.9434C57.2909 10.9436 57.2201 10.9688 57.1638 11.0148C57.1074 11.0608 57.0689 11.1247 57.0547 11.1956L54.0852 22.0735C54.0445 22.2962 53.9833 22.377 53.799 22.377C53.6147 22.377 53.5535 22.2929 53.5128 22.0735L50.5399 11.1931C50.5257 11.1222 50.4872 11.0583 50.4308 11.0123C50.3745 10.9663 50.3038 10.9411 50.2307 10.9409H47.308C47.2604 10.9409 47.2135 10.9516 47.1707 10.9721C47.1279 10.9926 47.0904 11.0223 47.0608 11.0592C47.0313 11.096 47.0105 11.139 47 11.1849C46.9896 11.2308 46.9897 11.2784 47.0005 11.3242C47.0005 11.3242 50.6274 23.7994 50.6673 23.9222C51.1514 25.4085 52.3262 26.1189 53.8211 26.1189C55.2447 26.1189 56.4873 25.3749 56.9732 23.9264C57.0309 23.7582 60.5772 11.3234 60.5772 11.3234C60.5877 11.2776 60.5878 11.2301 60.5773 11.1843C60.5667 11.1385 60.5459 11.0957 60.5164 11.0589C60.4869 11.0222 60.4494 10.9925 60.4066 10.972C60.3639 10.9516 60.3171 10.941 60.2697 10.9409L57.3639 10.9434Z\" fill={fill}/>\n </Fragment>\n )\n\n const width = logo ? '50' : '100'\n\n return (\n <svg width={width} height=\"36\" viewBox={`0 0 ${width} 36`} fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <rect width={width} height=\"36\" fill=\"black\" fillOpacity=\"0\"/>\n {vtex}\n <path d=\"M39.3559 0H7.58867C5.12544 0 3.54811 2.59188 4.70074 4.7466L7.87832 10.7021H2.11774C1.75293 10.7022 1.39433 10.7956 1.07667 10.9732C0.759019 11.1507 0.493077 11.4065 0.304605 11.7156C0.116133 12.0248 0.0115195 12.3769 0.000898204 12.7378C-0.00972314 13.0987 0.0740067 13.4562 0.243979 13.7757L10.4647 32.9227C10.6449 33.2595 10.9144 33.5412 11.2442 33.7378C11.5741 33.9343 11.9518 34.0381 12.3368 34.0381C12.7218 34.0381 13.0995 33.9343 13.4293 33.7378C13.7592 33.5412 14.0287 33.2595 14.2088 32.9227L16.9846 27.7507L20.4672 34.2762C21.6928 36.5714 25.0131 36.5756 26.243 34.283L42.1657 4.62638C43.2912 2.52883 41.7555 0 39.3559 0ZM25.0862 12.6711L18.2205 25.4615C18.1005 25.6854 17.9212 25.8728 17.7017 26.0034C17.4823 26.1341 17.231 26.2032 16.9749 26.2032C16.7188 26.2032 16.4675 26.1341 16.2481 26.0034C16.0286 25.8728 15.8492 25.6854 15.7292 25.4615L8.92986 12.7249C8.81622 12.5125 8.7599 12.2747 8.76636 12.0345C8.77283 11.7943 8.84185 11.5598 8.96675 11.3537C9.09166 11.1476 9.2682 10.977 9.4793 10.8582C9.69039 10.7395 9.92888 10.6768 10.1717 10.6761H23.8749C24.1116 10.6761 24.3443 10.7367 24.5503 10.8521C24.7564 10.9675 24.9287 11.1336 25.0507 11.3345C25.1726 11.5353 25.2399 11.7639 25.2462 11.9981C25.2524 12.2323 25.1973 12.4642 25.0862 12.6711Z\" fill={fill}/>\n </svg>\n\n )\n }\n}\n\nexport default VtexIcon\n\n```"
}
] |
code_formula_0f394c53
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of formula/react/icons/UserIcon.tsx from the formula VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport React, { Component } from 'react'\n\nclass UserIcon extends Component {\n public render() {\n return (\n <svg width=\"16\" height=\"16\" viewBox=\"0 0 1792 1792\">\n <path d=\"M1536 1399q0 109-62.5 187t-150.5 78h-854q-88 0-150.5-78t-62.5-187q0-85 8.5-160.5t31.5-152 58.5-131 94-89 134.5-34.5q131 128 313 128t313-128q76 0 134.5 34.5t94 89 58.5 131 31.5 152 8.5 160.5zm-256-887q0 159-112.5 271.5t-271.5 112.5-271.5-112.5-112.5-271.5 112.5-271.5 271.5-112.5 271.5 112.5 112.5 271.5z\" />\n </svg>\n )\n }\n}\n\nexport default UserIcon\n```"
}
] |
code_formula_1200cb35
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of formula/react/icons/LogoutIcon.tsx from the formula VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport React, { Component } from 'react'\n\nclass GithubIcon extends Component {\n public render() {\n return (\n <svg width=\"17\" height=\"16\" viewBox=\"0 0 17 16\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <rect width=\"15\" height=\"14\" fill=\"black\" fillOpacity=\"0\" transform=\"translate(1 1)\"/>\n <path d=\"M6 8H16\" stroke=\"#134CD8\" strokeMiterlimit=\"10\" strokeLinecap=\"round\" strokeLinejoin=\"round\"/>\n <path d=\"M12 4L16 8L12 12\" stroke=\"#134CD8\" strokeMiterlimit=\"10\" strokeLinecap=\"round\" strokeLinejoin=\"round\"/>\n <path d=\"M9 15H2C1.448 15 1 14.552 1 14V2C1 1.448 1.448 1 2 1H9\" stroke=\"#134CD8\" strokeMiterlimit=\"10\" strokeLinecap=\"round\" strokeLinejoin=\"round\"/>\n </svg>\n\n )\n }\n}\n\nexport default GithubIcon\n```"
}
] |
code_formula_0465c1b2
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of formula/react/icons/GithubIcon.tsx from the formula VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport React, { Component } from 'react'\n\nclass GithubIcon extends Component {\n public render() {\n return (\n <svg width=\"15px\" height=\"15px\" viewBox=\"0 0 256 250\">\n <g>\n <path d=\"M128.00106,0 C57.3172926,0 0,57.3066942 0,128.00106 C0,184.555281 36.6761997,232.535542 87.534937,249.460899 C93.9320223,250.645779 96.280588,246.684165 96.280588,243.303333 C96.280588,240.251045 96.1618878,230.167899 96.106777,219.472176 C60.4967585,227.215235 52.9826207,204.369712 52.9826207,204.369712 C47.1599584,189.574598 38.770408,185.640538 38.770408,185.640538 C27.1568785,177.696113 39.6458206,177.859325 39.6458206,177.859325 C52.4993419,178.762293 59.267365,191.04987 59.267365,191.04987 C70.6837675,210.618423 89.2115753,204.961093 96.5158685,201.690482 C97.6647155,193.417512 100.981959,187.77078 104.642583,184.574357 C76.211799,181.33766 46.324819,170.362144 46.324819,121.315702 C46.324819,107.340889 51.3250588,95.9223682 59.5132437,86.9583937 C58.1842268,83.7344152 53.8029229,70.715562 60.7532354,53.0843636 C60.7532354,53.0843636 71.5019501,49.6441813 95.9626412,66.2049595 C106.172967,63.368876 117.123047,61.9465949 128.00106,61.8978432 C138.879073,61.9465949 149.837632,63.368876 160.067033,66.2049595 C184.49805,49.6441813 195.231926,53.0843636 195.231926,53.0843636 C202.199197,70.715562 197.815773,83.7344152 196.486756,86.9583937 C204.694018,95.9223682 209.660343,107.340889 209.660343,121.315702 C209.660343,170.478725 179.716133,181.303747 151.213281,184.472614 C155.80443,188.444828 159.895342,196.234518 159.895342,208.176593 C159.895342,225.303317 159.746968,239.087361 159.746968,243.303333 C159.746968,246.709601 162.05102,250.70089 168.53925,249.443941 C219.370432,232.499507 256,184.536204 256,128.00106 C256,57.3066942 198.691187,0 128.00106,0 Z M47.9405593,182.340212 C47.6586465,182.976105 46.6581745,183.166873 45.7467277,182.730227 C44.8183235,182.312656 44.2968914,181.445722 44.5978808,180.80771 C44.8734344,180.152739 45.876026,179.97045 46.8023103,180.409216 C47.7328342,180.826786 48.2627451,181.702199 47.9405593,182.340212 Z M54.2367892,187.958254 C53.6263318,188.524199 52.4329723,188.261363 51.6232682,187.366874 C50.7860088,186.474504 50.6291553,185.281144 51.2480912,184.70672 C51.8776254,184.140775 53.0349512,184.405731 53.8743302,185.298101 C54.7115892,186.201069 54.8748019,187.38595 54.2367892,187.958254 Z M58.5562413,195.146347 C57.7719732,195.691096 56.4895886,195.180261 55.6968417,194.042013 C54.9125733,192.903764 54.9125733,191.538713 55.713799,190.991845 C56.5086651,190.444977 57.7719732,190.936735 58.5753181,192.066505 C59.3574669,193.22383 59.3574669,194.58888 58.5562413,195.146347 Z M65.8613592,203.471174 C65.1597571,204.244846 63.6654083,204.03712 62.5716717,202.981538 C61.4524999,201.94927 61.1409122,200.484596 61.8446341,199.710926 C62.5547146,198.935137 64.0575422,199.15346 65.1597571,200.200564 C66.2704506,201.230712 66.6095936,202.705984 65.8613592,203.471174 Z M75.3025151,206.281542 C74.9930474,207.284134 73.553809,207.739857 72.1039724,207.313809 C70.6562556,206.875043 69.7087748,205.700761 70.0012857,204.687571 C70.302275,203.678621 71.7478721,203.20382 73.2083069,203.659543 C74.6539041,204.09619 75.6035048,205.261994 75.3025151,206.281542 Z M86.046947,207.473627 C86.0829806,208.529209 84.8535871,209.404622 83.3316829,209.4237 C81.8013,209.457614 80.563428,208.603398 80.5464708,207.564772 C80.5464708,206.498591 81.7483088,205.631657 83.2786917,205.606221 C84.8005962,205.576546 86.046947,206.424403 86.046947,207.473627 Z M96.6021471,207.069023 C96.7844366,208.099171 95.7267341,209.156872 94.215428,209.438785 C92.7295577,209.710099 91.3539086,209.074206 91.1652603,208.052538 C90.9808515,206.996955 92.0576306,205.939253 93.5413813,205.66582 C95.054807,205.402984 96.4092596,206.021919 96.6021471,207.069023 Z\" fill=\"#161614\"></path>\n </g>\n </svg>\n )\n }\n}\n\nexport default GithubIcon\n```"
}
] |
code_product-review-commons_c96a36bd
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of product-review-commons/messages/en.json from the product-review-commons VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"numberOfReviews\": \"{number, plural, =0 {No Reviews} =1 {# Review} other {# Reviews}}\",\n \"writeAReview\": \"{number, plural, =0 {Write the first review} other {Write a review}}\",\n \"rating\": \"{rating} out of 5 stars\"\n}\n\n```"
}
] |
code_product-review-commons_319cd3f7
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of product-review-commons/messages/context.json from the product-review-commons VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"numberOfReviews\": \"# Reviews\",\n \"writeAReview\": \"Write a review\",\n \"rating\": \"Rating out of 5 stars\"\n}\n\n```"
}
] |
code_product-review-commons_71261ca0
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of product-review-commons/docs/README.md from the product-review-commons VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```markdown\n# VTEX IO Base Component\n\nThis demo component shows you how to make a simple yet complete VTEX IO component.\n\nIt shows a simple demonstration of the following features:\n\n- Declaring a component interface in `store/interfaces.json`.\n- Declaring a schema to receive props via Storefront.\n- Using the `messages` feature to have localized strings.\n- Using an NPM package like `react-intl`\n- Using another VTEX IO App like `vtex.styleguide`.\n- Using CSS Modules to make your component customizable via CSS on a store theme.\n- Using tachyons tokens to quickly style your components.\n```"
}
] |
code_product-review-commons_5a27739e
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of product-review-commons/react/styles.css from the product-review-commons VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```css\n.star--filled {\n color: #fc0;\n}\n\n.star--empty {\n color: #eee;\n}\n\n```"
}
] |
code_product-review-commons_24cdf9bb
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of product-review-commons/react/WriteAReview.test.tsx from the product-review-commons VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\nimport { render } from '@vtex/test-tools/react'\nimport WriteAReview from './WriteAReview'\n\ntest(\"should render when there's zero\", () => {\n const { getByText } = render(<WriteAReview number={0} linkTo=\"#foo\" />)\n\n expect(getByText('Write the first review')).toBeTruthy()\n})\n\ntest(\"should render when there's reviews\", () => {\n const { getByText } = render(<WriteAReview number={1} linkTo=\"#foo\" />)\n\n expect(getByText('Write a review')).toBeTruthy()\n})\n\n```"
}
] |
code_product-review-commons_3ae4703a
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of product-review-commons/react/WriteAReview.tsx from the product-review-commons VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport React, { FunctionComponent } from 'react'\nimport { FormattedMessage } from 'react-intl'\nimport { Link, useOwnerBlockCssHandles } from 'vtex.render-runtime'\n\nconst handleNames = ['writeAReview']\n\nconst WriteAReview: FunctionComponent<Props> = ({ number, linkTo }) => {\n const handles = useOwnerBlockCssHandles(handleNames)\n\n return (\n <Link\n to={linkTo || '#reviews'}\n className={`${handles.writeAReview} c-link t-small`}\n >\n <FormattedMessage id=\"writeAReview\" values={{ number }} />\n </Link>\n )\n}\n\ninterface Props {\n number: number\n linkTo: string\n}\n\nexport default WriteAReview\n\n```"
}
] |
code_product-review-commons_2d109387
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of product-review-commons/react/package.json from the product-review-commons VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"scripts\": {\n \"test\": \"vtex-test-tools test\",\n \"lint\": \"tsc --noEmit && eslint --ext ts,tsx .\"\n },\n \"dependencies\": {\n \"@vtex/css-handles\": \"^1.0.0\",\n \"classnames\": \"^2.2.6\",\n \"ramda\": \"^0.26.1\",\n \"react\": \"^16.8.3\",\n \"react-dom\": \"^16.8.3\",\n \"react-intl\": \"^2.7.2\"\n },\n \"devDependencies\": {\n \"@types/classnames\": \"^2.2.7\",\n \"@types/graphql\": \"^14.2.0\",\n \"@types/jest\": \"^24.0.11\",\n \"@types/node\": \"^11.13.0\",\n \"@types/prop-types\": \"^15.7.0\",\n \"@types/ramda\": \"^0.26.5\",\n \"@types/react\": \"^16.8.10\",\n \"@types/react-intl\": \"^2.3.17\",\n \"@vtex/test-tools\": \"^0.3.2\",\n \"apollo-client\": \"^2.5.1\",\n \"eslint\": \"^5.16.0\",\n \"eslint-config-vtex-react\": \"^4.1.0\",\n \"prettier\": \"^1.18.2\",\n \"tslint-eslint-rules\": \"^5.4.0\",\n \"typescript\": \"3.5.2\"\n },\n \"version\": \"0.1.0\"\n}\n\n```"
}
] |
code_product-review-commons_1ac1618f
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of product-review-commons/react/Stars.test.tsx from the product-review-commons VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\nimport { render } from '@vtex/test-tools/react'\nimport Stars from './Stars'\n\ntest('should render stars', () => {\n const { container, rerender } = render(<Stars rating={0} />)\n let empty = container.querySelectorAll('.star--empty')\n expect(empty).toHaveLength(5)\n\n rerender(<Stars rating={1} />)\n let filled = container.querySelectorAll('.star--filled')\n empty = container.querySelectorAll('.star--empty')\n expect(filled).toHaveLength(1)\n expect(empty).toHaveLength(4)\n\n rerender(<Stars rating={2} />)\n filled = container.querySelectorAll('.star--filled')\n empty = container.querySelectorAll('.star--empty')\n expect(filled).toHaveLength(2)\n expect(empty).toHaveLength(3)\n\n rerender(<Stars rating={3} />)\n filled = container.querySelectorAll('.star--filled')\n empty = container.querySelectorAll('.star--empty')\n expect(filled).toHaveLength(3)\n expect(empty).toHaveLength(2)\n\n rerender(<Stars rating={4} />)\n filled = container.querySelectorAll('.star--filled')\n empty = container.querySelectorAll('.star--empty')\n expect(filled).toHaveLength(4)\n expect(empty).toHaveLength(1)\n\n rerender(<Stars rating={5} />)\n filled = container.querySelectorAll('.star--filled')\n empty = container.querySelectorAll('.star--empty')\n expect(filled).toHaveLength(5)\n expect(empty).toHaveLength(0)\n})\n\n```"
}
] |
code_product-review-commons_621cc1d6
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of product-review-commons/react/NumberOfReviews.tsx from the product-review-commons VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport React, { FunctionComponent } from 'react'\nimport { FormattedMessage } from 'react-intl'\nimport { Link, useOwnerBlockCssHandles } from 'vtex.render-runtime'\n\nconst handleNames = ['numberOfReviews', 'numberOfReviews--zero']\n\nconst NumberOfReviews: FunctionComponent<NumberOfReviewsProps> = ({\n number,\n linkTo,\n}) => {\n const handles = useOwnerBlockCssHandles(handleNames)\n\n if (number === 0) {\n return (\n <span\n className={`${handles.numberOfReviews} ${handles['numberOfReviews--zero']} c-muted-2 t-small`}\n >\n <FormattedMessage id=\"numberOfReviews\" values={{ number }} />\n </span>\n )\n }\n\n return (\n <Link\n to={linkTo || '#reviews'}\n className={`${handles.numberOfReviews} c-link t-small`}\n >\n <FormattedMessage id=\"numberOfReviews\" values={{ number }} />\n </Link>\n )\n}\n\ninterface NumberOfReviewsProps {\n number: number\n linkTo: string\n}\n\nexport default NumberOfReviews\n\n```"
}
] |
code_product-review-commons_646cfdad
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of product-review-commons/react/NumberOfReviews.test.tsx from the product-review-commons VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\nimport { render } from '@vtex/test-tools/react'\nimport NumberOfReviews from './NumberOfReviews'\n\ntest(\"should render when there's zero\", () => {\n const { getByText } = render(<NumberOfReviews number={0} linkTo=\"#foo\" />)\n\n expect(getByText('No Reviews')).toBeTruthy()\n})\n\ntest(\"should render when there's reviews\", () => {\n const { getByText, rerender } = render(\n <NumberOfReviews number={1} linkTo=\"#foo\" />\n )\n\n expect(getByText('1 Review')).toBeTruthy()\n\n rerender(<NumberOfReviews number={2} linkTo=\"#foo\" />)\n\n expect(getByText('2 Reviews')).toBeTruthy()\n})\n\n```"
}
] |
code_product-review-commons_3cf66743
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of product-review-commons/react/Stars.tsx from the product-review-commons VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport React, { FunctionComponent, useMemo } from 'react'\nimport { injectIntl, InjectedIntlProps, defineMessages } from 'react-intl'\nimport { useOwnerBlockCssHandles } from 'vtex.render-runtime'\nimport Star from './components/Star'\n\nconst handleNames = ['stars']\n\nconst messages = defineMessages({\n rating: {\n id: 'rating',\n defaultMessage: '',\n },\n})\n\nconst Stars: FunctionComponent<StarsProps & InjectedIntlProps> = ({\n rating,\n intl,\n}) => {\n const styles = useOwnerBlockCssHandles(handleNames)\n const stars = useMemo(\n () => [null, null, null, null, null].map((_, index) => index < rating),\n [rating]\n )\n\n return (\n <span\n className={styles.stars}\n title={intl.formatMessage(messages.rating, { rating })}\n >\n {stars.map((value, index) => (\n <Star key={index} filled={value} />\n ))}\n </span>\n )\n}\n\ninterface StarsProps {\n rating: number\n}\n\nexport default injectIntl(Stars)\n\n```"
}
] |
code_product-review-commons_c50d0320
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of product-review-commons/store/interfaces.json from the product-review-commons VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"base-store-component\": {\n \"component\": \"Example\"\n }\n}\n```"
}
] |
code_product-review-commons_bab40667
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of product-review-commons/react/typings/storefront.d.ts from the product-review-commons VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport { FunctionComponent } from 'react'\n\ndeclare global {\n interface StorefrontFunctionComponent<P = {}> extends FunctionComponent<P> {\n getSchema?(props: P): object\n schema?: object\n }\n\n interface StorefrontComponent<P = {}, S = {}> extends Component<P, S> {\n getSchema?(props: P): object\n schema: object\n }\n}\n\n```"
}
] |
code_product-review-commons_d1122b78
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of product-review-commons/react/typings/vtex.render-runtime.d.ts from the product-review-commons VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\n/* Typings for `render-runtime` */\ndeclare module 'vtex.render-runtime' {\n import { Component, ComponentType, ReactElement, ReactType } from 'react'\n\n export interface NavigationOptions {\n page: string\n params?: any\n }\n\n export interface RenderContextProps {\n runtime: {\n navigate: (options: NavigationOptions) => void\n }\n }\n\n interface ExtensionPointProps {\n id: string\n [key: string]: any\n }\n\n export const ExtensionPoint: ComponentType<ExtensionPointProps>\n\n interface ChildBlockProps {\n id: string\n }\n\n export const ChildBlock: ComponentType<ChildBlockProps>\n export const useChildBlock = function({ id: string }): object {}\n\n interface CssHandles {\n [key: string]: string\n }\n\n export const useOwnerBlockCssHandles = (handles: string[]) => CssHandles\n export const Helmet: ReactElement\n export const Link: ReactType\n export const NoSSR: ReactElement\n export const RenderContextConsumer: ReactElement\n export const canUseDOM: boolean\n export const withRuntimeContext: <TOriginalProps extends {}>(\n Component: ComponentType<TOriginalProps & RenderContextProps>\n ) => ComponentType<TOriginalProps>\n}\n\n```"
}
] |
code_product-review-commons_86f127b9
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of product-review-commons/react/typings/vtex.store-icons.d.ts from the product-review-commons VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\ndeclare module 'vtex.store-icons' {\n import { ComponentType } from 'react'\n\n export const IconStar: ComponentType\n}\n\n```"
}
] |
code_product-review-commons_22dd62f0
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of product-review-commons/react/typings/css.d.ts from the product-review-commons VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\ndeclare module '*.css' {\n const css: any\n export default css\n}\n\n```"
}
] |
code_product-review-commons_bc4af930
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of product-review-commons/react/typings/graphql.d.ts from the product-review-commons VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\ndeclare module '*.graphql' {\n import { DocumentNode } from 'graphql'\n\n const value: DocumentNode\n export default value\n}\n\n```"
}
] |
code_product-review-commons_54cf071f
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of product-review-commons/react/typings/vtex.styleguide.d.ts from the product-review-commons VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\ndeclare module 'vtex.styleguide' {\n import { ComponentType } from 'react'\n\n export const Input: ComponentType<InputProps>\n\n interface InputProps {\n [key: string]: any\n }\n}\n\n```"
}
] |
code_product-review-commons_10507919
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of product-review-commons/react/components/Star.tsx from the product-review-commons VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport React, { FunctionComponent } from 'react'\nimport { useOwnerBlockCssHandles } from 'vtex.render-runtime'\nimport { IconStar } from 'vtex.store-icons'\nimport styles from '../styles.css'\nimport classNames from 'classnames'\n\nconst handleNames = ['star', 'star--filled', 'star--empty']\n\nconst Star: FunctionComponent<StarProps> = ({ filled }) => {\n const handles = useOwnerBlockCssHandles(handleNames)\n\n return (\n <span\n className={classNames(handles.star, {\n [`${styles['star--filled']} ${handles['star--filled']}`]: filled,\n [`${styles['star--empty']} ${handles['star--empty']}`]: !filled,\n })}\n >\n <IconStar />\n </span>\n )\n}\n\ninterface StarProps {\n filled: boolean\n}\n\nexport default Star\n\n```"
}
] |
code_code-cup_42eb8f65
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of code-cup/docs/README.md from the code-cup VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```markdown\n# VTEX Code Cup\n\nVTEX Code Cup is a programming contest for Brazilian students where each student's algorithms and data structures skills are challenged while trying to solve as many problems as possible in the smallest amount of time. \n\n```"
}
] |
code_code-cup_7bce9d3d
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of code-cup/react/CodeCupRules.tsx from the code-cup VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport React, { Fragment } from 'react'\nimport { Helmet } from 'vtex.render-runtime'\n\nimport favicon from './images/favicon.png'\nimport Logo from './images/logo_codecup_02@2x.png'\nimport Footer from './components/Footer'\n\nconst CodeCupRules = () => (\n <Fragment>\n <Helmet>\n <title>VTEX Code Cup - Regras</title>\n <meta name=\"description\" content=\"Coding competition from VTEX\" />\n <meta name=\"theme-color\" content=\"#F71963\" />\n <link rel=\"icon\" href={favicon} />\n </Helmet>\n <main className=\"w-100 bg-white\">\n <article className=\"w-90 w-75-l center pa9 lh-copy\">\n <img src={Logo} className=\"h4-l\" alt=\"VTEX Code Cup\" />\n <h1 className=\"t-heading-1 c-emphasis\">Regras</h1>\n <p>\n O VTEX Code Cup consiste em dois (2) rounds: <strong>Round 1</strong>{' '}\n e <strong>Round Final</strong>. O Round 1 será conduzido online. O\n Round Final será presencial no escritório da VTEX no Rio de Janeiro,\n Brasil.\n </p>\n <p>\n <strong>Round 1</strong>. O Round 1 do VTEX Code Cup Round será\n conduzido online. Você irá avançar para o Round Final se estiver\n entre os 10 primeiros colocados no ranking do contest do Round 1.\n </p>\n <p>\n <strong>Round Final</strong>. O Round Final do VTEX Code Cup\n acontecerá em um Sábado no dia 08 de Junho de 2019 no escritório da\n VTEX no Rio de Janeiro, Brasil.\n </p>\n <p>\n Durante o Round Final, você irá resolver problemas usando somente\n equipamento provisionado pela VTEX e outros materiais. Você poderá\n escolher usar o seu próprio teclado ou material com a permissão da\n VTEX.\n </p>\n <p>\n <strong>Notificações:</strong> Os critérios de qualificação e o\n ranking de cada Round estará disponível no site oficial do VTEX Code\n Cup. Após o scoreboard estiver finalizado, você irá receber um alerta\n no seu email caso esteja qualificado para competir no próximo Round.\n </p>\n <h2 className=\"t-heading-2 c-emphasis\">Prêmios</h2>\n <p>\n VTEX Code Cup T-Shirt. Você estará eleito a receber (1) t-shirt se\n pertencer aos <strong>20%</strong> dos melhores colocados do ranking\n no Round 1.\n </p>\n <p>\n 1) O primeiro colocado no ranking geral será o vencedor do VTEX Code\n Cup e como prêmio ganhará uma{' '}\n <strong>\n viagem à Rússia com passagem e hospedagem paga sem acompanhantes\n por 5 dias para acompanhar a final mundial ACM-ICPC em 2020.\n </strong>\n </p>\n <p>\n Caso a organização do ACM não autorize acompanhar a final da ICPC ou\n o vencedor já esteja classificado para a final do ICPC em 2020,\n poderá solicitar a troca do prêmio por uma participação no{' '}\n <strong>Moscow Pre-Finals Workshop ICPC 2020</strong>.\n </p>\n <p>\n 2) O segundo colocado no ranking geral receberá um Fone De Ouvido\n <strong>Bose Quietcomfort 35 Ii Wls 789564-0010</strong> Preto.\n </p>\n <p>\n 3) O terceiro colocado no ranking geral receberá um\n <strong>Kindle Paperwhite</strong>.\n </p>\n <h2 className=\"t-heading-2 c-emphasis\">Residência no Brasil</h2>\n <p>\n O evento é destinado somente a <strong>residentes brasileiros</strong>\n . Não serão aceitos brasileiros residindo fora do país ou que estejam\n em viagem internacional durante o Round Final.\n </p>\n <h2 className=\"t-heading-2 c-emphasis\">Idade Mínima</h2>\n <p>\n Você entende e concorda que precisa ter a Idade Mínima para competir\n presencialmente o Round Final. Se a sua idade não se enquadrar na\n Idade Mínima, você apenas será elegível para ganhar a camiseta da\n competição. Como {'Idade Mínima'} se entende por{' '}\n <strong>18 anos de idade</strong> no seu país de residência.\n </p>\n <h2 className=\"t-heading-2 c-emphasis\">Inscrições</h2>\n <p>\n Inscrições vão do período de{' '}\n <strong>\n 03 de maio de 2019 a 10 de maio de 2019, até as 21h00 GMT-3\n </strong>\n , para participar da primeira fase (online) da VTEX Code Cup.\n </p>\n <p>\n O Round 1 irá acontecer no dia{' '}\n <strong>11 de maio de 2019, às 13h00 GMT-3</strong> e terá duração\n máxima de 3h30min.\n </p>\n <p>\n O Round Final irá acontecer na tarde do dia{' '}\n <strong>08 de junho de 2019</strong>. Os detalhes desse Round serão\n divulgados em breve.\n </p>\n <h2 className=\"t-heading-2 c-emphasis\">Desqualificação</h2>\n <p>\n <strong>Round 1.</strong> Você será desqualificado no Round 1 se:\n </p>\n <p>\n (A) Usar ou compartilhar informação sobre os problemas com outras\n pessoas (competidores ou não) durante o contest do Round 1.\n </p>\n <p>\n (B) Compartilhar o seu código com outra pessoa (competidores ou não)\n durante o contest do Round 1.\n </p>\n <p>(C) Outra pessoa solucionar o problema para você.</p>\n <p>\n <strong>Round Final.</strong> Caso você seja desqualificado no Round\n Final do VTEX Code Cup, a VTEX irá selecionar o próximo competidor com\n a pontuação mais alta no ranking após você.\n </p>\n <p>\n Você será considerado desqualificado no Round Final se preencher as\n condições abaixo:\n </p>\n <p>\n (A) Você não foi capaz de reservar o seu vôo com a VTEX ou agente de\n viagem designado com 4 semanas de antecedência após receber o e-mail\n para participar do Round Final.\n </p>\n <p>\n (B) Você não foi capaz de responder os emails de confirmação do vôo\n com 48 horas de antecedência com a VTEX ou agente de viagem designado\n que enviou o email.\n </p>\n <p>\n (C) Você falou em prover toda a documentação e informação relacionada\n ao seu vôo requisitado pela VTEX com quatro (4) semana antes do Round\n final, ou\n </p>\n <p>\n (D) Você não foi capaz de completar o Round Final ou ficou\n impossibilitado de concluir (exemplo: chegou atrasado).\n </p>\n <h2 className=\"t-heading-2 c-emphasis\">Participação no Round Final</h2>\n <p>\n 1. Você deve chegar na localização do Round Final com{' '}\n <strong>pelo menos (1) dia de antecedência</strong> para evitar\n atrasos ou possibilidades de desqualificação.\n </p>\n <p>2. Prêmios devem ser recebidos.</p>\n <p>\n 3. Todos os eventos relacionados ao Round Final são apenas para\n competidores, se você não registrar convidados com antecedência eles\n não poderão assistir ao evento. A VTEX não se responsabilizará por\n qualquer custos que envolvam convidados ou terceiros.\n </p>\n <h2 className=\"t-heading-2 c-emphasis\">\n Reembolso de despesas de viagem\n </h2>\n <p>\n Como finalista, a VTEX vai custear as despesas da sua viagem de ida e\n volta ao Rio de Janeiro relacionadas ao Round Final do VTEX Code Cuo.\n Você é responsável por todas as outras despesas.\n </p>\n <p>\n <strong>Vôo:</strong> Como finalista, você receberá transporte aéreo\n de ida e volta em classe econômica no aeroporto mais próximo de sua\n residência em um vôo selecionado pela VTEX ou seu agente designado.\n </p>\n <p>\n <strong>Acomodações:</strong> Como finalista, você receberá\n acomodações de hotel para uma (1) pessoa em um hotel da VTEX ou a\n escolha de seu agente designado para a duração da sua estadia.\n </p>\n <p>\n <strong>Alimentação:</strong> Como finalista, a VTEX reembolsará você\n pelo custo de suas refeições até R$100,00 por dia durante a sua\n estadia, conforme aprovado pela VTEX, e seus dias de viagem de e para\n a localização do Round Final.\n </p>\n </article>\n </main>\n <Footer />\n </Fragment>\n)\n\nexport default CodeCupRules\n\n```"
}
] |
code_code-cup_570e4977
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of code-cup/react/CodeCup.tsx from the code-cup VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport React, { Fragment, Component } from 'react'\nimport { Helmet } from 'vtex.render-runtime'\nimport ReactGA from 'react-ga'\n\nimport favicon from './images/favicon.png'\nimport Header from './components/Header'\nimport About from './components/About'\nimport Rio from './components/Rio'\nimport Subscribe from './components/Subscribe'\nimport VTEX from './components/VTEX'\nimport FAQ from './components/FAQ'\nimport Footer from './components/Footer'\nimport Results from './components/Results'\n\nimport HomeImage from './images/imagem_home.jpg'\n\nfunction initializeReactGA() {\n ReactGA.initialize('UA-139462697-1')\n ReactGA.pageview('/')\n}\nclass Landing extends Component {\n public componentDidMount() {\n initializeReactGA()\n }\n\n public render() {\n return (\n <Fragment>\n <Helmet>\n <title>VTEX Code Cup</title>\n <meta name=\"title\" content=\"VTEX Code Cup\" />\n <meta name=\"description\" content=\"The coding competition from VTEX\" />\n <meta name=\"theme-color\" content=\"#F71963\" />\n <meta\n name=\"google-site-verification\"\n content=\"w74PwlErxsMKe0Hp083-KEET2vwM2XcjzjiS4dZcThU\"\n />\n {/* <!-- Open Graph / Facebook --> */}\n <meta property=\"og:type\" content=\"website\" />\n <meta property=\"og:url\" content=\"https://codecup.vtex.com/\" />\n <meta property=\"og:title\" content=\"VTEX Code Cup\" />\n <meta\n property=\"og:description\"\n content=\"The coding competition from VTEX\"\n />\n <meta property=\"og:image\" content={HomeImage} />\n {/* <!-- Twitter --> */}\n <meta property=\"twitter:card\" content=\"summary_large_image\" />\n <meta property=\"twitter:url\" content=\"https://codecup.vtex.com/\" />\n <meta property=\"twitter:title\" content=\"VTEX Code Cup\" />\n <meta\n property=\"twitter:description\"\n content=\"The coding competition from VTEX\"\n />\n <meta property=\"twitter:image\" content={HomeImage} />\n <link rel=\"icon\" href={favicon} />\n </Helmet>\n <main className=\"w-100 bg-white\">\n <Header />\n <Results />\n <About />\n <Rio />\n <Subscribe />\n <VTEX />\n <FAQ />\n </main>\n <Footer />\n </Fragment>\n )\n }\n}\n\nexport default Landing\n\n```"
}
] |
code_code-cup_aa5dcf60
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of code-cup/react/package.json from the code-cup VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"name\": \"vtex.code-cup\",\n \"version\": \"0.0.0\",\n \"scripts\": {\n \"lint\": \"tsc --noEmit && eslint --ext ts,tsx .\",\n \"lint:locales\": \"intl-equalizer\"\n },\n \"dependencies\": {\n \"@fortawesome/fontawesome-svg-core\": \"^1.2.17\",\n \"@fortawesome/free-brands-svg-icons\": \"^5.8.1\",\n \"@fortawesome/free-solid-svg-icons\": \"^5.8.1\",\n \"@fortawesome/react-fontawesome\": \"^0.1.4\",\n \"nuka-carousel\": \"^4.5.4\",\n \"react-anchor-link-smooth-scroll\": \"^1.0.12\",\n \"react-ga\": \"^2.5.7\"\n },\n \"devDependencies\": {\n \"@types/graphql\": \"^0.13.3\",\n \"@types/node\": \"^9.4.7\",\n \"@types/react\": \"^16.3.16\",\n \"@types/react-dom\": \"^16.0.5\",\n \"@types/react-helmet\": \"^5.0.5\",\n \"@types/react-intl\": \"^2.3.5\",\n \"@vtex/intl-equalizer\": \"^2.3.0\",\n \"eslint\": \"^5.15.1\",\n \"eslint-config-vtex\": \"^10.1.0\",\n \"eslint-config-vtex-react\": \"^4.1.0\",\n \"graphql\": \"^0.13.0\",\n \"prettier\": \"^1.16.1\",\n \"react\": \"^16.2.0\",\n \"react-apollo\": \"^2.0.4\",\n \"react-dom\": \"^16.2.0\",\n \"react-intl\": \"^2.4.0\",\n \"typescript\": \"3.5.2\"\n }\n}\n\n```"
}
] |
code_code-cup_da6c4ee6
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of code-cup/store/interfaces.json from the code-cup VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"codecup\": {\n \"blocks\": [\n \"codecup.landing\"\n ]\n },\n \"codecup.landing\": {\n \"component\": \"CodeCup\"\n },\n \"codecup.rules\": {\n \"component\": \"CodeCupRules\"\n }\n}\n\n```"
}
] |
code_code-cup_a0490a09
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of code-cup/store/routes.json from the code-cup VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"codecup.landing\": {\n \"path\": \"/codecup\"\n },\n \"codecup.rules\": {\n \"path\": \"/rules\"\n }\n}\n\n```"
}
] |
code_code-cup_e4d74bc1
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of code-cup/react/typings/jpg.d.ts from the code-cup VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\ndeclare module '*.jpg' {\n const path: string\n export default path\n}\n\n```"
}
] |
code_code-cup_a326094b
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of code-cup/react/typings/png.d.ts from the code-cup VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\ndeclare module '*.png' {\n const path: string\n export default path\n}\n\n```"
}
] |
code_code-cup_bb578eea
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of code-cup/react/typings/vtex.render-runtime.d.ts from the code-cup VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\n/* Typings for `render-runtime` */\ndeclare module 'vtex.render-runtime' {\n import { Component, ReactElement } from 'react'\n\n export interface RenderContextProps {\n runtime: {\n account: string\n }\n }\n\n export const Link: any\n export const NoSSR: any\n export const RenderContextConsumer: ReactElement\n export const canUseDOM: boolean\n export const withRuntimeContext: ReactElement\n export const Helmet: any\n export const useRuntime: () => {\n culture: {\n locale: string\n }\n emitter: {\n emit: (eventName: string, eventId: string) => void\n }\n query: {\n app: string\n filePath?: string\n }\n }\n}\n\n```"
}
] |
code_code-cup_9734177e
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of code-cup/react/typings/svg.d.ts from the code-cup VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\ndeclare module '*.svg' {\n const path: string\n export default path\n}\n\n```"
}
] |
code_code-cup_3315f745
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of code-cup/react/typings/graphql.d.ts from the code-cup VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\ndeclare module '*.graphql' {\n import { DocumentNode } from 'graphql'\n\n const value: DocumentNode\n export default value\n}\n\n```"
}
] |
code_code-cup_6ac0e31a
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of code-cup/react/typings/vtex.styleguide.d.ts from the code-cup VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\ndeclare module 'vtex.styleguide' {\n export const Alert\n export const Button\n export const ButtonWithIcon\n export const PageBlock\n export const IconCaretDown\n export const IconCaretUp\n export const IconCaretRight\n export const IconBars\n export const IconCheck\n export const IconDeny\n export const Spinner\n export const EmptyState\n}\n\n```"
}
] |
code_code-cup_68f299af
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of code-cup/react/components/Results.tsx from the code-cup VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\n\nimport First from '../images/CodeCupResults1.jpg'\nimport Third from '../images/CodeCupResults2.jpg'\nimport Second from '../images/CodeCupResults3.jpg'\n\nconst Results = () => (\n <section id=\"about\" className=\"w-90 w-75-l center pv9\">\n <h1 className=\"c-emphasis t-heading-1\">Resultados VTEX Code Cup 2019</h1>\n <div className=\"flex flex-column\">\n <article className=\"mv3 ph6 pv5 w-90 br3\">\n <div className=\"items-center link flex\">\n <div className=\"mr7\">\n <img src={First} className=\"vw-50 br2\" />\n </div>\n <div className=\"flex flex-column items-center\">\n <p className=\"t-heading-4 c-emphasis fw7\">1º Lugar</p>\n <p className=\"t-body c-muted-2\">Arthur Nascimento</p>\n </div>\n </div>\n </article>\n <article className=\"mv3 ph6 pv5 w-90 br3\">\n <div className=\"items-center link flex\">\n <div className=\"mr7\">\n <img src={Second} className=\"vw-50 br2\" />\n </div>\n <div className=\"flex flex-column items-center\">\n <p className=\"t-heading-4 c-emphasis fw7\">2º Lugar</p>\n <p className=\"t-body c-muted-2\">Tiago Gonçalves</p>\n </div>\n </div>\n </article>\n <article className=\"mv3 ph6 pv5 w-90 br3\">\n <div className=\"items-center link flex\">\n <div className=\"mr7\">\n <img src={Third} className=\"vw-50 br2\" />\n </div>\n <div className=\"flex flex-column items-center\">\n <p className=\"t-heading-4 c-emphasis center fw7\">3º Lugar</p>\n <p className=\"t-body c-muted-2 center\">Arthur Pratti Dadalto</p>\n </div>\n </div>\n </article>\n </div>\n <h1 className=\"c-emphasis t-heading-2 center tc mv7\">\n Até a próxima edição!\n </h1>\n <section className=\"pv7 flex justify-center items-center\">\n <iframe\n className=\"w-70-l w-90 vh-75\"\n src=\"https://www.youtube.com/embed/CWA0cWdkMOo\"\n frameBorder=\"0\"\n allow=\"accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture\"\n allowFullScreen\n />\n </section>\n </section>\n)\n\nexport default Results\n\n```"
}
] |
code_code-cup_a6a2d155
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of code-cup/react/components/Rio.tsx from the code-cup VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport React, { FunctionComponent } from 'react'\nimport Carousel from 'nuka-carousel'\n\nimport CarouselImage1 from '../images/06_foto_time.jpg'\nimport CarouselImage2 from '../images/05_foto_time.jpg'\nimport CarouselImage3 from '../images/04_foto_time.jpg'\nimport CarouselImage4 from '../images/03_foto_time.jpg'\nimport CarouselImage5 from '../images/02_foto_rio.jpg'\n\nconst Rio: FunctionComponent = () => (\n <section>\n <Carousel autoplay wrapAround heightMode=\"first\">\n <img src={CarouselImage1} alt=\"\" />\n <img src={CarouselImage2} alt=\"\" />\n <img src={CarouselImage3} alt=\"\" />\n <img src={CarouselImage4} alt=\"\" />\n <img src={CarouselImage5} alt=\"\" />\n </Carousel>\n </section>\n)\n\nexport default Rio\n\n```"
}
] |
code_code-cup_c7986abd
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of code-cup/react/components/Subscribe.tsx from the code-cup VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport React, { FunctionComponent } from 'react'\n\nimport Go from '../images/imagem_go_@2x.png'\n\nconst Subscribe: FunctionComponent = () => (\n <section className=\"flex flex-column pa6 w-90 ml-auto-l mr0-l center\">\n <div className=\"flex flex-row-l flex-column justify-around-l items-center\">\n <div className=\"w-40-l\">\n <p className=\"t-heading-1\">como funciona?</p>\n <p className=\"lh-copy\">\n Inscreva-se, no período de{' '}\n <strong>03 de maio de 2019 a 10 de maio de 2019</strong>, até as 21h\n (horário de brasília), para participar da primeira fase (online) da\n VTEX Code Cup. Essa etapa vai acontecer no dia{' '}\n <strong>11 de maio de 2019, as 13h (horário de Brasília)</strong> e\n terá duração de <strong>3h30min</strong>.\n </p>\n <p className=\"lh-copy\">\n Os primeiros 10 colocados no ranking geral da primeira fase, serão\n convidados para a segunda fase (presencial) que acontecerá no dia{' '}\n <strong>08 de junho de 2019</strong>, na sede da VTEX, no Rio de\n Janeiro. Nessa etapa, os competidores serão submetidos a um novo\n contest.\n </p>\n <p className=\"lh-copy\">\n O primeiro colocado no ranking geral será o vencedor do VTEX Code Cup\n e como prêmio receberá uma viagem à Rússia para acompanhar a final\n mundial ACM-ICPC em 2020.\n </p>\n </div>\n <div className=\"flex flex-column items-center w-50-l\">\n <img src={Go} className=\"mv4\" alt=\"\" />\n <a className=\"link\" href=\"https://vtexcc19.kattis.com/\">\n <button className=\"c-on-base--inverted br-pill mt6 mb3 bg-emphasis ph9 b--none pointer\">\n <p className=\"t-heading-4\">Participar</p>\n </button>\n </a>\n </div>\n </div>\n </section>\n)\n\nexport default Subscribe\n\n```"
}
] |
code_code-cup_45e4b195
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of code-cup/react/components/QuestionCard.tsx from the code-cup VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport React, { useState, FunctionComponent } from 'react'\nimport { IconCaretDown, IconCaretRight } from 'vtex.styleguide'\n\ninterface Props {\n question: string\n ans: any\n}\n\nconst QuestionCard: FunctionComponent<Props> = ({ question, ans }) => {\n const [open, setOpen] = useState(false)\n return (\n <article className=\"flex flex-column pr9-l w-100\">\n <p\n className=\"flex justify-between bb b--muted-3 pv3\"\n onClick={() => setOpen(!open)}\n >\n <strong>{question}</strong>\n {open ? <IconCaretDown /> : <IconCaretRight />}\n </p>\n <p hidden={!open} className=\"ph5 lh-copy\">\n {ans}\n </p>\n </article>\n )\n}\n\nexport default QuestionCard\n\n```"
}
] |
code_code-cup_b5a469ed
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of code-cup/react/components/VTEX.tsx from the code-cup VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport React, { FunctionComponent } from 'react'\n\nimport Logo from '../images/logo_vtex@2x.png'\nimport MapImage from '../images/01_mapa.png'\n\nconst VTEX: FunctionComponent = () => (\n <section className=\"bg-muted-5\">\n <div className=\"flex flex-column flex-row-l pv9 justify-center items-center w-90 ml-auto-l mr0-l center\">\n <div className=\"flex flex-column w-60-l\">\n <img src={Logo} className=\"w-60 mb5\" alt=\"VTEX Logo\" />\n <p className=\"t-body lh-copy\">\n A VTEX é uma empresa global de tecnologia focada em produtos para\n e-commerce que impacta diariamente o trabalho de milhares de pessoas\n ao redor do mundo. Através dos seus produtos e serviços, oferece aos\n lojistas uma plataforma coesa para executar todo o seu negócio e\n proporcionar aos seus clientes sempre a melhor experiência de compra.\n </p>\n </div>\n <div className=\"flex flex-column justify-between items-center\">\n <img src={MapImage} className=\"w-75-l\" alt=\"\" />\n </div>\n </div>\n </section>\n)\n\nexport default VTEX\n\n```"
}
] |
code_code-cup_8ee3246d
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of code-cup/react/components/Countdown.tsx from the code-cup VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport React, { Component } from 'react'\n\ninterface Props {\n date: string\n}\n\ninterface State {\n days: number\n hours: number\n min: number\n sec: number\n}\n\nclass Countdown extends Component<Props, State> {\n public constructor(props: Props) {\n super(props)\n\n this.state = {\n days: 0,\n hours: 0,\n min: 0,\n sec: 0,\n }\n }\n\n private interval = setInterval(() => {\n return\n }, 0)\n\n public componentDidMount() {\n // update every second\n this.interval = setInterval(() => {\n const date = this.calculateCountdown(this.props.date)\n date ? this.setState(date) : this.stop()\n }, 1000)\n }\n\n public componentWillUnmount() {\n this.stop()\n }\n\n private calculateCountdown(endDate: string) {\n let diff =\n (Date.parse(new Date(endDate).toUTCString()) -\n Date.parse(new Date().toUTCString())) /\n 1000\n\n // clear countdown when date is reached\n if (diff <= 0) return false\n\n const timeLeft = {\n years: 0,\n days: 0,\n hours: 0,\n min: 0,\n sec: 0,\n millisec: 0,\n }\n\n // calculate time difference between now and expected date\n if (diff >= 365.25 * 86400) {\n // 365.25 * 24 * 60 * 60\n timeLeft.years = Math.floor(diff / (365.25 * 86400))\n diff -= timeLeft.years * 365.25 * 86400\n }\n if (diff >= 86400) {\n // 24 * 60 * 60\n timeLeft.days = Math.floor(diff / 86400)\n diff -= timeLeft.days * 86400\n }\n if (diff >= 3600) {\n // 60 * 60\n timeLeft.hours = Math.floor(diff / 3600)\n diff -= timeLeft.hours * 3600\n }\n if (diff >= 60) {\n timeLeft.min = Math.floor(diff / 60)\n diff -= timeLeft.min * 60\n }\n timeLeft.sec = diff\n\n return timeLeft\n }\n\n private stop() {\n clearInterval(this.interval)\n }\n\n public render() {\n const { days, hours, min, sec } = this.state\n\n return (\n <div className=\"pa7-l pa5 br3 bg-emphasis flex justify-around\">\n <div className=\"mh5 flex flex-column justify-center items-center\">\n <p className=\"t-heading-2 mv2\">{days}</p>\n <p>dias</p>\n </div>\n <div className=\"mh5 flex flex-column justify-center items-center\">\n <p className=\"t-heading-2 mv2\">{hours}</p>\n <p>horas</p>\n </div>\n <div className=\"mh5 flex flex-column justify-center items-center\">\n <p className=\"t-heading-2 mv2\">{min}</p>\n <p>minutos</p>\n </div>\n <div className=\"mh5 flex flex-column justify-center items-center\">\n <p className=\"t-heading-2 mv2\">{sec}</p>\n <p>segundos</p>\n </div>\n </div>\n )\n }\n}\n\nexport default Countdown\n\n```"
}
] |
code_code-cup_80222fa6
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of code-cup/react/components/Footer.tsx from the code-cup VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport React, { FunctionComponent } from 'react'\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome'\nimport {\n faTwitter,\n faFacebook,\n faInstagram,\n} from '@fortawesome/free-brands-svg-icons'\n\nimport Logo from '../images/logo_codecup_03@2x.png'\n\nconst Footer: FunctionComponent = () => (\n <footer className=\"bg-base--inverted flex flex-column flex-row-l justify-around pa8\">\n <div className=\"flex flex-column w-25-l justify-around\">\n <img src={Logo} className=\"w-70-l\" alt=\"VTEX\" />\n <div className=\"flex justify-between mb7 mt9 mb0-l c-on-base--inverted\">\n <div>\n <a\n className=\"link c-on-base--inverted\"\n href=\"https://twitter.com/vtexonline\"\n >\n <FontAwesomeIcon icon={faTwitter} />\n </a>\n </div>\n <div>\n <a\n className=\"link c-on-base--inverted\"\n href=\"https://www.facebook.com/vtexonline/\"\n >\n <FontAwesomeIcon icon={faFacebook} />\n </a>\n </div>\n <div>\n <a\n className=\"link c-on-base--inverted\"\n href=\"https://www.instagram.com/vtextruecloud/\"\n >\n <FontAwesomeIcon icon={faInstagram} />\n </a>\n </div>\n </div>\n </div>\n <div className=\"flex flex-column justify-around w-40-l c-on-base\">\n <div className=\"flex-l list justify-between\">\n <p className=\"ttu\">\n <strong>\n <a className=\"link c-on-base--inverted\" href=\"https://vtex.com\">\n vtex.com\n </a>\n </strong>\n </p>\n <p className=\"ttu\">\n <strong>\n <a className=\"link c-on-base--inverted\" href=\"/rules\">\n termos e condições\n </a>\n </strong>\n </p>\n <p className=\"ttu\">\n <strong>\n <a\n className=\"link c-on-base--inverted\"\n href=\"https://careers.vtex.com\"\n >\n careers\n </a>\n </strong>\n </p>\n <p className=\"ttu\">\n <strong>\n <a\n className=\"link c-on-base--inverted\"\n href=\"mailto:codecup@vtex.com\"\n >\n contact us\n </a>\n </strong>\n </p>\n </div>\n <p className=\"c-on-base--inverted\">\n VTEX - Unified Cloud Commerce ™. Gerenciamos bilhões de sessões com um\n GMV estimado em mais de R$ 8bilhões em 3.000 lojas.\n </p>\n </div>\n </footer>\n)\n\nexport default Footer\n\n```"
}
] |
code_code-cup_eed67cb4
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of code-cup/react/components/FAQData.tsx from the code-cup VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport React, { Fragment } from 'react'\n\nexport const questions = [\n {\n question: 'O que é a VTEX Code Cup?',\n ans:\n 'É o desafio de programação da VTEX para brasileiros, onde competidores usam algoritmos para resolver o maior número de problemas no menor tempo possível. Os participantes serão selecionados em uma fase online, de onde só os melhores serão convidados para uma competir presencialmente no escritório da VTEX.',\n },\n {\n question: 'Como a VTEX Code Cup funciona?',\n ans: (\n <Fragment>\n <p>\n Inscreva-se até as 21h do dia 10 maio de 2019 para participar da\n primeira fase da VTEX Code Cup.\n </p>\n <p>\n Essa etapa acontecerá online no dia 11 de maio de 2019 as 13h (horário\n de Brasília) e terá duração de 3h30 horas.\n </p>\n <p>\n Assim que se encerrarem as inscrições os competidores receberão um\n e-mail de confirmação, com o link para acessar a plataforma da\n competição.\n </p>\n <p>\n Os primeiros 10 colocados na primeira fase serão convidados para a\n fase presencial. Ela acontecerá na tarde do dia 08 de junho de 2019 na\n sede da VTEX no Rio de Janeiro.\n </p>\n <p>\n Os finalistas competirão pela glória eterna e pelo título de campeão\n da primeira VTEX Code Cup.\n </p>\n <p>\n O campeão receberá uma viagem para acompanhar a final da ACM ICPC\n 2020, na Rússia.\n </p>\n </Fragment>\n ),\n },\n {\n question: 'Quem pode participar do VTEX Code Cup?',\n ans: (\n <Fragment>\n <p>\n 1. O evento é destinado somente a residentes brasileiros. Não serão\n aceitos brasileiros residindo fora do país ou que estejam em viagem\n internacional durante o Round Final.\n </p>\n <p>\n 2. Qualquer pessoa que não possua algum vínculo trabalhista com a VTEX\n (incluindo estágio) ou suas associadas.\n </p>\n <p>\n 3. Você deve ter no mínimo 18 anos para poder participar da etapa\n presencial.\n </p>\n </Fragment>\n ),\n },\n {\n question:\n 'Caso seja convidado para a etapa presencial, a VTEX vai pagar minha passagem?',\n ans: (\n <Fragment>\n Sim! Vamos arcar com todas as despesas necessárias para viabilizar sua\n participação na Segunda Fase Final (presencial) de acordo com as\n <a href=\"/rules\"> Regras da Competição</a>, na cláusula de Reembolso de\n Despesas de Viagem.\n </Fragment>\n ),\n },\n {\n question: 'Como me inscrevo para a VTEX Code Cup?',\n ans: (\n <Fragment>\n Clique em <strong>{'quero participar'}</strong> aqui nessa página,\n preencha seus dados e envie. Até o dia 10 de maio de 2019, as 21h você\n receberá no seu email cadastrado o link para acesso à arena da\n competição.\n </Fragment>\n ),\n },\n {\n question: 'Ainda possui alguma dúvida?',\n ans: (\n <Fragment>\n Se você ainda possui alguma dúvida que não respondemos aqui nesse FAQ,\n mande um e-mail para{' '}\n <a href={'mailto:codecup@vtex.com'}>codecup@vtex.com</a> que estamos\n disponíveis para te ajudar.\n </Fragment>\n ),\n },\n]\n\n```"
}
] |
code_code-cup_46731054
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of code-cup/react/components/Header.tsx from the code-cup VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport React, { FunctionComponent, useState } from 'react'\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome'\nimport {\n faTwitter,\n faFacebook,\n faInstagram,\n} from '@fortawesome/free-brands-svg-icons'\nimport { IconBars } from 'vtex.styleguide'\n\nimport HeaderImage from '../images/imagem_home.jpg'\nimport Logo from '../images/logo_codecup_01@2x.png'\nimport ArrowsDown from '../images/setas_down@2x.png'\nimport Countdown from './Countdown'\n\nconst Header: FunctionComponent = () => {\n const [openNav, setOpenNav] = useState(false)\n\n return (\n <header className=\"flex flex-column-s flex-row-l w-100\">\n <div\n className=\"flex-l dn-s justify-around pb9\"\n style={{\n writingMode: 'vertical-lr',\n transform: 'rotate(-180deg)',\n }}\n >\n <div className=\"ph5\">\n <p className=\"t-small c-muted-2\">11 de maio de 2019</p>\n <p className=\"t-small\">\n <strong>Primeira Fase Online</strong>\n </p>\n </div>\n <div className=\"ph5\">\n <p className=\"t-small c-muted-2\">08 de junho de 2019</p>\n <p className=\"t-small\">\n <strong>Final presencial</strong>\n </p>\n </div>\n <div className=\"ph5\">\n <p className=\"t-small c-muted-2\">codecup@vtex.com</p>\n <p className=\"t-small\">\n <strong>Rio de Janeiro . Brasil</strong>\n </p>\n </div>\n </div>\n <div\n className=\"flex flex-grow-1 pa9 flex-column justify-around c-on-emphasis bg-center-l\"\n style={{\n backgroundImage: `url(${HeaderImage})`,\n backgroundRepeat: 'no-repeat',\n backgroundSize: 'cover',\n }}\n >\n <nav className=\"flex\">\n <div className=\"c-on-emphasis w-100 flex flex-column flex-row-l justify-between\">\n <div className=\"flex flex-column items-center\">\n <img src={Logo} className=\"h3-l\" alt=\"VTEX CODE CUP\" />\n <button\n className=\"dn-l c-on-base w-33 mv7 bg-0 bn bg-transparent\"\n onClick={() => setOpenNav(!openNav)}\n >\n <IconBars />\n </button>\n </div>\n <div className=\"flex-l\" hidden={!openNav}>\n <div className=\"flex flex-column flex-row-l justify-center list mt0 items-center mb0\">\n <p className=\"mh5-l mv5 mv0-l\">\n <a\n className=\"link c-on-emphasis\"\n href=\"https://codecup.vtex.com\"\n >\n <strong>HOME</strong>\n </a>\n </p>\n <p className=\"mh5-l mv5 mv0-l bold\">\n <a className=\"link c-on-emphasis\" href=\"#about\">\n <strong>O QUE É?</strong>\n </a>\n </p>\n <p className=\"mh5-l mv5 mv0-l bold\">\n <a className=\"link c-on-emphasis\" href=\"#faq\">\n <strong>FAQ</strong>\n </a>\n </p>\n <p className=\"mh5-l mv5 mv0-l bold\">\n <a className=\"link c-on-emphasis\" href=\"/rules\">\n <strong>REGRAS</strong>\n </a>\n </p>\n </div>\n </div>\n </div>\n </nav>\n <div className=\"w-100 mv8 flex flex-column flex-row-l justify-between items-center flex-nowrap\">\n <div className=\"w-50-l\">\n <p className=\"t-heading-1\">a competição de programação da VTEX</p>\n <p className=\"t-heading-3 normal\">\n Teste suas habilidades junto com os melhores programadores do\n Brasil\n </p>\n </div>\n <div className=\"w-10 dn flex-l flex-column justify-around c-on-base\">\n <div className=\"mv3\">\n <a\n className=\"link c-on-base\"\n href=\"https://twitter.com/vtexonline\"\n >\n <FontAwesomeIcon icon={faTwitter} />\n </a>\n </div>\n <div className=\"mv3\">\n <a\n className=\"link c-on-base\"\n href=\"https://www.facebook.com/vtexonline/\"\n >\n <FontAwesomeIcon icon={faFacebook} />\n </a>\n </div>\n <div className=\"mv3\">\n <a\n className=\"link c-on-base\"\n href=\"https://www.instagram.com/vtextruecloud/\"\n >\n <FontAwesomeIcon icon={faInstagram} />\n </a>\n </div>\n </div>\n </div>\n <div className=\"flex flex-row-l flex-column items-center w-100 justify-around\">\n <p className=\"self-end\">08 DE JUNHO . FASE FINAL . BRASIL</p>\n <img\n src={ArrowsDown}\n className=\"h3 self-end-l\"\n style={{ animation: 'bounce 3s infinite' }}\n alt=\"\"\n />\n <div className=\"mt6\">\n <Countdown date=\"June, 08, 2019, 15:00:00\" />\n </div>\n </div>\n </div>\n <div className=\"bg-white flex flex-column dn-l justify-around\">\n <div className=\"ph5\">\n <p className=\"t-small\">\n <strong>Primeira Fase Online</strong>\n </p>\n <p className=\"t-small c-muted-2\">11 de maio de 2019</p>\n </div>\n <div className=\"ph5\">\n <p className=\"t-small\">\n <strong>Final presencial</strong>\n </p>\n <p className=\"t-small c-muted-2\">08 de junho de 2019</p>\n </div>\n <div className=\"ph5\">\n <p className=\"t-small\">\n <strong>Rio de Janeiro . Brasil</strong>\n </p>\n <p className=\"t-small c-muted-2\">codecup@vtex.com</p>\n </div>\n </div>\n </header>\n )\n}\n\nexport default Header\n\n```"
}
] |
code_code-cup_a2d6ddc3
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of code-cup/react/components/Winners.tsx from the code-cup VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\n\nimport First from '../images/Tiago1.jpg'\nimport Second from '../images/Artur2.jpg'\nimport Third from '../images/Gabriel3.jpg'\nimport Fourth from '../images/Cezar4.jpg'\nimport Fifth from '../images/Ivan5.jpg'\nimport Sixth from '../images/Misael6.jpg'\nimport Seventh from '../images/Lucas7.jpg'\nimport Eighth from '../images/Arthur8.png'\nimport Nineth from '../images/Luis9.jpg'\nimport Tenth from '../images/Lucas10.jpg'\n\nconst Winners = () => (\n <section id=\"about\" className=\"bg-white w-90 w-75-l center pv9\">\n <h1 className=\"c-emphasis t-heading-1\">\n Selecionados para a final no Rio de Janeiro\n </h1>\n <div className=\"flex flex-wrap justify-around\">\n <article className=\"bg-muted-1 mv3 ph6 pv5 w-40-l w-90 br3\">\n <div className=\"flex items-center link\">\n <div className=\"mr7\">\n <img src={First} className=\"h4 w4\" />\n </div>\n <div>\n <p className=\"t-heading-4 c-muted-5 c-emphasis\">1º Lugar</p>\n <p className=\"t-body c-muted-2\">Tiago Gonçalves</p>\n </div>\n </div>\n </article>\n <article className=\"bg-muted-1 mv3 ph6 pv5 w-40-l w-90 br3\">\n <div className=\"flex items-center link\">\n <div className=\"mr7\">\n <img src={Second} className=\"h4 w4\" />\n </div>\n <div>\n <p className=\"t-heading-4 c-muted-5 c-emphasis\">2º Lugar</p>\n <p className=\"t-body c-muted-2\">Arthur Pratti Dadalto</p>\n </div>\n </div>\n </article>\n <article className=\"bg-muted-1 mv3 ph6 pv5 w-40-l w-90 br3\">\n <div className=\"flex items-center link\">\n <div className=\"mr7\">\n <img src={Third} className=\"h4 w4\" />\n </div>\n <div>\n <p className=\"t-heading-4 c-muted-5 c-emphasis\">3º Lugar</p>\n <p className=\"t-body c-muted-2\">Gabriel Pessoa</p>\n </div>\n </div>\n </article>\n <article className=\"bg-muted-1 mv3 ph6 pv5 w-40-l w-90 br3\">\n <div className=\"flex items-center justify-around link\">\n <div className=\"mr7\">\n <img src={Fourth} className=\"h4 w4\" />\n </div>\n <div>\n <p className=\"t-heading-4 c-muted-5 c-emphasis\">4º Lugar</p>\n <p className=\"t-body c-muted-2\">\n Cezar Abadio Correia Guimarães Filho\n </p>\n </div>\n </div>\n </article>\n <article className=\"bg-muted-1 mv3 ph6 pv5 w-40-l w-90 br3\">\n <div className=\"flex items-center link\">\n <div className=\"mr7\">\n <img src={Fifth} className=\"h4 w4\" />\n </div>\n <div>\n <p className=\"t-heading-4 c-muted-5 c-emphasis\">5º Lugar</p>\n <p className=\"t-body c-muted-2\">Ivan Henrique Costa Petrin</p>\n </div>\n </div>\n </article>\n <article className=\"bg-muted-1 mv3 ph6 pv5 w-40-l w-90 br3\">\n <div className=\"flex items-center link\">\n <div className=\"mr7\">\n <img src={Sixth} className=\"h4 w4\" />\n </div>\n <div>\n <p className=\"t-heading-4 c-muted-5 c-emphasis\">6º Lugar</p>\n <p className=\"t-body c-muted-2\">Misael Mateus Oliveira de Moraes</p>\n </div>\n </div>\n </article>\n <article className=\"bg-muted-1 mv3 ph6 pv5 w-40-l w-90 br3\">\n <div className=\"flex items-center link\">\n <div className=\"mr7\">\n <img src={Seventh} className=\"h4 w4\" />\n </div>\n <div>\n <p className=\"t-heading-4 c-muted-5 c-emphasis\">7º Lugar</p>\n <p className=\"t-body c-muted-2\">Lucas Soares Ferreira</p>\n </div>\n </div>\n </article>\n <article className=\"bg-muted-1 mv3 ph6 pv5 w-40-l w-90 br3\">\n <div className=\"flex items-center link\">\n <div className=\"mr7\">\n <img src={Eighth} className=\"h4 w4\" />\n </div>\n <div>\n <p className=\"t-heading-4 c-muted-5 c-emphasis\">8º Lugar</p>\n <p className=\"t-body c-muted-2\">Artur Nascimento</p>\n </div>\n </div>\n </article>\n <article className=\"bg-muted-1 mv3 ph6 pv5 w-40-l w-90 br3\">\n <div className=\"flex items-center link\">\n <div className=\"mr7\">\n <img src={Nineth} className=\"h4\" />\n </div>\n <div>\n <p className=\"t-heading-4 c-muted-5 c-emphasis\">9º Lugar</p>\n <p className=\"t-body c-muted-2\">Luís Felipe Braga Gebrim Silva</p>\n </div>\n </div>\n </article>\n <article className=\"bg-muted-1 mv3 ph6 pv5 w-40-l w-90 br3\">\n <div className=\"flex items-center link\">\n <div className=\"mr7\">\n <img src={Tenth} className=\"h4\" />\n </div>\n <div>\n <p className=\"t-heading-4 c-muted-5 c-emphasis\">10º Lugar</p>\n <p className=\"t-body c-muted-2\">Lucas Turci</p>\n </div>\n </div>\n </article>\n </div>\n <h3 className=\"mt7 w-90 center\">Esclarecimento VTEX Code Cup T-Shirt</h3>\n <p className=\"lh-copy w-90 center\">\n <em>\n Você estará eleito a receber (1) t-shirt se pertencer aos 20% dos\n melhores colocados do ranking no Round 1”.\n </em>{' '}\n <strong>\n Considerando os melhores colocados os participantes que submeteram pelo\n menos uma vez.\n </strong>{' '}\n <br />\n Lista de competidores que ganharam camisetas da VTEX Code Cup está nesse\n link:{' '}\n <a href=\"https://drive.google.com/file/d/1DeNMqMH7teDBCnM4jVFGVgrFYhCZl0AL/view?usp=sharing\">\n Camisetas VTEX Code Cup 2019\n </a>\n .<br />A produção do VTEX Code Cup irá entrar em contato e agendar a data\n de entrega das camisetas. <br />\n Confira o resultado completo em{' '}\n <a href=\"https://vtexcc19.kattis.com/\">https://vtexcc19.kattis.com/</a>.\n </p>\n <p className=\"w-90 center\">\n <em>\n Nota: O competidor Artur Vinicus Tomé Rodrigues não preencheu os\n pré-requisitos para a etapa presencial, seguindo o regulamento abriu-se\n uma vaga para o próximo competidor do ranking. Agradecemos a\n participação e fica a menção honrosa pelo belo espírito competitivo!\n </em>\n </p>\n <h3 className=\"mt7 w-90 center\">Edital</h3>\n <p className=\"w-90 center\">\n O link a seguir possui um edital descrevendo a solução de todos os\n problemas da primeira fase:{' '}\n <a href=\"https://docs.google.com/document/d/14UlgDhjDOtvcRakR0fkxX-KhCzco5FzIsuypgZKz63c/edit?usp=sharing\">\n Edital VTEX Code Cup Primeira Fase\n </a>\n </p>\n </section>\n)\n\nexport default Winners\n\n```"
}
] |
code_code-cup_a39bd64c
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of code-cup/react/components/FAQ.tsx from the code-cup VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport React, { FunctionComponent } from 'react'\n\nimport UpArrow from '../images/setas_up@2x.png'\nimport QuestionCard from './QuestionCard'\n\nimport { questions } from './FAQData'\n\nconst FAQ: FunctionComponent = () => (\n <section id=\"faq\" className=\"pt7 pb8 flex flex-column items-center\">\n <div className=\"w-90 ml-auto-l mr0-l center\">\n <h1 className=\"c-emphasis t-heading-1\">regras e faq ::</h1>\n <p className=\"w-90\">\n Para saber mais sobre o VTEX Code Cup, confira as{' '}\n <a className=\"link\" href=\"/rules\">\n Regras da Competição\n </a>{' '}\n e as dúvidas frequentes antes de iniciar sua inscrição.\n </p>\n <div className=\"flex flex-column items-center\">\n {questions.map(q => (\n <QuestionCard question={q.question} ans={q.ans} key={q.question} />\n ))}\n </div>\n </div>\n <div className=\"flex items-center mt7\">\n <img\n src={UpArrow}\n className=\"w-30\"\n style={{ animation: 'bounce 3s infinite' }}\n alt=\"\"\n />\n </div>\n </section>\n)\n\nexport default FAQ\n\n```"
}
] |
code_code-cup_f3f3fe7a
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of code-cup/react/components/About.tsx from the code-cup VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport React, { FunctionComponent } from 'react'\n\nimport TrophyIcon from '../images/icone_trofeu@2x.png'\nimport Logo from '../images/logo_codecup_02@2x.png'\n\nconst About: FunctionComponent = () => (\n <section id=\"about\" className=\"bg-white flex w-90 w-100-l center pv9\">\n <div\n className=\"flex-l justify-center dn\"\n style={{ writingMode: 'vertical-lr', transform: 'rotate(-180deg)' }}\n >\n <p className=\"ph5\">V T E X :: C O D E C U P</p>\n </div>\n <div className=\"flex flex-column flex-row-l ml8-l justify-around flex-grow-1\">\n <div className=\"w-40-l pt6\">\n <h1 className=\"t-heading-1\" style={{ fontSize: '5rem' }}>\n o que é?\n </h1>\n <p className=\"lh-copy mv7\">\n É a competição de programação da VTEX em que programadores de todos os\n níveis testam suas habilidades. A competição reúne programadores de\n todo o Brasil em somente duas etapas, online e a final presencial no\n Rio de Janeiro!\n </p>\n <img src={Logo} className=\"w-50-l w-60 mt7 mb8\" alt=\"VTEX Code Cup\" />\n <p className=\"c-emphasis t-heading-1\">\n Inscreva-se e teste seus limites.\n </p>\n <p className=\"c-emphasis t-heading-3\">INSCRIÇÕES ENCERRADAS</p>\n </div>\n <div className=\"bg-emphasis w-40-l br3 pv7 ph3 flex flex-column items-center justify-around\">\n <p className=\"t-heading-1 c-on-muted-1 w-75 center\">\n Prêmio final: viagem à Rússia para acompanhar a final da ICPC*\n </p>\n <img src={TrophyIcon} className=\"w-40 center mv6\" alt=\"\" />\n <a className=\"link\" href=\"https://vtexcc19.kattis.com/\">\n <button className=\"c-on-base--inverted br-pill mt6 mb3 bg-base--inverted ph9 b--none pointer\">\n <p className=\"t-heading-4\">Participar</p>\n </button>\n </a>\n <p className=\"t-mini w-75 c-on-base--inverted\">\n * Caso a organização do ACM-ICPC não autorize acompanhar a final da\n ICPC ou o vencedor já esteja classificado para a final do ICPC em\n 2020, poderá solicitar a troca do prêmio por uma participação no\n Moscow Pre-Finals Workshop ICPC 2020.\n </p>\n </div>\n </div>\n </section>\n)\n\nexport default About\n\n```"
}
] |
code_butik_2997731a
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of butik/messages/es-AR.json from the butik VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"product-description.title\": \"Descripción del Producto\",\n \"product-description.property\": \"Propiedad\",\n \"product-description.specification\": \"Especificación\",\n \"collapse.showMore\": \"Ver más\",\n \"collapse.showLess\": \"Volver\",\n \"pricing.installment-display\": \"O {installments} {times} de {installmentPrice}\",\n \"pricing.from\": \"De\",\n \"pricing.to\": \"Por\",\n \"pricing.savings\": \"Ahorre {savings}\",\n \"pricing.interest-free\": \"sin interés\",\n \"pricing.startingAtLabel\": \"A partir de\",\n \"pricing.unavailable\": \"Indisponible\",\n \"technicalspecifications.title\": \"Especificaciones Tecnicas\",\n \"sku-selector.select-warning\": \"Selecciona\"\n}\n\n```"
}
] |
code_butik_414a94a9
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of butik/messages/ar-SA.json from the butik VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"product-description.title\": \"خصائص المنتج\",\n \"product-description.property\": \"المؤسسة\",\n \"product-description.specification\": \"المواصفات\",\n \"collapse.showMore\": \"اعرض المزيد\",\n \"collapse.showLess\": \"اعرض أقل\",\n \"pricing.installment-display\": \"أو {installments} {times} من {installmentPrice}\",\n \"pricing.from\": \"من\",\n \"pricing.to\": \"إلى\",\n \"pricing.savings\": \"توفير {savings}\",\n \"pricing.interest-free\": \"بدون فوائد\",\n \"pricing.startingAtLabel\": \"بداية من\",\n \"pricing.unavailable\": \"غير متاح\",\n \"technicalspecifications.title\": \"المواصفات الفنية\",\n \"sku-selector.select-warning\": \"اختر\"\n}\n\n```"
}
] |
code_butik_fd08310e
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of butik/messages/pt-BR.json from the butik VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"product-description.title\": \"Descrição do Produto\",\n \"product-description.property\": \"Propriedade\",\n \"product-description.specification\": \"Especificação\",\n \"collapse.showMore\": \"Ver mais\",\n \"collapse.showLess\": \"Ver menos\",\n \"pricing.installment-display\": \"Ou {installments} {times} de {installmentPrice}\",\n \"pricing.from\": \"De\",\n \"pricing.to\": \"Por\",\n \"pricing.savings\": \"Economize {savings}\",\n \"pricing.interest-free\": \"sem juros\",\n \"pricing.startingAtLabel\": \"A partir de\",\n \"pricing.unavailable\": \"Indisponível\",\n \"technicalspecifications.title\": \"Especificações Técnicas\",\n \"sku-selector.select-warning\": \"Selecione\"\n}\n\n```"
}
] |
code_butik_c350521d
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of butik/messages/en-US.json from the butik VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"product-description.title\": \"Product Description\",\n \"product-description.property\": \"Property\",\n \"product-description.specification\": \"Specification\",\n \"collapse.showMore\": \"Show more\",\n \"collapse.showLess\": \"Show less\",\n \"pricing.installment-display\": \"Or {installments} {times} of {installmentPrice}\",\n \"pricing.from\": \"From\",\n \"pricing.to\": \"To\",\n \"pricing.savings\": \"Save {savings}\",\n \"pricing.interest-free\": \"interest-free\",\n \"pricing.startingAtLabel\": \"Starting at\",\n \"pricing.unavailable\": \"Unavailable\",\n \"technicalspecifications.title\": \"Technical Specifications\",\n \"sku-selector.select-warning\": \"Select\"\n}\n\n```"
}
] |
code_butik_d2294315
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of butik/tests/index-test.js from the butik VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```javascript\nimport expect from 'expect'\nimport React from 'react'\nimport {render, unmountComponentAtNode} from 'react-dom'\n\nimport Component from 'react/'\n\ndescribe('Component', () => {\n let node\n\n beforeEach(() => {\n node = document.createElement('div')\n })\n\n afterEach(() => {\n unmountComponentAtNode(node)\n })\n\n it('displays a welcome message', () => {\n render(<Component/>, node, () => {\n expect(node.innerHTML).toContain('Welcome to React components2')\n })\n })\n})\n\n```"
}
] |
code_butik_b8747a2d
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of butik/docs/README.md from the butik VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```markdown\n# Butik\n\n> VTEX Butik React components ([Docs](https://butik.vtex.com))\n\n- [Usage](#usage)\n - [Installing](#installing)\n - [Import intl translations](#import-intl-translations)\n- [Docz](#docz)\n - [Running local docz page](#running-local-docz-page)\n\n## Usage\n\nFor instructions on how to use Butik components in your project refer to the page itself: https://butik.vtex.com.\n\n### Installing\n\nnpm\n```sh\nnpm install @vtex/butik\n```\n\nVTEX IO\n```sh\nvtex install vtex.butik\n```\n\n\n\n### Import intl translations\nImport translation files like above and add them to your react-intl\n```javascript\nimport ptMessages from '@vtex/butik/messages/pt-BR.json'\nimport enMessages from '@vtex/butik/messages/en-US.json'\nimport esMessages from '@vtex/butik/messages/es-AR.json'\n```\n\n## Docz\n\n### Running local docz page\n```sh\nnpm start\n```\n\n```"
}
] |
code_butik_d2b986d3
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of butik/react/ImageResizer.js from the butik VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```javascript\nimport ImageResizer from './components/ImageResizer'\n\nexport default ImageResizer\n\n```"
}
] |
code_butik_4817c1a1
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of butik/react/ProductName.js from the butik VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```javascript\nimport ProductName from './components/ProductName'\n\nexport default ProductName\n\n```"
}
] |
code_butik_ce57e38b
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of butik/react/BlurredLoader.js from the butik VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```javascript\nimport BlurredLoader from './components/BlurredLoader'\n\nexport default BlurredLoader\n\n```"
}
] |
code_butik_039d726c
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of butik/react/package.json from the butik VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"name\": \"vtex.butik\",\n \"dependencies\": {\n \"@material-ui/core\": \"^3.6.2\",\n \"@vtex/styleguide\": \"^9.72.4\",\n \"classnames\": \"^2.2.6\",\n \"debounce\": \"^1.2.0\",\n \"lodash\": \"^4.17.11\",\n \"object-hash\": \"^1.3.1\",\n \"ramda\": \"^0.26.1\",\n \"react-content-loader\": \"^3.4.1\",\n \"react-html-parser\": \"^2.0.2\",\n \"react-id-swiper\": \"^1.6.8\",\n \"react-intl\": \"^2.7.2\",\n \"react-transition-group\": \"^2.5.1\",\n \"vtex-tachyons\": \"^2.10.0\",\n \"xstate\": \"^4.2.2\"\n },\n \"version\": \"1.4.0\"\n}\n\n```"
}
] |
code_butik_611887e2
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of butik/react/GradientCollapse.js from the butik VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```javascript\nimport GradientCollapse from './components/GradientCollapse'\n\nexport default GradientCollapse\n\n```"
}
] |
code_butik_880d8691
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of butik/react/SKUSelector.js from the butik VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```javascript\nimport SKUSelector from './components/SKUSelector'\n\nexport default SKUSelector\n\n```"
}
] |
code_butik_2c3e2a84
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of butik/react/Video.js from the butik VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```javascript\nimport Video from './components/Video'\n\nexport default Video\n\n```"
}
] |
code_butik_3ee07132
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of butik/react/FixedButton.js from the butik VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```javascript\nimport FixedButton from './components/FixedButton'\n\nexport default FixedButton\n\n```"
}
] |
code_butik_fc4e01df
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of butik/react/Carousel.js from the butik VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```javascript\nimport Carousel from './components/Carousel'\n\nexport default Carousel\n\n```"
}
] |
code_butik_9f5f9b07
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of butik/react/ProductDescription.js from the butik VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```javascript\nimport ProductDescription from './components/ProductDescription'\n\nexport default ProductDescription\n\n```"
}
] |
code_butik_a66f7a08
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of butik/react/ProductPrice.js from the butik VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```javascript\nimport ProductPrice from './components/ProductPrice'\n\nexport default ProductPrice\n\n```"
}
] |
code_butik_dd287e0b
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of butik/es/SKUSelector/index.js from the butik VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```javascript\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nimport React, { PureComponent } from 'react';\nimport PropTypes from 'prop-types';\nimport VariationSelector from './components/VariationSelector';\nimport { Machine } from 'xstate';\nimport { interpret } from 'xstate/lib/interpreter';\nimport hash from 'object-hash';\nimport './global.css';\n\n/**\n * Display a list of SKU items of a product and its specifications.\n */\n\nvar SKUSelector = function (_PureComponent) {\n _inherits(SKUSelector, _PureComponent);\n\n function SKUSelector(props) {\n _classCallCheck(this, SKUSelector);\n\n var _this = _possibleConstructorReturn(this, _PureComponent.call(this, props));\n\n _this.getDifferentVariation = function (stateA, stateB) {\n var counter = 0;\n var differentVariation = null;\n\n Object.keys(stateA).forEach(function (variation) {\n if (stateA[variation] !== stateB[variation]) {\n counter++;\n differentVariation = variation;\n }\n });\n\n if (counter === 1) return differentVariation;\n };\n\n _this.createStateMachine = function (skus, visualVariations, standardVariations) {\n var stateMachine = _this.stateMachine;\n\n stateMachine.id = 'SKUSelector';\n stateMachine.states = {};\n stateMachine.initial = null;\n stateMachine.transitions = {};\n\n var states = stateMachine.states,\n transitions = stateMachine.transitions;\n\n\n skus.forEach(function (sku) {\n /** Creates all possible states without selecting some standardVariations **/\n var bitMaskLimit = 1 << standardVariations.length;\n\n var _loop = function _loop(bitMask) {\n var state = { variations: {} };\n\n visualVariations.forEach(function (variation) {\n return state.variations[variation] = sku[variation];\n });\n\n standardVariations.forEach(function (variation, variationIndex) {\n if (1 << variationIndex & bitMask) state.variations[variation] = sku[variation];else state.variations[variation] = null;\n });\n\n if (bitMask === 0 && !stateMachine.initial) stateMachine.initial = hash(state.variations);\n\n var stateKey = hash(state.variations);\n if (states[stateKey]) return 'continue';\n\n states[stateKey] = state;\n states[stateKey].sku = sku.skuId;\n };\n\n for (var bitMask = 0; bitMask < bitMaskLimit; bitMask++) {\n var _ret = _loop(bitMask);\n\n if (_ret === 'continue') continue;\n }\n });\n\n /** Creates a transition from A to B if there is only one different variation **/\n Object.keys(states).forEach(function (keyA) {\n states[keyA].on = {};\n\n Object.keys(states).forEach(function (keyB) {\n var stateA = states[keyA].variations;\n var stateB = states[keyB].variations;\n\n var differentVariation = _this.getDifferentVariation(stateA, stateB);\n if (!differentVariation) return;\n\n var action = {\n variation: differentVariation,\n label: stateB[differentVariation]\n };\n\n var actionHash = hash(action);\n transitions[actionHash] = action;\n states[keyA].on[actionHash] = keyB;\n });\n });\n\n return Machine(stateMachine);\n };\n\n _this.onSelectItem = function (actionHash) {\n return function () {\n _this.stateMachine.interpret.send(actionHash);\n };\n };\n\n _this.state = {};\n _this.visualVariations = [];\n _this.standardVariations = [];\n _this.stateMachine = {};\n _this.variationsOptions = {};\n return _this;\n }\n\n SKUSelector.prototype.componentDidMount = function componentDidMount() {\n var _this2 = this;\n\n var _props = this.props,\n skus = _props.skus,\n variations = _props.variations;\n\n\n variations.forEach(function (variation) {\n /** Separate all variations into visualVariations and standardVariations based on thumbSrc value */\n if (variation.thumbSrc) _this2.visualVariations.push(variation.name);else _this2.standardVariations.push(variation.name);\n\n /** Fills variationsOptions with all possible variationOptions */\n _this2.variationsOptions[variation.name] = {};\n skus.forEach(function (sku) {\n _this2.variationsOptions[variation.name][sku[variation.name]] = true;\n });\n });\n\n this.stateMachine.interpret = interpret(this.createStateMachine(skus, this.visualVariations, this.standardVariations));\n\n this.setState({ stateMachineStateHash: this.stateMachine.initial });\n this.stateMachine.interpret.onTransition(function (state) {\n return _this2.setState({ stateMachineStateHash: state.value });\n }).start();\n };\n\n /** Returns the variation that has a different label if there is exactly one different variation\n * or undefined otherwise\n * */\n\n\n /** Creates a state machine whose state is based on the selected variations **/\n\n\n SKUSelector.prototype.render = function render() {\n var _this3 = this;\n\n var visualVariations = this.visualVariations,\n standardVariations = this.standardVariations;\n\n var variations = visualVariations.concat(standardVariations);\n\n var stateMachineStateHash = this.state.stateMachineStateHash;\n\n if (!stateMachineStateHash) return React.createElement('div', null);\n\n var stateMachineState = this.stateMachine.states[stateMachineStateHash];\n\n var transitions = stateMachineState.on;\n var selectedVariations = stateMachineState.variations;\n\n return React.createElement(\n React.Fragment,\n null,\n variations.map(function (variation, variationIndex) {\n var selectedItem = selectedVariations[variation];\n\n var items = Object.keys(_this3.variationsOptions[variation]).reduce(function (accumulator, label) {\n var actionHash = hash({\n variation: variation,\n label: label === selectedItem ? null : label\n });\n\n if (transitions[actionHash] || label === selectedVariations[variation]) accumulator.push({\n label: label,\n available: true,\n thumbSrc: null,\n onSelectItem: _this3.onSelectItem(actionHash)\n });\n return accumulator;\n }, []);\n\n return React.createElement(VariationSelector, {\n key: variationIndex,\n variation: {\n name: variation,\n items: items\n },\n selectedItem: selectedItem\n });\n })\n );\n };\n\n return SKUSelector;\n}(PureComponent);\n\n// UP => selected SKU, isSkuFullySelected\n\nSKUSelector.propTypes = process.env.NODE_ENV !== \"production\" ? {\n variations: PropTypes.arrayOf(PropTypes.shape({\n /** Variation name, the same used as key in 'skus' */\n name: PropTypes.string\n })),\n /** Can just pass vtex product.items */\n skus: PropTypes.arrayOf(PropTypes.shape({\n /** Value that will be returned as identifier when selected */\n skuId: PropTypes.any\n /** Also has the values for each variation as variationName: label */\n })),\n handleSKUSelect: PropTypes.func\n} : {};\nexport default SKUSelector;\n```"
}
] |
code_butik_aac25751
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of butik/es/SKUSelector/utils/index.js from the butik VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```javascript\nimport { clone } from 'ramda';\n\n/**\n * Return the maximum sku price\n * @param {array of sku's} items\n */\nexport var getMaxSkuPrice = function getMaxSkuPrice(items) {\n if (!items) return 0;\n\n return items.reduce(function (max, sku) {\n var _sku$sellers = sku.sellers,\n Price = _sku$sellers[0].commertialOffer.Price;\n\n\n return Math.max(max, Price);\n });\n};\n\n/**\n * Remove the 'https' from the given url\n * @param {string} url\n */\nexport var stripUrl = function stripUrl(url) {\n return url.replace(/^https?:/, '');\n};\n\n/**\n * Parse the variations field in the sku object\n * @param {sku} sku\n */\nexport var parseSku = function parseSku(sku) {\n var result = clone(sku);\n\n var variations = sku.variations.map(function (variation) {\n result[variation.name] = variation.values[0];\n return variation.name;\n });\n\n result.variations = variations;\n\n return result;\n};\n\n/**\n * Retrieves a list of unique options of a given variation\n * @param {string} variation\n * @param {skus} skus\n */\nexport var getVariationOptions = function getVariationOptions(variation, skus) {\n var hTable = {};\n\n skus.map(function (sku) {\n var value = sku[variation];\n hTable[value] = sku;\n });\n\n return Object.values(hTable).sort(function (a, b) {\n if (a[variation] < b[variation]) return -1;\n if (a[variation] > b[variation]) return 1;\n return 0;\n });\n};\n\n/**\n * Verifies if the variation is color\n * @param {string} variation\n */\nexport var isColor = function isColor(variation) {\n if (!variation) return false;\n\n return variation.toLowerCase() === 'cor' || variation.toLowerCase() === 'color';\n};\n\n/**\n * Choose wich variation will be the main one.\n * @param {Array[string]} variations\n */\nexport var getMainVariationName = function getMainVariationName(variations) {\n for (var i = 0; i < variations.length; i++) {\n if (isColor(variations[i])) return variations[i];\n }\n\n return variations[0];\n};\n```"
}
] |
code_butik_80225530
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of butik/es/SKUSelector/utils/proptypes.js from the butik VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```javascript\nimport PropTypes from 'prop-types';\n\nvar skuPropType = PropTypes.shape({\n /** Name of the SKU Item */\n name: PropTypes.string.isRequired,\n /** Images of the SKU item */\n images: PropTypes.arrayOf(PropTypes.shape({\n /** URL of source Image */\n imageUrl: PropTypes.string.isRequired,\n /** Brief description of the image */\n imageLabel: PropTypes.string\n })).isRequired,\n /** SkuID */\n itemId: PropTypes.string.isRequired,\n /** List of products specifications names */\n variations: PropTypes.arrayOf(PropTypes.string)\n});\n\nexport var SKUSelectorContainerPropTypes = {\n /** Product's slug */\n productSlug: PropTypes.string,\n /** SKU selected */\n skuSelected: skuPropType.isRequired,\n /** List of SKU Items */\n skuItems: PropTypes.arrayOf(skuPropType).isRequired,\n /** Callback that is called when an SKU is selected */\n onSKUSelected: PropTypes.func\n};\n\nvar variationPropTypes = PropTypes.shape({\n name: PropTypes.string.isRequired,\n value: PropTypes.string,\n options: PropTypes.arrayOf(skuPropType)\n});\n\nexport var SKUSelectorPropTypes = {\n /** Selected SKU id */\n selectedId: PropTypes.string.isRequired,\n /** Function to go to the product page of a given sku */\n onSelectSku: PropTypes.func.isRequired,\n /** Name and list of options of the main variation */\n mainVariation: variationPropTypes,\n /** Name and list of options of the secondary variation */\n secondaryVariation: variationPropTypes,\n /** Max price find on the sku list */\n maxSkuPrice: PropTypes.number.isRequired\n};\n```"
}
] |
code_butik_a7622eef
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of butik/es/SKUSelector/components/VariationSelector.js from the butik VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```javascript\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nimport React from 'react';\nimport PropTypes from 'prop-types';\nimport ItemSelector from './ItemSelector';\n\nvar VariationSelector = function (_React$PureComponent) {\n _inherits(VariationSelector, _React$PureComponent);\n\n function VariationSelector() {\n _classCallCheck(this, VariationSelector);\n\n return _possibleConstructorReturn(this, _React$PureComponent.apply(this, arguments));\n }\n\n VariationSelector.prototype.render = function render() {\n var _props = this.props,\n variation = _props.variation,\n selectedItem = _props.selectedItem;\n\n\n return React.createElement(\n 'div',\n { className: 'vtex-sku-selector__container flex flex-column mb7' },\n React.createElement(\n 'div',\n { className: 'vtex-sku-selector__name-container ma1' },\n React.createElement(\n 'span',\n { className: 'vtex-sku-selector__name c-muted-2 db t-small overflow-hidden mb3' },\n variation.name\n ),\n React.createElement(\n 'div',\n { className: 'inline-flex flex-wrap ml2' },\n variation.items.map(function (item, i) {\n return React.createElement(ItemSelector, {\n selected: selectedItem === item.label,\n key: i,\n handleSelect: item.onSelectItem,\n label: item.label,\n thumbSrc: item.thumbSrc,\n isAvailable: item.available,\n variation: variation.name\n });\n })\n )\n )\n );\n };\n\n return VariationSelector;\n}(React.PureComponent);\n\nVariationSelector.propTypes = process.env.NODE_ENV !== \"production\" ? {\n variation: PropTypes.shape({\n name: PropTypes.string.isRequired,\n items: PropTypes.arrayOf(PropTypes.shape({\n label: PropTypes.string.isRequired,\n available: PropTypes.bool.isRequired,\n thumbSrc: PropTypes.string,\n onSelectItem: PropTypes.func.isRequired\n })).isRequired\n }).isRequired,\n /** It's either null when no item is selected or the selected item index */\n selectedItem: PropTypes.string\n} : {};\n\nexport default VariationSelector;\n```"
}
] |
code_butik_62335d7b
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of butik/es/SKUSelector/components/ItemSelector.js from the butik VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```javascript\nimport React from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\nimport './global.css';\n\nfunction ItemSelector(props) {\n var selected = props.selected,\n handleSelect = props.handleSelect,\n isAvailable = props.isAvailable,\n thumbSrc = props.thumbSrc,\n label = props.label,\n variation = props.variation;\n\n\n return React.createElement(\n 'div',\n {\n className: classNames('vtex-sku-selector__item relative di pointer flex items-center', thumbSrc && 'vtex-sku-selector__item-image'),\n onClick: handleSelect },\n React.createElement('div', {\n className: classNames('absolute frame-around b--action-primary br3 bw1', selected && 'ba')\n }),\n React.createElement(\n 'div',\n {\n className: classNames('w-100 h-100 ba br2 b b--muted-4 z-1 c-muted-5 flex items-center overflow-hidden', selected || 'hover-b--muted-2') },\n React.createElement('div', {\n className: classNames('absolute absolute--fill', isAvailable || 'diagonal-cross')\n }),\n React.createElement(\n 'div',\n { className: classNames(thumbSrc || 'c-on-base center pl5 pr5 z-1') },\n thumbSrc ? React.createElement('img', { src: thumbSrc, alt: label }) : label\n )\n )\n );\n}\n\nItemSelector.propTypes = process.env.NODE_ENV !== \"production\" ? {\n label: PropTypes.string,\n selected: PropTypes.bool,\n handleSelect: PropTypes.func,\n thumbSrc: PropTypes.string,\n isAvailable: PropTypes.bool,\n variation: PropTypes.string\n} : {};\nexport default ItemSelector;\n```"
}
] |
code_butik_6775fd7d
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of butik/es/SKUSelector/components2/SelectorItem.js from the butik VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```javascript\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nimport React, { PureComponent } from 'react';\nimport PropTypes from 'prop-types';\nimport { FormattedNumber } from 'react-intl';\nimport classNames from 'classnames';\n\n/**\n * Inherits the components2 that should be displayed inside the Selector component.\n */\n\nvar SelectorItem = function (_PureComponent) {\n _inherits(SelectorItem, _PureComponent);\n\n function SelectorItem() {\n _classCallCheck(this, SelectorItem);\n\n return _possibleConstructorReturn(this, _PureComponent.apply(this, arguments));\n }\n\n SelectorItem.prototype.render = function render() {\n var _props = this.props,\n isAvailable = _props.isAvailable,\n isSelected = _props.isSelected,\n children = _props.children,\n maxPrice = _props.maxPrice,\n price = _props.price,\n onClick = _props.onClick,\n isImage = _props.isImage;\n\n var discount = getDiscount(maxPrice, price);\n\n return React.createElement(\n 'div',\n {\n className: classNames('vtex-sku-selector__item relative di pointer flex items-center', isImage && 'vtex-sku-selector__item-image'),\n onClick: onClick },\n React.createElement('div', {\n className: classNames('absolute frame-around b--action-primary br3 bw1', isSelected && 'ba')\n }),\n React.createElement(\n 'div',\n {\n className: classNames('w-100 h-100 ba br2 b b--muted-4 z-1 c-muted-5 flex items-center overflow-hidden', isSelected || 'hover-b--muted-2') },\n React.createElement('div', {\n className: classNames('absolute absolute--fill', isAvailable || 'diagonal-cross')\n }),\n React.createElement(\n 'div',\n {\n className: classNames(isImage || 'c-on-base center pl5 pr5 z-1') },\n children\n )\n ),\n discount > 0 && React.createElement(\n 'span',\n { className: 'vtex-sku-selector__bagde b' },\n React.createElement(FormattedNumber, { value: discount, style: 'percent' })\n )\n );\n };\n\n return SelectorItem;\n}(PureComponent);\n\nexport { SelectorItem as default };\n\n\nSelectorItem.propTypes = process.env.NODE_ENV !== \"production\" ? {\n /** Index of the item into the selector parent component starting from 0 */\n index: PropTypes.number,\n /** Children components2 */\n children: PropTypes.node,\n /** Function that is called when the item is clicked */\n onClick: PropTypes.func,\n /** Flag that indicates if the sku is available */\n isAvailable: PropTypes.bool,\n /** Flag that indicates if the current item is selected */\n isSelected: PropTypes.bool,\n /** Max sku price */\n maxPrice: PropTypes.number,\n /** Price of the current sku */\n price: PropTypes.number,\n /** SKU's ID */\n skuId: PropTypes.string,\n /** True if it's an image variation */\n isImage: PropTypes.bool\n} : {};\n\nSelectorItem.defaultProps = {\n index: 0,\n children: {},\n isAvailable: true,\n isSelected: false\n};\n\nvar getDiscount = function getDiscount(maxPrice, price) {\n var discount = 0;\n if (maxPrice && price) {\n discount = 1 - price / maxPrice;\n }\n return discount;\n};\n```"
}
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.