Skip to content

Commit 092067c

Browse files
committed
chore(token/info): disable expanding info for now
Signed-off-by: Brandon McAnsh <[email protected]>
1 parent f0b685c commit 092067c

File tree

2 files changed

+78
-59
lines changed

2 files changed

+78
-59
lines changed

apps/flipcash/features/tokens/src/main/kotlin/com/flipcash/app/tokens/internal/TokenInfoScreen.kt

Lines changed: 26 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,7 @@ private fun TokenInfoScreen(
113113
modifier = Modifier
114114
.fillParentMaxWidth()
115115
.padding(horizontal = CodeTheme.dimens.inset)
116-
.padding(
117-
top = CodeTheme.dimens.grid.x5,
118-
),
116+
.padding(top = CodeTheme.dimens.grid.x5),
119117
buttonState = ButtonState.Filled10,
120118
text = stringResource(R.string.action_viewTransactionHistory),
121119
) {
@@ -127,11 +125,24 @@ private fun TokenInfoScreen(
127125
}
128126

129127
Divider(
130-
modifier = Modifier.padding(vertical = CodeTheme.dimens.grid.x5),
128+
modifier = Modifier.padding(
129+
horizontal = CodeTheme.dimens.inset,
130+
vertical = CodeTheme.dimens.grid.x5
131+
),
131132
color = CodeTheme.colors.dividerVariant,
132133
)
133134
}
134135

136+
// currency info
137+
item {
138+
CurrencyInfoSection(
139+
modifier = Modifier
140+
.fillParentMaxWidth(),
141+
state = state,
142+
dispatch = dispatch
143+
)
144+
}
145+
135146
// market cap
136147
state.marketCap?.let { mcap ->
137148
item {
@@ -143,16 +154,6 @@ private fun TokenInfoScreen(
143154
)
144155
}
145156
}
146-
147-
// currency info
148-
item {
149-
CurrencyInfoSection(
150-
modifier = Modifier
151-
.fillParentMaxWidth(),
152-
state = state,
153-
dispatch = dispatch
154-
)
155-
}
156157
}
157158
}
158159
}
@@ -169,10 +170,7 @@ private fun TokenBalance(
169170
Column(
170171
modifier = modifier
171172
.padding(horizontal = CodeTheme.dimens.inset)
172-
.padding(
173-
top = CodeTheme.dimens.grid.x9,
174-
bottom = CodeTheme.dimens.grid.x9,
175-
),
173+
.padding(vertical = CodeTheme.dimens.grid.x9,),
176174
) {
177175
if (balance == null) {
178176
Box(modifier = Modifier.fillMaxWidth(), contentAlignment = Alignment.Center) {
@@ -261,10 +259,19 @@ private fun CurrencyInfoSection(
261259
text = state.token?.description.orEmpty(),
262260
style = CodeTheme.typography.textMedium,
263261
isExpanded = state.descriptionExpanded,
262+
isExpandable = false,
264263
contentPadding = PaddingValues(horizontal = CodeTheme.dimens.inset)
265264
) {
266265
dispatch(TokenInfoViewModel.Event.ExpandDescription(!state.descriptionExpanded))
267266
}
267+
268+
Divider(
269+
modifier = Modifier.padding(
270+
horizontal = CodeTheme.dimens.inset,
271+
vertical = CodeTheme.dimens.grid.x5
272+
),
273+
color = CodeTheme.colors.dividerVariant,
274+
)
268275
}
269276
}
270277

@@ -305,6 +312,7 @@ private fun PreviewTokenInfo() {
305312
contentPadding = PaddingValues(horizontal = 16.dp),
306313
style = CodeTheme.typography.textMedium,
307314
isExpanded = false,
315+
isExpandable = false,
308316
onToggle = { }
309317
)
310318
}

ui/components/src/main/kotlin/com/getcode/ui/components/text/ExpandableText.kt

Lines changed: 52 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -39,66 +39,77 @@ fun ExpandableText(
3939
isExpanded: Boolean,
4040
modifier: Modifier = Modifier,
4141
textModifier: Modifier = Modifier,
42+
isExpandable: Boolean = true,
4243
contentPadding: PaddingValues = PaddingValues(0.dp),
4344
collapsedMaxLines: Int = 4,
4445
onToggle: () -> Unit,
4546
) {
4647
var hasOverflow by remember(text) { mutableStateOf(false) }
4748

48-
Box(modifier = modifier.animateContentSize()) {
49-
Column {
50-
if (isExpanded) {
51-
Text(
52-
modifier = textModifier
53-
.padding(contentPadding),
54-
text = text,
55-
style = style,
56-
color = CodeTheme.colors.textSecondary,
57-
)
58-
} else {
59-
Box {
49+
Box(modifier = modifier) {
50+
if (!isExpandable) {
51+
Text(
52+
modifier = textModifier
53+
.padding(contentPadding),
54+
text = text,
55+
style = style,
56+
color = CodeTheme.colors.textSecondary,
57+
)
58+
} else {
59+
Column(Modifier.animateContentSize()) {
60+
if (isExpanded) {
6061
Text(
6162
modifier = textModifier
6263
.padding(contentPadding),
6364
text = text,
64-
overflow = TextOverflow.Clip,
6565
style = style,
6666
color = CodeTheme.colors.textSecondary,
67-
onTextLayout = { textLayoutResult ->
68-
hasOverflow = textLayoutResult.hasVisualOverflow
69-
},
70-
maxLines = collapsedMaxLines
7167
)
68+
} else {
69+
Box {
70+
Text(
71+
modifier = textModifier
72+
.padding(contentPadding),
73+
text = text,
74+
overflow = TextOverflow.Clip,
75+
style = style,
76+
color = CodeTheme.colors.textSecondary,
77+
onTextLayout = { textLayoutResult ->
78+
hasOverflow = textLayoutResult.hasVisualOverflow
79+
},
80+
maxLines = collapsedMaxLines
81+
)
7282

73-
if (hasOverflow) {
74-
Box(
75-
modifier = Modifier
76-
.matchParentSize()
77-
.align(Alignment.BottomCenter)
78-
.drawWithGradient(
79-
color = CodeTheme.colors.background,
80-
startY = { 0f },
81-
endY = { size.height }
83+
if (hasOverflow) {
84+
Box(
85+
modifier = Modifier
86+
.matchParentSize()
87+
.align(Alignment.BottomCenter)
88+
.drawWithGradient(
89+
color = CodeTheme.colors.background,
90+
startY = { 0f },
91+
endY = { size.height }
8292

83-
)
84-
)
93+
)
94+
)
95+
}
8596
}
8697
}
87-
}
8898

89-
if (hasOverflow) {
90-
Surface(
91-
modifier = Modifier
92-
.fillMaxWidth()
93-
.padding(vertical = CodeTheme.dimens.grid.x1),
94-
color = Color.Transparent
95-
) {
96-
ExpandVisibilityButton(
97-
isExpanded = isExpanded,
99+
if (hasOverflow) {
100+
Surface(
98101
modifier = Modifier
99-
.padding(contentPadding),
100-
onToggle = onToggle
101-
)
102+
.fillMaxWidth()
103+
.padding(vertical = CodeTheme.dimens.grid.x1),
104+
color = Color.Transparent
105+
) {
106+
ExpandVisibilityButton(
107+
isExpanded = isExpanded,
108+
modifier = Modifier
109+
.padding(contentPadding),
110+
onToggle = onToggle
111+
)
112+
}
102113
}
103114
}
104115
}

0 commit comments

Comments
 (0)