Skip to content

Commit 64e879b

Browse files
committed
update
1 parent 1a89531 commit 64e879b

3 files changed

Lines changed: 23 additions & 23 deletions

File tree

src/components/AppLayout/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ const AppLayout: React.FC<PropsWithChildren> = ({ children }) => {
7171
/>
7272
</Sider>
7373
<Layout className="flex h-screen bg-gray-300" style={{ marginLeft: 200 }}>
74-
<Header className="flex h-12 w-full items-start justify-center bg-white px-1 ">
74+
{/* <Header className="flex h-12 w-full items-start justify-center bg-white px-1 ">
7575
<Row className="flex h-full w-full items-center justify-between">
7676
<Col span={8} className="flex items-center justify-center">
7777
<Search placeholder="Search" enterButton />
@@ -83,7 +83,7 @@ const AppLayout: React.FC<PropsWithChildren> = ({ children }) => {
8383
</div>
8484
</Col>
8585
</Row>
86-
</Header>
86+
</Header> */}
8787
<Content className="bg-slate-300 p-2 text-start">
8888
<div className="h-full flex-1 justify-start overflow-auto rounded-xl bg-white p-3 shadow-xl ">
8989
{children}

src/modules/dictionary/index.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,24 @@ import './dictionary.css';
1010
import Search from 'antd/es/input/Search';
1111
import { Button } from 'antd';
1212
import { CloseOutlined, DownloadOutlined } from '@ant-design/icons';
13-
import { includes as lodashIncludes, filter as lodashFilter } from 'lodash';
13+
import { includes as lodashIncludes, filter as lodashFilter, lowerCase } from 'lodash';
1414
const DictionaryPage = () => {
1515
const [keywords, setKeywords] = useState('');
1616
const [isLoading, setIsloading] = useState(false);
1717
const contentRef = useRef<HTMLDivElement>(null);
1818

1919
const handleSearch = async () => {
2020
setIsloading(true);
21+
const _key = lowerCase(keywords).trim();
2122
contentRef.current && (contentRef.current.innerHTML = 'loading');
22-
const dt = await getDbStorage(keywords);
23+
const dt = await getDbStorage(_key);
2324
if (dt && dt !== 'None') {
2425
contentRef.current && (contentRef.current.innerHTML = dt);
26+
setIsloading(false);
2527
return;
2628
}
2729

28-
const steamUrl = `https://dictionary.cambridge.org/dictionary/english-vietnamese/${keywords}`;
30+
const steamUrl = `https://dictionary.cambridge.org/dictionary/english-vietnamese/${_key}`;
2931
const html = await fetch<string>(steamUrl, {
3032
method: 'GET',
3133
responseType: ResponseType.Text,
@@ -34,7 +36,7 @@ const DictionaryPage = () => {
3436
const dic = $('.entry-body').html() || '';
3537
if (dic) {
3638
contentRef.current && (contentRef.current.innerHTML = $('.entry-body').html() || '');
37-
await setDbStorage(keywords, $('.entry-body').html() || '');
39+
await setDbStorage(_key, $('.entry-body').html() || '');
3840
} else {
3941
contentRef.current && (contentRef.current.innerHTML = 'Not found');
4042
}
@@ -48,7 +50,6 @@ const DictionaryPage = () => {
4850
if (isLoading) return;
4951
(async () => {
5052
const keys = await getAllDbKeys();
51-
console.log('🚀 ~ file: index.tsx:44 ~ keys:', keys);
5253
setDbKeys(keys);
5354
setSearchKey(keys);
5455
})();
@@ -85,7 +86,6 @@ const DictionaryPage = () => {
8586
<div className="flex w-[300px] flex-col space-y-3 px-3">
8687
<Search
8788
placeholder="Search..."
88-
loading={isLoading}
8989
allowClear
9090
enterButton
9191
onChange={(e) => handleSerachKey(e.target.value)}

src/routes/index.tsx

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,21 @@ export const routers: RouteObject[] = [
1313
element: <Root />,
1414
errorElement: <h1>404</h1>,
1515
children: [
16-
{
17-
path: 'learn',
18-
element: <LearnPage />,
19-
children: [
20-
{
21-
path: '',
22-
element: <h1></h1>,
23-
},
24-
...lessionsRouters,
25-
],
26-
},
27-
{
28-
path: 'tauri',
29-
element: <Tauri />,
30-
},
16+
// {
17+
// path: 'learn',
18+
// element: <LearnPage />,
19+
// children: [
20+
// {
21+
// path: '',
22+
// element: <h1></h1>,
23+
// },
24+
// ...lessionsRouters,
25+
// ],
26+
// },
27+
// {
28+
// path: 'tauri',
29+
// element: <Tauri />,
30+
// },
3131
{
3232
path: 'dictionary',
3333
element: <DictionaryPage />,

0 commit comments

Comments
 (0)