From d0a8f6baa47ce638c0bc20bf7f3eccd45dae9f34 Mon Sep 17 00:00:00 2001 From: DIYgod Date: Thu, 3 Apr 2025 20:49:25 +0800 Subject: [PATCH] feat(mobile): mark above as read bottom button --- .../entry-list/EntryListContentArticle.tsx | 8 ++- .../entry-list/EntryListContentPicture.tsx | 5 +- .../entry-list/EntryListContentSocial.tsx | 8 ++- .../entry-list/EntryListContentVideo.tsx | 12 ++-- .../modules/entry-list/EntryListFooter.tsx | 57 +++++++++++++++++++ locales/mobile/default/ar-DZ.json | 2 +- locales/mobile/default/ar-IQ.json | 2 +- locales/mobile/default/ar-KW.json | 2 +- locales/mobile/default/ar-MA.json | 2 +- locales/mobile/default/ar-SA.json | 2 +- locales/mobile/default/ar-TN.json | 2 +- locales/mobile/default/de.json | 2 +- locales/mobile/default/en.json | 3 +- locales/mobile/default/es.json | 2 +- locales/mobile/default/fi.json | 2 +- locales/mobile/default/fr.json | 2 +- locales/mobile/default/it.json | 2 +- locales/mobile/default/ja.json | 2 +- locales/mobile/default/ko.json | 2 +- locales/mobile/default/pt.json | 2 +- locales/mobile/default/ru.json | 2 +- locales/mobile/default/tr.json | 2 +- locales/mobile/default/zh-CN.json | 3 +- locales/mobile/default/zh-HK.json | 2 +- locales/mobile/default/zh-TW.json | 2 +- 25 files changed, 101 insertions(+), 31 deletions(-) create mode 100644 apps/mobile/src/modules/entry-list/EntryListFooter.tsx diff --git a/apps/mobile/src/modules/entry-list/EntryListContentArticle.tsx b/apps/mobile/src/modules/entry-list/EntryListContentArticle.tsx index e85c46cf9..021b393e7 100644 --- a/apps/mobile/src/modules/entry-list/EntryListContentArticle.tsx +++ b/apps/mobile/src/modules/entry-list/EntryListContentArticle.tsx @@ -7,6 +7,7 @@ import { usePlayingUrl } from "@/src/lib/player" import { useFetchEntriesControls } from "../screen/atoms" import { TimelineSelectorList } from "../screen/TimelineSelectorList" +import { EntryListFooter } from "./EntryListFooter" import { useOnViewableItemsChanged } from "./hooks" import { ItemSeparator } from "./ItemSeparator" import { EntryNormalItem } from "./templates/EntryNormalItem" @@ -17,7 +18,8 @@ export const EntryListContentArticle = forwardRef< >(({ entryIds, active }, ref) => { const playingAudioUrl = usePlayingUrl() - const { fetchNextPage, isFetching, refetch, isRefetching } = useFetchEntriesControls() + const { fetchNextPage, isFetching, refetch, isRefetching, hasNextPage } = + useFetchEntriesControls() const renderItem = useCallback( ({ item: id, extraData }: ListRenderItemInfo) => ( @@ -27,8 +29,8 @@ export const EntryListContentArticle = forwardRef< ) const ListFooterComponent = useMemo( - () => (isFetching ? : null), - [isFetching], + () => (hasNextPage ? : ), + [hasNextPage], ) const { onViewableItemsChanged, onScroll } = useOnViewableItemsChanged({ diff --git a/apps/mobile/src/modules/entry-list/EntryListContentPicture.tsx b/apps/mobile/src/modules/entry-list/EntryListContentPicture.tsx index b17795c55..e9260cac7 100644 --- a/apps/mobile/src/modules/entry-list/EntryListContentPicture.tsx +++ b/apps/mobile/src/modules/entry-list/EntryListContentPicture.tsx @@ -8,6 +8,7 @@ import { PlatformActivityIndicator } from "@/src/components/ui/loading/PlatformA import { useFetchEntriesControls } from "@/src/modules/screen/atoms" import { TimelineSelectorMasonryList } from "../screen/TimelineSelectorList" +import { GridEntryListFooter } from "./EntryListFooter" import { useOnViewableItemsChanged } from "./hooks" // import type { MasonryItem } from "./templates/EntryGridItem" import { EntryPictureItem } from "./templates/EntryPictureItem" @@ -44,7 +45,9 @@ export const EntryListContentPicture = forwardRef< - ) : null + ) : ( + + ) } {...rest} onRefresh={refetch} diff --git a/apps/mobile/src/modules/entry-list/EntryListContentSocial.tsx b/apps/mobile/src/modules/entry-list/EntryListContentSocial.tsx index 852d9300f..f01d17d55 100644 --- a/apps/mobile/src/modules/entry-list/EntryListContentSocial.tsx +++ b/apps/mobile/src/modules/entry-list/EntryListContentSocial.tsx @@ -5,6 +5,7 @@ import { View } from "react-native" import { useFetchEntriesControls } from "../screen/atoms" import { TimelineSelectorList } from "../screen/TimelineSelectorList" +import { EntryListFooter } from "./EntryListFooter" import { useOnViewableItemsChanged } from "./hooks" import { ItemSeparatorFullWidth } from "./ItemSeparator" import { EntrySocialItem } from "./templates/EntrySocialItem" @@ -13,7 +14,8 @@ export const EntryListContentSocial = forwardRef< ElementRef, { entryIds: string[]; active?: boolean } >(({ entryIds, active }, ref) => { - const { fetchNextPage, isFetching, refetch, isRefetching } = useFetchEntriesControls() + const { fetchNextPage, isFetching, refetch, isRefetching, hasNextPage } = + useFetchEntriesControls() const renderItem = useCallback( ({ item: id }: ListRenderItemInfo) => , @@ -21,8 +23,8 @@ export const EntryListContentSocial = forwardRef< ) const ListFooterComponent = useMemo( - () => (isFetching ? : null), - [isFetching], + () => (hasNextPage ? : ), + [hasNextPage], ) const { onViewableItemsChanged, onScroll } = useOnViewableItemsChanged({ diff --git a/apps/mobile/src/modules/entry-list/EntryListContentVideo.tsx b/apps/mobile/src/modules/entry-list/EntryListContentVideo.tsx index 09ff48502..db62cc34c 100644 --- a/apps/mobile/src/modules/entry-list/EntryListContentVideo.tsx +++ b/apps/mobile/src/modules/entry-list/EntryListContentVideo.tsx @@ -7,6 +7,7 @@ import { View } from "react-native" import { useFetchEntriesControls } from "@/src/modules/screen/atoms" import { TimelineSelectorMasonryList } from "../screen/TimelineSelectorList" +import { GridEntryListFooter } from "./EntryListFooter" import { useOnViewableItemsChanged } from "./hooks" import { EntryVideoItem } from "./templates/EntryVideoItem" @@ -17,20 +18,23 @@ export const EntryListContentVideo = forwardRef< "data" | "renderItem" > >(({ entryIds, active, ...rest }, ref) => { - const { fetchNextPage, refetch, isRefetching, isFetching } = useFetchEntriesControls() + const { fetchNextPage, refetch, isRefetching, isFetching, hasNextPage } = + useFetchEntriesControls() const { onViewableItemsChanged, onScroll } = useOnViewableItemsChanged({ disabled: active === false || isFetching, }) const ListFooterComponent = useMemo( () => - isFetching ? ( + hasNextPage ? ( - ) : null, - [isFetching], + ) : ( + + ), + [hasNextPage], ) return ( diff --git a/apps/mobile/src/modules/entry-list/EntryListFooter.tsx b/apps/mobile/src/modules/entry-list/EntryListFooter.tsx new file mode 100644 index 000000000..74cc50ec6 --- /dev/null +++ b/apps/mobile/src/modules/entry-list/EntryListFooter.tsx @@ -0,0 +1,57 @@ +import { useTranslation } from "react-i18next" +import { Pressable, Text } from "react-native" + +import { CheckCircleCuteReIcon } from "@/src/icons/check_circle_cute_re" +import { unreadSyncService } from "@/src/store/unread/store" + +import { useSelectedView } from "../screen/atoms" +import { ItemSeparator } from "./ItemSeparator" + +export const EntryListFooter = () => { + const { t } = useTranslation() + const selectedView = useSelectedView() + + return ( + <> + + { + if (typeof selectedView === "number") { + unreadSyncService.markViewAsRead(selectedView) + } + }} + > + + + {t("operation.mark_all_as_read_which", { + which: t("operation.mark_all_as_read_which_above"), + })} + + + + ) +} + +export const GridEntryListFooter = () => { + const { t } = useTranslation() + const selectedView = useSelectedView() + + return ( + { + if (typeof selectedView === "number") { + unreadSyncService.markViewAsRead(selectedView) + } + }} + > + + + {t("operation.mark_all_as_read_which", { + which: t("operation.mark_all_as_read_which_above"), + })} + + + ) +} diff --git a/locales/mobile/default/ar-DZ.json b/locales/mobile/default/ar-DZ.json index f7045ec36..ac4c895da 100644 --- a/locales/mobile/default/ar-DZ.json +++ b/locales/mobile/default/ar-DZ.json @@ -5,7 +5,7 @@ "operation.edit": "تحرير", "operation.mark_all_as_read": "تحديد الكل كمقروء", "operation.mark_all_as_read_confirm": "تأكيد تحديد الكل كمقروء؟", - "operation.mark_all_as_read_which": "هل تريد تحديد كمقروء؟", + "operation.mark_all_as_read_which": "هل تريد تحديد {{which}} كمقروء؟", "operation.mark_as_read": "تحديد كمقروء", "operation.rename_category": "إعادة تسمية الفئة", "operation.share": "مشاركة", diff --git a/locales/mobile/default/ar-IQ.json b/locales/mobile/default/ar-IQ.json index fb6eaa1bf..6f139d1fc 100644 --- a/locales/mobile/default/ar-IQ.json +++ b/locales/mobile/default/ar-IQ.json @@ -5,7 +5,7 @@ "operation.edit": "تحرير", "operation.mark_all_as_read": "تحديد الكل كمقروء", "operation.mark_all_as_read_confirm": "تأكيد تحديد الكل كمقروء؟", - "operation.mark_all_as_read_which": "تحديد كمقروء؟", + "operation.mark_all_as_read_which": "تحديد {{which}} كمقروء؟", "operation.mark_as_read": "تحديد كمقروء", "operation.rename_category": "إعادة تسمية الفئة", "operation.share": "مشاركة", diff --git a/locales/mobile/default/ar-KW.json b/locales/mobile/default/ar-KW.json index 5bca7addb..a93d4792b 100644 --- a/locales/mobile/default/ar-KW.json +++ b/locales/mobile/default/ar-KW.json @@ -5,7 +5,7 @@ "operation.edit": "تحرير", "operation.mark_all_as_read": "وضع علامة الكل كمقروء", "operation.mark_all_as_read_confirm": "تأكيد وضع علامة الجميع كمقروء؟", - "operation.mark_all_as_read_which": "وضع علامة كمقروء؟", + "operation.mark_all_as_read_which": "وضع علامة {{which}} كمقروء؟", "operation.mark_as_read": "وضع علامة كمقروء", "operation.rename_category": "إعادة تسمية الفئة", "operation.share": "مشاركة", diff --git a/locales/mobile/default/ar-MA.json b/locales/mobile/default/ar-MA.json index 0e009073c..6761a5e50 100644 --- a/locales/mobile/default/ar-MA.json +++ b/locales/mobile/default/ar-MA.json @@ -5,7 +5,7 @@ "operation.edit": "تعديل", "operation.mark_all_as_read": "وضع علامة على الكل كمقروء", "operation.mark_all_as_read_confirm": "تأكيد وضع علامة على الكل كمقروء؟", - "operation.mark_all_as_read_which": "وضع علامة على كمقروء؟", + "operation.mark_all_as_read_which": "وضع علامة على {{which}} كمقروء؟", "operation.mark_as_read": "وضع علامة كمقروء", "operation.rename_category": "إعادة تسمية الفئة", "operation.share": "مشاركة", diff --git a/locales/mobile/default/ar-SA.json b/locales/mobile/default/ar-SA.json index e99c2c663..53c436903 100644 --- a/locales/mobile/default/ar-SA.json +++ b/locales/mobile/default/ar-SA.json @@ -5,7 +5,7 @@ "operation.edit": "تحرير", "operation.mark_all_as_read": "تمييز الكل كمقروء", "operation.mark_all_as_read_confirm": "هل ترغب في تأكيد تمييز الكل كمقروء؟", - "operation.mark_all_as_read_which": "تمييز كمقروء؟", + "operation.mark_all_as_read_which": "تمييز {{which}} كمقروء؟", "operation.mark_as_read": "تمييز كمقروء", "operation.rename_category": "إعادة تسمية الفئة", "operation.share": "مشاركة", diff --git a/locales/mobile/default/ar-TN.json b/locales/mobile/default/ar-TN.json index a886834cd..f79dcef69 100644 --- a/locales/mobile/default/ar-TN.json +++ b/locales/mobile/default/ar-TN.json @@ -5,7 +5,7 @@ "operation.edit": "تحرير", "operation.mark_all_as_read": "وضع علامة على الكل كمقروء", "operation.mark_all_as_read_confirm": "تأكيد وضع الجميع كمقروء؟", - "operation.mark_all_as_read_which": "وضع علامة كمقروء؟", + "operation.mark_all_as_read_which": "وضع علامة {{which}} كمقروء؟", "operation.mark_as_read": "وضع علامة كمقروء", "operation.rename_category": "إعادة تسمية الفئة", "operation.share": "مشاركة", diff --git a/locales/mobile/default/de.json b/locales/mobile/default/de.json index d95e1e61a..1a649707a 100644 --- a/locales/mobile/default/de.json +++ b/locales/mobile/default/de.json @@ -5,7 +5,7 @@ "operation.edit": "Bearbeiten", "operation.mark_all_as_read": "Alles als gelesen markieren", "operation.mark_all_as_read_confirm": "Möchten Sie alle als gelesen markieren?", - "operation.mark_all_as_read_which": " als gelesen markieren?", + "operation.mark_all_as_read_which": "{{which}} als gelesen markieren", "operation.mark_as_read": "Als gelesen markieren", "operation.rename_category": "Kategorie umbenennen", "operation.share": "Teilen", diff --git a/locales/mobile/default/en.json b/locales/mobile/default/en.json index 55c294913..2bf8cf15f 100644 --- a/locales/mobile/default/en.json +++ b/locales/mobile/default/en.json @@ -6,7 +6,8 @@ "operation.edit": "Edit", "operation.mark_all_as_read": "Mark all as read", "operation.mark_all_as_read_confirm": "Confirm mark all as read?", - "operation.mark_all_as_read_which": "Mark as read?", + "operation.mark_all_as_read_which": "Mark {{which}} as read", + "operation.mark_all_as_read_which_above": "above", "operation.mark_as_read": "Mark as Read", "operation.open_link": "Open Link", "operation.rename_category": "Rename Category", diff --git a/locales/mobile/default/es.json b/locales/mobile/default/es.json index 1d1fc4d4b..01ed8f6aa 100644 --- a/locales/mobile/default/es.json +++ b/locales/mobile/default/es.json @@ -5,7 +5,7 @@ "operation.edit": "Editar", "operation.mark_all_as_read": "Marcar todo como leído", "operation.mark_all_as_read_confirm": "¿Confirmar marcar todo como leído?", - "operation.mark_all_as_read_which": "¿Marcar como leído?", + "operation.mark_all_as_read_which": "¿Marcar {{which}} como leído", "operation.mark_as_read": "Marcar como leído", "operation.rename_category": "Renombrar categoría", "operation.share": "Compartir", diff --git a/locales/mobile/default/fi.json b/locales/mobile/default/fi.json index e8f6e8675..63fd7acc2 100644 --- a/locales/mobile/default/fi.json +++ b/locales/mobile/default/fi.json @@ -5,7 +5,7 @@ "operation.edit": "Muokkaa", "operation.mark_all_as_read": "Merkitse kaikki luetuiksi", "operation.mark_all_as_read_confirm": "Vahvista kaikki merkinnät luetuiksi?", - "operation.mark_all_as_read_which": "Merkitäänkö luetuksi?", + "operation.mark_all_as_read_which": "Merkitäänkö {{which}} luetuksi", "operation.mark_as_read": "Merkitse luetuksi", "operation.rename_category": "Nimeä kategoria uudelleen", "operation.share": "Jaa", diff --git a/locales/mobile/default/fr.json b/locales/mobile/default/fr.json index c8fc54262..bc4105903 100644 --- a/locales/mobile/default/fr.json +++ b/locales/mobile/default/fr.json @@ -5,7 +5,7 @@ "operation.edit": "Éditer", "operation.mark_all_as_read": "Tout marquer comme lu", "operation.mark_all_as_read_confirm": "Confirmez que vous voulez tout marquer comme lu ?", - "operation.mark_all_as_read_which": "Marquer comme lu ?", + "operation.mark_all_as_read_which": "Marquer {{which}} comme lu", "operation.mark_as_read": "Marquer comme lu", "operation.rename_category": "Renommer la catégorie", "operation.share": "Partager", diff --git a/locales/mobile/default/it.json b/locales/mobile/default/it.json index f376d7633..0e39fa096 100644 --- a/locales/mobile/default/it.json +++ b/locales/mobile/default/it.json @@ -5,7 +5,7 @@ "operation.edit": "Modifica", "operation.mark_all_as_read": "Segna tutto come letto", "operation.mark_all_as_read_confirm": "Confermi di segnare tutto come letto?", - "operation.mark_all_as_read_which": "Segna come letto?", + "operation.mark_all_as_read_which": "Segna {{which}} come letto", "operation.mark_as_read": "Segna come letto", "operation.rename_category": "Rinomina categoria", "operation.share": "Condividi", diff --git a/locales/mobile/default/ja.json b/locales/mobile/default/ja.json index 7eba4e24e..4187fda04 100644 --- a/locales/mobile/default/ja.json +++ b/locales/mobile/default/ja.json @@ -6,7 +6,7 @@ "operation.edit": "編集", "operation.mark_all_as_read": "すべてを既読にする", "operation.mark_all_as_read_confirm": "すべてを既読にしますか?", - "operation.mark_all_as_read_which": "を既読にしますか?", + "operation.mark_all_as_read_which": "{{which}}を既読にしますか", "operation.mark_as_read": "既読にする", "operation.rename_category": "カテゴリーをリネーム", "operation.share": "共有", diff --git a/locales/mobile/default/ko.json b/locales/mobile/default/ko.json index 13cb5da5e..4d8a84f69 100644 --- a/locales/mobile/default/ko.json +++ b/locales/mobile/default/ko.json @@ -6,7 +6,7 @@ "operation.edit": "편집", "operation.mark_all_as_read": "모두 읽음으로 표시", "operation.mark_all_as_read_confirm": "모두 읽음으로 표시하시겠습니까?", - "operation.mark_all_as_read_which": "을 (를) 모두 읽음으로 표시하시겠습니까?", + "operation.mark_all_as_read_which": "{{which}}을 (를) 모두 읽음으로 표시하시겠습니까", "operation.mark_as_read": "읽음으로 표시", "operation.rename_category": "카테고리 이름 변경", "operation.share": "공유", diff --git a/locales/mobile/default/pt.json b/locales/mobile/default/pt.json index 2c5b04587..7b1911099 100644 --- a/locales/mobile/default/pt.json +++ b/locales/mobile/default/pt.json @@ -5,7 +5,7 @@ "operation.edit": "編集", "operation.mark_all_as_read": "すべてを既読にする", "operation.mark_all_as_read_confirm": "すべてを既読にしますか?", - "operation.mark_all_as_read_which": "を既読にしますか?", + "operation.mark_all_as_read_which": "{{which}}を既読にしますか", "operation.mark_as_read": "既読にする", "operation.rename_category": "カテゴリーの名前を変更", "operation.share": "共有", diff --git a/locales/mobile/default/ru.json b/locales/mobile/default/ru.json index 32973f26e..6ced002e0 100644 --- a/locales/mobile/default/ru.json +++ b/locales/mobile/default/ru.json @@ -6,7 +6,7 @@ "operation.edit": "Редактировать", "operation.mark_all_as_read": "Отметить все как прочитанное", "operation.mark_all_as_read_confirm": "Подтвердить отметку всего как прочитанное?", - "operation.mark_all_as_read_which": "Отметить как прочитанное?", + "operation.mark_all_as_read_which": "Отметить {{which}} как прочитанное", "operation.mark_as_read": "Отметить как прочитанное", "operation.rename_category": "Переименовать категорию", "operation.share": "Поделиться", diff --git a/locales/mobile/default/tr.json b/locales/mobile/default/tr.json index c19c224df..85d983e64 100644 --- a/locales/mobile/default/tr.json +++ b/locales/mobile/default/tr.json @@ -5,7 +5,7 @@ "operation.edit": "Düzenle", "operation.mark_all_as_read": "Tümünü okundu olarak işaretle", "operation.mark_all_as_read_confirm": "Tümünü okundu olarak işaretlemeyi onaylıyor musunuz?", - "operation.mark_all_as_read_which": " okundu olarak işaretlensin mi?", + "operation.mark_all_as_read_which": "{{which}} okundu olarak işaretlensin mi", "operation.mark_as_read": "Okundu olarak işaretle", "operation.rename_category": "Kategoriyi yeniden adlandır", "operation.share": "Paylaş", diff --git a/locales/mobile/default/zh-CN.json b/locales/mobile/default/zh-CN.json index 991ca2026..6e7bd2c31 100644 --- a/locales/mobile/default/zh-CN.json +++ b/locales/mobile/default/zh-CN.json @@ -6,7 +6,8 @@ "operation.edit": "编辑", "operation.mark_all_as_read": "全部标记为已读", "operation.mark_all_as_read_confirm": "确认将全部标记为已读?", - "operation.mark_all_as_read_which": "将 标记为已读?", + "operation.mark_all_as_read_which": "将{{which}}标记为已读", + "operation.mark_all_as_read_which_above": "以上", "operation.mark_as_read": "标记为已读", "operation.open_link": "打开链接", "operation.rename_category": "重命名分类", diff --git a/locales/mobile/default/zh-HK.json b/locales/mobile/default/zh-HK.json index 5eb4f7c03..d5dabdfa4 100644 --- a/locales/mobile/default/zh-HK.json +++ b/locales/mobile/default/zh-HK.json @@ -6,7 +6,7 @@ "operation.edit": "編輯", "operation.mark_all_as_read": "全部標記為已讀", "operation.mark_all_as_read_confirm": "確定將所有標記為已讀?", - "operation.mark_all_as_read_which": "確定將 標記為已讀?", + "operation.mark_all_as_read_which": "確定將 {{which}} 標記為已讀", "operation.mark_as_read": "標記為已讀", "operation.rename_category": "重新命名分類", "operation.share": "分享", diff --git a/locales/mobile/default/zh-TW.json b/locales/mobile/default/zh-TW.json index 4d373364d..bf8fe413f 100644 --- a/locales/mobile/default/zh-TW.json +++ b/locales/mobile/default/zh-TW.json @@ -6,7 +6,7 @@ "operation.edit": "編輯", "operation.mark_all_as_read": "全部標記為已讀", "operation.mark_all_as_read_confirm": "確認將全部標記為已讀?", - "operation.mark_all_as_read_which": "將 標記為已讀?", + "operation.mark_all_as_read_which": "將 {{which}} 標記為已讀", "operation.mark_as_read": "標記為已讀", "operation.rename_category": "重新命名類別", "operation.share": "分享",