mirror of
https://github.com/Athou/commafeed.git
synced 2026-03-21 21:37:29 +00:00
clicking on the body of an entry in expanded mode selects it and marks it as read (#1089)
This commit is contained in:
@@ -59,6 +59,18 @@ export function FeedEntries() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const bodyClicked = (entry: ExpendableEntry) => {
|
||||||
|
if (viewMode !== "expanded") return
|
||||||
|
dispatch(
|
||||||
|
selectEntry({
|
||||||
|
entry,
|
||||||
|
expand: true,
|
||||||
|
markAsRead: true,
|
||||||
|
scrollToEntry: true,
|
||||||
|
})
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
const swipedRight = (entry: ExpendableEntry) => dispatch(markEntry({ entry, read: !entry.read }))
|
const swipedRight = (entry: ExpendableEntry) => dispatch(markEntry({ entry, read: !entry.read }))
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -272,6 +284,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)}
|
||||||
|
onBodyClick={() => bodyClicked(entry)}
|
||||||
onSwipedRight={() => swipedRight(entry)}
|
onSwipedRight={() => swipedRight(entry)}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ interface FeedEntryProps {
|
|||||||
showSelectionIndicator: boolean
|
showSelectionIndicator: boolean
|
||||||
maxWidth?: number
|
maxWidth?: number
|
||||||
onHeaderClick: (e: React.MouseEvent) => void
|
onHeaderClick: (e: React.MouseEvent) => void
|
||||||
|
onBodyClick: (e: React.MouseEvent) => void
|
||||||
onSwipedRight: () => void
|
onSwipedRight: () => void
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -135,7 +136,7 @@ export function FeedEntry(props: FeedEntryProps) {
|
|||||||
</Box>
|
</Box>
|
||||||
</a>
|
</a>
|
||||||
{props.expanded && (
|
{props.expanded && (
|
||||||
<Box px={paddingX} pb={paddingY}>
|
<Box px={paddingX} pb={paddingY} onClick={props.onBodyClick}>
|
||||||
<Box className={classes.body} sx={{ direction: props.entry.rtl ? "rtl" : "ltr" }}>
|
<Box className={classes.body} sx={{ direction: props.entry.rtl ? "rtl" : "ltr" }}>
|
||||||
<FeedEntryBody entry={props.entry} />
|
<FeedEntryBody entry={props.entry} />
|
||||||
</Box>
|
</Box>
|
||||||
|
|||||||
Reference in New Issue
Block a user