Add You're in screen (UI)
tom
This commit is contained in:
parent
0f06bf5d08
commit
d7a7751a76
2 changed files with 55 additions and 19 deletions
|
|
@ -27,12 +27,13 @@ open class WaitListStateProvider : PreviewParameterProvider<WaitListState> {
|
||||||
aWaitListState(loginAction = Async.Loading()),
|
aWaitListState(loginAction = Async.Loading()),
|
||||||
aWaitListState(loginAction = Async.Failure(Throwable())),
|
aWaitListState(loginAction = Async.Failure(Throwable())),
|
||||||
aWaitListState(loginAction = Async.Failure(Throwable(message = "IO_ELEMENT_X_WAIT_LIST"))),
|
aWaitListState(loginAction = Async.Failure(Throwable(message = "IO_ELEMENT_X_WAIT_LIST"))),
|
||||||
|
aWaitListState(loginAction = Async.Success(SessionId("@alice:element.io"))),
|
||||||
// Add other state here
|
// Add other state here
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun aWaitListState(
|
fun aWaitListState(
|
||||||
appName: String = "Element",
|
appName: String = "Element X",
|
||||||
serverName: String = "server.org",
|
serverName: String = "server.org",
|
||||||
loginAction: Async<SessionId> = Async.Uninitialized,
|
loginAction: Async<SessionId> = Async.Uninitialized,
|
||||||
) = WaitListState(
|
) = WaitListState(
|
||||||
|
|
|
||||||
|
|
@ -48,9 +48,11 @@ import androidx.lifecycle.Lifecycle
|
||||||
import io.element.android.features.login.impl.R
|
import io.element.android.features.login.impl.R
|
||||||
import io.element.android.features.login.impl.error.isWaitListError
|
import io.element.android.features.login.impl.error.isWaitListError
|
||||||
import io.element.android.features.login.impl.error.loginError
|
import io.element.android.features.login.impl.error.loginError
|
||||||
|
import io.element.android.libraries.architecture.Async
|
||||||
import io.element.android.libraries.designsystem.components.dialogs.RetryDialog
|
import io.element.android.libraries.designsystem.components.dialogs.RetryDialog
|
||||||
import io.element.android.libraries.designsystem.preview.ElementPreviewDark
|
import io.element.android.libraries.designsystem.preview.ElementPreviewDark
|
||||||
import io.element.android.libraries.designsystem.preview.ElementPreviewLight
|
import io.element.android.libraries.designsystem.preview.ElementPreviewLight
|
||||||
|
import io.element.android.libraries.designsystem.theme.components.Button
|
||||||
import io.element.android.libraries.designsystem.theme.components.CircularProgressIndicator
|
import io.element.android.libraries.designsystem.theme.components.CircularProgressIndicator
|
||||||
import io.element.android.libraries.designsystem.theme.components.Text
|
import io.element.android.libraries.designsystem.theme.components.Text
|
||||||
import io.element.android.libraries.designsystem.theme.components.TextButton
|
import io.element.android.libraries.designsystem.theme.components.TextButton
|
||||||
|
|
@ -137,19 +139,21 @@ private fun WaitListContent(
|
||||||
.systemBarsPadding()
|
.systemBarsPadding()
|
||||||
.padding(horizontal = 16.dp, vertical = 16.dp)
|
.padding(horizontal = 16.dp, vertical = 16.dp)
|
||||||
) {
|
) {
|
||||||
TextButton(
|
if (state.loginAction !is Async.Success) {
|
||||||
onClick = onCancelClicked,
|
TextButton(
|
||||||
colors = ButtonDefaults.buttonColors(
|
onClick = onCancelClicked,
|
||||||
containerColor = Color.White,
|
colors = ButtonDefaults.buttonColors(
|
||||||
contentColor = Color.Black,
|
containerColor = Color.White,
|
||||||
disabledContainerColor = Color.White,
|
contentColor = Color.Black,
|
||||||
disabledContentColor = Color.Black,
|
disabledContainerColor = Color.White,
|
||||||
),
|
disabledContentColor = Color.Black,
|
||||||
) {
|
),
|
||||||
Text(
|
) {
|
||||||
text = stringResource(CommonStrings.action_cancel),
|
Text(
|
||||||
style = ElementTheme.typography.fontBodyLgMedium,
|
text = stringResource(CommonStrings.action_cancel),
|
||||||
)
|
style = ElementTheme.typography.fontBodyLgMedium,
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Box(
|
Box(
|
||||||
modifier = Modifier.fillMaxSize(),
|
modifier = Modifier.fillMaxSize(),
|
||||||
|
|
@ -171,26 +175,57 @@ private fun WaitListContent(
|
||||||
Spacer(modifier = Modifier.height(24.dp))
|
Spacer(modifier = Modifier.height(24.dp))
|
||||||
}
|
}
|
||||||
Spacer(modifier = Modifier.height(18.dp))
|
Spacer(modifier = Modifier.height(18.dp))
|
||||||
|
val titleRes = when (state.loginAction) {
|
||||||
|
is Async.Success -> R.string.screen_waitlist_title_success
|
||||||
|
else -> R.string.screen_waitlist_title
|
||||||
|
}
|
||||||
Text(
|
Text(
|
||||||
text = withColoredPeriod(R.string.screen_waitlist_title),
|
text = withColoredPeriod(titleRes),
|
||||||
style = ElementTheme.typography.fontHeadingXlBold,
|
style = ElementTheme.typography.fontHeadingXlBold,
|
||||||
textAlign = TextAlign.Center,
|
textAlign = TextAlign.Center,
|
||||||
color = Color.White,
|
color = Color.White,
|
||||||
)
|
)
|
||||||
Spacer(modifier = Modifier.height(8.dp))
|
Spacer(modifier = Modifier.height(8.dp))
|
||||||
Text(
|
val subtitle = when (state.loginAction) {
|
||||||
modifier = Modifier.widthIn(max = 360.dp),
|
is Async.Success -> stringResource(
|
||||||
text = stringResource(
|
id = R.string.screen_waitlist_message_success,
|
||||||
|
state.appName,
|
||||||
|
)
|
||||||
|
else -> stringResource(
|
||||||
id = R.string.screen_waitlist_message,
|
id = R.string.screen_waitlist_message,
|
||||||
state.appName,
|
state.appName,
|
||||||
state.serverName,
|
state.serverName,
|
||||||
),
|
)
|
||||||
|
}
|
||||||
|
Text(
|
||||||
|
modifier = Modifier.widthIn(max = 360.dp),
|
||||||
|
text = subtitle,
|
||||||
style = ElementTheme.typography.fontBodyLgRegular,
|
style = ElementTheme.typography.fontBodyLgRegular,
|
||||||
textAlign = TextAlign.Center,
|
textAlign = TextAlign.Center,
|
||||||
color = Color.White,
|
color = Color.White,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (state.loginAction is Async.Success) {
|
||||||
|
Button(
|
||||||
|
onClick = { TODO() },
|
||||||
|
colors = ButtonDefaults.buttonColors(
|
||||||
|
containerColor = Color.White,
|
||||||
|
contentColor = Color.Black,
|
||||||
|
disabledContainerColor = Color.White,
|
||||||
|
disabledContentColor = Color.Black,
|
||||||
|
),
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.align(Alignment.BottomCenter)
|
||||||
|
.padding(bottom = 8.dp)
|
||||||
|
) {
|
||||||
|
Text(
|
||||||
|
text = stringResource(id = CommonStrings.action_continue),
|
||||||
|
style = ElementTheme.typography.fontBodyLgMedium,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue