Better event handling on home action icons
This commit is contained in:
@ -74,7 +74,8 @@ export function HomeContainer(): JSX.Element {
|
||||
>
|
||||
{homeData.sections?.map((homeSection, idx) => {
|
||||
if (homeSection.items.length < 1) {
|
||||
return <></>
|
||||
console.log('empty home section: ', homeSection)
|
||||
return <SpanBox key={`section-${idx}`}></SpanBox>
|
||||
}
|
||||
switch (homeSection.layout) {
|
||||
case 'just_added':
|
||||
@ -110,7 +111,8 @@ export function HomeContainer(): JSX.Element {
|
||||
/>
|
||||
)
|
||||
default:
|
||||
return <></>
|
||||
console.log('unknown home section: ', homeSection)
|
||||
return <SpanBox key={`section-${idx}`}></SpanBox>
|
||||
}
|
||||
})}
|
||||
</VStack>
|
||||
@ -629,28 +631,34 @@ const TopPicksItemView = (
|
||||
<SpanBox css={{ px: '20px' }}></SpanBox>
|
||||
<HStack css={{ gap: '10px', my: '15px', px: '20px' }}>
|
||||
{props.homeItem.canSave && (
|
||||
<Button style="homeAction">
|
||||
<Button
|
||||
style="homeAction"
|
||||
onClick={(event) => {
|
||||
event.preventDefault()
|
||||
event.stopPropagation()
|
||||
|
||||
props.dispatchList({
|
||||
type: 'REMOVE_ITEM',
|
||||
itemId: props.homeItem.id,
|
||||
})
|
||||
}}
|
||||
>
|
||||
<AddToLibraryActionIcon
|
||||
color={theme.colors.homeActionIcons.toString()}
|
||||
/>
|
||||
</Button>
|
||||
)}
|
||||
{/* <Button style="homeAction">
|
||||
<CommentActionIcon color={theme.colors.homeActionIcons.toString()} />
|
||||
</Button> */}
|
||||
|
||||
{props.homeItem.canArchive && (
|
||||
<Button
|
||||
style="homeAction"
|
||||
onClick={(event) => {
|
||||
// archiveItem(props.homeItem)
|
||||
console.log('archiving')
|
||||
event.preventDefault()
|
||||
event.stopPropagation()
|
||||
|
||||
props.dispatchList({
|
||||
type: 'REMOVE_ITEM',
|
||||
itemId: props.homeItem.id,
|
||||
})
|
||||
event.preventDefault()
|
||||
event.stopPropagation()
|
||||
}}
|
||||
>
|
||||
<ArchiveActionIcon
|
||||
@ -659,12 +667,29 @@ const TopPicksItemView = (
|
||||
</Button>
|
||||
)}
|
||||
{props.homeItem.canDelete && (
|
||||
<Button style="homeAction">
|
||||
<Button
|
||||
style="homeAction"
|
||||
onClick={(event) => {
|
||||
event.preventDefault()
|
||||
event.stopPropagation()
|
||||
|
||||
props.dispatchList({
|
||||
type: 'REMOVE_ITEM',
|
||||
itemId: props.homeItem.id,
|
||||
})
|
||||
}}
|
||||
>
|
||||
<RemoveActionIcon color={theme.colors.homeActionIcons.toString()} />
|
||||
</Button>
|
||||
)}
|
||||
{props.homeItem.canShare && (
|
||||
<Button style="homeAction">
|
||||
<Button
|
||||
style="homeAction"
|
||||
onClick={(event) => {
|
||||
event.preventDefault()
|
||||
event.stopPropagation()
|
||||
}}
|
||||
>
|
||||
<ShareActionIcon color={theme.colors.homeActionIcons.toString()} />
|
||||
</Button>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user