Skip to content

Commit

Permalink
fix review notify
Browse files Browse the repository at this point in the history
  • Loading branch information
ttop32 committed Mar 14, 2024
1 parent 17e9a15 commit 52686eb
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 13 deletions.
1 change: 1 addition & 0 deletions doc/description.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ English, Russian, Japanese, Chinese and so on

# Change Log
- 0.1.130
- fix review notify
- hide mouseover text error (contributed by gignac-cha)
- 0.1.129
- fix korea ocr manga lang size
Expand Down
33 changes: 31 additions & 2 deletions src/components/commentBanner.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<template>
<v-alert
v-if="isNewVisit"
type="success"
border="start"
variant="tonal"
Expand All @@ -9,28 +10,56 @@
>
{{ subtitle }}
<template v-slot:append>
<v-btn variant="tonal" @click="openUrl(url)">Open</v-btn>
<v-btn variant="tonal" @click="handleClick(url)">Open</v-btn>
</template>
</v-alert>
</template>
<script>
import * as util from "/src/util";
import browser from "webextension-polyfill";
import { useSettingStore } from "/src/stores/setting.js";
import { mapState } from "pinia";
export default {
name: "CommentBanner",
props: ["title"],
emits: ["click"],
// props: ["title"],
data() {
return {
title: browser.i18n.getMessage("Review_this"),
subtitle: browser.i18n.getMessage("Developer_love_criticism"),
url: util.getReviewUrl(),
};
},
async mounted() {
await this.waitSettingLoad();
this.increasePopupCount();
},
computed: {
...mapState(useSettingStore, ["setting", "waitSettingLoad"]),
isNewVisit() {
var count = Number(this.setting?.["popupCount"]);
return 1 < count && count < 7;
},
},
methods: {
openUrl(newURL) {
window.open(newURL);
},
handleClick(newURL) {
this.openUrl(newURL);
this.finishPopupCount();
this.$emit("click");
},
increasePopupCount(inc = 1) {
var count = Number(this.setting["popupCount"]);
if (count < 10) {
this.setting["popupCount"] = count + inc;
}
},
finishPopupCount() {
this.increasePopupCount(100);
},
},
};
</script>
Expand Down
12 changes: 1 addition & 11 deletions src/pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@
class="scrollList"
>
<!-- comment request banner -->
<CommentBanner v-if="tabId == 'MAIN' && checkCommentSchedule()">
</CommentBanner>
<CommentBanner v-if="tabId == 'MAIN'"> </CommentBanner>

<v-list-item
v-for="(option, optionName) in tabItems[tabId]"
Expand Down Expand Up @@ -466,7 +465,6 @@ export default {
async mounted() {
await this.addTtsVoiceTabOption();
await this.waitSettingLoad();
this.handlePopupCount();
},
computed: {
...mapState(useSettingStore, ["setting", "waitSettingLoad"]),
Expand Down Expand Up @@ -556,14 +554,6 @@ export default {
transition: "border-radius 200ms ease-in-out",
};
},
handlePopupCount() {
if (10 < this.setting["popupCount"]) {
this.setting["popupCount"] += 1;
}
},
checkCommentSchedule() {
return 1 < this.setting["popupCount"] && this.setting["popupCount"] < 5;
},
},
};
</script>
Expand Down

0 comments on commit 52686eb

Please sign in to comment.