Skip to content

Commit

Permalink
feat: add hint go back last ep read
Browse files Browse the repository at this point in the history
  • Loading branch information
tachibana-shin committed Dec 16, 2023
1 parent 18f48c8 commit 828ef57
Show file tree
Hide file tree
Showing 18 changed files with 123 additions and 881 deletions.
67 changes: 51 additions & 16 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,15 @@
"editor.guides.bracketPairs": true,
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.codeActionsOnSave": ["source.fixAll.eslint"],
"eslint.validate": ["javascript", "javascriptreact", "typescript", "vue"],
"editor.codeActionsOnSave": [
"source.fixAll.eslint"
],
"eslint.validate": [
"javascript",
"javascriptreact",
"typescript",
"vue"
],
"typescript.tsdk": "node_modules/typescript/lib",
"cSpell.words": [
"Chương",
Expand All @@ -19,23 +26,35 @@
"ionic.previewInEditor": true,
"vue-i18n.i18nPaths": "src/i18n",
"i18n-ally.keystyle": "flat",
"i18n-ally.localesPaths": ["src/i18n", "src/i18n/messages"],
"i18n-ally.localesPaths": [
"src/i18n",
"src/i18n/messages"
],
"i18n-ally.extract.ignoredByFiles": {
"src/components/BrtPlayer.vue": ["Space", "Space"],
"src/pages/[_type-normal]/[value].vue": [""],
"src/components/BrtPlayer.vue": [
"Space",
"Space"
],
"src/pages/[_type-normal]/[value].vue": [
""
],
"src/pages/phim/_season.vue": [
"${nameSeason} (${chaps[0].name} - ${\n chaps[chaps.length - 1].name\n })",
"${name} - ${currentMetaSeason.name} Tập ${currentMetaChap.name}(${seasonId}/${currentMetaChap.id})"
],
"src/pages/tai-khoan/index.vue": ["bg-dark text-light-9"],
"src/pages/tai-khoan/index.vue": [
"bg-dark text-light-9"
],
"src/pages/lich-chieu-phim.vue": [
"\n T{{ dayTextToNum(item.day) }}\n ",
"/{{ item.month }}"
],
"src/pages/news.vue": [
"•\n {{ dayjs(item.time).locale(\"vi\").fromNow() }}\n "
],
"src/pages/tai-khoan/edit-profile.vue": ["bg-dark text-light-9"],
"src/pages/tai-khoan/edit-profile.vue": [
"bg-dark text-light-9"
],
"src/layouts/MainLayout.vue": [
"mailto:ogmo2r3q@duck.com?subject=Phản hồi ứng dụng web AnimeVsub",
"bg-dark text-light-9",
Expand All @@ -49,8 +68,12 @@
"• {{ t('_maxPage-trang', [data?.maxPage]) }}\n ",
"• {{ t('_maxPage-trang', [data?.maxPage]) }}\n "
],
"src/apis/runs/ajax/rate.ts": ["${token_name}=${token_value}"],
"src/components/errors/cloudflare.vue": [")\n "],
"src/apis/runs/ajax/rate.ts": [
"${token_name}=${token_value}"
],
"src/components/errors/cloudflare.vue": [
")\n "
],
"src/components/errors/domain-strange.vue": [
"\n {{ extensionVersion ?? \""
],
Expand All @@ -60,30 +83,42 @@
"src/components/library/_components/EpControl.vue": [
"< data.pages.length\n ? downloading\n ? $t(\"dang-tai\")\n : $t(\"tam-dung\")\n : $t(\"finished\")\n }}"
],
"src/components/app/AppHeaderSearch.vue": ["Slash"],
"src/pages/tim-kiem.vue": ["\nmeta:\n hiddenHeader: $lt.md\n"],
"src/pages/index.vue": ["%"],
"src/pages/[...catchAll].vue": ["\nname: not_found\n"],
"src/components/app/AppHeaderSearch.vue": [
"Slash"
],
"src/pages/tim-kiem.vue": [
"\nmeta:\n hiddenHeader: $lt.md\n"
],
"src/pages/index.vue": [
"%"
],
"src/pages/[...catchAll].vue": [
"\nname: not_found\n"
],
"src/pages/truyen-tranh/[zlug]/index.vue": [
"\nmeta:\n hiddenFooter: true\n hiddenDrawer: true\n hiddenHeader: $lt.md\n"
],
"src/pages/truyen-tranh/[zlug]/[epName]/[epId].vue": [
"\nmeta:\n hiddenHeader: true\n hiddenDrawer: true\n hiddenFooter: true\n"
],
"src/components/PluginManagerDialog.vue": ["install plugin"],
"src/components/PluginManagerDialog.vue": [
"install plugin"
],
"uno.config.ts": [
"overflow-y-scroll flex-shrink-1 mt-2 text-#eee text-opacity-70"
]
},
"scss.lint.unknownAtRules": "ignore",
"i18n-ally.sourceLanguage": "en-US",
"i18n-ally.sourceLanguage": "vi-VN",
"i18n-ally.extract.ignored": [
"&bull;\n {{\n t(\"tap-moi-chieu-vao-_time-_day\", [\n dayjs(\n new Date(\n `${currentDataSeason.update[1]}:${currentDataSeason.update[2]} 1/1/0`\n )\n ).format(\"HH:MM\"),\n currentDataSeason.update[0] === 0\n ? \"chủ nhật\"\n : `thứ ${currentDataSeason.update[0]}`,\n currentDataSeason.update[0] > new Date().getDay() + 1\n ? \"tuần sau\"\n : \"tuần này\",\n ])\n }}\n ",
"Urban VPN"
],
"editor.tabCompletion": "on",
"diffEditor.codeLens": true,
"typescript.preferences.autoImportFileExcludePatterns": ["vue-router"],
"typescript.preferences.autoImportFileExcludePatterns": [
"vue-router"
],
"MutableAI.upsell": false,
"[ruby]": {
"editor.defaultFormatter": "mbessey.vscode-rufo"
Expand Down
1 change: 1 addition & 0 deletions database.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ export interface Database {
name: string
param: string
source: string
manga_param: string
updated_at: string
current_page: number
max_page: number
Expand Down
5 changes: 4 additions & 1 deletion src/i18n/messages/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -292,5 +292,8 @@
"ascending": "Ascending",
"descending": "Descending",
"sort-by": "Sort by:",
"all": "All"
"all": "All",
"di-nao": "Let's go",
"khong": "Are not",
"msg-message-hint-goback-ep": "Wow! \nYou have read this comic but another chapter"
}
5 changes: 4 additions & 1 deletion src/i18n/messages/ja-JP.json
Original file line number Diff line number Diff line change
Expand Up @@ -292,5 +292,8 @@
"language": "言語:",
"search-plugin-by-name-or-id": "名前または ID でプラグインを検索",
"show-specific-languages": "特定の言語を表示...",
"sort-by": "並べ替え:"
"sort-by": "並べ替え:",
"di-nao": "さあ行こう",
"khong": "そうではありません",
"msg-message-hint-goback-ep": "おお!\nあなたはこの漫画を読みましたが、別の章を読みました"
}
5 changes: 4 additions & 1 deletion src/i18n/messages/vi-VN.json
Original file line number Diff line number Diff line change
Expand Up @@ -292,5 +292,8 @@
"language": "Ngôn ngữ:",
"search-plugin-by-name-or-id": "Tìm kiếm plugin theo tên hoặc ID",
"show-specific-languages": "Hiển thị ngôn ngữ cụ thể...",
"sort-by": "Sắp xếp theo:"
"sort-by": "Sắp xếp theo:",
"msg-message-hint-goback-ep": "Uaa! Bạn đã đọc comic này nhưng chương khác",
"khong": "Không",
"di-nao": "Đi nào"
}
5 changes: 4 additions & 1 deletion src/i18n/messages/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -292,5 +292,8 @@
"language": "语言:",
"search-plugin-by-name-or-id": "按名称或 ID 搜索插件",
"show-specific-languages": "显示特定语言...",
"sort-by": "排序方式:"
"sort-by": "排序方式:",
"di-nao": "我们走吧",
"khong": "不是",
"msg-message-hint-goback-ep": "哇!\n你已经读过这本漫画了,但还有一章"
}
59 changes: 52 additions & 7 deletions src/pages/~[sourceId]/comic/[comic]/chap-[chap].vue
Original file line number Diff line number Diff line change
Expand Up @@ -103,17 +103,17 @@ meta:
:max-page="maxPage"
v-model:current-page="currentPage"
v-model:zoom="zoom"
:next-episode="nextEpisode?.value.route??null"
:prev-episode="prevEpisode?.value.route??null"
:next-episode="nextEpisode?.value.route ?? null"
:prev-episode="prevEpisode?.value.route ?? null"
/>
<ReaderVertical
v-else
ref="readerVerticalRef"
:pages="pages"
v-model:current-page="currentPage"
v-model:zoom="zoom"
:next-episode="nextEpisode?.value.route??null"
:prev-episode="prevEpisode?.value.route??null"
:next-episode="nextEpisode?.value.route ?? null"
:prev-episode="prevEpisode?.value.route ?? null"
@action:next-ch="nextCh"
/>

Expand Down Expand Up @@ -239,9 +239,7 @@ meta:
class="bg-dark text-14px text-weight-medium"
transition-show="jump-up"
transition-hide="jump-down"
>{{
$t("chuong-truoc-name", [prevEpisode?.value.name])
}}</q-tooltip
>{{ $t("chuong-truoc-name", [prevEpisode?.value.name]) }}</q-tooltip
>
</q-btn>
<q-btn
Expand Down Expand Up @@ -826,6 +824,52 @@ const listEpRead = computedAsync(
}
)

watchImmediate(lastEpRead, (lastEpRead) => {
if (!lastEpRead) return

console.log({ lastEpRead })

$q.notify({
message: i18n.t("msg-message-hint-goback-ep"),
caption: i18n.t("chuong-name", [lastEpRead.name]),
icon: "contactless",
color: "sakura",
textColor: "black",
progress: true,
timeout: 60_000,
actions: [
{ label: i18n.t("khong"), rounded: true, noCaps: true, color: "black" },
{
label: i18n.t("di-nao"),
rounded: true,
noCaps: true,
color: "black",
handler() {
if (APP_STANDALONE) {
void router.replace({
name: "comic chap",
params: {
sourceId: lastEpRead.source,
comic: lastEpRead.manga_param,
chap: lastEpRead.param
}
})
} else {
void router.push({
name: "comic chap",
params: {
sourceId: lastEpRead.source,
comic: lastEpRead.manga_param,
chap: lastEpRead.param
}
})
}
}
}
]
})
})

const zoom = useClamp(100, 50, 200)
const server = ref(0)
const serversReady = computedAsync(
Expand Down Expand Up @@ -1069,6 +1113,7 @@ watch(
WARN(error)
})

console.log("Starting watch to save progress read")
// eslint-disable-next-line camelcase
if (h_manga_id) {
const clean = watch(
Expand Down
2 changes: 1 addition & 1 deletion src/stores/history.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ export const useHistoryStore = defineStore("history", () => {
max_page: number
): Promise<void> {
await authStore.assert()

if (typeof source_id === "boolean") {
if (source_id)
await supabase
Expand Down
Loading

0 comments on commit 828ef57

Please sign in to comment.