Skip to content
This repository has been archived by the owner on Aug 20, 2024. It is now read-only.

Commit

Permalink
ThreadScreen: Show thread title in top app bar
Browse files Browse the repository at this point in the history
Signed-off-by: Aayush Gupta <[email protected]>
  • Loading branch information
theimpulson committed Aug 27, 2023
1 parent cb0a182 commit a3ee547
Showing 1 changed file with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package io.aayush.relabs.ui.screens.thread

import androidx.compose.foundation.Image
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.lazy.LazyColumn
Expand All @@ -18,14 +16,13 @@ import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
import androidx.hilt.navigation.compose.hiltViewModel
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import androidx.navigation.NavHostController
import io.aayush.relabs.R
import io.aayush.relabs.network.data.post.Post
import io.aayush.relabs.network.data.thread.ThreadInfo
import io.aayush.relabs.ui.components.PostItem

@Composable
Expand All @@ -39,11 +36,19 @@ fun ThreadScreen(
viewModel.getThreadInfo(threadID)
}

val threadInfo: ThreadInfo by viewModel.threadInfo.collectAsStateWithLifecycle()

Scaffold(
modifier = Modifier.fillMaxSize(),
topBar = {
TopAppBar(
title = { Text(text = stringResource(id = R.string.thread)) },
title = {
Text(
text = threadInfo.thread.title,
maxLines = 1,
overflow = TextOverflow.Ellipsis
)
},
navigationIcon = {
IconButton(onClick = { navHostController.navigateUp() }) {
Icon(
Expand Down

0 comments on commit a3ee547

Please sign in to comment.