Changeset View
Changeset View
Standalone View
Standalone View
native/chat/settings/thread-settings.react.js
Show All 40 Lines | import { | ||||
useResolvedThreadInfo, | useResolvedThreadInfo, | ||||
useResolvedOptionalThreadInfo, | useResolvedOptionalThreadInfo, | ||||
useResolvedOptionalThreadInfos, | useResolvedOptionalThreadInfos, | ||||
} from 'lib/utils/entity-helpers.js'; | } from 'lib/utils/entity-helpers.js'; | ||||
import type { CategoryType } from './thread-settings-category.react.js'; | import type { CategoryType } from './thread-settings-category.react.js'; | ||||
import { | import { | ||||
ThreadSettingsCategoryHeader, | ThreadSettingsCategoryHeader, | ||||
ThreadSettingsCategoryActionHeader, | |||||
ThreadSettingsCategoryFooter, | ThreadSettingsCategoryFooter, | ||||
} from './thread-settings-category.react.js'; | } from './thread-settings-category.react.js'; | ||||
import ThreadSettingsChildThread from './thread-settings-child-thread.react.js'; | import ThreadSettingsChildThread from './thread-settings-child-thread.react.js'; | ||||
import ThreadSettingsColor from './thread-settings-color.react.js'; | import ThreadSettingsColor from './thread-settings-color.react.js'; | ||||
import ThreadSettingsDeleteThread from './thread-settings-delete-thread.react.js'; | import ThreadSettingsDeleteThread from './thread-settings-delete-thread.react.js'; | ||||
import ThreadSettingsDescription from './thread-settings-description.react.js'; | import ThreadSettingsDescription from './thread-settings-description.react.js'; | ||||
import ThreadSettingsEditRelationship from './thread-settings-edit-relationship.react.js'; | import ThreadSettingsEditRelationship from './thread-settings-edit-relationship.react.js'; | ||||
import ThreadSettingsHomeNotifs from './thread-settings-home-notifs.react.js'; | import ThreadSettingsHomeNotifs from './thread-settings-home-notifs.react.js'; | ||||
Show All 18 Lines | |||||
import { defaultStackScreenOptions } from '../../navigation/options.js'; | import { defaultStackScreenOptions } from '../../navigation/options.js'; | ||||
import { | import { | ||||
OverlayContext, | OverlayContext, | ||||
type OverlayContextType, | type OverlayContextType, | ||||
} from '../../navigation/overlay-context.js'; | } from '../../navigation/overlay-context.js'; | ||||
import { | import { | ||||
AddUsersModalRouteName, | AddUsersModalRouteName, | ||||
ComposeSubchannelModalRouteName, | ComposeSubchannelModalRouteName, | ||||
FullScreenThreadMediaGalleryRouteName, | |||||
} from '../../navigation/route-names.js'; | } from '../../navigation/route-names.js'; | ||||
import type { NavigationRoute } from '../../navigation/route-names.js'; | import type { NavigationRoute } from '../../navigation/route-names.js'; | ||||
import type { TabNavigationProp } from '../../navigation/tab-navigator.react.js'; | import type { TabNavigationProp } from '../../navigation/tab-navigator.react.js'; | ||||
import { useSelector } from '../../redux/redux-utils.js'; | import { useSelector } from '../../redux/redux-utils.js'; | ||||
import type { AppState } from '../../redux/state-types.js'; | import type { AppState } from '../../redux/state-types.js'; | ||||
import { | import { | ||||
useStyles, | useStyles, | ||||
type IndicatorStyle, | type IndicatorStyle, | ||||
Show All 17 Lines | |||||
type ChatSettingsItem = | type ChatSettingsItem = | ||||
| { | | { | ||||
+itemType: 'header', | +itemType: 'header', | ||||
+key: string, | +key: string, | ||||
+title: string, | +title: string, | ||||
+categoryType: CategoryType, | +categoryType: CategoryType, | ||||
} | } | ||||
| { | | { | ||||
+itemType: 'actionHeader', | |||||
+key: string, | |||||
+title: string, | |||||
+actionText: string, | |||||
+onPress: () => void, | |||||
} | |||||
| { | |||||
+itemType: 'footer', | +itemType: 'footer', | ||||
+key: string, | +key: string, | ||||
+categoryType: CategoryType, | +categoryType: CategoryType, | ||||
} | } | ||||
| { | | { | ||||
+itemType: 'name', | +itemType: 'name', | ||||
+key: string, | +key: string, | ||||
+threadInfo: ResolvedThreadInfo, | +threadInfo: ResolvedThreadInfo, | ||||
▲ Show 20 Lines • Show All 502 Lines • ▼ Show 20 Lines | class ThreadSettings extends React.PureComponent<Props, State> { | ||||
mediaGalleryListDataSelector = createSelector( | mediaGalleryListDataSelector = createSelector( | ||||
(propsAndState: PropsAndState) => propsAndState.threadInfo, | (propsAndState: PropsAndState) => propsAndState.threadInfo, | ||||
(threadInfo: ThreadInfo) => { | (threadInfo: ThreadInfo) => { | ||||
const listData: ChatSettingsItem[] = []; | const listData: ChatSettingsItem[] = []; | ||||
const limit = 6; | const limit = 6; | ||||
listData.push({ | listData.push({ | ||||
itemType: 'header', | itemType: 'actionHeader', | ||||
key: 'mediaGalleryHeader', | key: 'mediaGalleryHeader', | ||||
title: 'Media Gallery', | title: 'Media Gallery', | ||||
categoryType: 'outline', | actionText: 'See more', | ||||
onPress: this.onPressSeeMoreMediaGallery, | |||||
}); | }); | ||||
listData.push({ | listData.push({ | ||||
itemType: 'mediaGallery', | itemType: 'mediaGallery', | ||||
key: 'mediaGallery', | key: 'mediaGallery', | ||||
threadInfo, | threadInfo, | ||||
limit, | limit, | ||||
}); | }); | ||||
▲ Show 20 Lines • Show All 204 Lines • ▼ Show 20 Lines | renderItem = (row: { item: ChatSettingsItem, ... }) => { | ||||
const item = row.item; | const item = row.item; | ||||
if (item.itemType === 'header') { | if (item.itemType === 'header') { | ||||
return ( | return ( | ||||
<ThreadSettingsCategoryHeader | <ThreadSettingsCategoryHeader | ||||
type={item.categoryType} | type={item.categoryType} | ||||
title={item.title} | title={item.title} | ||||
/> | /> | ||||
); | ); | ||||
} else if (item.itemType === 'actionHeader') { | |||||
return ( | |||||
<ThreadSettingsCategoryActionHeader | |||||
title={item.title} | |||||
actionText={item.actionText} | |||||
onPress={item.onPress} | |||||
/> | |||||
); | |||||
} else if (item.itemType === 'footer') { | } else if (item.itemType === 'footer') { | ||||
return <ThreadSettingsCategoryFooter type={item.categoryType} />; | return <ThreadSettingsCategoryFooter type={item.categoryType} />; | ||||
} else if (item.itemType === 'name') { | } else if (item.itemType === 'name') { | ||||
return ( | return ( | ||||
<ThreadSettingsName | <ThreadSettingsName | ||||
threadInfo={item.threadInfo} | threadInfo={item.threadInfo} | ||||
nameEditValue={item.nameEditValue} | nameEditValue={item.nameEditValue} | ||||
setNameEditValue={this.setNameEditValue} | setNameEditValue={this.setNameEditValue} | ||||
▲ Show 20 Lines • Show All 148 Lines • ▼ Show 20 Lines | onPressSeeMoreSubchannels = () => { | ||||
})); | })); | ||||
}; | }; | ||||
onPressSeeMoreSidebars = () => { | onPressSeeMoreSidebars = () => { | ||||
this.setState(prevState => ({ | this.setState(prevState => ({ | ||||
numSidebarsShowing: prevState.numSidebarsShowing + itemPageLength, | numSidebarsShowing: prevState.numSidebarsShowing + itemPageLength, | ||||
})); | })); | ||||
}; | }; | ||||
onPressSeeMoreMediaGallery = () => { | |||||
this.props.navigation.navigate(FullScreenThreadMediaGalleryRouteName, { | |||||
threadInfo: this.props.threadInfo, | |||||
}); | |||||
}; | |||||
} | } | ||||
const unboundStyles = { | const unboundStyles = { | ||||
container: { | container: { | ||||
backgroundColor: 'panelBackground', | backgroundColor: 'panelBackground', | ||||
flex: 1, | flex: 1, | ||||
}, | }, | ||||
flatList: { | flatList: { | ||||
▲ Show 20 Lines • Show All 153 Lines • Show Last 20 Lines |