mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-07-13 01:36:43 +02:00
adds DVM picture and name to the top bar and the status feed.
This commit is contained in:
@ -188,7 +188,6 @@ private fun RenderTopRouteBar(
|
|||||||
Route.Settings.base -> TopBarWithBackButton(stringResource(id = R.string.application_preferences), navPopBack)
|
Route.Settings.base -> TopBarWithBackButton(stringResource(id = R.string.application_preferences), navPopBack)
|
||||||
Route.Bookmarks.base -> TopBarWithBackButton(stringResource(id = R.string.bookmarks), navPopBack)
|
Route.Bookmarks.base -> TopBarWithBackButton(stringResource(id = R.string.bookmarks), navPopBack)
|
||||||
Route.Drafts.base -> TopBarWithBackButton(stringResource(id = R.string.drafts), navPopBack)
|
Route.Drafts.base -> TopBarWithBackButton(stringResource(id = R.string.drafts), navPopBack)
|
||||||
Route.ContentDiscovery.base -> TopBarWithBackButton(stringResource(id = R.string.discover_content), navPopBack)
|
|
||||||
|
|
||||||
else -> {
|
else -> {
|
||||||
if (id != null) {
|
if (id != null) {
|
||||||
@ -200,6 +199,7 @@ private fun RenderTopRouteBar(
|
|||||||
Route.Hashtag.base -> HashTagTopBar(id, accountViewModel, navPopBack)
|
Route.Hashtag.base -> HashTagTopBar(id, accountViewModel, navPopBack)
|
||||||
Route.Geohash.base -> GeoHashTopBar(id, accountViewModel, navPopBack)
|
Route.Geohash.base -> GeoHashTopBar(id, accountViewModel, navPopBack)
|
||||||
Route.Note.base -> ThreadTopBar(id, accountViewModel, navPopBack)
|
Route.Note.base -> ThreadTopBar(id, accountViewModel, navPopBack)
|
||||||
|
Route.ContentDiscovery.base -> DvmTopBar(id, accountViewModel, nav, navPopBack)
|
||||||
else -> MainTopBar(drawerState, accountViewModel, nav)
|
else -> MainTopBar(drawerState, accountViewModel, nav)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -295,6 +295,35 @@ private fun RoomTopBar(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
private fun DvmTopBar(
|
||||||
|
id: String,
|
||||||
|
accountViewModel: AccountViewModel,
|
||||||
|
nav: (String) -> Unit,
|
||||||
|
navPopBack: () -> Unit,
|
||||||
|
) {
|
||||||
|
FlexibleTopBarWithBackButton(
|
||||||
|
title = {
|
||||||
|
LoadUser(baseUserHex = id, accountViewModel) { baseUser ->
|
||||||
|
if (baseUser != null) {
|
||||||
|
ClickableUserPicture(
|
||||||
|
baseUser = baseUser,
|
||||||
|
accountViewModel = accountViewModel,
|
||||||
|
size = Size34dp,
|
||||||
|
)
|
||||||
|
|
||||||
|
Spacer(modifier = DoubleHorzSpacer)
|
||||||
|
|
||||||
|
UsernameDisplay(baseUser, Modifier.weight(1f), fontWeight = FontWeight.Normal)
|
||||||
|
} else {
|
||||||
|
Spacer(BottomTopHeight)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
popBack = navPopBack,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun RoomByAuthorTopBar(
|
private fun RoomByAuthorTopBar(
|
||||||
id: String,
|
id: String,
|
||||||
|
@ -22,6 +22,7 @@ package com.vitorpamplona.amethyst.ui.screen.loggedIn
|
|||||||
|
|
||||||
import androidx.compose.foundation.layout.Arrangement
|
import androidx.compose.foundation.layout.Arrangement
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
|
import androidx.compose.foundation.layout.Spacer
|
||||||
import androidx.compose.foundation.layout.fillMaxHeight
|
import androidx.compose.foundation.layout.fillMaxHeight
|
||||||
import androidx.compose.foundation.layout.fillMaxSize
|
import androidx.compose.foundation.layout.fillMaxSize
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
@ -36,16 +37,23 @@ import androidx.compose.runtime.setValue
|
|||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
|
import androidx.compose.ui.text.font.FontWeight
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||||
import androidx.lifecycle.viewmodel.compose.viewModel
|
import androidx.lifecycle.viewmodel.compose.viewModel
|
||||||
import com.vitorpamplona.amethyst.R
|
import com.vitorpamplona.amethyst.R
|
||||||
import com.vitorpamplona.amethyst.model.Note
|
import com.vitorpamplona.amethyst.model.Note
|
||||||
|
import com.vitorpamplona.amethyst.ui.note.ClickableUserPicture
|
||||||
|
import com.vitorpamplona.amethyst.ui.note.LoadUser
|
||||||
|
import com.vitorpamplona.amethyst.ui.note.UsernameDisplay
|
||||||
import com.vitorpamplona.amethyst.ui.screen.FeedEmpty
|
import com.vitorpamplona.amethyst.ui.screen.FeedEmpty
|
||||||
import com.vitorpamplona.amethyst.ui.screen.NostrNIP90ContentDiscoveryFeedViewModel
|
import com.vitorpamplona.amethyst.ui.screen.NostrNIP90ContentDiscoveryFeedViewModel
|
||||||
import com.vitorpamplona.amethyst.ui.screen.RefresheableBox
|
import com.vitorpamplona.amethyst.ui.screen.RefresheableBox
|
||||||
import com.vitorpamplona.amethyst.ui.screen.RenderFeedState
|
import com.vitorpamplona.amethyst.ui.screen.RenderFeedState
|
||||||
import com.vitorpamplona.amethyst.ui.screen.SaveableFeedState
|
import com.vitorpamplona.amethyst.ui.screen.SaveableFeedState
|
||||||
|
import com.vitorpamplona.amethyst.ui.theme.DoubleVertSpacer
|
||||||
|
import com.vitorpamplona.amethyst.ui.theme.Size75dp
|
||||||
|
import com.vitorpamplona.quartz.encoders.HexKey
|
||||||
import com.vitorpamplona.quartz.events.NIP90ContentDiscoveryResponseEvent
|
import com.vitorpamplona.quartz.events.NIP90ContentDiscoveryResponseEvent
|
||||||
import com.vitorpamplona.quartz.events.NIP90StatusEvent
|
import com.vitorpamplona.quartz.events.NIP90StatusEvent
|
||||||
|
|
||||||
@ -84,7 +92,7 @@ fun NIP90ContentDiscoveryScreen(
|
|||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
// TODO: Make a good splash screen with loading animation for this DVM.
|
// TODO: Make a good splash screen with loading animation for this DVM.
|
||||||
FeedEmptywithStatus(stringResource(R.string.dvm_requesting_job))
|
FeedEmptywithStatus(dvmPublicKey, stringResource(R.string.dvm_requesting_job), accountViewModel, nav)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -141,11 +149,11 @@ fun ObserverDvmStatusResponse(
|
|||||||
if (latestStatus != null) {
|
if (latestStatus != null) {
|
||||||
// TODO: Make a good splash screen with loading animation for this DVM.
|
// TODO: Make a good splash screen with loading animation for this DVM.
|
||||||
latestStatus?.let {
|
latestStatus?.let {
|
||||||
FeedEmptywithStatus(it.content())
|
FeedEmptywithStatus(dvmPublicKey, it.content(), accountViewModel, nav)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// TODO: Make a good splash screen with loading animation for this DVM.
|
// TODO: Make a good splash screen with loading animation for this DVM.
|
||||||
FeedEmptywithStatus(stringResource(R.string.dvm_waiting_status))
|
FeedEmptywithStatus(dvmPublicKey, stringResource(R.string.dvm_waiting_status), accountViewModel, nav)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -201,7 +209,12 @@ fun RenderNostrNIP90ContentDiscoveryScreen(
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun FeedEmptywithStatus(status: String) {
|
fun FeedEmptywithStatus(
|
||||||
|
pubkey: HexKey,
|
||||||
|
status: String,
|
||||||
|
accountViewModel: AccountViewModel,
|
||||||
|
nav: (String) -> Unit,
|
||||||
|
) {
|
||||||
Column(
|
Column(
|
||||||
Modifier
|
Modifier
|
||||||
.fillMaxSize()
|
.fillMaxSize()
|
||||||
@ -209,6 +222,22 @@ fun FeedEmptywithStatus(status: String) {
|
|||||||
horizontalAlignment = Alignment.CenterHorizontally,
|
horizontalAlignment = Alignment.CenterHorizontally,
|
||||||
verticalArrangement = Arrangement.Center,
|
verticalArrangement = Arrangement.Center,
|
||||||
) {
|
) {
|
||||||
|
LoadUser(baseUserHex = pubkey, accountViewModel = accountViewModel) { baseUser ->
|
||||||
|
if (baseUser != null) {
|
||||||
|
ClickableUserPicture(
|
||||||
|
baseUser = baseUser,
|
||||||
|
accountViewModel = accountViewModel,
|
||||||
|
size = Size75dp,
|
||||||
|
)
|
||||||
|
|
||||||
|
Spacer(modifier = DoubleVertSpacer)
|
||||||
|
|
||||||
|
UsernameDisplay(baseUser, Modifier, fontWeight = FontWeight.Normal)
|
||||||
|
|
||||||
|
Spacer(modifier = DoubleVertSpacer)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Text(status)
|
Text(status)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user