Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/pages/case-studies.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Layout from "@theme/Layout";
import useDocusaurusContext from "@docusaurus/useDocusaurusContext";
import useBaseUrl from "@docusaurus/useBaseUrl";
import { useBaseUrlUtils } from "@docusaurus/useBaseUrl";
import caseStudies from "../data/caseStudies";
import styles from "./case-studies.module.css";

Expand All @@ -16,6 +16,7 @@ function formatDate(date, locale) {

export default function CaseStudiesPage() {
const { i18n } = useDocusaurusContext();
const { withBaseUrl } = useBaseUrlUtils();
const isZh = i18n.currentLocale === "zh";
const t = (item) => (isZh ? item.zh : item.en);

Expand Down Expand Up @@ -48,7 +49,7 @@ export default function CaseStudiesPage() {
<div className={styles.logoBox}>
<img
className={styles.logo}
src={useBaseUrl(logo)}
src={withBaseUrl(logo)}
alt={displayName}
loading="lazy"
/>
Expand Down
38 changes: 21 additions & 17 deletions src/pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { useEffect, useRef, useCallback, useState } from "react";
import clsx from "clsx";
import Layout from "@theme/Layout";
import Link from "@docusaurus/Link";
import useBaseUrl from "@docusaurus/useBaseUrl";
import { useBaseUrlUtils } from "@docusaurus/useBaseUrl";
import useDocusaurusContext from "@docusaurus/useDocusaurusContext";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import {
Expand Down Expand Up @@ -373,14 +373,15 @@ function RuntimeLaneCard({ lane, locale }) {

export default function Home() {
const { i18n } = useDocusaurusContext();
const { withBaseUrl } = useBaseUrlUtils();
const isZh = i18n.currentLocale === "zh";
const [starsCount, setStarsCount] = useState(3100);
// Static: Docker Hub's API sends no CORS header, so it cannot be read from the browser.
const dockerPulls = 325000;
const kubernetesLogo = useBaseUrl("img/kubernetes-logo.svg");
const hamiLogo = useBaseUrl("img/hami-graph-color.svg");
const hamiHorizontalLogoLight = useBaseUrl("img/hami-horizontal-color-black.svg");
const hamiHorizontalLogoDark = useBaseUrl("img/hami-horizontal-color-white.svg");
const kubernetesLogo = withBaseUrl("img/kubernetes-logo.svg");
const hamiLogo = withBaseUrl("img/hami-graph-color.svg");
const hamiHorizontalLogoLight = withBaseUrl("img/hami-horizontal-color-black.svg");
const hamiHorizontalLogoDark = withBaseUrl("img/hami-horizontal-color-white.svg");
const contributorsCount = useCountUp(500);
const contributorCountries = useCountUp(27);
const starsCountDisplay = useCountUp(starsCount);
Expand Down Expand Up @@ -494,11 +495,14 @@ export default function Home() {
<div className={styles.heroActions}>
<Link
className="button button--primary button--lg"
to={useBaseUrl("/docs/get-started/deploy-with-helm")}
to={withBaseUrl("/docs/get-started/deploy-with-helm")}
>
{isZh ? "快速开始" : "Quick Start"}
</Link>
<Link className="button button--outline button--lg" to={useBaseUrl("/community")}>
<Link
className="button button--outline button--lg"
to={withBaseUrl("/community")}
>
{isZh ? "加入社区" : "Join Community"}
</Link>
</div>
Expand All @@ -521,7 +525,7 @@ export default function Home() {
<div key={item.key} className={styles.ecoLogoChip}>
{item.logo ? (
<img
src={useBaseUrl(item.logo)}
src={withBaseUrl(item.logo)}
alt={pickLocalizedOrRaw(i18n.currentLocale, item.label)}
/>
) : (
Expand All @@ -542,7 +546,7 @@ export default function Home() {
{heroSchedulerEcosystem.map((item) => (
<div key={item.key} className={styles.ecoLogoChip}>
<img
src={useBaseUrl(item.logo)}
src={withBaseUrl(item.logo)}
alt={pickLocalizedOrRaw(i18n.currentLocale, item.label)}
/>
</div>
Expand Down Expand Up @@ -624,13 +628,13 @@ export default function Home() {
<div className={styles.observabilityLogoRow}>
<div className={styles.ecoLogoChip}>
<img
src={useBaseUrl("img/ecosystem/prometheus.svg")}
src={withBaseUrl("img/ecosystem/prometheus.svg")}
alt="Prometheus"
/>
</div>
<div className={styles.ecoLogoChip}>
<img
src={useBaseUrl("img/ecosystem/opentelemetry.svg")}
src={withBaseUrl("img/ecosystem/opentelemetry.svg")}
alt="OpenTelemetry"
/>
</div>
Expand All @@ -649,7 +653,7 @@ export default function Home() {
{heroDeviceEcosystem.map((item) => (
<div key={item.key} className={styles.ecoLogoChip}>
<img
src={useBaseUrl(item.logo)}
src={withBaseUrl(item.logo)}
alt={pickLocalizedOrRaw(i18n.currentLocale, item.label)}
/>
</div>
Expand All @@ -672,14 +676,14 @@ export default function Home() {
<div className={styles.cncfFeatureMedia}>
<div className={styles.cncfLogoBox}>
<img
src={useBaseUrl("img/cncf-color.svg")}
src={withBaseUrl("img/cncf-color.svg")}
alt="CNCF logo"
className={styles.cncfFeatureLogoLight}
/>
</div>
<div className={styles.cnaiLogoBox}>
<img
src={useBaseUrl("img/ecosystem/cnai.svg")}
src={withBaseUrl("img/ecosystem/cnai.svg")}
alt="CNAI Landscape logo"
className={styles.cnaiLogo}
/>
Expand Down Expand Up @@ -860,15 +864,15 @@ export default function Home() {
rel="noopener noreferrer"
className="adopter-card-link"
>
{vendor.logo && <img src={useBaseUrl(vendor.logo)} alt={vendor.name} />}
{vendor.logo && <img src={withBaseUrl(vendor.logo)} alt={vendor.name} />}
</a>
</li>
))}
</ul>
</div>
<Link
className={clsx(styles.inlineLink, styles.supportDocsLink)}
to={useBaseUrl("/docs/userguide/device-supported")}
to={withBaseUrl("/docs/userguide/device-supported")}
>
{isZh ? "查看完整设备支持列表 →" : "View full supported devices list →"}
</Link>
Expand Down Expand Up @@ -1032,7 +1036,7 @@ export default function Home() {
>
{isZh ? "给 HAMi 点个 Star" : "Star HAMi on GitHub"}
</a>
<Link className={clsx("button", "button--outline")} to={useBaseUrl("/community")}>
<Link className={clsx("button", "button--outline")} to={withBaseUrl("/community")}>
{isZh ? "加入社区" : "Join Community"}
</Link>
</div>
Expand Down
7 changes: 2 additions & 5 deletions src/theme/BlogPostItem/Header/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export default function BlogPostItemHeader() {
const { metadata, frontMatter, isBlogPostPage } = useBlogPost();
const { i18n } = useDocusaurusContext();
const cover = frontMatter.cover;
const coverUrl = useBaseUrl(cover || "");
const fallbackLabel = (
<Translate
id="theme.hami.blog.meta.unknownAuthor"
Expand All @@ -44,11 +45,7 @@ export default function BlogPostItemHeader() {
<header>
{isBlogPostPage && cover && (
<div className={styles.coverWrap}>
<img
className={styles.cover}
src={useBaseUrl(cover)}
alt={frontMatter.title || metadata.title}
/>
<img className={styles.cover} src={coverUrl} alt={frontMatter.title || metadata.title} />
</div>
)}
<BlogPostItemHeaderTitle />
Expand Down
23 changes: 11 additions & 12 deletions src/theme/Footer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,12 @@ function Footer() {
const { i18n } = useDocusaurusContext();
const [isWechatModalOpen, setIsWechatModalOpen] = useState(false);
const [isWechatOfficialOpen, setIsWechatOfficialOpen] = useState(false);

if (!footer) {
return null;
}

const { copyright, links, logo, style } = footer;
const cncfLogoLight = useBaseUrl("img/cncf-color.svg");
const cncfLogoDark = useBaseUrl("img/cncf-white.svg");
const wechatGroupQr = useBaseUrl("img/community/wechat-assistant-qr.jpg");
const wechatOfficialQr = useBaseUrl("img/community/wechat-official-account-qr.jpg");
const cncfLogo = colorMode === "dark" ? cncfLogoDark : cncfLogoLight;
const isZh = i18n.currentLocale === "zh";

useEffect(() => {
if (i18n.currentLocale !== "zh") {
Expand Down Expand Up @@ -119,6 +119,11 @@ function Footer() {
return () => document.removeEventListener("click", onFooterLinkClick, true);
}, [i18n.currentLocale]);

if (!footer) {
return null;
}

const { copyright, links, logo, style } = footer;
const zhOnlyLabels = new Set(["WeChat Group", "WeChat Official Account"]);
const adjustedLinks =
i18n.currentLocale === "zh"
Expand Down Expand Up @@ -167,12 +172,6 @@ function Footer() {
}));
const footerLinks =
iconizedLinks && iconizedLinks.length > 0 ? <FooterLinks links={iconizedLinks} /> : null;
const isZh = i18n.currentLocale === "zh";
const cncfLogoLight = useBaseUrl("img/cncf-color.svg");
const cncfLogoDark = useBaseUrl("img/cncf-white.svg");
const cncfLogo = colorMode === "dark" ? cncfLogoDark : cncfLogoLight;
const wechatGroupQr = useBaseUrl("img/community/wechat-assistant-qr.jpg");
const wechatOfficialQr = useBaseUrl("img/community/wechat-official-account-qr.jpg");

return (
<>
Expand Down