add PollClosing component,

rename poll strings/values
This commit is contained in:
toadlyBroodle
2023-03-13 17:33:00 +09:00
parent c31b99b1dc
commit 63ad7fd205
5 changed files with 69 additions and 9 deletions

View File

@@ -131,6 +131,7 @@ fun NewPollView(onClose: () -> Unit, baseReplyTo: Note? = null, quote: Note? = n
Text(stringResource(R.string.poll_heading_optional))
PollVoteValueRange()
PollConsensusThreshold()
PollClosing()
}
}

View File

@@ -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()
}

View File

@@ -2,6 +2,7 @@ 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
@@ -24,6 +25,7 @@ fun PollConsensusThreshold() {
var text by rememberSaveable { mutableStateOf("") }
Row(
Modifier.fillMaxWidth(),
horizontalArrangement = Arrangement.Center
) {
OutlinedTextField(

View File

@@ -36,13 +36,13 @@ fun PollVoteValueRange() {
modifier = Modifier.width(150.dp),
label = {
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)
)
},
placeholder = {
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)
)
}
@@ -54,13 +54,13 @@ fun PollVoteValueRange() {
modifier = Modifier.width(150.dp),
label = {
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)
)
},
placeholder = {
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)
)
}

View File

@@ -227,11 +227,12 @@
<string name="poll_option_index">Option %s</string>
<string name="poll_option_description">Poll option description</string>
<string name="poll_heading_optional">Optional fields:</string>
<string name="poll_vote_value_min">Vote minimum</string>
<string name="poll_vote_value_max">Vote maximum</string>
<string name="poll_consensus_threshold">Consensus threshold</string>
<string name="poll_zap_value_min">Zap minimum</string>
<string name="poll_zap_value_max">Zap maximum</string>
<string name="poll_consensus_threshold">Consensus</string>
<string name="poll_consensus_threshold_percent">%</string>
<string name="poll_vote_value_min_zap_amount">Minimum zap</string>
<string name="poll_vote_value_max_zap_amount">Maximum zap</string>
<string name="poll_zap_amount">sats</string>
<string name="poll_closing_time">Close after</string>
<string name="poll_closing_time_days">days</string>
</resources>