Skip to content

Commit

Permalink
adds new companies to homepage and company redirect
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandersimoes committed Sep 25, 2018
1 parent 4a3da55 commit 88e864e
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 35 deletions.
13 changes: 8 additions & 5 deletions app/pages/Home.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class Home extends React.Component {
{type: "country", name: "USA", continent: "North America", id: "nausa", flickr_link: "https://flic.kr/p/8CZkZ7"},
{type: "country", name: "Italy", continent: "Europe", id: "euita", flickr_link: "https://flic.kr/p/gonJ3Y"},
{type: "country", name: "Vietnam", continent: "Asia", id: "asvnm", flickr_link: ""},
{type: "country", name: "Azerbaijan", continent: "Asia", id: "asaze", flickr_link: ""}
{type: "country", name: "Cote d'Ivoire", continent: "Africa", id: "afciv", flickr_link: "https://flic.kr/p/dd4Jxb"}
];
this.products = [
{type: "product", name: "Wine", category: "Foodstuffs", id: "042204", flickr_link: "https://flic.kr/p/a7awbU"},
Expand All @@ -32,13 +32,16 @@ class Home extends React.Component {
{type: "product", name: "Electrical Transformers", category: "Machines", id: "168504", flickr_link: "https://flic.kr/p/6Bfnmw"}
];
this.companies = [
{id: "mutara-africa-link-technologies", type: "company", name: "Mutara Africa Link Technologies", logo: "https://storage.googleapis.com/mm-company/company/company6023-mutara-logo-design.png"},
{id: "chaochomvarnish-coltd", type: "company", name: "Chaochomvarnish Co.", logo: "https://storage.googleapis.com/mm-company/company/company277--.jpg"},
{id: "sheabutter-guys-uk-limited", type: "company", name: "sheabutter guys UK Limited", logo: "https://storage.googleapis.com/mm-company/company/company254-official-logo.png"},
{id: "dobropole", type: "company", name: "DOBROPOLE", logo: "https://storage.googleapis.com/mm-company/company/company284-ukrainian_flag-wallpaper-1024x1024.jpg"},
{id: "inversiones-martinez-perez", type: "company", name: "Inversiones Martinez Perez", logo: "https://storage.googleapis.com/mm-company/company/company6056-logo-cuadrado.jpeg"},
{id: "shaylan-group", type: "company", name: "Shaylan Group", logo: "https://storage.googleapis.com/mm-company/company/company271-shaylan.png"},
{id: "algeria-universal-export", type: "company", name: "Algeria Universal Export", logo: "https://storage.googleapis.com/mm-company/company/company287-a.jpg"},
{id: "planet-port-export-and-imports", type: "company", name: "Planet Port Export and Imports", logo: "https://storage.googleapis.com/mm-company/company/company291-planet-port-logo_final-1-paint.jpg"},
{id: "shenzhen-wangjing-printing-coltd", type: "company", name: "Shenzhen Wangjing Printing", logo: "https://storage.googleapis.com/mm-company/company/company251-img_2104s.jpg"}
{id: "planet-port-export-and-imports", type: "company", name: "Planet Port Export and Imports", logo: "https://storage.googleapis.com/mm-company/company/company291-planet-port-logo_final-1-paint.jpg"}

// {id: "shenzhen-wangjing-printing-coltd", type: "company", name: "Shenzhen Wangjing Printing", logo: "https://storage.googleapis.com/mm-company/company/company251-img_2104s.jpg"}
// {id: "algeria-universal-export", type: "company", name: "Algeria Universal Export", logo: "https://storage.googleapis.com/mm-company/company/company287-a.jpg"},

// {type: "company", name: "Al Hafar Transport", id: "al-hafar-transport-and-cont-llc-1", logo: "https://storage.googleapis.com/mm-company/company/company259-cat-966h.jpg"}
// {type: "company", name: "Kandil Egypt Lighting", id: "kandil-egypt-for-chandeliers-and-decorative-lighting", logo: "https://storage.googleapis.com/mm-company/company/company255-kandil-logo-english.jpg"},
Expand Down Expand Up @@ -137,7 +140,7 @@ class Home extends React.Component {
<div className="search-input-wrapper">
<input onChange={this.handleChange} value={this.state.keyword} className="search-input" placeholder="Enter a Search" type="text" />
{searchResults.length > 0
? <ul ref="area" className="suggestions-wrapper">
? <ul className="suggestions-wrapper">
{searchResults.map((suggestion, i) => <li key={i} onClick={this.selectSuggestion.bind(this, suggestion)} className="dropdown-item">
<img className="icon" src={suggestion.profile_type === "Country"
? "/images/icons/icon-country-yellow.svg"
Expand Down
59 changes: 29 additions & 30 deletions app/routes.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import EditProducts from "pages/admin/EditProducts";
import ChangePw from "pages/admin/ChangePw";
import Inbox from "pages/Inbox";

function genRandId(path) {
const genRandId = path => {
let candidates;
if (path.includes("country")) {
candidates = ["saper", "napri", "sapry", "ocnzl", "afken", "asbgd", "afzaf", "aschn", "asvnm", "eudeu", "eufra", "nacri", "namex", "nausa", "saarg", "sabra", "sachl", "euisl"];
Expand All @@ -32,13 +32,13 @@ function genRandId(path) {
}
else if (path.includes("company")) {
const caCandidates = ["ca_21078", "ca_58962", "ca_4616", "ca_27687", "ca_56948", "ca_3855", "ca_9228", "ca_42430", "ca_62858", "ca_76847", "ca_76268", "ca_76847", "ca_76801", "ca_76460", "ca_77156", "ca_76579", "ca_5051", "ca_70762"];
const mmCandidates = ["pelican-international-trading-solutions", "carvalho-vernet-advogados", "standard-freight-incorporation", "akram-trading", "ems-shipping-and-logistics-agency", "shriji-luggageware-pvt-ltd", "al-ansari-teqmark-llc", "aureus-lubrico-trading-inc", "trinity-shipping-colombo-pvt-ltd", "w3-holding-trading-corp", "thundercom-technologies", "azexporter", "kariem-haddadin-farms", "mali-true-food", "kemal-ozgoren-textile-export-company", "sunbiz-services-and-solutions", "fruktville-delight-pvt-ltd", "sidick-general-trading-m-sdn-bhd", "ossa-productos-organicos", "globe-engineering", "crest-international", "ci-panandina-bh-sas", "premium-comex-ltda", "crest-international", "pento-business-associates-ltd", "interchemie-werken-de-adelaar", "kcc-exports"];
const mmCandidates = ["pelican-international-trading-solutions", "carvalho-vernet-advogados", "standard-freight-incorporation", "akram-trading", "ems-shipping-and-logistics-agency", "shriji-luggageware-pvt-ltd", "al-ansari-teqmark-llc", "aureus-lubrico-trading-inc", "trinity-shipping-colombo-pvt-ltd", "w3-holding-trading-corp", "thundercom-technologies", "azexporter", "kariem-haddadin-farms", "mali-true-food", "kemal-ozgoren-textile-export-company", "sunbiz-services-and-solutions", "fruktville-delight-pvt-ltd", "sidick-general-trading-m-sdn-bhd", "ossa-productos-organicos", "globe-engineering", "crest-international", "ci-panandina-bh-sas", "premium-comex-ltda", "crest-international", "pento-business-associates-ltd", "interchemie-werken-de-adelaar", "kcc-exports", "inversiones-martinez-perez", "travelpd", "mutara-africa-link-technologies"];
candidates = caCandidates.concat(mmCandidates);
}
return candidates[Math.floor(Math.random() * candidates.length)];
}
};

function checkForId(nextState, replace) {
const checkForId = (nextState, replace) => {
if (!nextState.params.countryWithId && !nextState.params.productWithId && !nextState.params.companySlug) {
const reqestedUrl = nextState.location.pathname;

Expand All @@ -54,32 +54,31 @@ function checkForId(nextState, replace) {
// make sure it's legal
return <NotFound/>;
}
}
};

export default function RouteCreate() {
return (
<Route path="/" component={App}>
<IndexRoute component={Home} />
<Route path="/country(/:countryWithId)" onEnter={checkForId} component={CountryWithId} />
<Route path="/company(/:companySlug)" onEnter={checkForId} component={CompanyWithId} />
<Route path="/product(/:productWithId)" onEnter={checkForId} component={ProductWithId} />
<Route path="/login" component={Login} />
<Route path="/signup" component={Signup} />
<Route path="terms" component={Terms} />
<Route path="privacy" component={Privacy} />
<Route path="reset" component={Reset} />
<Route path="activate" component={Activate} />
<Route path="settings" component={Settings}>
<IndexRoute component={SettingsSummary} />
<Route path="stats" component={Stats} />
<Route path="change-password" component={ChangePw} />
<Route path="company/:companySlug" component={CompanySummary}>
<IndexRoute component={EditCompany} />
<Route path="products" component={EditProducts} />
</Route>
const RouteCreate = () =>
<Route path="/" component={App}>
<IndexRoute component={Home} />
<Route path="/country(/:countryWithId)" onEnter={checkForId} component={CountryWithId} />
<Route path="/company(/:companySlug)" onEnter={checkForId} component={CompanyWithId} />
<Route path="/product(/:productWithId)" onEnter={checkForId} component={ProductWithId} />
<Route path="/login" component={Login} />
<Route path="/signup" component={Signup} />
<Route path="terms" component={Terms} />
<Route path="privacy" component={Privacy} />
<Route path="reset" component={Reset} />
<Route path="activate" component={Activate} />
<Route path="settings" component={Settings}>
<IndexRoute component={SettingsSummary} />
<Route path="stats" component={Stats} />
<Route path="change-password" component={ChangePw} />
<Route path="company/:companySlug" component={CompanySummary}>
<IndexRoute component={EditCompany} />
<Route path="products" component={EditProducts} />
</Route>
<Route path="/inbox" component={Inbox} />
<Route path="*" exact={true} component={NotFound} />
</Route>
);
}
<Route path="/inbox" component={Inbox} />
<Route path="*" exact={true} component={NotFound} />
</Route>;

export default RouteCreate;

0 comments on commit 88e864e

Please sign in to comment.