Skip to content

Commit

Permalink
feat(web): add laf_doc and laf_about_us url config (#1763)
Browse files Browse the repository at this point in the history
  • Loading branch information
newfish-cmyk committed Jan 2, 2024
1 parent 0fc0e03 commit 9a96ff7
Show file tree
Hide file tree
Showing 5 changed files with 76 additions and 44 deletions.
2 changes: 0 additions & 2 deletions web/src/constants/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,8 @@ export const Routes = {
};

export const site_url = {
laf_doc: "https://doc.laf.run/zh/",
laf_github: "https://github.com/labring/laf",
laf_index_video: "https://itceb8-video.oss.laf.run/laf-website.mp4",
laf_about_us: "https://sealos.run/zh-Hans/company/",
};

export const CHAKRA_UI_COLOR_MODE_KEY = "chakra-ui-color-mode";
Expand Down
4 changes: 2 additions & 2 deletions web/src/layouts/Header/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import ColorModeSwitch from "@/components/ColorModeSwitch";
import { ChatIcon, DocIcon } from "@/components/CommonIcon";
import LanguageSwitch from "@/components/LanguageSwitch";
import { Logo, LogoText } from "@/components/LogoIcon";
import { COLOR_MODE, Routes, site_url } from "@/constants";
import { COLOR_MODE, Routes } from "@/constants";
import { getAvatarUrl } from "@/utils/getAvatarUrl";

import UserSetting from "../../pages/app/setting/UserSetting";
Expand All @@ -31,7 +31,7 @@ const Header = (props: { className?: string }) => {
const navList_right = [
{
text: t("HomePage.NavBar.docs"),
ref: site_url.laf_doc,
ref: siteSettings.laf_doc_url?.value,
icon: <DocIcon boxSize={5} />,
},
{
Expand Down
108 changes: 70 additions & 38 deletions web/src/pages/homepage/footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,13 @@ const Footer = (props: Props) => {
{t("HomePage.Footer.item2_4")}
</a>
</li>
<li>
<a href={site_url.laf_doc} target="_blank" rel="noreferrer">
{t("HomePage.Footer.item2_5")}
</a>
</li>
{siteSettings.laf_doc_url?.value && (
<li>
<a href={siteSettings.laf_doc_url?.value} target="_blank" rel="noreferrer">
{t("HomePage.Footer.item2_5")}
</a>
</li>
)}
</ul>
</div>
<div
Expand All @@ -143,17 +145,25 @@ const Footer = (props: Props) => {
</a>
</li>

<li>
<a href={siteSettings.laf_forum_url?.value} target="_blank" rel="noreferrer">
{t("HomePage.Footer.item3_2")}
</a>
</li>
{siteSettings.laf_forum_url?.value && (
<li>
<a href={siteSettings.laf_forum_url?.value} target="_blank" rel="noreferrer">
{t("HomePage.Footer.item3_2")}
</a>
</li>
)}

<li>
<a href={site_url.laf_about_us} target="_blank" rel="noreferrer">
{t("HomePage.Footer.item3_3")}
</a>
</li>
{siteSettings.laf_about_us_url?.value && (
<li>
<a
href={siteSettings.laf_about_us_url?.value}
target="_blank"
rel="noreferrer"
>
{t("HomePage.Footer.item3_3")}
</a>
</li>
)}
</ul>
</div>
</div>
Expand All @@ -165,7 +175,11 @@ const Footer = (props: Props) => {
}
>
laf. all rights reserved. © {new Date().getFullYear()}
<div dangerouslySetInnerHTML={{ __html: siteSettings.site_footer?.value || "" }} />
<div
dangerouslySetInnerHTML={{
__html: siteSettings.site_footer?.value || "",
}}
/>
</div>
<div className="flex justify-evenly ">
{siteSettings.laf_status_url?.value && <Status />}
Expand Down Expand Up @@ -271,17 +285,25 @@ const Footer = (props: Props) => {
</a>
</li>

<li>
<a href={siteSettings.laf_forum_url?.value} target="_blank" rel="noreferrer">
{t("HomePage.Footer.item3_2")}
</a>
</li>
{siteSettings.laf_forum_url?.value && (
<li>
<a href={siteSettings.laf_forum_url?.value} target="_blank" rel="noreferrer">
{t("HomePage.Footer.item3_2")}
</a>
</li>
)}

<li>
<a href={site_url.laf_about_us} target="_blank" rel="noreferrer">
{t("HomePage.Footer.item3_3")}
</a>
</li>
{siteSettings.laf_about_us_url?.value && (
<li>
<a
href={siteSettings.laf_about_us_url?.value}
target="_blank"
rel="noreferrer"
>
{t("HomePage.Footer.item3_3")}
</a>
</li>
)}
</ul>
</div>
</div>
Expand Down Expand Up @@ -312,11 +334,13 @@ const Footer = (props: Props) => {
{t("HomePage.Footer.item2_4")}
</a>
</li>
<li>
<a href={site_url.laf_doc} target="_blank" rel="noreferrer">
{t("HomePage.Footer.item2_5")}
</a>
</li>
{siteSettings.laf_doc_url?.value && (
<li>
<a href={siteSettings.laf_doc_url?.value} target="_blank" rel="noreferrer">
{t("HomePage.Footer.item2_5")}
</a>
</li>
)}
</ul>
</div>
</div>
Expand All @@ -325,20 +349,28 @@ const Footer = (props: Props) => {
<div className="flex flex-col gap-2 py-6 ">
<div className={darkMode ? "text-lg text-lafWhite-700" : "text-lg text-[#3C455D]"}>
laf. all rights reserved. © {new Date().getFullYear()}
<div dangerouslySetInnerHTML={{ __html: siteSettings.site_footer?.value || "" }} />
<div
dangerouslySetInnerHTML={{
__html: siteSettings.site_footer?.value || "",
}}
/>
</div>
<div className="flex ">
{siteSettings.laf_wechat_url?.value && (
<a href={siteSettings.laf_wechat_url?.value} target="_blank" rel="noreferrer">
<WechatIcon fontSize={28} color={darkMode ? "#F6F8F9" : "#3C455D"} />
</a>
)}
<a href={siteSettings.laf_forum_url?.value} target="_blank" rel="noreferrer">
<ForumIcon fontSize={28} color={darkMode ? "#F6F8F9" : "#3C455D"} />
</a>
<a href={siteSettings.laf_discord_url?.value} target="_blank" rel="noreferrer">
<DiscordIcon fontSize={28} color={darkMode ? "#F6F8F9" : "#3C455D"} />
</a>
{siteSettings.laf_forum_url?.value && (
<a href={siteSettings.laf_forum_url?.value} target="_blank" rel="noreferrer">
<ForumIcon fontSize={28} color={darkMode ? "#F6F8F9" : "#3C455D"} />
</a>
)}
{siteSettings.laf_discord_url?.value && (
<a href={siteSettings.laf_discord_url?.value} target="_blank" rel="noreferrer">
<DiscordIcon fontSize={28} color={darkMode ? "#F6F8F9" : "#3C455D"} />
</a>
)}
</div>
<div>
<Status />
Expand Down
2 changes: 1 addition & 1 deletion web/src/pages/homepage/navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const Navbar = () => {
const navList = [
{
text: t("HomePage.NavBar.docs"),
ref: site_url.laf_doc,
ref: siteSettings.laf_doc_url?.value,
},
{
text: t("HomePage.NavBar.forum"),
Expand Down
4 changes: 3 additions & 1 deletion web/src/pages/siteSetting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ type SITE_KEY =
| "laf_business_url"
| "laf_discord_url"
| "laf_wechat_url"
| "laf_status_url";
| "laf_status_url"
| "laf_doc_url"
| "laf_about_us_url";

type State = {
siteSettings: {
Expand Down

0 comments on commit 9a96ff7

Please sign in to comment.