Skip to content

Commit

Permalink
Show unread indicator as red if it is affecting the app badge counter
Browse files Browse the repository at this point in the history
Not sure about this, might revert later

#156

#90
  • Loading branch information
brunolemos committed Jul 3, 2019
1 parent 0cb1995 commit bf7270e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
12 changes: 11 additions & 1 deletion packages/components/src/components/columns/ColumnHeaderItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ export interface ColumnHeaderItemProps {
title?: string
titleStyle?: StyleProp<TextStyle>
tooltip: string | undefined
unreadIndicatorBackgroundThemeColor?:
| keyof ThemeColors
| ((theme: ThemeColors) => string)
}

export const ColumnHeaderItem = React.memo((props: ColumnHeaderItemProps) => {
Expand Down Expand Up @@ -116,6 +119,7 @@ export const ColumnHeaderItem = React.memo((props: ColumnHeaderItemProps) => {
title,
titleStyle,
tooltip,
unreadIndicatorBackgroundThemeColor = 'primaryBackgroundColor',
} = props

const theme = useTheme()
Expand All @@ -138,6 +142,11 @@ export const ColumnHeaderItem = React.memo((props: ColumnHeaderItemProps) => {
hoverForegroundThemeColor,
)

const unreadIndicatorBackgroundColor = getThemeColorOrItself(
theme,
unreadIndicatorBackgroundThemeColor,
)

const isHovered = (_isHovered || forceHoverState) && !disabled
const immediate =
constants.DISABLE_ANIMATIONS ||
Expand All @@ -163,6 +172,7 @@ export const ColumnHeaderItem = React.memo((props: ColumnHeaderItemProps) => {
: foregroundColor || theme.foregroundColor,
mutedForegroundColor: theme.foregroundColorMuted60,
primaryBackgroundColor: theme.primaryBackgroundColor,
unreadIndicatorBackgroundColor,
}
},
[
Expand Down Expand Up @@ -320,7 +330,7 @@ export const ColumnHeaderItem = React.memo((props: ColumnHeaderItemProps) => {
width: 12,
height: 12,
backgroundColor:
springAnimatedStyles.primaryBackgroundColor,
springAnimatedStyles.unreadIndicatorBackgroundColor,
borderColor:
springAnimatedStyles.backgroundColorWithoutTransparency,
borderWidth: 2,
Expand Down
6 changes: 6 additions & 0 deletions packages/components/src/components/layout/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { useReduxState } from '../../hooks/use-redux-state'
import { bugsnag } from '../../libs/bugsnag'
import { emitter } from '../../libs/emitter'
import { FlatList } from '../../libs/flatlist'
import { Platform } from '../../libs/platform'
import * as actions from '../../redux/actions'
import * as selectors from '../../redux/selectors'
import { sharedStyles } from '../../styles/shared'
Expand Down Expand Up @@ -676,6 +677,11 @@ const SidebarColumnItem = React.memo(
tooltip={`${headerDetails.title} (${headerDetails.subtitle})`
.toLowerCase()
.trim()}
unreadIndicatorBackgroundThemeColor={
Platform.OS === 'web' && column.type === 'notifications'
? 'red'
: undefined
}
/>
)
},
Expand Down

0 comments on commit bf7270e

Please sign in to comment.