mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-09-25 23:26:16 +02:00
add PollClosing component,
rename poll strings/values
This commit is contained in:
@@ -131,6 +131,7 @@ fun NewPollView(onClose: () -> Unit, baseReplyTo: Note? = null, quote: Note? = n
|
|||||||
Text(stringResource(R.string.poll_heading_optional))
|
Text(stringResource(R.string.poll_heading_optional))
|
||||||
PollVoteValueRange()
|
PollVoteValueRange()
|
||||||
PollConsensusThreshold()
|
PollConsensusThreshold()
|
||||||
|
PollClosing()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -0,0 +1,56 @@
|
|||||||
|
package com.vitorpamplona.amethyst.ui.components
|
||||||
|
|
||||||
|
import androidx.compose.foundation.layout.Arrangement
|
||||||
|
import androidx.compose.foundation.layout.Row
|
||||||
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
|
import androidx.compose.foundation.layout.width
|
||||||
|
import androidx.compose.foundation.text.KeyboardOptions
|
||||||
|
import androidx.compose.material.MaterialTheme
|
||||||
|
import androidx.compose.material.OutlinedTextField
|
||||||
|
import androidx.compose.material.Text
|
||||||
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.runtime.getValue
|
||||||
|
import androidx.compose.runtime.mutableStateOf
|
||||||
|
import androidx.compose.runtime.saveable.rememberSaveable
|
||||||
|
import androidx.compose.runtime.setValue
|
||||||
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.compose.ui.res.stringResource
|
||||||
|
import androidx.compose.ui.text.input.KeyboardType
|
||||||
|
import androidx.compose.ui.tooling.preview.Preview
|
||||||
|
import androidx.compose.ui.unit.dp
|
||||||
|
import com.vitorpamplona.amethyst.R
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun PollClosing() {
|
||||||
|
var text by rememberSaveable { mutableStateOf("") }
|
||||||
|
|
||||||
|
Row(
|
||||||
|
Modifier.fillMaxWidth(),
|
||||||
|
horizontalArrangement = Arrangement.Center
|
||||||
|
) {
|
||||||
|
OutlinedTextField(
|
||||||
|
value = text,
|
||||||
|
onValueChange = { text = it },
|
||||||
|
keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Number),
|
||||||
|
modifier = Modifier.width(150.dp),
|
||||||
|
label = {
|
||||||
|
Text(
|
||||||
|
text = stringResource(R.string.poll_closing_time),
|
||||||
|
color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f)
|
||||||
|
)
|
||||||
|
},
|
||||||
|
placeholder = {
|
||||||
|
Text(
|
||||||
|
text = stringResource(R.string.poll_closing_time_days),
|
||||||
|
color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Preview
|
||||||
|
@Composable
|
||||||
|
fun PollClosingPreview() {
|
||||||
|
PollClosing()
|
||||||
|
}
|
@@ -2,6 +2,7 @@ package com.vitorpamplona.amethyst.ui.components
|
|||||||
|
|
||||||
import androidx.compose.foundation.layout.Arrangement
|
import androidx.compose.foundation.layout.Arrangement
|
||||||
import androidx.compose.foundation.layout.Row
|
import androidx.compose.foundation.layout.Row
|
||||||
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
import androidx.compose.foundation.layout.width
|
import androidx.compose.foundation.layout.width
|
||||||
import androidx.compose.foundation.text.KeyboardOptions
|
import androidx.compose.foundation.text.KeyboardOptions
|
||||||
import androidx.compose.material.MaterialTheme
|
import androidx.compose.material.MaterialTheme
|
||||||
@@ -24,6 +25,7 @@ fun PollConsensusThreshold() {
|
|||||||
var text by rememberSaveable { mutableStateOf("") }
|
var text by rememberSaveable { mutableStateOf("") }
|
||||||
|
|
||||||
Row(
|
Row(
|
||||||
|
Modifier.fillMaxWidth(),
|
||||||
horizontalArrangement = Arrangement.Center
|
horizontalArrangement = Arrangement.Center
|
||||||
) {
|
) {
|
||||||
OutlinedTextField(
|
OutlinedTextField(
|
||||||
|
@@ -36,13 +36,13 @@ fun PollVoteValueRange() {
|
|||||||
modifier = Modifier.width(150.dp),
|
modifier = Modifier.width(150.dp),
|
||||||
label = {
|
label = {
|
||||||
Text(
|
Text(
|
||||||
text = stringResource(R.string.poll_vote_value_min),
|
text = stringResource(R.string.poll_zap_value_min),
|
||||||
color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f)
|
color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f)
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
placeholder = {
|
placeholder = {
|
||||||
Text(
|
Text(
|
||||||
text = stringResource(R.string.poll_vote_value_min_zap_amount),
|
text = stringResource(R.string.poll_zap_amount),
|
||||||
color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f)
|
color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -54,13 +54,13 @@ fun PollVoteValueRange() {
|
|||||||
modifier = Modifier.width(150.dp),
|
modifier = Modifier.width(150.dp),
|
||||||
label = {
|
label = {
|
||||||
Text(
|
Text(
|
||||||
text = stringResource(R.string.poll_vote_value_max),
|
text = stringResource(R.string.poll_zap_value_max),
|
||||||
color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f)
|
color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f)
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
placeholder = {
|
placeholder = {
|
||||||
Text(
|
Text(
|
||||||
text = stringResource(R.string.poll_vote_value_max_zap_amount),
|
text = stringResource(R.string.poll_zap_amount),
|
||||||
color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f)
|
color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@@ -227,11 +227,12 @@
|
|||||||
<string name="poll_option_index">Option %s</string>
|
<string name="poll_option_index">Option %s</string>
|
||||||
<string name="poll_option_description">Poll option description</string>
|
<string name="poll_option_description">Poll option description</string>
|
||||||
<string name="poll_heading_optional">Optional fields:</string>
|
<string name="poll_heading_optional">Optional fields:</string>
|
||||||
<string name="poll_vote_value_min">Vote minimum</string>
|
<string name="poll_zap_value_min">Zap minimum</string>
|
||||||
<string name="poll_vote_value_max">Vote maximum</string>
|
<string name="poll_zap_value_max">Zap maximum</string>
|
||||||
<string name="poll_consensus_threshold">Consensus threshold</string>
|
<string name="poll_consensus_threshold">Consensus</string>
|
||||||
<string name="poll_consensus_threshold_percent">%</string>
|
<string name="poll_consensus_threshold_percent">%</string>
|
||||||
<string name="poll_vote_value_min_zap_amount">Minimum zap</string>
|
<string name="poll_zap_amount">sats</string>
|
||||||
<string name="poll_vote_value_max_zap_amount">Maximum zap</string>
|
<string name="poll_closing_time">Close after</string>
|
||||||
|
<string name="poll_closing_time_days">days</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
Reference in New Issue
Block a user