mirror of
https://github.com/LiveFastEatTrashRaccoon/RaccoonForLemmy.git
synced 2025-02-10 06:30:39 +01:00
enhancement: remove comment horizontal padding (#1003)
This commit is contained in:
parent
708bc2473c
commit
e2e22029cf
@ -427,10 +427,7 @@ object ProfileLoggedScreen : Tab {
|
|||||||
key = { it.id.toString() + (it.updateDate ?: it.publishDate) },
|
key = { it.id.toString() + (it.updateDate ?: it.publishDate) },
|
||||||
) { comment ->
|
) { comment ->
|
||||||
CommentCard(
|
CommentCard(
|
||||||
modifier =
|
modifier = Modifier.background(MaterialTheme.colorScheme.background),
|
||||||
Modifier
|
|
||||||
.background(MaterialTheme.colorScheme.background)
|
|
||||||
.padding(horizontal = Spacing.xs),
|
|
||||||
comment = comment,
|
comment = comment,
|
||||||
voteFormat = uiState.voteFormat,
|
voteFormat = uiState.voteFormat,
|
||||||
autoLoadImages = uiState.autoLoadImages,
|
autoLoadImages = uiState.autoLoadImages,
|
||||||
|
@ -170,38 +170,40 @@ class UserDetailScreen(
|
|||||||
val clipboardManager = LocalClipboardManager.current
|
val clipboardManager = LocalClipboardManager.current
|
||||||
|
|
||||||
LaunchedEffect(model) {
|
LaunchedEffect(model) {
|
||||||
model.effects.onEach { effect ->
|
model.effects
|
||||||
when (effect) {
|
.onEach { effect ->
|
||||||
is UserDetailMviModel.Effect.Error -> {
|
when (effect) {
|
||||||
snackbarHostState.showSnackbar(effect.message ?: genericError)
|
is UserDetailMviModel.Effect.Error -> {
|
||||||
}
|
snackbarHostState.showSnackbar(effect.message ?: genericError)
|
||||||
|
}
|
||||||
|
|
||||||
UserDetailMviModel.Effect.Success -> {
|
UserDetailMviModel.Effect.Success -> {
|
||||||
snackbarHostState.showSnackbar(successMessage)
|
snackbarHostState.showSnackbar(successMessage)
|
||||||
}
|
}
|
||||||
|
|
||||||
UserDetailMviModel.Effect.BackToTop -> {
|
UserDetailMviModel.Effect.BackToTop -> {
|
||||||
scope.launch {
|
scope.launch {
|
||||||
runCatching {
|
runCatching {
|
||||||
lazyListState.scrollToItem(0)
|
lazyListState.scrollToItem(0)
|
||||||
topAppBarState.heightOffset = 0f
|
topAppBarState.heightOffset = 0f
|
||||||
topAppBarState.contentOffset = 0f
|
topAppBarState.contentOffset = 0f
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
is UserDetailMviModel.Effect.TriggerCopy -> {
|
is UserDetailMviModel.Effect.TriggerCopy -> {
|
||||||
clipboardManager.setText(AnnotatedString(text = effect.text))
|
clipboardManager.setText(AnnotatedString(text = effect.text))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}.launchIn(this)
|
||||||
}.launchIn(this)
|
|
||||||
}
|
}
|
||||||
LaunchedEffect(navigationCoordinator) {
|
LaunchedEffect(navigationCoordinator) {
|
||||||
navigationCoordinator.globalMessage.onEach { message ->
|
navigationCoordinator.globalMessage
|
||||||
snackbarHostState.showSnackbar(
|
.onEach { message ->
|
||||||
message = message,
|
snackbarHostState.showSnackbar(
|
||||||
)
|
message = message,
|
||||||
}.launchIn(this)
|
)
|
||||||
|
}.launchIn(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
Scaffold(
|
Scaffold(
|
||||||
@ -210,9 +212,10 @@ class UserDetailScreen(
|
|||||||
val userName = uiState.user.readableName(uiState.preferNicknames)
|
val userName = uiState.user.readableName(uiState.preferNicknames)
|
||||||
val maxTopInset = Dimensions.maxTopBarInset.toLocalPixel()
|
val maxTopInset = Dimensions.maxTopBarInset.toLocalPixel()
|
||||||
var topInset by remember { mutableStateOf(maxTopInset) }
|
var topInset by remember { mutableStateOf(maxTopInset) }
|
||||||
snapshotFlow { topAppBarState.collapsedFraction }.onEach {
|
snapshotFlow { topAppBarState.collapsedFraction }
|
||||||
topInset = maxTopInset * (1 - it)
|
.onEach {
|
||||||
}.launchIn(scope)
|
topInset = maxTopInset * (1 - it)
|
||||||
|
}.launchIn(scope)
|
||||||
|
|
||||||
TopAppBar(
|
TopAppBar(
|
||||||
windowInsets =
|
windowInsets =
|
||||||
@ -298,13 +301,14 @@ class UserDetailScreen(
|
|||||||
var optionsOffset by remember { mutableStateOf(Offset.Zero) }
|
var optionsOffset by remember { mutableStateOf(Offset.Zero) }
|
||||||
Image(
|
Image(
|
||||||
modifier =
|
modifier =
|
||||||
Modifier.onGloballyPositioned {
|
Modifier
|
||||||
optionsOffset = it.positionInParent()
|
.onGloballyPositioned {
|
||||||
}.onClick(
|
optionsOffset = it.positionInParent()
|
||||||
onClick = {
|
}.onClick(
|
||||||
optionsExpanded = true
|
onClick = {
|
||||||
},
|
optionsExpanded = true
|
||||||
),
|
},
|
||||||
|
),
|
||||||
imageVector = Icons.Default.MoreVert,
|
imageVector = Icons.Default.MoreVert,
|
||||||
contentDescription = null,
|
contentDescription = null,
|
||||||
colorFilter = ColorFilter.tint(MaterialTheme.colorScheme.onBackground),
|
colorFilter = ColorFilter.tint(MaterialTheme.colorScheme.onBackground),
|
||||||
@ -355,7 +359,8 @@ class UserDetailScreen(
|
|||||||
}
|
}
|
||||||
|
|
||||||
OptionId.ExploreInstance -> {
|
OptionId.ExploreInstance -> {
|
||||||
val screen = ExploreScreen(otherInstance = uiState.user.host)
|
val screen =
|
||||||
|
ExploreScreen(otherInstance = uiState.user.host)
|
||||||
navigationCoordinator.pushScreen(screen)
|
navigationCoordinator.pushScreen(screen)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -462,15 +467,13 @@ class UserDetailScreen(
|
|||||||
Modifier
|
Modifier
|
||||||
.padding(
|
.padding(
|
||||||
top = padding.calculateTopPadding(),
|
top = padding.calculateTopPadding(),
|
||||||
)
|
).then(
|
||||||
.then(
|
|
||||||
if (settings.hideNavigationBarWhileScrolling) {
|
if (settings.hideNavigationBarWhileScrolling) {
|
||||||
Modifier.nestedScroll(scrollBehavior.nestedScrollConnection)
|
Modifier.nestedScroll(scrollBehavior.nestedScrollConnection)
|
||||||
} else {
|
} else {
|
||||||
Modifier
|
Modifier
|
||||||
},
|
},
|
||||||
)
|
).nestedScroll(fabNestedScrollConnection)
|
||||||
.nestedScroll(fabNestedScrollConnection)
|
|
||||||
.pullRefresh(pullRefreshState),
|
.pullRefresh(pullRefreshState),
|
||||||
) {
|
) {
|
||||||
LazyColumn(
|
LazyColumn(
|
||||||
@ -535,7 +538,7 @@ class UserDetailScreen(
|
|||||||
if (uiState.posts.isEmpty() && uiState.loading && uiState.initial) {
|
if (uiState.posts.isEmpty() && uiState.loading && uiState.initial) {
|
||||||
items(5) {
|
items(5) {
|
||||||
PostCardPlaceholder(
|
PostCardPlaceholder(
|
||||||
modifier = Modifier.padding(horizontal = Spacing.s),
|
modifier = Modifier.padding(horizontal = Spacing.xs),
|
||||||
postLayout = uiState.postLayout,
|
postLayout = uiState.postLayout,
|
||||||
)
|
)
|
||||||
if (uiState.postLayout != PostLayout.Card) {
|
if (uiState.postLayout != PostLayout.Card) {
|
||||||
@ -592,7 +595,9 @@ class UserDetailScreen(
|
|||||||
onTriggered =
|
onTriggered =
|
||||||
rememberCallback {
|
rememberCallback {
|
||||||
model.reduce(
|
model.reduce(
|
||||||
UserDetailMviModel.Intent.DownVotePost(post.id),
|
UserDetailMviModel.Intent.DownVotePost(
|
||||||
|
post.id,
|
||||||
|
),
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
@ -661,7 +666,6 @@ class UserDetailScreen(
|
|||||||
},
|
},
|
||||||
content = {
|
content = {
|
||||||
PostCard(
|
PostCard(
|
||||||
modifier = Modifier.padding(horizontal = Spacing.s),
|
|
||||||
post = post,
|
post = post,
|
||||||
hideAuthor = true,
|
hideAuthor = true,
|
||||||
postLayout = uiState.postLayout,
|
postLayout = uiState.postLayout,
|
||||||
@ -879,7 +883,7 @@ class UserDetailScreen(
|
|||||||
if (uiState.comments.isEmpty() && uiState.loading && uiState.initial) {
|
if (uiState.comments.isEmpty() && uiState.loading && uiState.initial) {
|
||||||
items(5) {
|
items(5) {
|
||||||
CommentCardPlaceholder(
|
CommentCardPlaceholder(
|
||||||
modifier = Modifier.padding(horizontal = Spacing.s),
|
modifier = Modifier.padding(horizontal = Spacing.xs),
|
||||||
)
|
)
|
||||||
HorizontalDivider(
|
HorizontalDivider(
|
||||||
modifier = Modifier.padding(vertical = Spacing.xxxs),
|
modifier = Modifier.padding(vertical = Spacing.xxxs),
|
||||||
@ -910,7 +914,9 @@ class UserDetailScreen(
|
|||||||
onTriggered =
|
onTriggered =
|
||||||
rememberCallback {
|
rememberCallback {
|
||||||
model.reduce(
|
model.reduce(
|
||||||
UserDetailMviModel.Intent.UpVoteComment(comment.id),
|
UserDetailMviModel.Intent.UpVoteComment(
|
||||||
|
comment.id,
|
||||||
|
),
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
@ -977,7 +983,9 @@ class UserDetailScreen(
|
|||||||
onTriggered =
|
onTriggered =
|
||||||
rememberCallback {
|
rememberCallback {
|
||||||
model.reduce(
|
model.reduce(
|
||||||
UserDetailMviModel.Intent.SaveComment(comment.id),
|
UserDetailMviModel.Intent.SaveComment(
|
||||||
|
comment.id,
|
||||||
|
),
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
@ -1007,10 +1015,7 @@ class UserDetailScreen(
|
|||||||
},
|
},
|
||||||
content = {
|
content = {
|
||||||
CommentCard(
|
CommentCard(
|
||||||
modifier =
|
modifier = Modifier.background(MaterialTheme.colorScheme.background),
|
||||||
Modifier
|
|
||||||
.padding(horizontal = Spacing.s)
|
|
||||||
.background(MaterialTheme.colorScheme.background),
|
|
||||||
comment = comment,
|
comment = comment,
|
||||||
voteFormat = uiState.voteFormat,
|
voteFormat = uiState.voteFormat,
|
||||||
autoLoadImages = uiState.autoLoadImages,
|
autoLoadImages = uiState.autoLoadImages,
|
||||||
@ -1064,7 +1069,11 @@ class UserDetailScreen(
|
|||||||
null
|
null
|
||||||
} else {
|
} else {
|
||||||
rememberCallback(model) {
|
rememberCallback(model) {
|
||||||
model.reduce(UserDetailMviModel.Intent.UpVoteComment(comment.id))
|
model.reduce(
|
||||||
|
UserDetailMviModel.Intent.UpVoteComment(
|
||||||
|
comment.id,
|
||||||
|
),
|
||||||
|
)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onDownVote =
|
onDownVote =
|
||||||
@ -1072,7 +1081,11 @@ class UserDetailScreen(
|
|||||||
null
|
null
|
||||||
} else {
|
} else {
|
||||||
rememberCallback(model) {
|
rememberCallback(model) {
|
||||||
model.reduce(UserDetailMviModel.Intent.DownVoteComment(comment.id))
|
model.reduce(
|
||||||
|
UserDetailMviModel.Intent.DownVoteComment(
|
||||||
|
comment.id,
|
||||||
|
),
|
||||||
|
)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onReply =
|
onReply =
|
||||||
@ -1199,7 +1212,8 @@ class UserDetailScreen(
|
|||||||
} else {
|
} else {
|
||||||
Row(
|
Row(
|
||||||
modifier =
|
modifier =
|
||||||
Modifier.fillMaxWidth()
|
Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
.padding(top = Spacing.s),
|
.padding(top = Spacing.s),
|
||||||
horizontalArrangement = Arrangement.Center,
|
horizontalArrangement = Arrangement.Center,
|
||||||
) {
|
) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user