Skip to content

Commit

Permalink
fix(web): fix route dashboard link (#1020)
Browse files Browse the repository at this point in the history
  • Loading branch information
LeezQ authored Apr 11, 2023
1 parent 4e05678 commit 7ad26a0
Show file tree
Hide file tree
Showing 18 changed files with 145 additions and 35 deletions.
File renamed without changes
File renamed without changes
File renamed without changes
2 changes: 1 addition & 1 deletion web/public/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@
"Start": "Start",
"TryLafAI": "Try 🎉 Laf AI !",
"HomePage": {
"LafLink": "https://laf.dev",
"LafLink": "/dashboard",
"DocsLink": "https://doc.laf.run/guide/",
"VideoLink": "https://itceb8-video.oss.laf.run/laf-website-en.mp4",
"WebSite": {
Expand Down
83 changes: 80 additions & 3 deletions web/public/locales/zh-CN/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@
"WX": "微信小程序/公众号",
"Welcome": "欢迎来到 LAF 云开发平台!",
"DeleteApp": "删除 APP",
"DeleteTip": "当前操作将会永久删除应用, 包括函数、数据、云存储等与应用相关的数据, 删除后<strong>将无法撤消</strong>, 请输入 <strong>{{appId}}</strong> 后确认",
"DeleteTip": "当前操作将会永久删除应用, 包括函数、数据、云存储等与应用相关的数据, 删除后<strong>将无法撤消</strong>, 请输入 <strong>{{appId}}</strong> 后确认",
"Duration": "购买时长"
},
"LogPanel": {
Expand Down Expand Up @@ -333,5 +333,82 @@
"Or": "",
"Generating": "正在生成",
"Start": "开始生成",
"TryLafAI": "试试 🎉 Laf AI !"
}
"TryLafAI": "试试 🎉 Laf AI !",
"HomePage": {
"LafLink": "/dashboard",
"DocsLink": "https://doc.laf.run/guide/",
"VideoLink": "https://itceb8-video.oss.laf.run/laf-website.mp4",
"WebSite": {
"title": "Laf 云开发官网",
"description": "Laf 是一个集函数、数据库、存储为一体的云开发平台,随时随地,发布上线"
},
"NavBar": {
"title": "如果你喜欢 Laf 的话,请在 Github 上给我们一个 Star 吧!",
"home": "主页",
"price": "价格",
"case": "案例",
"aboutUs": "关于我们",
"docs": "文档",
"contact": "联系我们",
"forum": "开发者社区",
"faq": "FAQ",
"start": "立即体验",
"stars": "3.9K"
},
"HomePage": {
"slogan": "像写博客一样写代码",
"start": "立即体验",
"content1": "Laf 是一个集函数、数据库、存储为一体的云开发平台",
"content2": "随时随地,发布上线"
},
"Ability": {
"title": "Laf 的能力",
"learn": "了解详情",
"function": "云函数",
"functionSub": ", 5秒发布你的第一个函数。",
"database": "数据库",
"databaseSub": ", 无需创建数据库, 开箱即用.",
"storage": "云储存",
"storageSub": ",创建属于你的云储存,管理文件更简单。"
},
"Choice": {
"title": "为什么选择 Laf",
"open": "更开放",
"openSub": "Laf 遵循 Apache License 2.0 开源协议",
"fast": "请求更快",
"fastSub": "没有冷启时间让你的请求响应更快",
"private": "支持私有化部署",
"privateSub": "担心云服务不稳定?没关系,我们支持私有化部署",
"simple": "开发更简单",
"simpleSub": "无需关心部署、运维,一切都是 Serverless",
"cheap": "高性价比",
"cheapSub": "百万次调用,最低仅需 0.01 元",
"service": "我们致力于为所有开发者提供敏捷高效的服务",
"serviceSub": "了解详情"
},
"Join": {
"title": "加入 Laf 开发者社区",
"subtitle": "和我们一起成长",
"content": "在这里你可以在第一时间体验 Laf 的最新版本,以及在 Discord 或微信群与开发者和用户保持沟通",
"WeChat": "微信",
"forum": "开发者社区"
},
"Footer": {
"laf": "Laf 是一个 Serverless 框架,提供开箱即用的云函数,云数据库,对象存储等能力,是一个干净清爽的开发平台,像写博客一样写代码!三分钟上线 ChatGPT 应用!",
"product": "产品",
"item1_1": "Laf 公有云",
"item1_2": "Sealos",
"item1_3": "更新日志",
"item1_4": "Vscode 插件",
"developer": "开发者",
"item2_1": "私有化部署",
"item2_2": "开放 API",
"item2_3": "贡献者指南",
"item2_4": "源码",
"item2_5": "文档",
"support": "支持",
"item3_1": "问题反馈",
"item3_2": "开发者社区"
}
}
}
4 changes: 2 additions & 2 deletions web/public/locales/zh/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@
"Start": "开始生成",
"TryLafAI": "试试 🎉 Laf AI !",
"HomePage": {
"LafLink": "https://laf.run",
"LafLink": "/dashboard",
"DocsLink": "https://doc.laf.run/guide/",
"VideoLink": "https://itceb8-video.oss.laf.run/laf-website.mp4",
"WebSite": {
Expand All @@ -356,7 +356,7 @@
"stars": "3.9K"
},
"HomePage": {
"slogan": "写博客一样,写函数",
"slogan": "像写博客一样写代码",
"start": "立即体验",
"content1": "Laf 是一个集函数、数据库、存储为一体的云开发平台",
"content2": "随时随地,发布上线"
Expand Down
4 changes: 4 additions & 0 deletions web/src/constants/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,7 @@ export enum CURRENCY {
CNY = "CNY",
USD = "USD",
}

export const Routes = {
dashboard: "/dashboard",
};
4 changes: 3 additions & 1 deletion web/src/pages/403.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import { ArrowForwardIcon } from "@chakra-ui/icons";
import { Button, Center, HStack } from "@chakra-ui/react";
import { t } from "i18next";

import { Routes } from "@/constants";

export default function Index() {
const navigate = useNavigate();
return (
Expand All @@ -16,7 +18,7 @@ export default function Index() {
<Button
rightIcon={<ArrowForwardIcon />}
size={"lg"}
onClick={() => navigate("/", { replace: true })}
onClick={() => navigate(Routes.dashboard, { replace: true })}
>
{t("Take me home")}
</Button>
Expand Down
4 changes: 3 additions & 1 deletion web/src/pages/404.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import { ArrowForwardIcon } from "@chakra-ui/icons";
import { Button, Center, HStack } from "@chakra-ui/react";
import { t } from "i18next";

import { Routes } from "@/constants";

export default function Index() {
const navigate = useNavigate();
return (
Expand All @@ -16,7 +18,7 @@ export default function Index() {
<Button
rightIcon={<ArrowForwardIcon />}
size={"lg"}
onClick={() => navigate("/", { replace: true })}
onClick={() => navigate(Routes.dashboard, { replace: true })}
>
{t("Take me home")}
</Button>
Expand Down
4 changes: 3 additions & 1 deletion web/src/pages/LoginCallback.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import { useNavigate, useSearchParams } from "react-router-dom";
import { Center, Spinner } from "@chakra-ui/react";
import { useQuery } from "@tanstack/react-query";

import { Routes } from "@/constants";

import { AuthControllerCode2token } from "@/apis/v1/code2token";

export default function LoginCallBack() {
Expand All @@ -17,7 +19,7 @@ export default function LoginCallBack() {

if (!tokenRes.isLoading && tokenRes.data?.data) {
localStorage.setItem("token", tokenRes.data?.data);
navigate("/", { replace: true });
navigate(Routes.dashboard, { replace: true });
}

return (
Expand Down
4 changes: 2 additions & 2 deletions web/src/pages/app/mods/SideBar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { Center } from "@chakra-ui/react";
import clsx from "clsx";
import { t } from "i18next";

import { Pages, SideBarWidth } from "@/constants/index";
import { Pages, Routes, SideBarWidth } from "@/constants/index";

import SysSetting from "../../setting/SysSetting";

Expand Down Expand Up @@ -101,7 +101,7 @@ export default function SideBar() {
}}
className="cursor-pointer"
onClick={() => {
navigate("/dashboard");
navigate(Routes.dashboard);
}}
>
{item.component}
Expand Down
6 changes: 3 additions & 3 deletions web/src/pages/app/setting/AppInfoList/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { useNavigate } from "react-router-dom";
import { Box, Button, HStack, useColorMode } from "@chakra-ui/react";
import clsx from "clsx";

import { APP_PHASE_STATUS } from "@/constants/index";
import { APP_PHASE_STATUS, Routes } from "@/constants/index";
import { formatDate } from "@/utils/format";

import InfoDetail from "./InfoDetail";
Expand All @@ -21,7 +21,7 @@ const AppEnvList = () => {
const darkMode = useColorMode().colorMode === "dark";

if (currentApp?.state === APP_PHASE_STATUS.Deleted) {
navigate("/");
navigate(Routes.dashboard);
return <></>;
}

Expand Down Expand Up @@ -77,7 +77,7 @@ const AppEnvList = () => {
<DeleteAppModal
item={currentApp}
onSuccess={() => {
navigate("/");
navigate(Routes.dashboard);
}}
>
<Button className="mr-2" fontWeight={"semibold"} size={"sm"} variant={"warnText"}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import {
} from "@chakra-ui/react";
import { t } from "i18next";

import { Routes } from "@/constants";

import { useSigninByPasswordMutation } from "@/pages/auth/service";

type FormData = {
Expand Down Expand Up @@ -45,7 +47,7 @@ export default function LoginByPasswordPanel({
});

if (res?.data) {
navigate("/", { replace: true });
navigate(Routes.dashboard, { replace: true });
}
};

Expand Down
4 changes: 3 additions & 1 deletion web/src/pages/auth/signin/mods/LoginByPhonePanel/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import {
} from "@chakra-ui/react";
import { t } from "i18next";

import { Routes } from "@/constants";

import { useSendSmsCodeMutation, useSigninBySmsCodeMutation } from "@/pages/auth/service";
import useGlobalStore from "@/pages/globalStore";

Expand Down Expand Up @@ -52,7 +54,7 @@ export default function LoginByPhonePanel({
});

if (res?.data) {
navigate("/", { replace: true });
navigate(Routes.dashboard, { replace: true });
}
};

Expand Down
12 changes: 6 additions & 6 deletions web/src/pages/homepage/choice.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const Choice = (props: Props) => {
<div className="mt-[120px]">
<h2 className="mb-[60px] font-[#152132]"> {t(`HomePage.Choice.title`)}</h2>
<div className="mx-[16px] space-y-4 lg:mx-0 lg:grid lg:grid-cols-3 lg:gap-6 lg:space-y-0">
<div className="flex h-auto justify-between rounded-md border border-solid p-[40px] hover:bg-[#F9F9F9] ">
<div className="flex justify-between rounded-md border border-solid p-[40px] hover:bg-[#F9F9F9] ">
<div className="w-1/4">
<img src="/homepage/icon_01.svg" alt="logo1" />
</div>
Expand All @@ -18,7 +18,7 @@ const Choice = (props: Props) => {
<p className="font-[##3C455D] text-xl font-light"> {t(`HomePage.Choice.openSub`)}</p>
</div>
</div>
<div className="flex h-auto justify-between rounded-md border border-solid p-[40px] hover:bg-[#F9F9F9]">
<div className="flex justify-between rounded-md border border-solid p-[40px] hover:bg-[#F9F9F9]">
<div className="w-1/4">
<img src="/homepage/icon_02.svg" alt="icon_02" />
</div>
Expand All @@ -27,7 +27,7 @@ const Choice = (props: Props) => {
<p className="font-[##3C455D] text-xl font-light">{t(`HomePage.Choice.fastSub`)}</p>
</div>
</div>
<div className="flex h-auto justify-between rounded-md border border-solid p-[40px] hover:bg-[#F9F9F9]">
<div className="flex justify-between rounded-md border border-solid p-[40px] hover:bg-[#F9F9F9]">
<div className="w-1/4">
<img src="/homepage/icon_03.svg" alt="icon_03" />
</div>
Expand All @@ -36,7 +36,7 @@ const Choice = (props: Props) => {
<p className="font-[##3C455D] text-xl font-light">{t(`HomePage.Choice.privateSub`)}</p>
</div>
</div>
<div className="flex h-auto justify-between rounded-md border border-solid p-[40px] hover:bg-[#F9F9F9]">
<div className="flex justify-between rounded-md border border-solid p-[40px] hover:bg-[#F9F9F9]">
<div className="w-1/4">
<img src="/homepage/icon_04.svg" alt="icon_04" />
</div>
Expand All @@ -45,7 +45,7 @@ const Choice = (props: Props) => {
<p className="font-[##3C455D] text-xl font-light">{t(`HomePage.Choice.simpleSub`)}</p>
</div>
</div>
<div className="flex h-[200px] justify-between rounded-md border border-solid p-[40px] hover:bg-[#F9F9F9]">
<div className="flex justify-between rounded-md border border-solid p-[40px] hover:bg-[#F9F9F9]">
<div className="w-1/4">
<img src="/homepage/icon_05.svg" alt="icon_05" />
</div>
Expand All @@ -54,7 +54,7 @@ const Choice = (props: Props) => {
<p className="font-[##3C455D] text-xl font-light">{t(`HomePage.Choice.cheapSub`)}</p>
</div>
</div>
<div className="flex h-[200px] justify-between rounded-md border border-solid p-[40px] hover:bg-[#F9F9F9]">
<div className="flex justify-between rounded-md border border-solid p-[40px] hover:bg-[#F9F9F9]">
<div className="w-1/4">
<img src="/homepage/icon_06.png" className="h-12 w-12" alt="icon_06" />
</div>
Expand Down
4 changes: 3 additions & 1 deletion web/src/pages/homepage/hero.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import React, { useState } from "react";
import { useTranslation } from "react-i18next";
import { Link } from "react-router-dom";

import { Routes } from "@/constants";

import Video from "./video";

type Props = {};
Expand All @@ -22,7 +24,7 @@ const Hero = (props: Props) => {

<div className="z-10 mt-8 lg:mt-6">
<Link
to={"/dashboard"}
to={Routes.dashboard}
className="bg-primary z-40 flex h-[48px] w-[144px] items-center justify-center rounded-md text-[16px] text-white hover:active:bg-[#00AFA3]"
>
{t(`HomePage.HomePage.start`)}
Expand Down
Loading

0 comments on commit 7ad26a0

Please sign in to comment.