86 lines
3.0 KiB
Kotlin
86 lines
3.0 KiB
Kotlin
package chat.stoat.sheets
|
|
|
|
import androidx.compose.foundation.background
|
|
import androidx.compose.foundation.layout.Arrangement
|
|
import androidx.compose.foundation.layout.Box
|
|
import androidx.compose.foundation.layout.Column
|
|
import androidx.compose.foundation.layout.fillMaxWidth
|
|
import androidx.compose.foundation.layout.padding
|
|
import androidx.compose.foundation.layout.size
|
|
import androidx.compose.foundation.shape.RoundedCornerShape
|
|
import androidx.compose.material3.Button
|
|
import androidx.compose.material3.Icon
|
|
import androidx.compose.material3.MaterialTheme
|
|
import androidx.compose.material3.Text
|
|
import androidx.compose.runtime.Composable
|
|
import androidx.compose.ui.Alignment
|
|
import androidx.compose.ui.Modifier
|
|
import androidx.compose.ui.draw.clip
|
|
import androidx.compose.ui.draw.rotate
|
|
import androidx.compose.ui.platform.LocalContext
|
|
import androidx.compose.ui.res.painterResource
|
|
import androidx.compose.ui.res.stringResource
|
|
import androidx.compose.ui.text.style.TextAlign
|
|
import androidx.compose.ui.tooling.preview.Preview
|
|
import androidx.compose.ui.unit.dp
|
|
import chat.stoat.R
|
|
import chat.stoat.composables.chat.viewUrlInBrowser
|
|
import chat.stoat.core.model.data.STOAT_SUPPORT
|
|
|
|
@Composable
|
|
fun WebHookUserSheet(modifier: Modifier = Modifier) {
|
|
val context = LocalContext.current
|
|
|
|
Column(
|
|
verticalArrangement = Arrangement.spacedBy(16.dp),
|
|
horizontalAlignment = Alignment.CenterHorizontally,
|
|
modifier = modifier.padding(16.dp).padding(top = 16.dp)
|
|
) {
|
|
Box(
|
|
modifier = Modifier
|
|
.padding(bottom = 16.dp)
|
|
.size(96.dp)
|
|
.rotate(5f)
|
|
.clip(RoundedCornerShape(12.dp))
|
|
.background(MaterialTheme.colorScheme.primaryContainer),
|
|
contentAlignment = Alignment.Center
|
|
) {
|
|
Icon(
|
|
painter = painterResource(R.drawable.ic_webhook_24dp),
|
|
tint = MaterialTheme.colorScheme.onPrimaryContainer,
|
|
contentDescription = null,
|
|
modifier = Modifier.size(64.dp)
|
|
)
|
|
}
|
|
Text(
|
|
text = stringResource(R.string.user_info_sheet_webhook),
|
|
style = MaterialTheme.typography.titleMedium,
|
|
textAlign = TextAlign.Center,
|
|
modifier = Modifier.fillMaxWidth()
|
|
)
|
|
Text(
|
|
text = stringResource(R.string.user_info_sheet_webhook_body),
|
|
style = MaterialTheme.typography.bodyMedium,
|
|
textAlign = TextAlign.Center,
|
|
modifier = Modifier.fillMaxWidth()
|
|
)
|
|
Button(
|
|
onClick = {
|
|
viewUrlInBrowser(context, "$STOAT_SUPPORT/kb/server-management/integrations-and-bots/webhooks")
|
|
},
|
|
modifier = Modifier
|
|
.fillMaxWidth()
|
|
.padding(top = 8.dp)
|
|
) {
|
|
Text(text = stringResource(R.string.user_info_sheet_webhook_learn_more))
|
|
}
|
|
}
|
|
}
|
|
|
|
@Preview(showBackground = true)
|
|
@Composable
|
|
private fun WebHookUserSheetPreview() {
|
|
Column {
|
|
WebHookUserSheet()
|
|
}
|
|
} |