refactor: style problem and async request

pull/13/head
moonrailgun 4 years ago
parent 584f064184
commit d7511f88ac

@ -61,7 +61,7 @@ const GroupPanelItem: React.FC<{
className={clsx( className={clsx(
'w-full hover:bg-white hover:bg-opacity-20 cursor-pointer text-white rounded px-1 h-8 flex items-center text-base group', 'w-full hover:bg-white hover:bg-opacity-20 cursor-pointer text-white rounded px-1 h-8 flex items-center text-base group',
{ {
'bg-opacity-20': isActive, 'bg-white bg-opacity-20': isActive,
} }
)} )}
> >

@ -1,5 +1,10 @@
import React, { useCallback } from 'react'; import React from 'react';
import { createDMConverse, t, useAppSelector } from 'tailchat-shared'; import {
createDMConverse,
t,
useAppSelector,
useAsyncRequest,
} from 'tailchat-shared';
import { UserListItem } from '@/components/UserListItem'; import { UserListItem } from '@/components/UserListItem';
import { IconBtn } from '@/components/IconBtn'; import { IconBtn } from '@/components/IconBtn';
import { Tooltip } from 'antd'; import { Tooltip } from 'antd';
@ -12,11 +17,10 @@ export const FriendList: React.FC = React.memo(() => {
const friends = useAppSelector((state) => state.user.friends); const friends = useAppSelector((state) => state.user.friends);
const history = useHistory(); const history = useHistory();
const handleCreateConverse = useCallback( const [, handleCreateConverse] = useAsyncRequest(
(targetId: string) => { async (targetId: string) => {
createDMConverse(targetId).then((converse) => { const converse = await createDMConverse(targetId);
history.push(`/main/personal/converse/${converse._id}`); history.push(`/main/personal/converse/${converse._id}`);
});
}, },
[history] [history]
); );

@ -49,6 +49,7 @@ module.exports = {
lg: { min: '1024px' }, lg: { min: '1024px' },
md: { max: '767px' }, md: { max: '767px' },
sm: { max: '639px' }, sm: { max: '639px' },
mobile: { max: '639px' }, // alias
}, },
extend: { extend: {
borderRadius: { borderRadius: {

Loading…
Cancel
Save