Skip to content

Commit

Permalink
Indicate which column types support private content
Browse files Browse the repository at this point in the history
  • Loading branch information
brunolemos committed Feb 27, 2019
1 parent 637ba0c commit f78264c
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,17 @@ import {
import { useCSSVariablesOrSpringAnimatedTheme } from '../../hooks/use-css-variables-or-spring--animated-theme'
import { useReduxAction } from '../../hooks/use-redux-action'
import { useReduxState } from '../../hooks/use-redux-state'
import { Platform } from '../../libs/platform'
import * as actions from '../../redux/actions'
import * as selectors from '../../redux/selectors'
import { contentPadding } from '../../styles/variables'
import { findNode } from '../../utils/helpers/shared'
import { ColumnHeaderItem } from '../columns/ColumnHeaderItem'
import { SpringAnimatedIcon } from '../animated/spring/SpringAnimatedIcon'
import { SpringAnimatedText } from '../animated/spring/SpringAnimatedText'
import { ModalColumn } from '../columns/ModalColumn'
import { Button } from '../common/Button'
import { H2 } from '../common/H2'
import { H3 } from '../common/H3'
import { HeaderMessage } from '../common/HeaderMessage'
import { Spacer } from '../common/Spacer'
import { SubHeader } from '../common/SubHeader'
import {
Expand Down Expand Up @@ -80,6 +82,7 @@ export const AddColumnDetailsModal = React.memo(
const {
defaultParams,
icon,
isPrivateSupported,
paramList,
showBackButton,
subscription,
Expand Down Expand Up @@ -265,7 +268,48 @@ export const AddColumnDetailsModal = React.memo(
title="Add Column"
>
<ScrollView keyboardShouldPersistTaps="handled" style={{ flex: 1 }}>
<SubHeader iconName={icon} title={title} />
<SubHeader iconName={icon} title={title}>
{typeof isPrivateSupported === 'boolean' &&
(() => {
const contentLabel =
subscription.type === 'notifications'
? 'notifications'
: subscription.type === 'activity'
? 'events'
: 'content'

const text = isPrivateSupported
? `This column type supports private ${contentLabel}.`
: `This column type supports public ${contentLabel} only.`

return (
<View style={{ flex: 1, flexDirection: 'row' }}>
<Spacer flex={1} />

<SpringAnimatedIcon
name={isPrivateSupported ? 'lock' : 'globe'}
onPress={() => {
alert(text)
}}
size={18}
style={[
{ color: springAnimatedTheme.foregroundColorMuted50 },
Platform.select({
web: {
cursor: 'help',
} as any,
}),
]}
{...Platform.select({
web: {
title: text,
} as any,
})}
/>
</View>
)
})()}
</SubHeader>

<View style={{ flex: 1, padding: contentPadding }}>
{(paramList
Expand Down
7 changes: 6 additions & 1 deletion packages/components/src/components/modals/AddColumnModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import { useCSSVariablesOrSpringAnimatedTheme } from '../../hooks/use-css-variab
import { useHover } from '../../hooks/use-hover'
import { useReduxAction } from '../../hooks/use-redux-action'
import { useReduxState } from '../../hooks/use-redux-state'
import { Browser } from '../../libs/browser'
import { Platform } from '../../libs/platform'
import * as actions from '../../redux/actions'
import * as selectors from '../../redux/selectors'
Expand Down Expand Up @@ -66,6 +65,7 @@ const columnTypes: Array<{
subtype: undefined,
},
paramList: ['all'],
isPrivateSupported: true,
},
},
{
Expand All @@ -79,6 +79,7 @@ const columnTypes: Array<{
subtype: 'REPO_NOTIFICATIONS',
},
paramList: ['all', 'owner', 'repo'],
isPrivateSupported: true,
},
},
],
Expand All @@ -99,6 +100,7 @@ const columnTypes: Array<{
subtype: 'USER_RECEIVED_EVENTS',
},
paramList: ['username'],
isPrivateSupported: false,
},
},
{
Expand All @@ -112,6 +114,7 @@ const columnTypes: Array<{
subtype: 'USER_EVENTS',
},
paramList: ['username'],
isPrivateSupported: false,
},
},
{
Expand All @@ -125,6 +128,7 @@ const columnTypes: Array<{
subtype: 'REPO_EVENTS',
},
paramList: ['owner', 'repo'],
isPrivateSupported: true,
},
},
{
Expand All @@ -138,6 +142,7 @@ const columnTypes: Array<{
subtype: 'ORG_PUBLIC_EVENTS',
},
paramList: ['org'],
isPrivateSupported: false,
},
},
],
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/types/devhub.ts
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,7 @@ export interface AddColumnDetailsPayload {
subscription: Pick<ColumnSubscription, 'type' | 'subtype'>
paramList: ColumnParamField[]
defaultParams?: Partial<Record<ColumnParamField, any>>
isPrivateSupported: boolean
}

export interface ColumnAndSubscriptions {
Expand Down

0 comments on commit f78264c

Please sign in to comment.