@@ -291,42 +291,49 @@ public struct ArticleScreen: View {
291291 }
292292
293293 HStack ( alignment: . bottom, spacing: 8 ) {
294- TextField ( " Message " , text: $store. commentText. removeDuplicates ( ) , axis: . vertical)
295- . font ( . subheadline)
296- . foregroundStyle ( Color . Labels. primary)
297- . lineLimit ( 1 ... 10 )
298- . focused ( $focus, equals: ArticleFeature . State. Field. comment)
299- . padding ( . horizontal, 8 )
300- . padding ( . vertical, 7 )
301- . background ( Color . Background. teritary)
302- . clipShape ( RoundedRectangle ( cornerRadius: 18 ) )
303- . overlay {
304- RoundedRectangle ( cornerRadius: 18 )
305- . stroke ( Color . Separator. secondary, lineWidth: 0.33 )
294+ TextField ( text: $store. commentText. removeDuplicates ( ) ) {
295+ Text ( " Comment... " , bundle: . module)
296+ . font ( . subheadline)
297+ . foregroundStyle ( Color . Labels. quintuple)
298+ }
299+ . font ( . subheadline)
300+ . foregroundStyle ( Color . Labels. primary)
301+ . lineLimit ( 1 ... 10 )
302+ . focused ( $focus, equals: ArticleFeature . State. Field. comment)
303+ . padding ( . horizontal, 8 )
304+ . padding ( . vertical, 7 )
305+ . background ( Color . Background. teritary)
306+ . clipShape ( RoundedRectangle ( cornerRadius: 18 ) )
307+ . overlay {
308+ RoundedRectangle ( cornerRadius: 18 )
309+ . stroke ( Color . Separator. secondary, lineWidth: 0.33 )
306310 }
307311
308- Button {
309- store. send ( . sendCommentButtonTapped)
310- } label: {
311- ZStack {
312- Circle ( )
313- . fill ( tintColor)
314-
315- if store. isUploadingComment {
316- ProgressView ( )
317- . progressViewStyle ( . circular)
318- . tint ( Color . Labels. primaryInvariably)
319- } else {
320- Image ( systemSymbol: . arrowUp)
321- . font ( . body)
322- . fontWeight ( . medium)
323- . foregroundStyle ( Color . Labels. primaryInvariably)
312+ if !store. commentText. isEmpty {
313+ Button {
314+ store. send ( . sendCommentButtonTapped)
315+ } label: {
316+ ZStack {
317+ Circle ( )
318+ . fill ( tintColor)
319+
320+ if store. isUploadingComment {
321+ ProgressView ( )
322+ . progressViewStyle ( . circular)
323+ . tint ( Color . Labels. primaryInvariably)
324+ } else {
325+ Image ( systemSymbol: . arrowUp)
326+ . font ( . body)
327+ . fontWeight ( . medium)
328+ . foregroundStyle ( Color . Labels. primaryInvariably)
329+ }
324330 }
331+ . frame ( width: 34 , height: 34 )
325332 }
326- . frame ( width : 34 , height : 34 )
333+ . disabled ( store . isUploadingComment )
327334 }
328- . disabled ( store. isUploadingComment)
329335 }
336+ . animation ( . default, value: store. commentText. isEmpty)
330337 }
331338 . padding ( . horizontal, 12 )
332339 . padding ( . top, 8 )
@@ -491,7 +498,9 @@ extension UIApplication {
491498}
492499
493500#Preview( " Test comments " ) {
494- NavigationStack {
501+ @Shared ( . userSession) var userSession
502+ userSession = UserSession ( userId: 1 , token: " 1 " , isHidden: false )
503+ return NavigationStack {
495504 ArticleScreen (
496505 store: Store (
497506 initialState: ArticleFeature . State (
0 commit comments