mirror of
https://github.com/Athou/commafeed.git
synced 2026-03-21 21:37:29 +00:00
move swipe callback next to other callbacks
This commit is contained in:
@@ -59,6 +59,8 @@ export function FeedEntries() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const swipedRight = (entry: ExpendableEntry) => dispatch(markEntry({ entry, read: !entry.read }))
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const scrollArea = document.getElementById(Constants.dom.mainScrollAreaId)
|
const scrollArea = document.getElementById(Constants.dom.mainScrollAreaId)
|
||||||
|
|
||||||
@@ -270,6 +272,7 @@ export function FeedEntries() {
|
|||||||
showSelectionIndicator={entry.id === selectedEntryId && (!entry.expanded || viewMode === "expanded")}
|
showSelectionIndicator={entry.id === selectedEntryId && (!entry.expanded || viewMode === "expanded")}
|
||||||
maxWidth={sidebarVisible ? Constants.layout.entryMaxWidth : undefined}
|
maxWidth={sidebarVisible ? Constants.layout.entryMaxWidth : undefined}
|
||||||
onHeaderClick={event => headerClicked(entry, event)}
|
onHeaderClick={event => headerClicked(entry, event)}
|
||||||
|
onSwipedRight={() => swipedRight(entry)}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
import { Box, createStyles, Divider, Paper } from "@mantine/core"
|
import { Box, createStyles, Divider, Paper } from "@mantine/core"
|
||||||
import { MantineNumberSize } from "@mantine/styles"
|
import { MantineNumberSize } from "@mantine/styles"
|
||||||
import { Constants } from "app/constants"
|
import { Constants } from "app/constants"
|
||||||
import { markEntry } from "app/slices/entries"
|
|
||||||
import { useAppDispatch } from "app/store"
|
|
||||||
import { Entry, ViewMode } from "app/types"
|
import { Entry, ViewMode } from "app/types"
|
||||||
import { useViewMode } from "hooks/useViewMode"
|
import { useViewMode } from "hooks/useViewMode"
|
||||||
import React from "react"
|
import React from "react"
|
||||||
@@ -20,6 +18,7 @@ interface FeedEntryProps {
|
|||||||
showSelectionIndicator: boolean
|
showSelectionIndicator: boolean
|
||||||
maxWidth?: number
|
maxWidth?: number
|
||||||
onHeaderClick: (e: React.MouseEvent) => void
|
onHeaderClick: (e: React.MouseEvent) => void
|
||||||
|
onSwipedRight: () => void
|
||||||
}
|
}
|
||||||
|
|
||||||
const useStyles = createStyles((theme, props: FeedEntryProps & { viewMode?: ViewMode }) => {
|
const useStyles = createStyles((theme, props: FeedEntryProps & { viewMode?: ViewMode }) => {
|
||||||
@@ -85,10 +84,8 @@ export function FeedEntry(props: FeedEntryProps) {
|
|||||||
const { viewMode } = useViewMode()
|
const { viewMode } = useViewMode()
|
||||||
const { classes, cx } = useStyles({ ...props, viewMode })
|
const { classes, cx } = useStyles({ ...props, viewMode })
|
||||||
|
|
||||||
const dispatch = useAppDispatch()
|
|
||||||
|
|
||||||
const swipeHandlers = useSwipeable({
|
const swipeHandlers = useSwipeable({
|
||||||
onSwipedRight: () => dispatch(markEntry({ entry: props.entry, read: !props.entry.read })),
|
onSwipedRight: props.onSwipedRight,
|
||||||
})
|
})
|
||||||
|
|
||||||
const { onContextMenu } = useFeedEntryContextMenu(props.entry)
|
const { onContextMenu } = useFeedEntryContextMenu(props.entry)
|
||||||
|
|||||||
Reference in New Issue
Block a user