Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 1. homepage improvements 2. add ga and baidu #32

Merged
merged 1 commit into from
Dec 9, 2023
Merged
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
20 changes: 19 additions & 1 deletion docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,13 @@ const config = {
locales: ['zh-Hans', 'en'],
},

scripts: [
{
src: 'https://hm.baidu.com/hm.js?3c5253cd6530122d0f774cab69e3c07f',
async: true,
},
],

presets: [
[
'classic',
Expand Down Expand Up @@ -78,6 +85,16 @@ const config = {
],
],

plugins: [
[
'@docusaurus/plugin-google-gtag',
{
trackingID: 'G-999X9XX9XX',
anonymizeIP: true,
},
],
],

themes: [
[
require.resolve('@easyops-cn/docusaurus-search-local'),
Expand Down Expand Up @@ -106,7 +123,8 @@ const config = {
title: 'Cloudpods',
logo: {
alt: 'Cloudpods Logo',
src: 'img/logo.png',
src: 'img/logo_green_round_revert.png',
srcDark: 'img/logo_white_round_revert.png',
},
items: [
// { to: '/docs/getting-started', label: '快速开始', position: 'left' },
Expand Down
3 changes: 3 additions & 0 deletions i18n/en/code.json
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,9 @@
"homepage.subtitle": {
"message": "A cloud-native open-source unified cloud platform"
},
"homepage.buildown": {
"message": "Build your own cloud on clouds"
},
"homepage.cloudpodsVirtDesc": {
"message": "Local virtualization&bare metal"
},
Expand Down
50 changes: 13 additions & 37 deletions scripts/cherry_pick_pull.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ declare -r REBASEMAGIC="${REPO_ROOT}/.git/rebase-apply"
DRY_RUN=${DRY_RUN:-""}
UPSTREAM_REMOTE=${UPSTREAM_REMOTE:-upstream}
FORK_REMOTE=${FORK_REMOTE:-origin}
MAIN_REPO_ORG=${MAIN_REPO_ORG:-$(git_remote_get_url "$UPSTREAM_REMOTE" | awk '{gsub(/http[s]:\/\/|git@/,"")}1' | awk -F'[@:./]' 'NR==1{print $3}')}
MAIN_REPO_NAME=${MAIN_REPO_NAME:-$(git_remote_get_url "$UPSTREAM_REMOTE" | awk '{gsub(/http[s]:\/\/|git@/,"")}1' | awk -F'[@:./]' 'NR==1{print $4}')}
MAIN_REPO_ORG=${MAIN_REPO_ORG:-$(git_remote_get_url "$UPSTREAM_REMOTE" | awk -F'github.com' '{print $2}' | awk -F'[:./]' 'NR==1{print $2}')}
MAIN_REPO_NAME=${MAIN_REPO_NAME:-$(git_remote_get_url "$UPSTREAM_REMOTE" | awk -F'github.com' '{print $2}' | awk -F'[:./]' 'NR==1{print $3}')}

if [[ -z ${GITHUB_USER:-} ]]; then
echo "Please export GITHUB_USER=<your-user> (or GH organization, if that's where your fork lives)"
Expand All @@ -59,6 +59,15 @@ if ! which hub > /dev/null; then
exit 1
fi

function version_lt() {
test "$(echo "$@" | tr " " "\n" | sort -rV | head -n 1)" != "$1"
}

if version_lt "$(hub version | awk '/hub/ {print $3}')" "2.13.0"; then
echo "Please install 'hub' with version 2.13.0+ from https://github.com/github/hub/releases"
exit 1
fi

if [[ "$#" -lt 2 ]]; then
echo "${0} <remote branch> <pr-number>...: cherry pick one or more <pr> onto <remote branch> and leave instructions for proposing pull request"
echo
Expand Down Expand Up @@ -156,45 +165,14 @@ EOF
hub pull-request -F "${prtext}" -h "${GITHUB_USER}:${NEWBRANCH}" -b "${MAIN_REPO_ORG}:${rel}"
}

function extract-subject {
local patch="$1"

script='
import os
import email.parser
import email.header
with open("'"$patch"'", "r") as f:
m = email.parser.Parser().parse(f, headersonly=True)
subj = m["subject"]
subj = email.header.decode_header(subj)
s = u""
for txt, enc in subj:
txt = txt.decode(enc) if enc else txt
txt = txt.decode("ascii") if isinstance(txt, bytes) else txt
txt = txt.replace(u"\n", u"")
if txt.startswith(u"[PATCH"):
i = txt.index(u"]")
txt = txt[i+1:]
s += txt
s = s.strip() + u"\n"
s = s.encode("utf-8") # write out utf-8 bytes whatsoever
os.write(1, s)
'
os=`uname -s`
if [ $os == "Darwin" ]; then
python3 -c "$script"
else
python -c "$script"
fi
}

git checkout -b "${NEWBRANCHUNIQ}" "${BRANCH}"
cleanbranch="${NEWBRANCHUNIQ}"

gitamcleanup=true
for pull in "${PULLS[@]}"; do
echo "+++ Downloading patch to /tmp/${pull}.patch (in case you need to do this again)"

echo "Downloading https://github.com/${MAIN_REPO_ORG}/${MAIN_REPO_NAME}/pull/${pull}.patch ..."
curl -o "/tmp/${pull}.patch" -sSL "https://github.com/${MAIN_REPO_ORG}/${MAIN_REPO_NAME}/pull/${pull}.patch"
echo
echo "+++ About to attempt cherry pick of PR. To reattempt:"
Expand Down Expand Up @@ -225,9 +203,7 @@ for pull in "${PULLS[@]}"; do
fi
}

# set the subject
subject=$(extract-subject "/tmp/${pull}.patch")
SUBJECTS+=("#${pull}: ${subject}")
SUBJECTS+=("$(hub pr show -f "%i: %t" ${pull})")

# remove the patch file from /tmp
rm -f "/tmp/${pull}.patch"
Expand Down
2 changes: 1 addition & 1 deletion src/components/HomepageFeatures/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export default function HomepageFeatures() {
<section className={styles.featureSection}>
<div className="container">
<div className={styles.sectionTitle}>
<Translate id="">The one cloud contains all your clouds</Translate>
<Translate id="">The One Cloud Contains All Your Clouds</Translate>
</div>
<div className={styles.sectionSubTitle}>
<Translate id="homepage.featureDesc">Cloudpods不仅可以管理本地的虚拟机和物理机资源,还可以管理多个云平台和云账号。Cloudpods隐藏了这些异构基础设施资源的数据模型和API的差异,对外暴露了一套统一的API,允许用户就像用一个云一样地访问多云。从而大大降低了访问多云的复杂度,提升了管理多云的效率。</Translate>
Expand Down
1 change: 1 addition & 0 deletions src/components/HomepageFeatures/styles.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
text-align: center;
width: 100%;
margin-top: 2rem;
margin-bottom: 2rem;
}

.sectionSubTitle {
Expand Down
39 changes: 25 additions & 14 deletions src/pages/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import clsx from 'clsx';
import Link from '@docusaurus/Link';
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
import { useColorMode } from '@docusaurus/theme-common';
import useBaseUrl from '@docusaurus/useBaseUrl';
import Layout from '@theme/Layout';
import HomepageFeatures from '@site/src/components/HomepageFeatures';
import HomepageBrands from '@site/src/components/HomepageBrands';
Expand All @@ -14,29 +16,38 @@ import Translate, { translate } from '@docusaurus/Translate';

function HomepageHeader() {
const { siteConfig } = useDocusaurusContext();
const { isDarkTheme } = useColorMode();
return (
<header className={clsx('hero hero--primary', styles.heroBanner)}>
<div className="container">
<Heading as="h1" className="hero__title">
{siteConfig.title}
</Heading>
<p className="hero__subtitle">
<Translate id="homepage.subtitle">开源、云原生的融合云平台</Translate>
</p>
<div className={styles.buttons}>
<Link
className="button button--secondary button--lg"
to="/docs/getting-started/">
<Translate id="homepage.getStarted">快速开始</Translate>
</Link>
<div className="container row">
<div className={clsx('col', styles.alignCenter)}>
<Heading as="h1" className="hero__title">
{siteConfig.title}
</Heading>
<p className="hero__subtitle">
<Translate id="homepage.subtitle">云原生的开源融合云平台</Translate>
</p>
<p className="hero__title">
<Translate id="homepage.buildown">构建您自己的云上之云</Translate>
</p>
<div className={styles.buttons}>
<Link
className="button button--secondary button--lg"
to="/docs/getting-started/">
<Translate id="homepage.getStarted">快速开始</Translate>
</Link>
</div>
</div>
<div className="col">
<img src={isDarkTheme? useBaseUrl('img/logo_black.png') : useBaseUrl('img/logo_white.png') } className={styles.heroImg} />
</div>
</div>
</header>
);
}

export default function Home() {
const { siteConfig } = useDocusaurusContext();
// const { siteConfig } = useDocusaurusContext();
return (
<Layout
title={''}
Expand Down
17 changes: 17 additions & 0 deletions src/pages/index.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,16 @@
overflow: hidden;
}

.heroImg {
width: 400px;
}

.alignCenter {
margin-top: auto;
margin-left: 100px;
margin-bottom: auto;
}

@media screen and (max-width: 996px) {
.heroBanner {
padding: 2rem;
Expand All @@ -21,3 +31,10 @@
align-items: center;
justify-content: center;
}

.buttonsDark {
display: flex;
align-items: center;
justify-content: center;
color: black;
}
Binary file added static/img/logo_black.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/img/logo_green_round_revert.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/img/logo_white.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/img/logo_white_round_revert.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 4 additions & 2 deletions tools/run-in-docker.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/usr/bin/env bash -x
#!/usr/bin/env bash

set -x

docker run --rm -ti -v $(pwd):/website -w /website \
--publish 3000:3000 \
--entrypoint yarn node:21.3.0-alpine3.17 "$@" # start --host 0.0.0.0
--entrypoint yarn node:21.3.0-alpine3.17 "$@"