|
| 1 | +import React from 'react' |
| 2 | +import PT from 'prop-types' |
| 3 | +import config from '../../../config/projectWizard' |
| 4 | +import ProductCard from './ProductCard' |
| 5 | +import { findCategory } from '../../../config/projectWizard' |
| 6 | +import { DOMAIN } from '../../../config/constants' |
| 7 | +import './SelectProduct.scss' |
| 8 | +import IconAnalyticsAlgorithmOptimization from '../../../assets/icons/product-analytics-algorithm-optimization.svg' |
| 9 | +import IconAnalyticsComputerVision from '../../../assets/icons/product-analytics-computer-vision.svg' |
| 10 | +import IconAnalyticsDataExploration from '../../../assets/icons/product-analytics-data-exploration.svg' |
| 11 | +import IconAnalyticsPredictiveAnalytics from '../../../assets/icons/product-analytics-predictive-analytics.svg' |
| 12 | +import IconAppApp from '../../../assets/icons/product-app-app.svg' |
| 13 | +import IconCatAnalytics from '../../../assets/icons/product-cat-analytics.svg' |
| 14 | +import IconCatApp from '../../../assets/icons/product-cat-app.svg' |
| 15 | +import IconCatChatbot from '../../../assets/icons/product-cat-chatbot.svg' |
| 16 | +import IconCatDesign from '../../../assets/icons/product-cat-design.svg' |
| 17 | +import IconCatDevelopment from '../../../assets/icons/product-cat-development.svg' |
| 18 | +import IconCatQa from '../../../assets/icons/product-cat-qa.svg' |
| 19 | +import IconCatWebsite from '../../../assets/icons/product-cat-website.svg' |
| 20 | +import IconChatbotChatbot from '../../../assets/icons/product-chatbot-chatbot.svg' |
| 21 | +import IconChatbotWatson from '../../../assets/icons/product-chatbot-watson.svg' |
| 22 | +import IconDesignAppVisual from '../../../assets/icons/product-design-app-visual.svg' |
| 23 | +import IconDesignInfographic from '../../../assets/icons/product-design-infographic.svg' |
| 24 | +import IconDesignOther from '../../../assets/icons/product-design-other.svg' |
| 25 | +import IconDesignWireframes from '../../../assets/icons/product-design-wireframes.svg' |
| 26 | +import IconDevFrontendDev from '../../../assets/icons/product-dev-front-end-dev.svg' |
| 27 | +import IconDevIntegration from '../../../assets/icons/product-dev-integration.svg' |
| 28 | +import IconDevOther from '../../../assets/icons/product-dev-other.svg' |
| 29 | +import IconDevPrototype from '../../../assets/icons/product-dev-prototype.svg' |
| 30 | +import IconOtherDesign from '../../../assets/icons/product-other-design.svg' |
| 31 | +import IconQaConsulting from '../../../assets/icons/product-qa-consulting.svg' |
| 32 | +import IconQaCrowdTesting from '../../../assets/icons/product-qa-crowd-testing.svg' |
| 33 | +import IconQaDigitalAccessability from '../../../assets/icons/product-qa-digital-accessability.svg' |
| 34 | +import IconQaHelthCheck from '../../../assets/icons/product-qa-health-check.svg' |
| 35 | +import IconQaMobilityTesting from '../../../assets/icons/product-qa-mobility-testing.svg' |
| 36 | +import IconQaOsAutomation from '../../../assets/icons/product-qa-os-automation.svg' |
| 37 | +import IconQaWebsitePrerfomance from '../../../assets/icons/product-qa-website-performance.svg' |
| 38 | +import IconQaSFDCAccelerator from '../../../assets/icons/product-qa-sfdc-accelerator.svg' |
| 39 | +import IconWebsiteWebsite from '../../../assets/icons/product-website-website.svg' |
| 40 | +import IconOutlineWorkProject from '../../../assets/icons/tech-32px-outline-work-project.svg' |
| 41 | + |
| 42 | +/** |
| 43 | + * @params {string} type project type |
| 44 | + */ |
| 45 | +const ProjectTypeIcons = ({ type }) => { |
| 46 | + switch (type) { |
| 47 | + case 'product-analytics-algorithm-optimization': |
| 48 | + return <IconAnalyticsAlgorithmOptimization className="icon-analytics-algorithm-optimization" /> |
| 49 | + case 'product-analytics-computer-vision': |
| 50 | + return <IconAnalyticsComputerVision className="icon-analytics-computer-vision" /> |
| 51 | + case 'product-analytics-data-exploration': |
| 52 | + return <IconAnalyticsDataExploration className="icon-analytics-data-exploration" /> |
| 53 | + case 'product-analytics-predictive-analytics': |
| 54 | + return <IconAnalyticsPredictiveAnalytics className="icon-analytics-predictive-analytics" /> |
| 55 | + case 'product-app-app': |
| 56 | + return <IconAppApp className="icon-app-app" /> |
| 57 | + case 'product-cat-analytics': |
| 58 | + return <IconCatAnalytics className="icon-cat-analytics" /> |
| 59 | + case 'product-cat-app': |
| 60 | + return <IconCatApp className="icon-cat-app" /> |
| 61 | + case 'product-cat-chatbot': |
| 62 | + return <IconCatChatbot className="icon-cat-chatbot" /> |
| 63 | + case 'product-cat-design': |
| 64 | + return <IconCatDesign className="icon-cat-design" /> |
| 65 | + case 'product-cat-development': |
| 66 | + return <IconCatDevelopment className="icon-cat-development" /> |
| 67 | + case 'product-cat-qa': |
| 68 | + return <IconCatQa className="icon-cat-qa" /> |
| 69 | + case 'product-cat-website': |
| 70 | + return <IconCatWebsite className="icon-cat-website" /> |
| 71 | + case 'product-chatbot-chatbot': |
| 72 | + return <IconChatbotChatbot className="icon-chatbot-chatbot" /> |
| 73 | + case 'product-chatbot-watson': |
| 74 | + return <IconChatbotWatson className="icon-chatbot-watson" /> |
| 75 | + case 'product-design-app-visual': |
| 76 | + return <IconDesignAppVisual className="icon-design-app-visual" /> |
| 77 | + case 'product-design-infographic': |
| 78 | + return <IconDesignInfographic className="icon-design-infographic" /> |
| 79 | + case 'product-design-other': |
| 80 | + return <IconDesignOther className="icon-design-other" /> |
| 81 | + case 'product-design-wireframes': |
| 82 | + return <IconDesignWireframes className="icon-design-wireframes" /> |
| 83 | + case 'product-dev-front-end-dev': |
| 84 | + return <IconDevFrontendDev className="icon-dev-frontend-dev" /> |
| 85 | + case 'product-dev-integration': |
| 86 | + return <IconDevIntegration className="icon-dev-integration" /> |
| 87 | + case 'product-dev-other': |
| 88 | + return <IconDevOther className="icon-dev-other" /> |
| 89 | + case 'product-dev-prototype': |
| 90 | + return <IconDevPrototype className="icon-dev-prototype" /> |
| 91 | + case 'product-other-design': |
| 92 | + return <IconOtherDesign className="icon-dev-other" /> |
| 93 | + case 'product-qa-consulting': |
| 94 | + return <IconQaConsulting className="icon-qa-consulting" /> |
| 95 | + case 'product-qa-crowd-testing': |
| 96 | + return <IconQaCrowdTesting className="icon-qa-crowd-testing" /> |
| 97 | + case 'product-qa-digital-accessability': |
| 98 | + return <IconQaDigitalAccessability className="icon-qa-digital-accessability" /> |
| 99 | + case 'product-qa-health-check': |
| 100 | + return <IconQaHelthCheck className="icon-qa-health-check" /> |
| 101 | + case 'product-qa-mobility-testing': |
| 102 | + return <IconQaMobilityTesting className="icon-qa-mobility-testing" /> |
| 103 | + case 'product-qa-os-automation': |
| 104 | + return <IconQaOsAutomation className="icon-qa-os-automation" /> |
| 105 | + case 'product-qa-website-performance': |
| 106 | + return <IconQaWebsitePrerfomance className="icon-qa-website-performance" /> |
| 107 | + case 'product-qa-sfdc-accelerator': |
| 108 | + return <IconQaSFDCAccelerator className="icon-qa-sfdc-accelerator" /> |
| 109 | + case 'product-website-website': |
| 110 | + return <IconWebsiteWebsite className="icon-website-website" /> |
| 111 | + case 'tech-32px-outline-work-project': |
| 112 | + return <IconOutlineWorkProject className="icon-outline-work-project" /> |
| 113 | + default: |
| 114 | + return 'undefined icon' |
| 115 | + } |
| 116 | +} |
| 117 | + |
| 118 | +ProjectTypeIcons.propTypes = { |
| 119 | + type: PT.string |
| 120 | +} |
| 121 | + |
| 122 | +function SelectProduct(props) { |
| 123 | + const { projectType } = props |
| 124 | + const cards = [] |
| 125 | + for (const key in config) { |
| 126 | + const type = config[key] |
| 127 | + if (projectType && type.id !== projectType) continue |
| 128 | + const subTypes = type.subtypes |
| 129 | + for(const subType in subTypes) { |
| 130 | + const item = subTypes[subType] |
| 131 | + // don't render disabled items for selection |
| 132 | + // don't render hidden items as well, hidden items can be reached via direct link though |
| 133 | + if (item.disabled || item.hidden) continue |
| 134 | + const icon = <ProjectTypeIcons type={item.icon} /> |
| 135 | + cards.push( |
| 136 | + <ProductCard |
| 137 | + icon={icon} |
| 138 | + info={item.details} |
| 139 | + key={item.id} |
| 140 | + onClick={() => props.onProductChange(type.id, item.id)} |
| 141 | + type={ subType } |
| 142 | + /> |
| 143 | + ) |
| 144 | + } |
| 145 | + } |
| 146 | + const projectCategory = findCategory(props.projectType) |
| 147 | + return ( |
| 148 | + <div> |
| 149 | + <div className="header headerSelectProduct" /> |
| 150 | + <div className="SelectProduct"> |
| 151 | + <h1> { projectCategory.name } projects </h1> |
| 152 | + <h2>{ projectCategory.question }</h2> |
| 153 | + <div className="cards">{cards}</div> |
| 154 | + <div className="footer"> |
| 155 | + Looking for something else? <a href={`https://${DOMAIN}/contact?utm_source=Connect&utm_medium=Referral&utm_campaign=FooterContact`}>Get in touch with us →</a> |
| 156 | + </div> |
| 157 | + </div> |
| 158 | + </div> |
| 159 | + ) |
| 160 | +} |
| 161 | + |
| 162 | +SelectProduct.propTypes = { |
| 163 | + onProductChange: PT.func.isRequired, |
| 164 | + userRoles: PT.arrayOf(PT.string) |
| 165 | +} |
| 166 | + |
| 167 | +export default SelectProduct |
0 commit comments