feat(mobile): mark above as read bottom button

This commit is contained in:
DIYgod
2025-04-03 20:49:42 +08:00
parent 9c75d8b9fc
commit d0a8f6baa4
25 changed files with 101 additions and 31 deletions
@@ -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<string>) => (
@@ -27,8 +29,8 @@ export const EntryListContentArticle = forwardRef<
)
const ListFooterComponent = useMemo(
() => (isFetching ? <EntryItemSkeleton /> : null),
[isFetching],
() => (hasNextPage ? <EntryItemSkeleton /> : <EntryListFooter />),
[hasNextPage],
)
const { onViewableItemsChanged, onScroll } = useOnViewableItemsChanged({
@@ -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<
<View className="h-20 items-center justify-center">
<PlatformActivityIndicator />
</View>
) : null
) : (
<GridEntryListFooter />
)
}
{...rest}
onRefresh={refetch}
@@ -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<typeof TimelineSelectorList>,
{ 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<string>) => <EntrySocialItem key={id} entryId={id} />,
@@ -21,8 +23,8 @@ export const EntryListContentSocial = forwardRef<
)
const ListFooterComponent = useMemo(
() => (isFetching ? <EntryItemSkeleton /> : null),
[isFetching],
() => (hasNextPage ? <EntryItemSkeleton /> : <EntryListFooter />),
[hasNextPage],
)
const { onViewableItemsChanged, onScroll } = useOnViewableItemsChanged({
@@ -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 ? (
<View className="flex flex-row justify-between">
<EntryItemSkeleton />
<EntryItemSkeleton />
</View>
) : null,
[isFetching],
) : (
<GridEntryListFooter />
),
[hasNextPage],
)
return (
@@ -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 (
<>
<ItemSeparator />
<Pressable
className="flex-row items-center gap-1.5 py-6 pl-6"
onPress={() => {
if (typeof selectedView === "number") {
unreadSyncService.markViewAsRead(selectedView)
}
}}
>
<CheckCircleCuteReIcon height={16} width={16} />
<Text className="text-label font-bold">
{t("operation.mark_all_as_read_which", {
which: t("operation.mark_all_as_read_which_above"),
})}
</Text>
</Pressable>
</>
)
}
export const GridEntryListFooter = () => {
const { t } = useTranslation()
const selectedView = useSelectedView()
return (
<Pressable
className="flex-row items-center justify-center gap-1.5 py-6"
onPress={() => {
if (typeof selectedView === "number") {
unreadSyncService.markViewAsRead(selectedView)
}
}}
>
<CheckCircleCuteReIcon height={16} width={16} />
<Text className="text-label font-bold">
{t("operation.mark_all_as_read_which", {
which: t("operation.mark_all_as_read_which_above"),
})}
</Text>
</Pressable>
)
}
+1 -1
View File
@@ -5,7 +5,7 @@
"operation.edit": "تحرير",
"operation.mark_all_as_read": "تحديد الكل كمقروء",
"operation.mark_all_as_read_confirm": "تأكيد تحديد الكل كمقروء؟",
"operation.mark_all_as_read_which": "هل تريد تحديد <which /> كمقروء؟",
"operation.mark_all_as_read_which": "هل تريد تحديد {{which}} كمقروء؟",
"operation.mark_as_read": "تحديد كمقروء",
"operation.rename_category": "إعادة تسمية الفئة",
"operation.share": "مشاركة",
+1 -1
View File
@@ -5,7 +5,7 @@
"operation.edit": "تحرير",
"operation.mark_all_as_read": "تحديد الكل كمقروء",
"operation.mark_all_as_read_confirm": "تأكيد تحديد الكل كمقروء؟",
"operation.mark_all_as_read_which": "تحديد <which /> كمقروء؟",
"operation.mark_all_as_read_which": "تحديد {{which}} كمقروء؟",
"operation.mark_as_read": "تحديد كمقروء",
"operation.rename_category": "إعادة تسمية الفئة",
"operation.share": "مشاركة",
+1 -1
View File
@@ -5,7 +5,7 @@
"operation.edit": "تحرير",
"operation.mark_all_as_read": "وضع علامة الكل كمقروء",
"operation.mark_all_as_read_confirm": "تأكيد وضع علامة الجميع كمقروء؟",
"operation.mark_all_as_read_which": "وضع علامة <which /> كمقروء؟",
"operation.mark_all_as_read_which": "وضع علامة {{which}} كمقروء؟",
"operation.mark_as_read": "وضع علامة كمقروء",
"operation.rename_category": "إعادة تسمية الفئة",
"operation.share": "مشاركة",
+1 -1
View File
@@ -5,7 +5,7 @@
"operation.edit": "تعديل",
"operation.mark_all_as_read": "وضع علامة على الكل كمقروء",
"operation.mark_all_as_read_confirm": "تأكيد وضع علامة على الكل كمقروء؟",
"operation.mark_all_as_read_which": "وضع علامة على <which /> كمقروء؟",
"operation.mark_all_as_read_which": "وضع علامة على {{which}} كمقروء؟",
"operation.mark_as_read": "وضع علامة كمقروء",
"operation.rename_category": "إعادة تسمية الفئة",
"operation.share": "مشاركة",
+1 -1
View File
@@ -5,7 +5,7 @@
"operation.edit": "تحرير",
"operation.mark_all_as_read": "تمييز الكل كمقروء",
"operation.mark_all_as_read_confirm": "هل ترغب في تأكيد تمييز الكل كمقروء؟",
"operation.mark_all_as_read_which": "تمييز <which /> كمقروء؟",
"operation.mark_all_as_read_which": "تمييز {{which}} كمقروء؟",
"operation.mark_as_read": "تمييز كمقروء",
"operation.rename_category": "إعادة تسمية الفئة",
"operation.share": "مشاركة",
+1 -1
View File
@@ -5,7 +5,7 @@
"operation.edit": "تحرير",
"operation.mark_all_as_read": "وضع علامة على الكل كمقروء",
"operation.mark_all_as_read_confirm": "تأكيد وضع الجميع كمقروء؟",
"operation.mark_all_as_read_which": "وضع علامة <which /> كمقروء؟",
"operation.mark_all_as_read_which": "وضع علامة {{which}} كمقروء؟",
"operation.mark_as_read": "وضع علامة كمقروء",
"operation.rename_category": "إعادة تسمية الفئة",
"operation.share": "مشاركة",
+1 -1
View File
@@ -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": "<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",
+2 -1
View File
@@ -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 <which /> 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",
+1 -1
View File
@@ -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 <which /> 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",
+1 -1
View File
@@ -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ö <which /> 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",
+1 -1
View File
@@ -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 <which /> 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",
+1 -1
View File
@@ -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 <which /> 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",
+1 -1
View File
@@ -6,7 +6,7 @@
"operation.edit": "編集",
"operation.mark_all_as_read": "すべてを既読にする",
"operation.mark_all_as_read_confirm": "すべてを既読にしますか?",
"operation.mark_all_as_read_which": "<which />を既読にしますか?",
"operation.mark_all_as_read_which": "{{which}}を既読にしますか",
"operation.mark_as_read": "既読にする",
"operation.rename_category": "カテゴリーをリネーム",
"operation.share": "共有",
+1 -1
View File
@@ -6,7 +6,7 @@
"operation.edit": "편집",
"operation.mark_all_as_read": "모두 읽음으로 표시",
"operation.mark_all_as_read_confirm": "모두 읽음으로 표시하시겠습니까?",
"operation.mark_all_as_read_which": "<which />을 (를) 모두 읽음으로 표시하시겠습니까?",
"operation.mark_all_as_read_which": "{{which}}을 (를) 모두 읽음으로 표시하시겠습니까",
"operation.mark_as_read": "읽음으로 표시",
"operation.rename_category": "카테고리 이름 변경",
"operation.share": "공유",
+1 -1
View File
@@ -5,7 +5,7 @@
"operation.edit": "編集",
"operation.mark_all_as_read": "すべてを既読にする",
"operation.mark_all_as_read_confirm": "すべてを既読にしますか?",
"operation.mark_all_as_read_which": "<which />を既読にしますか?",
"operation.mark_all_as_read_which": "{{which}}を既読にしますか",
"operation.mark_as_read": "既読にする",
"operation.rename_category": "カテゴリーの名前を変更",
"operation.share": "共有",
+1 -1
View File
@@ -6,7 +6,7 @@
"operation.edit": "Редактировать",
"operation.mark_all_as_read": "Отметить все как прочитанное",
"operation.mark_all_as_read_confirm": "Подтвердить отметку всего как прочитанное?",
"operation.mark_all_as_read_which": "Отметить <which /> как прочитанное?",
"operation.mark_all_as_read_which": "Отметить {{which}} как прочитанное",
"operation.mark_as_read": "Отметить как прочитанное",
"operation.rename_category": "Переименовать категорию",
"operation.share": "Поделиться",
+1 -1
View File
@@ -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": "<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ş",
+2 -1
View File
@@ -6,7 +6,8 @@
"operation.edit": "编辑",
"operation.mark_all_as_read": "全部标记为已读",
"operation.mark_all_as_read_confirm": "确认将全部标记为已读?",
"operation.mark_all_as_read_which": "将 <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": "重命名分类",
+1 -1
View File
@@ -6,7 +6,7 @@
"operation.edit": "編輯",
"operation.mark_all_as_read": "全部標記為已讀",
"operation.mark_all_as_read_confirm": "確定將所有標記為已讀?",
"operation.mark_all_as_read_which": "確定將 <which /> 標記為已讀?",
"operation.mark_all_as_read_which": "確定將 {{which}} 標記為已讀",
"operation.mark_as_read": "標記為已讀",
"operation.rename_category": "重新命名分類",
"operation.share": "分享",
+1 -1
View File
@@ -6,7 +6,7 @@
"operation.edit": "編輯",
"operation.mark_all_as_read": "全部標記為已讀",
"operation.mark_all_as_read_confirm": "確認將全部標記為已讀?",
"operation.mark_all_as_read_which": "將 <which /> 標記為已讀?",
"operation.mark_all_as_read_which": "將 {{which}} 標記為已讀",
"operation.mark_as_read": "標記為已讀",
"operation.rename_category": "重新命名類別",
"operation.share": "分享",