Skip to content

Commit 4b99859

Browse files
committed
refactor: optimize page layout for enhanced user experience
1 parent e282971 commit 4b99859

File tree

4 files changed

+48
-56
lines changed

4 files changed

+48
-56
lines changed

client/pages/knowledge/[pId]/index.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { RightOutlined } from '@ant-design/icons';
2-
import { Footer } from '@components/Footer';
32
import { Breadcrumb, Button } from 'antd';
43
import cls from 'classnames';
54
import { NextPage } from 'next';
@@ -144,7 +143,6 @@ const Page: NextPage<IProps> = ({ pId, book, otherBooks = [] }) => {
144143
}
145144
isRightNodeMobileHidden={false}
146145
/>
147-
<Footer className={style.footer} setting={setting} />
148146
</div>
149147
);
150148
};
@@ -163,7 +161,7 @@ Page.getInitialProps = async (ctx) => {
163161
pId,
164162
book,
165163
otherBooks: allBooks.filter((b) => b.id !== book.id),
166-
needLayoutFooter: false,
164+
needLayoutFooter: true,
167165
hasBg: true,
168166
};
169167
};

client/pages/knowledge/index.tsx

Lines changed: 28 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,6 @@ import { GlobalContext } from '@/context/global';
1111
import { DoubleColumnLayout } from '@/layout/DoubleColumnLayout';
1212
import { KnowledgeProvider } from '@/providers/knowledge';
1313

14-
import { Footer } from '@/components/Footer';
15-
import styles from '../index.module.scss';
16-
1714
interface IHomeProps {
1815
books: IKnowledge[];
1916
total: number;
@@ -43,36 +40,33 @@ const Page: NextPage<IHomeProps> = ({ books: defaultBooks = [], total = 0 }) =>
4340
}, []);
4441

4542
return (
46-
<>
47-
<DoubleColumnLayout
48-
leftNode={
49-
<>
50-
<Helmet>
51-
<title>{`${t('knowledge')} - ${setting.systemTitle}`}</title>
52-
</Helmet>
53-
<InfiniteScroll
54-
pageStart={1}
55-
loadMore={getArticles}
56-
hasMore={page * pageSize < total}
57-
loader={
58-
<div className={'loading'} key={0}>
59-
{t('gettingKnowledge')}
60-
</div>
61-
}
62-
>
63-
<KnowledgeList knowledges={books} />
64-
</InfiniteScroll>
65-
</>
66-
}
67-
rightNode={
68-
<div className={'sticky'}>
69-
<ArticleRecommend mode="inline" />
70-
<Categories categories={categories} />
71-
</div>
72-
}
73-
/>
74-
<Footer className={styles.footer} setting={setting} />
75-
</>
43+
<DoubleColumnLayout
44+
leftNode={
45+
<>
46+
<Helmet>
47+
<title>{`${t('knowledge')} - ${setting.systemTitle}`}</title>
48+
</Helmet>
49+
<InfiniteScroll
50+
pageStart={1}
51+
loadMore={getArticles}
52+
hasMore={page * pageSize < total}
53+
loader={
54+
<div className={'loading'} key={0}>
55+
{t('gettingKnowledge')}
56+
</div>
57+
}
58+
>
59+
<KnowledgeList knowledges={books} />
60+
</InfiniteScroll>
61+
</>
62+
}
63+
rightNode={
64+
<div className={'sticky'}>
65+
<ArticleRecommend mode="inline" />
66+
<Categories categories={categories} />
67+
</div>
68+
}
69+
/>
7670
);
7771
};
7872

@@ -86,7 +80,7 @@ Page.getInitialProps = async () => {
8680
return {
8781
books,
8882
total,
89-
needLayoutFooter: false,
83+
needLayoutFooter: true,
9084
};
9185
};
9286

client/src/components/AboutUs/index.tsx

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -112,26 +112,24 @@ export const ContactInfo = () => {
112112
const AboutUs = ({ setting, className = '', hasBg = false }: IProps) => {
113113
const t = useTranslations();
114114
return (
115-
<footer>
116-
<Card title={t('aboutUs')} className={style.card}>
117-
<div className={style.wrapper}>
118-
{setting?.systemFooterInfo && (
119-
<div
120-
className={style.copyright}
121-
dangerouslySetInnerHTML={{
122-
__html: setting.systemFooterInfo,
123-
}}
124-
></div>
125-
)}
126-
<div className={cls(style.footer, className, hasBg && style.hasBg)}>
127-
<div className={style.container}>
128-
<Divider dashed />
129-
<ContactInfo />
130-
</div>
115+
<Card title={t('aboutUs')} className={style.card}>
116+
<div className={style.wrapper}>
117+
{setting?.systemFooterInfo && (
118+
<div
119+
className={style.copyright}
120+
dangerouslySetInnerHTML={{
121+
__html: setting.systemFooterInfo,
122+
}}
123+
></div>
124+
)}
125+
<div className={cls(style.footer, className, hasBg && style.hasBg)}>
126+
<div className={style.container}>
127+
<Divider dashed />
128+
<ContactInfo />
131129
</div>
132130
</div>
133-
</Card>
134-
</footer>
131+
</div>
132+
</Card>
135133
);
136134
};
137135

client/src/components/Footer/index.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,15 @@ import { ContactInfo } from '@/components/AboutUs';
22
import cls from 'classnames';
33

44
import style from './index.module.scss';
5+
import { useTranslations } from 'next-intl';
56

67
export const Footer = ({ setting, className = '', hasBg = false }) => {
8+
const t = useTranslations();
79
return (
810
<footer className={cls(style.footer, className, hasBg && style.hasBg)}>
911
<div className={cls('container', style.container)}>
1012
<ul className={style.left}>
11-
<span className={style.title}>关于我们</span>
13+
<span className={style.title}>{t('aboutUs')}</span>
1214
{setting && setting.systemFooterInfo && (
1315
<div
1416
className={style.copyright}

0 commit comments

Comments
 (0)