Fix empty states for scene members and memberships
parent
829fa175d0
commit
23fd43e306
|
@ -42,7 +42,7 @@ export class MembersViewModel {
|
||||||
}
|
}
|
||||||
|
|
||||||
get hasContent() {
|
get hasContent() {
|
||||||
return this.subject.did !== ''
|
return this.members.length !== 0
|
||||||
}
|
}
|
||||||
|
|
||||||
get hasError() {
|
get hasError() {
|
||||||
|
|
|
@ -17,7 +17,12 @@ export class MembershipsViewModel {
|
||||||
params: GetMemberships.QueryParams
|
params: GetMemberships.QueryParams
|
||||||
|
|
||||||
// data
|
// data
|
||||||
subject: Subject = {did: '', handle: '', displayName: ''}
|
subject: Subject = {
|
||||||
|
did: '',
|
||||||
|
handle: '',
|
||||||
|
displayName: '',
|
||||||
|
declaration: {cid: '', actorType: ''},
|
||||||
|
}
|
||||||
memberships: MembershipItem[] = []
|
memberships: MembershipItem[] = []
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
|
@ -36,7 +41,7 @@ export class MembershipsViewModel {
|
||||||
}
|
}
|
||||||
|
|
||||||
get hasContent() {
|
get hasContent() {
|
||||||
return this.subject.did !== ''
|
return this.memberships.length !== 0
|
||||||
}
|
}
|
||||||
|
|
||||||
get hasError() {
|
get hasError() {
|
||||||
|
|
|
@ -137,15 +137,8 @@ export const Profile = observer(({visible, params}: ScreenParams) => {
|
||||||
if (uiState.profile.isScene) {
|
if (uiState.profile.isScene) {
|
||||||
renderItem = () => (
|
renderItem = () => (
|
||||||
<View style={styles.emptyContainer}>
|
<View style={styles.emptyContainer}>
|
||||||
<View style={{flexDirection: 'row'}}>
|
<View style={styles.emptyIconContainer}>
|
||||||
<UserGroupIcon
|
<UserGroupIcon size="64" style={styles.emptyIcon} />
|
||||||
size="64"
|
|
||||||
style={{
|
|
||||||
marginLeft: 'auto',
|
|
||||||
marginRight: 'auto',
|
|
||||||
color: colors.gray3,
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</View>
|
</View>
|
||||||
<Text style={styles.emptyText}>
|
<Text style={styles.emptyText}>
|
||||||
As members upvote posts, they will trend here. Follow the
|
As members upvote posts, they will trend here. Follow the
|
||||||
|
@ -171,7 +164,16 @@ export const Profile = observer(({visible, params}: ScreenParams) => {
|
||||||
}
|
}
|
||||||
} else if (uiState.memberships.isEmpty) {
|
} else if (uiState.memberships.isEmpty) {
|
||||||
items.push(EMPTY_ITEM)
|
items.push(EMPTY_ITEM)
|
||||||
renderItem = () => <Text style={styles.loading}>No scenes yet!</Text>
|
renderItem = () => (
|
||||||
|
<View style={styles.emptyContainer}>
|
||||||
|
<View style={styles.emptyIconContainer}>
|
||||||
|
<UserGroupIcon size="64" style={styles.emptyIcon} />
|
||||||
|
</View>
|
||||||
|
<Text style={styles.emptyText}>
|
||||||
|
This user hasn't joined any scenes.
|
||||||
|
</Text>
|
||||||
|
</View>
|
||||||
|
)
|
||||||
}
|
}
|
||||||
} else if (uiState.selectedView === Sections.Members) {
|
} else if (uiState.selectedView === Sections.Members) {
|
||||||
if (uiState.members.hasContent) {
|
if (uiState.members.hasContent) {
|
||||||
|
@ -202,7 +204,16 @@ export const Profile = observer(({visible, params}: ScreenParams) => {
|
||||||
}
|
}
|
||||||
} else if (uiState.members.isEmpty) {
|
} else if (uiState.members.isEmpty) {
|
||||||
items.push(EMPTY_ITEM)
|
items.push(EMPTY_ITEM)
|
||||||
renderItem = () => <Text style={styles.loading}>No members yet!</Text>
|
renderItem = () => (
|
||||||
|
<View style={styles.emptyContainer}>
|
||||||
|
<View style={styles.emptyIconContainer}>
|
||||||
|
<UserGroupIcon size="64" style={styles.emptyIcon} />
|
||||||
|
</View>
|
||||||
|
<Text style={styles.emptyText}>
|
||||||
|
This scene doesn't have any members.
|
||||||
|
</Text>
|
||||||
|
</View>
|
||||||
|
)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
items.push(EMPTY_ITEM)
|
items.push(EMPTY_ITEM)
|
||||||
|
@ -260,6 +271,14 @@ const styles = StyleSheet.create({
|
||||||
paddingVertical: 20,
|
paddingVertical: 20,
|
||||||
paddingHorizontal: 36,
|
paddingHorizontal: 36,
|
||||||
},
|
},
|
||||||
|
emptyIconContainer: {
|
||||||
|
flexDirection: 'row',
|
||||||
|
},
|
||||||
|
emptyIcon: {
|
||||||
|
marginLeft: 'auto',
|
||||||
|
marginRight: 'auto',
|
||||||
|
color: colors.gray3,
|
||||||
|
},
|
||||||
emptyText: {
|
emptyText: {
|
||||||
textAlign: 'center',
|
textAlign: 'center',
|
||||||
color: colors.gray5,
|
color: colors.gray5,
|
||||||
|
|
Loading…
Reference in New Issue