Skip to content

Commit

Permalink
fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
troyeguo committed Dec 2, 2023
1 parent 1ec4a9d commit 57e3a16
Show file tree
Hide file tree
Showing 20 changed files with 435 additions and 83 deletions.
4 changes: 2 additions & 2 deletions public/lib/kookit/kookit.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/assets/locales/en/translation.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"Books": "Books",
"Recent": "Recent",
"Recent": "Recents",
"Bookmarks": "Bookmarks",
"Favorites": "Favorite",
"Favorites": "Favorites",
"Notes": "Notes",
"Highlights": "Highlights",
"Shelf": "Shelf",
Expand Down
File renamed without changes.
371 changes: 371 additions & 0 deletions src/assets/locales/zh-MO/translation.json

Large diffs are not rendered by default.

File renamed without changes.
23 changes: 1 addition & 22 deletions src/components/background/background.css
Original file line number Diff line number Diff line change
Expand Up @@ -45,27 +45,6 @@
}

.spine-shadow-left {
width: 68px;
height: 100%;
background: url("../../assets/gradient-left.png") repeat-y;
z-index: 10;
margin: 0;
z-index: 10;
position: absolute;
left: calc(50% - 68px);
}

.spine-shadow-right {
width: 68px;
height: 100%;
background: url("../../assets/gradient-right.png") repeat-y;
z-index: 10;
margin: 0;
box-sizing: border-box;
position: absolute;
right: calc(50% - 68px);
}
.dark-spine-shadow-left {
width: 68px;
height: 100%;
background: url("../../assets/dark-gradient-left.png") repeat-y;
Expand All @@ -76,7 +55,7 @@
left: calc(50% - 68px);
}

.dark-spine-shadow-right {
.spine-shadow-right {
width: 68px;
height: 100%;
background: url("../../assets/dark-gradient-right.png") repeat-y;
Expand Down
35 changes: 8 additions & 27 deletions src/components/background/component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,28 +80,14 @@ class Background extends React.Component<BackgroundProps, BackgroundState> {
StorageUtil.getReaderConfig("backgroundColor") ===
"rgba(44,47,49,1)" ? (
<div
className="dark-spine-shadow-left"
style={
this.state.isSingle ||
(StorageUtil.getReaderConfig("backgroundColor") &&
StorageUtil.getReaderConfig("backgroundColor").startsWith(
"#"
))
? { display: "none" }
: {}
}
className="spine-shadow-left"
style={this.state.isSingle ? { display: "none" } : {}}
></div>
) : (
<div
className="spine-shadow-left"
style={
this.state.isSingle ||
(StorageUtil.getReaderConfig("backgroundColor") &&
StorageUtil.getReaderConfig("backgroundColor").startsWith(
"#"
))
? { display: "none" }
: {}
this.state.isSingle ? { display: "none" } : { opacity: "0.2" }
}
></div>
)}
Expand All @@ -116,12 +102,9 @@ class Background extends React.Component<BackgroundProps, BackgroundState> {
StorageUtil.getReaderConfig("backgroundColor") ===
"rgba(44,47,49,1)" ? (
<div
className="dark-spine-shadow-right"
className="spine-shadow-right"
style={
StorageUtil.getReaderConfig("backgroundColor") &&
StorageUtil.getReaderConfig("backgroundColor").startsWith("#")
? { display: "none" }
: this.state.isSingle
this.state.isSingle
? {
position: "relative",
right: 0,
Expand All @@ -133,15 +116,13 @@ class Background extends React.Component<BackgroundProps, BackgroundState> {
<div
className="spine-shadow-right"
style={
StorageUtil.getReaderConfig("backgroundColor") &&
StorageUtil.getReaderConfig("backgroundColor").startsWith("#")
? { display: "none" }
: this.state.isSingle
this.state.isSingle
? {
position: "relative",
right: 0,
opacity: 0.2,
}
: {}
: { opacity: 0.2 }
}
></div>
)}
Expand Down
8 changes: 4 additions & 4 deletions src/components/dialogs/aboutDialog/component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ class AboutDialog extends React.Component<AboutDialogProps, AboutDialogState> {
className="sort-by-category-list"
onClick={() => {
if (
StorageUtil.getReaderConfig("lang") === "zh" ||
StorageUtil.getReaderConfig("lang") === "cht"
StorageUtil.getReaderConfig("lang") === "zhCN" ||
StorageUtil.getReaderConfig("lang") === "zhTW"
) {
this.handleJump(
"https://troyeguo.notion.site/Koodo-Reader-0c9c7ccdc5104a54825dfc72f1c84bea"
Expand All @@ -80,8 +80,8 @@ class AboutDialog extends React.Component<AboutDialogProps, AboutDialogState> {
className="sort-by-category-list"
onClick={() => {
if (
StorageUtil.getReaderConfig("lang") === "zh" ||
StorageUtil.getReaderConfig("lang") === "cht"
StorageUtil.getReaderConfig("lang") === "zhCN" ||
StorageUtil.getReaderConfig("lang") === "zhTW"
) {
this.handleJump(
"https://troyeguo.notion.site/215baeda57804fd29dbb0e91d1e6a021?v=360c00183d944b598668f34c255edfd7"
Expand Down
11 changes: 7 additions & 4 deletions src/components/dialogs/backupDialog/component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,13 @@ class BackupDialog extends React.Component<
handleRestoreToLocal = async (event: any) => {
event.preventDefault();
this.props.handleLoadingDialog(true);
let result = await restore(event.target.files[0]);
if (result) {
this.handleFinish();
}
//Fix animation issue
setTimeout(async () => {
let result = await restore(event.target.files[0]);
if (result) {
this.handleFinish();
}
}, 10);
};
showMessage = (message: string) => {
toast(this.props.t(message));
Expand Down
2 changes: 1 addition & 1 deletion src/components/importLocal/importLocal.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
right: 0px;
top: 0px;
width: 138px;
margin-right: 20px;
margin-right: 25px;
margin-top: 23px;
min-width: 42px;
height: 42px;
Expand Down
1 change: 1 addition & 0 deletions src/components/popups/popupNote/popupNote.css
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
-webkit-box-orient: vertical;
-webkit-line-clamp: 3;
overflow: hidden;
font-size: 15px;
}
.editor-box-parent {
width: 100%;
Expand Down
1 change: 1 addition & 0 deletions src/components/popups/popupTrans/component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ class PopupTrans extends React.Component<PopupTransProps, PopupTransState> {
? "trans-service-selector"
: "trans-service-selector-inactive"
}
style={{ width: "90px" }}
onClick={() => {
this.handleChangeService("Google");
}}
Expand Down
3 changes: 3 additions & 0 deletions src/components/popups/popupTrans/popupTrans.css
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@
margin: 2px;
margin-right: 5px;
}
.trans-bing-icon {
font-size: 14px;
}
.trans-service-selector-inactive {
border: 1px solid rgba(0, 0, 0, 0.05);
color: #f16464;
Expand Down
5 changes: 3 additions & 2 deletions src/constants/settingList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,9 @@ export const settingList = [
},
];
export const langList = [
{ label: "简体中文", value: "zh" },
{ label: "繁體中文", value: "cht" },
{ label: "简体中文", value: "zhCN" },
{ label: "繁體中文", value: "zhTW" },
{ label: "繁體中文-澳門", value: "zhMO" },
{ label: "English", value: "en" },
{ label: "Pусский", value: "ru" },
{ label: "Español", value: "es" },
Expand Down
2 changes: 1 addition & 1 deletion src/containers/header/header.css
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,6 @@
display: flex;
justify-content: center;
align-items: center;
margin-left: 25px;
margin-left: 15px;
float: left;
}
7 changes: 2 additions & 5 deletions src/containers/htmlViewer/component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -377,11 +377,8 @@ class Viewer extends React.Component<ViewerProps, ViewerState> {
: {}
}
></div>
{StorageUtil.getReaderConfig("isHideBackground") === "yes" ||
(StorageUtil.getReaderConfig("backgroundColor") &&
StorageUtil.getReaderConfig("backgroundColor").startsWith(
"#"
)) ? null : this.props.currentBook.key ? (
{StorageUtil.getReaderConfig("isHideBackground") === "yes" ? null : this
.props.currentBook.key ? (
<Background />
) : null}
{this.props.htmlBook ? (
Expand Down
1 change: 0 additions & 1 deletion src/containers/pageWidget/background.css
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
overflow: hidden;
line-height: 30px;
text-align: center;
font-size: 14px;
opacity: 0.3;
}
.bookmark {
Expand Down
16 changes: 10 additions & 6 deletions src/i18n.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import i18n from "i18next";
import { initReactI18next } from "react-i18next";
import translationEN from "./assets/locales/en/translation.json";
import translationCN from "./assets/locales/cn/translation.json";
import translationTW from "./assets/locales/tw/translation.json";
import translationZHCN from "./assets/locales/zh-CN/translation.json";
import translationZHTW from "./assets/locales/zh-TW/translation.json";
import translationZHMO from "./assets/locales/zh-MO/translation.json";
import translationAR from "./assets/locales/ar/translation.json";
import translationTR from "./assets/locales/tr/translation.json";
import translationRO from "./assets/locales/ro/translation.json";
Expand All @@ -29,11 +30,14 @@ const resources = {
en: {
translation: translationEN,
},
zh: {
translation: translationCN,
zhCN: {
translation: translationZHCN,
},
cht: {
translation: translationTW,
zhTW: {
translation: translationZHTW,
},
zhMO: {
translation: translationZHMO,
},
tr: {
translation: translationTR,
Expand Down
22 changes: 17 additions & 5 deletions src/router/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,30 @@ import StorageUtil from "../utils/serviceUtils/storageUtil";
const Router = () => {
useEffect(() => {
const lng = StorageUtil.getReaderConfig("lang");

if (lng) {
i18n.changeLanguage(lng);
//Compatile with 1.6.0 and older
if (lng === "zh") {
console.log(lng);
i18n.changeLanguage("zhCN");
} else if (lng === "cht") {
i18n.changeLanguage("zhTW");
} else {
i18n.changeLanguage(lng);
}
} else {
if (navigator.language === "zh-CN" || navigator.language === "zh-SG") {
i18n.changeLanguage("zh");
StorageUtil.setReaderConfig("lang", "zh");
i18n.changeLanguage("zhCN");
StorageUtil.setReaderConfig("lang", "zhCN");
} else if (
navigator.language === "zh-TW" ||
navigator.language === "zh-HK"
) {
i18n.changeLanguage("cht");
StorageUtil.setReaderConfig("lang", "cht");
i18n.changeLanguage("zhTW");
StorageUtil.setReaderConfig("lang", "zhTW");
} else if (navigator.language === "zh-MO") {
i18n.changeLanguage("zhMO");
StorageUtil.setReaderConfig("lang", "zhMO");
} else if (navigator.language.startsWith("ro")) {
i18n.changeLanguage("ro");
StorageUtil.setReaderConfig("lang", "ro");
Expand Down
2 changes: 1 addition & 1 deletion src/utils/serviceUtils/mouseEvent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const sleep = (ms: number) => {
};

let throttleTime =
StorageUtil.getReaderConfig("isSliding") === "yes" ? 1000 : 0;
StorageUtil.getReaderConfig("isSliding") === "yes" ? 1000 : 200;
export const getSelection = () => {
let doc = getIframeDoc();
if (!doc) return;
Expand Down

0 comments on commit 57e3a16

Please sign in to comment.