@@ -3,7 +3,7 @@ import { Container, Grid, Typography } from '@mui/material';
33import { observer } from 'mobx-react' ;
44import { useRouter } from 'next/router' ;
55import { compose , JWTProps , jwtVerifier } from 'next-ssr-middleware' ;
6- import { FC , useContext , useMemo } from 'react' ;
6+ import { FC , useContext } from 'react' ;
77
88import { ProjectCard } from '../../components/Project/NewCard' ;
99import { ScrollList } from '../../components/ScrollList' ;
@@ -25,15 +25,6 @@ const DashboardPage: FC<DashboardPageProps> = observer(({ jwtPayload }) => {
2525
2626 const menu = [ { href : '/dashboard' , title : t ( 'overview' ) } ] ;
2727
28- // Role-based filtering: pass createdBy for client users, empty for others
29- const filter = useMemo ( ( ) => {
30- const userRole = jwtPayload ?. role ;
31- if ( userRole === 'client' && jwtPayload ?. id ) {
32- return { createdBy : jwtPayload . id } ;
33- }
34- return { } ;
35- } , [ jwtPayload ] ) ;
36-
3728 return (
3829 < SessionBox title = { t ( 'backend_management' ) } path = { asPath } { ...{ menu, jwtPayload } } >
3930 < Container maxWidth = "lg" className = "py-8" >
@@ -42,19 +33,19 @@ const DashboardPage: FC<DashboardPageProps> = observer(({ jwtPayload }) => {
4233 </ Typography >
4334
4435 < Typography variant = "h5" component = "h2" sx = { { mt : 4 , mb : 3 } } >
45- 最近项目
36+ { t ( 'recent_projects' ) }
4637 </ Typography >
4738
4839 < ScrollList
4940 translator = { i18n }
5041 store = { projectStore }
51- filter = { filter }
42+ filter = { jwtPayload ?. role === 'client' && jwtPayload ?. id ? { createdBy : jwtPayload . id } : { } }
5243 renderList = { ( allItems : Project [ ] ) => (
5344 < Grid container spacing = { 3 } >
5445 { allItems . length === 0 ? (
5546 < Grid size = { { xs : 12 } } >
5647 < Typography color = "textSecondary" sx = { { textAlign : 'center' , mt : 4 } } >
57- 暂无项目数据
48+ { t ( 'no_project_data' ) }
5849 </ Typography >
5950 </ Grid >
6051 ) : (
0 commit comments