Skip to content

Commit

Permalink
fix: UI issues
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxtuneLee committed Oct 11, 2024
1 parent 9952310 commit 07ecc7c
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 32 deletions.
2 changes: 1 addition & 1 deletion app/(tourist)/callback/feishu/page.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
display: grid;
align-items: center;
justify-content: center;
width: 100%;
width: 100vw;
height: 100vh;
.wrap {
display: flex;
Expand Down
2 changes: 1 addition & 1 deletion app/(tourist)/callback/feishu/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const FeishuCallback = ({
const data = res.data.Data;
dispatch(
addAccount({
nickName: "ming",
nickName: "NJUPTer",
email: data.email,
Token: feishuRes.data.Data.loginToken,
userId: data.userId,
Expand Down
2 changes: 1 addition & 1 deletion app/(tourist)/callback/github/page.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
display: grid;
align-items: center;
justify-content: center;
width: 100%;
width: 100vw;
height: 100vh;
.wrap {
display: flex;
Expand Down
2 changes: 1 addition & 1 deletion app/(tourist)/callback/github/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const GithubCallback = ({
const data = res.data.Data;
dispatch(
addAccount({
nickName: "ming",
nickName: "NJUPTer",
email: data.email,
Token: githubRes.data.Data.loginToken,
userId: data.userId,
Expand Down
3 changes: 1 addition & 2 deletions app/(tourist)/login/2/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,12 @@ const LoginStep2 = () => {
const data = res.data.Data;
dispatch(
addAccount({
nickName: "ming",
nickName: "NJUPTer",
email: data.email,
Token: tokenRef.current,
userId: data.userId,
}),
);
//dispatch(login({ username: "ming", email: data.email }));
if (urlParams.get("redirect") !== null) {
router.push(redirect_uri);
} else {
Expand Down
2 changes: 1 addition & 1 deletion components/accountPanel/accountItem/index.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
flex-shrink: 0;
align-items: center;
justify-content: space-between;
width: 300px;
width: 100%;
height: 78px;
margin: 1px 0;
padding: 0px 14px;
Expand Down
2 changes: 1 addition & 1 deletion components/accountPanel/accountItem/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const AccountItem = forwardRef<any, AccountItemProps>(
/>
</div>
<div className={`${styles.accountMsg}`}>
<div className={`${styles.accountName}`}>{nickName ?? "Ming"}</div>
<div className={`${styles.accountName}`}>{nickName ?? "NJUPTer"}</div>
<div className={`${styles.accountMail}`}>
{mail ?? "[email protected]"}
</div>
Expand Down
49 changes: 25 additions & 24 deletions components/accountPanel/accountList/index.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
"use client";
import { useCallback, useEffect, useRef } from "react";
import { MemorizedAccountItem } from "../accountItem";
import styles from "./index.module.scss";
import { useAppSelector } from "@/redux";
import { useAppDispatch } from "@/redux";
import { removeAccount } from "@/redux/features/userList";
import { useRouter } from "next/navigation";
import { useContext } from "react";
import { SelectedAccountContext } from "@/lib/context";
'use client'
import { useCallback, useEffect, useRef } from 'react'
import { MemorizedAccountItem } from '../accountItem'
import styles from './index.module.scss'
import { useAppSelector } from '@/redux'
import { useAppDispatch } from '@/redux'
import { removeAccount } from '@/redux/features/userList'
import { useRouter } from 'next/navigation'
import { useContext } from 'react'
import { SelectedAccountContext } from '@/lib/context'
import defaultAvatar from '@/public/defaultAvatar.png'

/**
*
Expand All @@ -16,14 +17,14 @@ import { SelectedAccountContext } from "@/lib/context";
* @returns
*/
const AccountList = () => {
const { selected, setSelected } = useContext(SelectedAccountContext);
const scrollRef = useRef<HTMLDivElement>(null);
const localUserList = useAppSelector((state) => state.localUserList);
const dispatch = useAppDispatch();
const { selected, setSelected } = useContext(SelectedAccountContext)
const scrollRef = useRef<HTMLDivElement>(null)
const localUserList = useAppSelector((state) => state.localUserList)
const dispatch = useAppDispatch()

const scroll = useCallback((index: number) => {
scrollRef.current!.scroll({ top: index * 80, behavior: "smooth" });
}, []);
scrollRef.current!.scroll({ top: index * 80, behavior: 'smooth' })
}, [])

return (
<>
Expand All @@ -38,22 +39,22 @@ const AccountList = () => {
key={`${value.email}_${value.nickName}`}
nickName={`${value.nickName}`}
mail={`${value.email}`}
avator={`${value.avator}`}
avator={`${value.avator || defaultAvatar.src}`}
onFocus={() => {
setSelected(index);
scroll(index);
setSelected(index)
scroll(index)
}}
onClose={() => {
dispatch(removeAccount(index));
dispatch(removeAccount(index))
}}
/>
);
)
})}
<div className={styles.bottomWhite} />
</div>
</div>
</>
);
};
)
}

export { AccountList };
export { AccountList }

0 comments on commit 07ecc7c

Please sign in to comment.