Skip to content

Commit

Permalink
fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
troyeguo committed Feb 19, 2023
1 parent ba602c3 commit 0fb5e79
Show file tree
Hide file tree
Showing 60 changed files with 13,693 additions and 1,006 deletions.
12,722 changes: 12,722 additions & 0 deletions _yarn.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/components/dialogs/TipDialog/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ const mapStateToProps = (state: stateType) => {
const actionCreator = {
handleTipDialog,
};
export default connect(mapStateToProps, actionCreator)(TipDialog);
export default connect(mapStateToProps, actionCreator)(TipDialog as any);
45 changes: 24 additions & 21 deletions src/components/dialogs/settingDialog/component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import StorageUtil from "../../../utils/serviceUtils/storageUtil";
import { changePath } from "../../../utils/syncUtils/common";
import { isElectron } from "react-device-detect";
import { dropdownList } from "../../../constants/dropdownList";
import { Tooltip } from "react-tippy";

import { restore } from "../../../utils/syncUtils/restoreUtil";
import {
settingList,
Expand All @@ -19,6 +19,7 @@ import {
import { themeList } from "../../../constants/themeList";
import toast from "react-hot-toast";
import { openExternalUrl } from "../../../utils/serviceUtils/urlUtil";
import { getTooltip } from "../../../utils/commonUtil";
class SettingDialog extends React.Component<
SettingInfoProps,
SettingInfoState
Expand Down Expand Up @@ -301,26 +302,28 @@ class SettingDialog extends React.Component<
<div className="setting-dialog-new-title">
<Trans>Theme Color</Trans>
<ul className="theme-setting-container">
{themeList.map((item, index) => (
<Tooltip
key={item.id}
title={this.props.t(item.title)}
position="top"
trigger="mouseenter"
>
<li
className={
index === this.state.currentThemeIndex
? "active-color theme-setting-item"
: "theme-setting-item"
}
onClick={() => {
this.handleTheme(item.name, index);
}}
style={{ backgroundColor: item.color }}
></li>
</Tooltip>
))}
{themeList.map((item, index) =>
getTooltip(
(
<li
className={
index === this.state.currentThemeIndex
? "active-color theme-setting-item"
: "theme-setting-item"
}
onClick={() => {
this.handleTheme(item.name, index);
}}
style={{ backgroundColor: item.color }}
></li>
) as any,
{
title: item.title,
position: "top",
trigger: "mouseenter",
}
)
)}
</ul>
</div>

Expand Down
2 changes: 1 addition & 1 deletion src/components/dialogs/settingDialog/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ const actionCreator = {
export default connect(
mapStateToProps,
actionCreator
)(withTranslation()(SettingDialog as any));
)(withTranslation()(SettingDialog as any) as any);
2 changes: 1 addition & 1 deletion src/components/dialogs/sortDialog/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ const actionCreator = {
handleBookSort,
handleNoteSort,
};
export default connect(mapStateToProps, actionCreator)(SortDialog);
export default connect(mapStateToProps, actionCreator)(SortDialog as any);
2 changes: 1 addition & 1 deletion src/components/dialogs/tokenDialog/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ const actionCreator = {
export default connect(
mapStateToProps,
actionCreator
)(withTranslation()(TokenDialog as any));
)(withTranslation()(TokenDialog as any) as any);
2 changes: 1 addition & 1 deletion src/components/dialogs/updateDialog/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ const actionCreator = {
export default connect(
mapStateToProps,
actionCreator
)(withTranslation()(UpdateInfo as any));
)(withTranslation()(UpdateInfo as any) as any);
2 changes: 1 addition & 1 deletion src/components/imageViewer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ const actionCreator = {};
export default connect(
mapStateToProps,
actionCreator
)(withTranslation()(ImageViewer as any));
)(withTranslation()(ImageViewer as any) as any);
30 changes: 17 additions & 13 deletions src/components/importLocal/component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import localforage from "localforage";
import { fetchMD5 } from "../../utils/fileUtils/md5Util";
import { Trans } from "react-i18next";
import Dropzone from "react-dropzone";
import { Tooltip } from "react-tippy";

import { ImportLocalProps, ImportLocalState } from "./interface";
import RecordRecent from "../../utils/readUtils/recordRecent";
import { isElectron } from "react-device-detect";
Expand All @@ -14,6 +14,7 @@ import BookUtil from "../../utils/fileUtils/bookUtil";
import { fetchFileFromPath } from "../../utils/fileUtils/fileUtil";
import toast from "react-hot-toast";
import StorageUtil from "../../utils/serviceUtils/storageUtil";
import { getTooltip } from "../../utils/commonUtil";
declare var window: any;
let clickFilePath = "";

Expand Down Expand Up @@ -266,17 +267,20 @@ class ImportLocal extends React.Component<ImportLocalProps, ImportLocalState> {
>
<div className="animation-mask-local"></div>
{this.props.isCollapsed && this.state.width < 950 ? (
<Tooltip
title={this.props.t("Import")}
position="top"
style={{ height: "20px" }}
trigger="mouseenter"
>
<span
className="icon-folder"
style={{ fontSize: "15px", fontWeight: 500 }}
></span>
</Tooltip>
getTooltip(
(
<span
className="icon-folder"
style={{ fontSize: "15px", fontWeight: 500 }}
></span>
) as any,
{
title: this.props.t("Import"),
position: "top",
style: { height: "20px" },
trigger: "mouseenter",
}
)
) : (
<span>
<Trans>Import</Trans>
Expand All @@ -297,4 +301,4 @@ class ImportLocal extends React.Component<ImportLocalProps, ImportLocalState> {
}
}

export default withRouter(ImportLocal);
export default withRouter(ImportLocal as any);
2 changes: 1 addition & 1 deletion src/components/importLocal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ const actionCreator = {
export default connect(
mapStateToProps,
actionCreator
)(withTranslation()(ImportLocal as any));
)(withTranslation()(ImportLocal as any) as any);
2 changes: 1 addition & 1 deletion src/components/noteTag/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ const actionCreator = {
export default connect(
mapStateToProps,
actionCreator
)(withTranslation()(NoteTag as any));
)(withTranslation()(NoteTag as any) as any);
2 changes: 1 addition & 1 deletion src/components/popups/popupMenu/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ const actionCreator = {
export default connect(
mapStateToProps,
actionCreator
)(withTranslation()(PopupMenu));
)(withTranslation()(PopupMenu as any) as any);
2 changes: 1 addition & 1 deletion src/components/popups/popupNote/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ const actionCreator = {
export default connect(
mapStateToProps,
actionCreator
)(withTranslation()(PopupNote as any));
)(withTranslation()(PopupNote as any) as any);
25 changes: 15 additions & 10 deletions src/components/popups/popupOption/component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import Note from "../../../model/Note";
import { PopupOptionProps } from "./interface";
import ColorOption from "../../colorOption";
import RecordLocation from "../../../utils/readUtils/recordLocation";
import { Tooltip } from "react-tippy";

import { popupList } from "../../../constants/popupList";
import StorageUtil from "../../../utils/serviceUtils/storageUtil";
import toast from "react-hot-toast";
Expand All @@ -15,6 +15,7 @@ import { getHightlightCoords } from "../../../utils/fileUtils/pdfUtil";
import { getIframeDoc } from "../../../utils/serviceUtils/docUtil";
import { openExternalUrl } from "../../../utils/serviceUtils/urlUtil";
import { isElectron } from "react-device-detect";
import { getTooltip } from "../../../utils/commonUtil";

declare var window: any;

Expand Down Expand Up @@ -243,15 +244,19 @@ class PopupOption extends React.Component<PopupOptionProps> {
}
}}
>
<Tooltip
title={this.props.t(item.title)}
position="top"
trigger="mouseenter"
>
<span
className={`icon-${item.icon} ${item.name}-icon`}
></span>
</Tooltip>
{getTooltip(
(
<span
className={`icon-${item.icon} ${item.name}-icon`}
></span>
) as any,
{
title: this.props.t(item.title),
position: "top",
style: { height: "20px" },
trigger: "mouseenter",
}
)}
</div>
);
})}
Expand Down
2 changes: 1 addition & 1 deletion src/components/popups/popupOption/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ const actionCreator = {
export default connect(
mapStateToProps,
actionCreator
)(withTranslation()(PopupOption as any));
)(withTranslation()(PopupOption as any) as any);
2 changes: 1 addition & 1 deletion src/components/popups/popupTrans/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ const actionCreator = {
export default connect(
mapStateToProps,
actionCreator
)(withTranslation()(PopupTrans as any));
)(withTranslation()(PopupTrans as any) as any);
2 changes: 1 addition & 1 deletion src/components/readerSettings/dropdownList/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ const actionCreator = {};
export default connect(
mapStateToProps,
actionCreator
)(withTranslation()(DropdownList as any));
)(withTranslation()(DropdownList as any) as any);
108 changes: 62 additions & 46 deletions src/components/readerSettings/modeControl/component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ import "./modeControl.css";
import { ModeControlProps, ModeControlState } from "./interface";
import StorageUtil from "../../../utils/serviceUtils/storageUtil";
import { Trans } from "react-i18next";
import { Tooltip } from "react-tippy";

import { isElectron } from "react-device-detect";
import toast from "react-hot-toast";
import { getTooltip } from "../../../utils/commonUtil";

class ModeControl extends React.Component<ModeControlProps, ModeControlState> {
constructor(props: ModeControlProps) {
Expand Down Expand Up @@ -34,51 +35,66 @@ class ModeControl extends React.Component<ModeControlProps, ModeControlState> {
<Trans>View Mode</Trans>
</div>
<div className="single-control-container">
<Tooltip
title={this.props.t("Single-Page Mode")}
position="top"
trigger="mouseenter"
>
<div
className="single-mode-container"
onClick={() => {
this.handleChangeMode("single");
}}
style={this.state.readerMode === "single" ? {} : { opacity: 0.4 }}
>
<span className="icon-single-page single-page-icon"></span>
</div>
</Tooltip>
<Tooltip
title={this.props.t("Double-Page Mode")}
position="top"
trigger="mouseenter"
>
<div
className="double-mode-container"
onClick={() => {
this.handleChangeMode("double");
}}
style={this.state.readerMode === "double" ? {} : { opacity: 0.4 }}
>
<span className="icon-two-page two-page-icon"></span>
</div>
</Tooltip>
<Tooltip
title={this.props.t("Scroll Mode")}
position="top"
trigger="mouseenter"
>
<div
className="double-mode-container"
onClick={() => {
this.handleChangeMode("scroll");
}}
style={this.state.readerMode === "scroll" ? {} : { opacity: 0.4 }}
>
<span className="icon-scroll two-page-icon"></span>
</div>
</Tooltip>
{getTooltip(
(
<div
className="single-mode-container"
onClick={() => {
this.handleChangeMode("single");
}}
style={
this.state.readerMode === "single" ? {} : { opacity: 0.4 }
}
>
<span className="icon-single-page single-page-icon"></span>
</div>
) as any,
{
title: this.props.t("Single-Page Mode"),
position: "top",
trigger: "mouseenter",
}
)}
{getTooltip(
(
<div
className="double-mode-container"
onClick={() => {
this.handleChangeMode("double");
}}
style={
this.state.readerMode === "double" ? {} : { opacity: 0.4 }
}
>
<span className="icon-two-page two-page-icon"></span>
</div>
) as any,
{
title: this.props.t("Double-Page Mode"),
position: "top",
trigger: "mouseenter",
}
)}
{getTooltip(
(
<div
className="double-mode-container"
onClick={() => {
this.handleChangeMode("scroll");
}}
style={
this.state.readerMode === "scroll" ? {} : { opacity: 0.4 }
}
>
<span className="icon-scroll two-page-icon"></span>
</div>
) as any,
{
title: this.props.t("Scroll Mode"),
position: "top",
trigger: "mouseenter",
}
)}
</div>
</div>
);
Expand Down
2 changes: 1 addition & 1 deletion src/components/readerSettings/modeControl/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ const actionCreator = {};
export default connect(
mapStateToProps,
actionCreator
)(withTranslation()(ModeControl as any));
)(withTranslation()(ModeControl as any) as any);
2 changes: 1 addition & 1 deletion src/components/readerSettings/settingSwitch/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ const actionCreator = {};
export default connect(
mapStateToProps,
actionCreator
)(withTranslation()(SettingSwitch as any));
)(withTranslation()(SettingSwitch as any) as any);
2 changes: 1 addition & 1 deletion src/components/readerSettings/sliderList/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ const actionCreator = {};
export default connect(
mapStateToProps,
actionCreator
)(withTranslation()(SliderList as any));
)(withTranslation()(SliderList as any) as any);
Loading

0 comments on commit 0fb5e79

Please sign in to comment.