client: clean code

This commit is contained in:
fantasticit 2022-05-29 23:42:35 +08:00
parent 9c1d9bd15d
commit 70d3879a85
1 changed files with 1 additions and 15 deletions

View File

@ -48,12 +48,7 @@ interface IProps {
export const DocumentReader: React.FC<IProps> = ({ documentId }) => { export const DocumentReader: React.FC<IProps> = ({ documentId }) => {
const { isMobile } = IsOnMobile.useHook(); const { isMobile } = IsOnMobile.useHook();
const mounted = useMount(); const mounted = useMount();
const [container, setContainer] = useState<HTMLDivElement>();
const { width: windowWidth } = useWindowSize(); const { width: windowWidth } = useWindowSize();
const { width, fontSize } = useDocumentStyle();
const editorWrapClassNames = useMemo(() => {
return width === 'standardWidth' ? styles.isStandardWidth : styles.isFullWidth;
}, [width]);
const { user } = useUser(); const { user } = useUser();
const { data: documentAndAuth, loading: docAuthLoading, error: docAuthError } = useDocumentDetail(documentId); const { data: documentAndAuth, loading: docAuthLoading, error: docAuthError } = useDocumentDetail(documentId);
const { document, authority } = documentAndAuth || {}; const { document, authority } = documentAndAuth || {};
@ -102,8 +97,6 @@ export const DocumentReader: React.FC<IProps> = ({ documentId }) => {
); );
}, [document, documentId, readable, editable, gotoEdit]); }, [document, documentId, readable, editable, gotoEdit]);
const editBtnStyle = useMemo(() => getEditBtnStyle(isMobile ? 16 : 100), [isMobile]);
return ( return (
<div className={styles.wrap}> <div className={styles.wrap}>
<Header className={styles.headerWrap}> <Header className={styles.headerWrap}>
@ -121,7 +114,7 @@ export const DocumentReader: React.FC<IProps> = ({ documentId }) => {
ellipsis={{ ellipsis={{
showTooltip: { opts: { content: document.title, style: { wordBreak: 'break-all' } } }, showTooltip: { opts: { content: document.title, style: { wordBreak: 'break-all' } } },
}} }}
style={{ width: isMobile ? windowWidth - 100 : ~~(windowWidth / 4) }} style={{ width: isMobile ? windowWidth - 100 : ~~(windowWidth / 3) }}
> >
{document.title} {document.title}
</Text> </Text>
@ -161,13 +154,6 @@ export const DocumentReader: React.FC<IProps> = ({ documentId }) => {
onAwarenessUpdate={triggerJoinUser} onAwarenessUpdate={triggerJoinUser}
/> />
)} )}
{/* {!isMobile && authority && authority.editable && container && (
<BackTop style={editBtnStyle} onClick={gotoEdit} target={() => container} visibilityHeight={200}>
<IconEdit />
</BackTop>
)}
<ImageViewer containerSelector="#js-reader-container" />
{container && <BackTop style={{ bottom: 65, right: isMobile ? 16 : 100 }} target={() => container} />} */}
</> </>
)} )}
/> />