@@ -5,19 +5,20 @@ import { connect } from 'react-redux';
55import compose from 'recompose/compose' ;
66import { ChannelListItem } from '../../../components/listItems' ;
77import { ChannelProfile } from '../../../components/profile' ;
8- import { IconButton } from '../../../components/buttons' ;
8+ import { OutlineButton } from '../../../components/buttons' ;
99import Icon from '../../../components/icons' ;
1010import { openModal } from '../../../actions/modals' ;
1111import viewNetworkHandler from '../../../components/viewNetworkHandler' ;
12- import { LoadingCard } from '../../../components/loading' ;
12+ import { LoadingCard , Loading } from '../../../components/loading' ;
1313import getCommunityChannels from 'shared/graphql/queries/community/getCommunityChannelConnection' ;
1414import type { GetCommunityChannelConnectionType } from 'shared/graphql/queries/community/getCommunityChannelConnection' ;
15+ import { StyledCard , ListContainer } from '../../../components/listItems/style' ;
1516import {
16- StyledCard ,
17- ListHeader ,
18- ListHeading ,
19- ListContainer ,
20- } from '../../../ components/listItems/style ' ;
17+ ColumnHeading ,
18+ ChannelListItemRow ,
19+ ToggleNotificationsContainer ,
20+ } from '../style' ;
21+ import ToggleChannelNotifications from 'src/ components/toggleChannelNotifications ' ;
2122
2223type Props = {
2324 data : {
@@ -80,18 +81,7 @@ class ChannelList extends React.Component<Props> {
8081
8182 return (
8283 < StyledCard largeOnly >
83- < ListHeader >
84- < ListHeading > Channels</ ListHeading >
85- { isOwner && (
86- < IconButton
87- glyph = "plus"
88- color = "text.placeholder"
89- onClick = { ( ) =>
90- dispatch ( openModal ( 'CREATE_CHANNEL_MODAL' , community ) )
91- }
92- />
93- ) }
94- </ ListHeader >
84+ < ColumnHeading > Channels</ ColumnHeading >
9585
9686 { /*
9787 user isn't logged in, channel list is used for navigation
@@ -128,31 +118,57 @@ class ChannelList extends React.Component<Props> {
128118 { sortedJoinedChannels . map ( channel => {
129119 if ( ! channel ) return null ;
130120 return (
131- < Link
132- key = { channel . id }
133- to = { `/${ communitySlug } /${ channel . slug } ` }
134- >
135- < ChannelListItem
136- clickable
137- contents = { channel }
138- withDescription = { false }
139- channelIcon
121+ < ChannelListItemRow key = { channel . id } >
122+ < Link
123+ to = { `/${ communitySlug } /${ channel . slug } ` }
124+ style = { {
125+ display : 'flex' ,
126+ flex : 'auto' ,
127+ } }
140128 >
141- < Icon glyph = "view-forward" />
142- </ ChannelListItem >
143- </ Link >
129+ < ChannelListItem
130+ clickable
131+ contents = { channel }
132+ withDescription = { false }
133+ channelIcon
134+ />
135+ </ Link >
136+ < ToggleChannelNotifications
137+ channel = { channel }
138+ render = { state => (
139+ < ToggleNotificationsContainer
140+ tipLocation = { 'top-left' }
141+ tipText = {
142+ channel . channelPermissions . receiveNotifications
143+ ? 'Turn notifications off'
144+ : 'Turn notifications on'
145+ }
146+ >
147+ { state . isLoading ? (
148+ < Loading />
149+ ) : (
150+ < Icon
151+ glyph = {
152+ channel . channelPermissions
153+ . receiveNotifications
154+ ? 'notification-fill'
155+ : 'notification'
156+ }
157+ />
158+ ) }
159+ </ ToggleNotificationsContainer >
160+ ) }
161+ />
162+ </ ChannelListItemRow >
144163 ) ;
145164 } ) }
146165 </ ListContainer >
147166 ) }
148167
149168 { sortedNonJoinedChannels . length > 0 &&
150169 isMember && (
151- < span >
152- < ListHeader secondary >
153- < ListHeading > New channels</ ListHeading >
154- </ ListHeader >
155-
170+ < React . Fragment >
171+ < ColumnHeading > New channels</ ColumnHeading >
156172 < ListContainer >
157173 < ul >
158174 { sortedNonJoinedChannels . map ( channel => {
@@ -167,8 +183,23 @@ class ChannelList extends React.Component<Props> {
167183 } ) }
168184 </ ul >
169185 </ ListContainer >
170- </ span >
186+ </ React . Fragment >
171187 ) }
188+
189+ { isOwner && (
190+ < OutlineButton
191+ style = { {
192+ alignSelf : 'flex-end' ,
193+ marginTop : '12px' ,
194+ } }
195+ glyph = "plus"
196+ onClick = { ( ) =>
197+ dispatch ( openModal ( 'CREATE_CHANNEL_MODAL' , community ) )
198+ }
199+ >
200+ Create a channel
201+ </ OutlineButton >
202+ ) }
172203 </ StyledCard >
173204 ) ;
174205 }
0 commit comments