Prepare website for domain substitution

Signed-off-by: Egor Savkin <es@m-labs.hk>
This commit is contained in:
Egor Savkin 2024-06-04 16:25:04 +08:00
parent da39ac3f56
commit 2742826bc4
19 changed files with 70 additions and 21 deletions

View File

@ -11,3 +11,4 @@ highlight_code = true
[extra]
author = "M-Labs"
simulate_intl_domain = false

View File

@ -18,4 +18,4 @@ Selling drinks is not our main business and only a service we do to other Club M
* In case of any dispute, the seller is always right.
Contact: [sb@m-labs.hk](mailto:sb@m-labs.hk)
Contact: <a href="mailto:sb@m-labs.hk" class="domain-sub">sb@m-labs.hk</a>

View File

@ -83,5 +83,5 @@ Now is your chance to work on top-notch science and technology projects that get
{% layout_centered_content() %}
##### Contact us at [jobs@m-labs.hk](mailto:jobs@m-labs.hk) or [jobs@m-labs.ph](mailto:jobs@m-labs.ph)!
##### Contact us at <a href="mailto:jobs@m-labs.hk" class="domain-sub">jobs@m-labs.hk</a> or [jobs@m-labs.ph](mailto:jobs@m-labs.ph)!
{% end %}

View File

@ -62,7 +62,7 @@ The <a href="https://github.com/quartiq/stabilizer" target="_blank" rel="noopene
<div class="col-12 col-md-4">
<p>
To purchase this controller, email <a href="mailto:sales@m-labs.hk">sales@m-labs.hk</a>. We also offer firmware customizations and development of new features. Note that features that are not implemented in the open source code above (e.g. control from Kasli) are not supported unless purchased separately.
To purchase this controller, email <a href="mailto:sales@m-labs.hk" class="domain-sub">sales@m-labs.hk</a>. We also offer firmware customizations and development of new features. Note that features that are not implemented in the open source code above (e.g. control from Kasli) are not supported unless purchased separately.
</p>
</div>

View File

@ -19,7 +19,7 @@ ARTIQ and the related components that we are developing ([Migen/MiSoC](/gateware
{% layout_funding(position="center", title="Sponsors") %}
We acknowledge support from our partners below. Please get in touch ([sales@m-labs.hk](mailto:sales@m-labs.hk)) if you also want to move ARTIQ forward!
We acknowledge support from our partners below. Please get in touch (<a href="mailto:sales@m-labs.hk" class="domain-sub">sales@m-labs.hk</a>) if you also want to move ARTIQ forward!
{% end %}

View File

@ -114,7 +114,7 @@ template = "page.html"
**Sinara hardware purchases, ports to your hardware, feature development, technical support, bugfixing**
contact [sales@m-labs.hk](mailto:sales@m-labs.hk)
contact <a href="mailto:sales@m-labs.hk" class="domain-sub">sales@m-labs.hk</a>
We welcome inquiries from research groups of all sizes.<br>[See what has been funded before](/experiment-control/funding)
@ -237,6 +237,6 @@ We welcome inquiries from research groups of all sizes.<br>[See what has been fu
</div>
{% layout_div(css="col-12 text-center") %}
Want your project listed here? Write to [sb@m-labs.hk](mailto:sb@m-labs.hk).
Want your project listed here? Write to <a href="mailto:sb@{{ config.extra.domain_name }}">sb@{{ config.extra.domain_name }}</a>.
{% end %}

View File

@ -14,7 +14,7 @@ The first ARTIQ core devices used hardware built in-house by physicists (based o
The Sinara hardware is in active development, and the latest information is available <a href="https://github.com/sinara-hw" target="_blank" rel="noopener noreferrer">on the wiki of each project's page</a>. Most of the hardware engineering is done at the <a href="https://www.ise.pw.edu.pl/" target="_blank" rel="noopener noreferrer">Institute for Electronics Systems</a> at the Warsaw University of Technology.
Kasli and EEMs can be ordered now. We can deliver a rack-mountable crate that contains all the cards, is fully tested, and is ready to be connected to your experiment and computer network. Use our [web-based configuration and ordering tool](../place-order), or contact <a href="mailto:sales@m-labs.hk">sales@m-labs.hk</a> with your requirements, and we will establish a quote.
Kasli and EEMs can be ordered now. We can deliver a rack-mountable crate that contains all the cards, is fully tested, and is ready to be connected to your experiment and computer network. Use our [web-based configuration and ordering tool](../place-order), or contact <a href="mailto:sales@m-labs.hk" class="domain-sub">sales@m-labs.hk</a> with your requirements, and we will establish a quote.
{% end %}
@ -297,7 +297,7 @@ The 4624 AWG "Phaser" is a quad channel 1.25 GS/s RF generator card with dual IQ
We can deliver a rack-mountable crate that contains all the cards, is fully tested, and is ready to be connected to your experiment and computer network. The lead time can be as short as a few working days and we will provide assistance to help you set up your new equipment with ARTIQ via the online helpdesk. Using our AFWS tool, you can keep the firmware of your M-Labs devices up-to-date easily, and benefit from the new features we continuously develop into ARTIQ.
Use our [web-based configuration and ordering tool](../place-order), or contact <a href="mailto:sales@m-labs.hk">sales@m-labs.hk</a> with your requirements, and we will establish a quote.
Use our [web-based configuration and ordering tool](../place-order), or contact <a href="mailto:sales@{{ config.extra.domain_name }}">sales@{{ config.extra.domain_name }}</a> with your requirements, and we will establish a quote.
{% end %}

View File

@ -30,7 +30,7 @@ Built on the <a href="/gateware/migen/">MiSoC and Migen</a> technologies that or
The Mixxeo supported mixing from two DVI or HDMI sources up to 720p60, with crossfade, fade to black and potentially other effects with a latency of less than two frames.
<b>Status (Aug 2014)</b> - Main board and gateware have been <a href="/images/mixxeo_result.jpg">mostly functional</a> for a while, mechanical design and manufacturing for the case/mechatronics are progressing slowly. If you have the skills and would like to help out, email [sb@m-labs.hk](mailto:sb@m-labs.hk) or the mailing list.
<b>Status (Aug 2014)</b> - Main board and gateware have been <a href="/images/mixxeo_result.jpg">mostly functional</a> for a while, mechanical design and manufacturing for the case/mechatronics are progressing slowly. If you have the skills and would like to help out, email <a href="mailto:sb@m-labs.hk" class="domain-sub">sb@m-labs.hk</a> or the mailing list.
<center><img src="/images/mixxeo_menu.png"><br /><br /><img src="/images/mixxeo_board.jpg" class="picimg"></center>

View File

@ -26,6 +26,6 @@ smoltcp achieves <a href="https://github.com/smoltcp-rs/smoltcp#examplesbenchmar
The source code is available <a href="https://github.com/smoltcp-rs/smoltcp" rel="noopener noreferrer">on GitHub</a>.
**Commercial support for smoltcp is available.** Email [sales@m-labs.hk](mailto:sales@m-labs.hk).
**Commercial support for smoltcp is available.** Email <a href="mailto:sales@m-labs.hk" class="domain-sub">sales@m-labs.hk</a>.
{% end %}

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,8 @@
import React from "react";
import {DEFAULT_DOMAIN, INTL_DOMAIN, USE_INTL_DOMAIN} from "./utils";
export function DomainedEmail({address}) {
const target = `${address}@${USE_INTL_DOMAIN ? INTL_DOMAIN : DEFAULT_DOMAIN}`;
return <a href={"mailto:" + target}>{target}</a>
}

View File

@ -0,0 +1,8 @@
import React from "react";
import {DomainedEmail} from "./DomainedEmail";
export const RFQMessages = {
OK: <>We've received your request and will be in contact soon.</>,
ERROR: <>We cannot receive your request. Try using the export by coping the configuration and send it to us at <DomainedEmail address="sales"/></>
}

View File

@ -9,6 +9,7 @@ import {Layout} from "./Layout";
import {Catalog} from "./Catalog";
import {OrderPanel} from "./OrderPanel";
import {useShopStore} from "./shop_store";
import {DomainedEmail} from "./DomainedEmail";
/**
* Component that renders the entire shop
@ -61,7 +62,7 @@ export function Shop() {
the combination would look like. Configure the card settings by tapping on the top of
the card; many of the options can be adjusted even after the card has been shipped.
If you have any issues with this ordering system, or if you need other configurations,
email us directly anytime at <a href="mailto:sales@m-labs.hk">sales@m-labs.hk</a>.
email us directly anytime at <DomainedEmail address="sales"/>.
The price excludes shipping, is estimated, and must be confirmed by a quote.
</p>
)}

View File

@ -1,7 +1,7 @@
'use strict';
import {createWithEqualityFn} from "zustand/traditional";
import {data as shared_data, itemsUnfoldedList} from "./utils";
import {data as shared_data, itemsUnfoldedList, USE_INTL_DOMAIN} from "./utils";
import {FillExtCrateData, FillExtOrderData, true_type_of} from "./options/utils";
import {v4 as uuidv4} from "uuid";
import {FillResources} from "./count_resources";
@ -10,6 +10,7 @@ import {TriggerCrateWarnings, TriggerWarnings} from "./warnings";
import {Validation, validateEmail, validateNote, validateJSONInput} from "./validate";
import {CratesToJSON, JSONToCrates} from "./json_porter";
import {ProcessOptionsToData} from "./options/Options";
import {RFQMessages} from "./RFQMessages";
const cards_to_pn_map = (cards) => {
@ -228,7 +229,7 @@ const useSubmitForm = ((set, get) => ({
status: Validation.OK,
message: ""
},
API_RFQ: shared_data.API_RFQ,
API_RFQ: USE_INTL_DOMAIN ? shared_data.INTL_API_RFQ : shared_data.API_RFQ,
email: {
value: "",
error: null
@ -306,18 +307,18 @@ const useSubmitForm = ((set, get) => ({
if (response.status !== 200) {
throw Error("Response status is not OK: " + response.status + ".\n" + response);
}
get().finishSubmitForm({status: Validation.OK, message: "We've received your request and will be in contact soon."})
get().finishSubmitForm({status: Validation.OK, message: RFQMessages.OK})
}, reason => {
console.error("Request rejected, reason:", reason)
get().finishSubmitForm({
status: Validation.Invalid,
message: "We cannot receive your request. Try using the export by coping the configuration and send it to us at sales@m-labs.hk"
message: RFQMessages.ERROR
})
}).catch(err => {
console.error("Request failed, reason:", err)
get().finishSubmitForm({
status: Validation.Invalid,
message: "We cannot receive your request. Try using the export by coping the configuration and send it to us at sales@m-labs.hk"
message: RFQMessages.ERROR
})
})
},

View File

@ -91,4 +91,13 @@ export const compareArraysLevelOne = (a, b) =>
export function compareObjectsEmptiness(a, b) {
return (!a && !b) || (!(!a !== !b) && Object.getPrototypeOf(a) === Object.getPrototypeOf(b) &&
(Object.getPrototypeOf(a) !== Object.getPrototypeOf([]) || !!Object.keys(a).length === !!Object.keys(b).length))
}
}
export const INTL_DOMAIN = "m-labs-intl.com";
export const DEFAULT_DOMAIN = "m-labs.hk";
// #!if intl_domain
export const USE_INTL_DOMAIN = true;
// #!else
export const USE_INTL_DOMAIN = window.location.hostname === INTL_DOMAIN;
// #!endif

View File

@ -1,6 +1,7 @@
const shop_data = {
API_RFQ: 'https://hooks.m-labs.hk/rfq',
INTL_API_RFQ: 'https://example.com/rfq',
currency: 'USD',
crateModes: {

View File

@ -43,6 +43,25 @@
<link href="{{ get_url(path='favicon.ico', cachebust=true) }}" rel="icon" type="image/x-icon">
{% block styles %}{% endblock %}
<script>
function substituteDomain () {
{% if config.extra.simulate_intl_domain %}
const isIntl = true;
{% else %}
const isIntl = window.location.hostname === "m-labs-intl.com";
{% endif %}
if (isIntl) {
let selected = document.querySelectorAll(".domain-sub");
for (element of selected) {
const code = element.innerHTML;
element.innerHTML = code.replaceAll("m-labs.hk", "m-labs-intl.com");
}
}
}
addEventListener("DOMContentLoaded", (event) => {substituteDomain()});
addEventListener("load", (event) => {substituteDomain()});
</script>
</head>
<body>

View File

@ -5,7 +5,7 @@
<h5 class="pb-3">Sales inquiries</h5>
<p>
To purchase ARTIQ Sinara hardware, software and gateware development services, or to enter a technical support agreement, write to <a href="mailto:sales@m-labs.hk">sales@m-labs.hk</a>.
To purchase ARTIQ Sinara hardware, software and gateware development services, or to enter a technical support agreement, write to <a href="mailto:sales@m-labs.hk" class="domain-sub">sales@m-labs.hk</a>.
</p>
</div>
@ -15,7 +15,7 @@
<h5 class="pb-3">Commercial technical support</h5>
<p>
If you need help setting up ARTIQ hardware purchased from us, or if you have a commercial technical support agreement with us, email us anytime at <a href="mailto:helpdesk@m-labs.hk">helpdesk@m-labs.hk</a>.
If you need help setting up ARTIQ hardware purchased from us, or if you have a commercial technical support agreement with us, email us anytime at <a href="mailto:helpdesk@m-labs.hk" class="domain-sub">helpdesk@m-labs.hk</a>.
</p>
<h5 class="pb-3">Community support</h5>

View File

@ -25,7 +25,8 @@ module.exports = {
},
params: {
ENV: process.env.NODE_ENV,
disable_card_highlight: false
disable_card_highlight: false,
intl_domain: false
},
verbose: false,
}