Skip to content

Commit

Permalink
Merge pull request #385 from SquareTable/383-add-page-to-see-members-…
Browse files Browse the repository at this point in the history
…in-a-category

Added CategoryMemberViewPage
  • Loading branch information
Sebastian-Webster authored Feb 4, 2024
2 parents c37b953 + 795de32 commit db44244
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 28 deletions.
4 changes: 4 additions & 0 deletions navigation/StackNavigator.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ import PrivacySettings from "../screens/PrivacySettings.js";
import LoginActivitySettings from "../screens/SecuritySettingsScreens/LoginActivitySettings.js";
import PostUpvoteDownvoteActivity from "../screens/ActivityScreens/PostUpvoteDownvoteActivity.js";
import VotesViewPage from "../screens/VotesViewPage.js";
import CategoryMemberViewPage from "../screens/CategoryMemberViewPage.js";


const Stack = createStackNavigator();
Expand Down Expand Up @@ -138,6 +139,7 @@ const RootStack = () => {
<Stack.Screen name="ThreadViewPage" component={ThreadViewPage}/>
<Stack.Screen name="EditProfile" component={EditProfile}/>
<Stack.Screen name="CategoryViewPage" component={CategoryViewPage}/>
<Stack.Screen name="CategoryMemberViewPage" component={CategoryMemberViewPage}/>
<Stack.Screen name="ProfilePages" component={ProfilePages}/>
<Stack.Screen name="VotesViewPage" component={VotesViewPage}/>
</Stack.Group>
Expand Down Expand Up @@ -166,6 +168,7 @@ const FindScreen_Stack = () => {
<Stack.Screen name="AccountBadges" component={AccountBadges}/>
<Stack.Screen name="BadgeInfo" component={BadgeInfo}/>
<Stack.Screen name="CategoryViewPage" component={CategoryViewPage}/>
<Stack.Screen name="CategoryMemberViewPage" component={CategoryMemberViewPage}/>
<Stack.Screen name="SelectCategorySearchScreen" component={SelectCategorySearchScreen}/>
<Stack.Screen name="ViewImagePostPage" component={ViewImagePostPage}/>
<Stack.Screen name="ViewPollPostPage" component={ViewPollPostPage}/>
Expand Down Expand Up @@ -204,6 +207,7 @@ const HomeScreenStack = () => {
<Stack.Screen name="ThreadViewPage" component={ThreadViewPage}/>
<Stack.Screen name="ProfilePages" component={ProfilePages}/>
<Stack.Screen name="CategoryViewPage" component={CategoryViewPage}/>
<Stack.Screen name="CategoryMemberViewPage" component={CategoryMemberViewPage}/>
<Stack.Screen name="VotesViewPage" component={VotesViewPage}/>
<Stack.Screen name="ProfileStats" component={ProfileStats}/>
<Stack.Screen name="BadgeInfo" component={BadgeInfo}/>
Expand Down
35 changes: 35 additions & 0 deletions screens/CategoryMemberViewPage.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import ItemAutoList from '../components/ItemAutoList';
import TopNavBar from '../components/TopNavBar';
import UserItem from '../components/Users/UserItem';
import useItemReducer from '../hooks/useItemReducer';

export default function CategoryMemberViewPage({route}) {
const {categoryId} = route.params;
const [state, dispatch] = useItemReducer();
return (
<>
<TopNavBar screenName="Members"/>
<ItemAutoList
url="/tempRoute/getcategorymembers"
centreIfNoItems={true}
noItemsFoundText="This category has no members."
noMoreItemsText="There are no more category members to show."
extraPOSTData={{
categoryId
}}
extraProps={{
getItemLayout: (data, index) => {
return {
length: 70,
offset: 70 * index,
index
}
}
}}
DisplayComponent={UserItem}
state={state}
dispatch={dispatch}
/>
</>
)
}
58 changes: 30 additions & 28 deletions screens/CategoryViewPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -397,34 +397,36 @@ const CategoryViewPage = ({route, navigation}) => {
) : null}
<ProfileHorizontalView>
<ProfileHorizontalViewItem profLeftIcon={true}>
<SubTitle style={{color: colors.tertiary}} welcome={true}> Members </SubTitle>
<ProfIcons style={{tintColor: colors.tertiary}} source={require('./../assets/icomoon-icons/IcoMoon-Free-master/PNG/64px/115-users.png')}/>
{initialInCategory == true && (
<View>
{inCategory == true && (
<SubTitle welcome={true} style={{marginBottom: 0, color: colors.tertiary}}> {members} </SubTitle>
)}
{inCategory == false && (
<SubTitle welcome={true} style={{marginBottom: 0, color: colors.tertiary}}> {members-1} </SubTitle>
)}
</View>
)}
{initialInCategory == false && (
<View>
{inCategory == true && (
<SubTitle welcome={true} style={{marginBottom: 0, color: colors.tertiary}}> {members+1} </SubTitle>
)}
{inCategory == false && (
<SubTitle welcome={true} style={{marginBottom: 0, color: colors.tertiary}}> {members} </SubTitle>
)}
</View>
)}
<TouchableOpacity style={{height: 30, width: '80%', backgroundColor: dark ? colors.darkLight : colors.borderColor, borderRadius: 10, justifyContent: 'center', alignItems: 'center', marginVertical: 5}} onPress={JoinLeaveCategory}>
{typeof inCategory === "boolean" ?
<Text style={{fontSize: 20, color: colors.tertiary}}>{inCategory ? 'Leave' : 'Join'}</Text>
: inCategory === "Changing" || inCategory === "Finding" ?
<ActivityIndicator size="small" color={colors.brand}/>
: null}
<TouchableOpacity onPress={() => navigation.navigate('CategoryMemberViewPage', {categoryId})} style={{width: '100%', alignItems: 'center'}}>
<SubTitle style={{color: colors.tertiary}} welcome={true}> Members </SubTitle>
<ProfIcons style={{tintColor: colors.tertiary}} source={require('./../assets/icomoon-icons/IcoMoon-Free-master/PNG/64px/115-users.png')}/>
{initialInCategory == true && (
<View>
{inCategory == true && (
<SubTitle welcome={true} style={{marginBottom: 0, color: colors.tertiary}}> {members} </SubTitle>
)}
{inCategory == false && (
<SubTitle welcome={true} style={{marginBottom: 0, color: colors.tertiary}}> {members-1} </SubTitle>
)}
</View>
)}
{initialInCategory == false && (
<View>
{inCategory == true && (
<SubTitle welcome={true} style={{marginBottom: 0, color: colors.tertiary}}> {members+1} </SubTitle>
)}
{inCategory == false && (
<SubTitle welcome={true} style={{marginBottom: 0, color: colors.tertiary}}> {members} </SubTitle>
)}
</View>
)}
<TouchableOpacity style={{height: 30, width: '80%', backgroundColor: dark ? colors.darkLight : colors.borderColor, borderRadius: 10, justifyContent: 'center', alignItems: 'center', marginVertical: 5}} onPress={JoinLeaveCategory}>
{typeof inCategory === "boolean" ?
<Text style={{fontSize: 20, color: colors.tertiary}}>{inCategory ? 'Leave' : 'Join'}</Text>
: inCategory === "Changing" || inCategory === "Finding" ?
<ActivityIndicator size="small" color={colors.brand}/>
: null}
</TouchableOpacity>
</TouchableOpacity>
</ProfileHorizontalViewItem>
<ProfileHorizontalViewItem profCenterIcon={true}>
Expand Down

0 comments on commit db44244

Please sign in to comment.