Skip to content

Commit

Permalink
Feat/UI enhancement (#28)
Browse files Browse the repository at this point in the history
* feat: logo title update

* feat: add app table in home screen

* feat: bind status
  • Loading branch information
MaxtuneLee authored Jul 28, 2024
1 parent c320d8f commit 515ac3b
Show file tree
Hide file tree
Showing 11 changed files with 73 additions and 92 deletions.
15 changes: 0 additions & 15 deletions app/(tourist)/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,22 +1,7 @@
"use client";

import { ReactNode, useEffect } from "react";
import { useRouter } from "next/navigation";
import { getUserInfo } from "@/lib/apis/user";

const AuthGuard = (props: { children: ReactNode }) => {
const { children } = props;
// const router = useRouter();

// useEffect(() => {
// if (localStorage.getItem("Token")) {
// getUserInfo()
// .then((res) => {
// if (res.data.Success) router.replace("/home");
// })
// .catch();
// }
// }, [router]);

return <>{children}</>;
};
Expand Down
1 change: 0 additions & 1 deletion app/(user)/home/@appPanel/page.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@
justify-items: center;
width: 100%;
max-height: calc(100vh - 270px);
overflow-y: auto;
@media screen and (min-width: 500px) {
grid-template-columns: 1fr 1fr 1fr 1fr;
}
Expand Down
5 changes: 0 additions & 5 deletions app/(user)/home/@getInfo/default.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,6 @@ const GetInfo = () => {
if (localStorage.getItem("Token") === null) {
return router.replace("/login");
}
// getUserProfile().then((res) => {
// if (res.data.Success === true) {
// dispatch(setUserBasicInfo(res.data.Data));
// } else router.replace("/login");
// });
}, [dispatch, router]);
return <></>;
};
Expand Down
2 changes: 1 addition & 1 deletion app/(user)/home/@infoPanel/page.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
position: fixed;
top: 150px;
right: 0;
z-index: 10;
z-index: 50;

display: flex;
flex-direction: column;
Expand Down
14 changes: 9 additions & 5 deletions app/(user)/home/@profilePanel/default.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,15 @@ import { BindAppItem } from "@/components/bindItem";
import Link from "next/link";
import { usePathname } from "next/navigation";
import { useAppSelector } from "@/redux";
import useSWR from "swr";
import { getUserBindStatus } from "@/lib/apis/user";

const ProfilePanel = () => {
const userBasicInfo = useAppSelector((state) => state.userBasicInfo);
// console.log(userBasicInfo);
const pathname = usePathname();
const { data } = useSWR("bindStatus", () =>
getUserBindStatus().then((res) => res.data.Data),
);
return (
<>
<div
Expand Down Expand Up @@ -79,25 +83,25 @@ const ProfilePanel = () => {
<BindAppItem
bindAppIconProps={qqIcon}
bindAppTitle={"QQ"}
binded={false}
binded={data?.includes("qq") ?? false}
/>

<BindAppItem
bindAppIconProps={feishuIcon}
bindAppTitle={"SAST 飞书"}
binded={false}
binded={data?.includes("lark") ?? false}
/>

<BindAppItem
bindAppIconProps={msIcon}
bindAppTitle={"Microsoft"}
binded={false}
binded={data?.includes("microsoft") ?? false}
/>

<BindAppItem
bindAppIconProps={githubIcon}
bindAppTitle={"GutHub"}
binded={false}
binded={data?.includes("github") ?? false}
/>
</div>
</>
Expand Down
8 changes: 7 additions & 1 deletion app/(user)/home/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ import { TopBar } from "@/components/topbar";
import classNames from "classnames";
import styles from "./page.module.scss";
import PageTransition from "@/components/pageTransition";
import { Metadata } from "next";

export const metadata: Metadata = {
title: "用户中心 | SAST Link",
description: "OAuth of SAST",
};

const Layout = (props: {
children: ReactNode;
Expand All @@ -19,7 +25,7 @@ const Layout = (props: {
<TopBar />
{getInfo}
<PageTransition
className="flex w-full justify-center px-5"
className="flex w-screen justify-center px-5"
position="bottomToTop"
>
<div className={classNames(styles.homeContainer)}>
Expand Down
6 changes: 3 additions & 3 deletions app/(user)/home/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,23 +36,23 @@ const Home = () => {
<Link href="https://fc.sast.fun">
<MagicCard className="p-4 grid place-content-center">
<div className="flex flex-col gap-2 items-center">
<Image src={fc} alt={"approve system"} />
<Image width={45} height={45} src={fc} alt={"sastoj"} />
<span className={styles.appName}>SASTOJ</span>
</div>
</MagicCard>
</Link>
<Link href="https://sastimg.mxte.cc">
<MagicCard className="p-4 grid place-content-center">
<div className="flex flex-col gap-2 items-center">
<Image src={seeing} alt={"approve system"} />
<Image src={seeing} alt={"sast image"} />
<span className={styles.appName}>视觉科协</span>
</div>
</MagicCard>
</Link>
<Link href="https://evento.sast.fun">
<MagicCard className="p-4 grid place-content-center">
<div className="flex flex-col gap-2 items-center">
<Image src={evento} alt={"approve system"} />
<Image src={evento} alt={"sast evento"} />
<span className={styles.appName}>SAST Evento</span>
</div>
</MagicCard>
Expand Down
2 changes: 1 addition & 1 deletion app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { ReduxProvider } from "@/redux/reduxProvider";
import { SWRProvider } from "@/components/swrProvider";
import "./globals.scss";

const metadata = {
export const metadata: Metadata = {
title: "SAST Link",
description: "OAuth of SAST",
};
Expand Down
6 changes: 6 additions & 0 deletions lib/apis/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,3 +94,9 @@ export function uploadAvatar(file: Blob) {
{ headers: { Token: JSON.parse(localStorage.getItem("Token") ?? "") } },
);
}

export function getUserBindStatus() {
return apis.get<ResType<string[]>>("/apis/profile/bindStatus", {
headers: { Token: JSON.parse(localStorage.getItem("Token") ?? "") },
});
}
2 changes: 1 addition & 1 deletion next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const nextConfig = {
return [
{
source: "/apis/:slug*",
destination: `http://81.68.225.220:8080/api/v1/:slug*`,
destination: `http://localhost:8080/api/v1/:slug*`,
},
];
},
Expand Down
104 changes: 45 additions & 59 deletions public/svg/app-logo/fc.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 515ac3b

Please sign in to comment.