mirror of
https://github.com/LiveFastEatTrashRaccoon/RaccoonForLemmy.git
synced 2025-02-09 11:48:43 +01:00
feat(common-ui): translate image loading error
This commit is contained in:
parent
5d2ce2d836
commit
443a9f480a
@ -7,8 +7,11 @@ import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.blur
|
||||
import androidx.compose.ui.layout.ContentScale
|
||||
import androidx.compose.ui.text.style.TextAlign
|
||||
import androidx.compose.ui.unit.dp
|
||||
import com.github.diegoberaldin.racconforlemmy.core.utils.onClick
|
||||
import com.github.diegoberaldin.raccoonforlemmy.resources.MR
|
||||
import dev.icerock.moko.resources.compose.stringResource
|
||||
import io.kamel.image.KamelImage
|
||||
import io.kamel.image.asyncPainterResource
|
||||
|
||||
@ -32,7 +35,11 @@ fun PostCardImage(
|
||||
contentDescription = null,
|
||||
contentScale = ContentScale.FillWidth,
|
||||
onFailure = {
|
||||
Text(text = "⚠️ Image loading error")
|
||||
Text(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
textAlign = TextAlign.Center,
|
||||
text = stringResource(MR.strings.message_image_loading_error)
|
||||
)
|
||||
},
|
||||
)
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.gestures.detectTransformGestures
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.getValue
|
||||
@ -17,6 +18,9 @@ import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.graphics.RectangleShape
|
||||
import androidx.compose.ui.graphics.graphicsLayer
|
||||
import androidx.compose.ui.input.pointer.pointerInput
|
||||
import androidx.compose.ui.text.style.TextAlign
|
||||
import com.github.diegoberaldin.raccoonforlemmy.resources.MR
|
||||
import dev.icerock.moko.resources.compose.stringResource
|
||||
import io.kamel.image.KamelImage
|
||||
import io.kamel.image.asyncPainterResource
|
||||
|
||||
@ -54,7 +58,11 @@ fun ZoomableImage(
|
||||
resource = painterResource,
|
||||
contentDescription = null,
|
||||
onFailure = {
|
||||
Text(text = "⚠️ Image loading error")
|
||||
Text(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
textAlign = TextAlign.Center,
|
||||
text = stringResource(MR.strings.message_image_loading_error)
|
||||
)
|
||||
},
|
||||
)
|
||||
}
|
||||
|
@ -40,6 +40,7 @@ kotlin {
|
||||
|
||||
api(libs.markdown)
|
||||
implementation(libs.kamel)
|
||||
implementation(projects.resources)
|
||||
}
|
||||
}
|
||||
val commonTest by getting {
|
||||
|
@ -15,6 +15,9 @@ import androidx.compose.ui.text.Placeholder
|
||||
import androidx.compose.ui.text.PlaceholderVerticalAlign
|
||||
import androidx.compose.ui.text.TextLayoutResult
|
||||
import androidx.compose.ui.text.TextStyle
|
||||
import androidx.compose.ui.text.style.TextAlign
|
||||
import com.github.diegoberaldin.raccoonforlemmy.resources.MR
|
||||
import dev.icerock.moko.resources.compose.stringResource
|
||||
import androidx.compose.ui.unit.sp
|
||||
import com.github.diegoberaldin.raccoonforlemmy.core.markdown.compose.LocalMarkdownColors
|
||||
import com.github.diegoberaldin.raccoonforlemmy.core.markdown.compose.LocalMarkdownTypography
|
||||
@ -82,7 +85,11 @@ internal fun MarkdownText(
|
||||
contentScale = ContentScale.FillWidth,
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
onFailure = {
|
||||
Text(text = "⚠️ Image loading error")
|
||||
Text(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
textAlign = TextAlign.Center,
|
||||
text = stringResource(MR.strings.message_image_loading_error)
|
||||
)
|
||||
},
|
||||
)
|
||||
},
|
||||
|
@ -70,6 +70,7 @@ class LoginBottomSheet : Screen {
|
||||
val snackbarHostState = remember { SnackbarHostState() }
|
||||
val genericError = stringResource(MR.strings.message_generic_error)
|
||||
val bottomSheetNavigator = LocalBottomSheetNavigator.current
|
||||
val successfulLoginMessage = stringResource(MR.strings.message_login_successful)
|
||||
|
||||
LaunchedEffect(model) {
|
||||
model.effects.onEach {
|
||||
@ -81,9 +82,7 @@ class LoginBottomSheet : Screen {
|
||||
}
|
||||
|
||||
LoginBottomSheetMviModel.Effect.LoginSuccess -> {
|
||||
snackbarHostState.showSnackbar(
|
||||
message = "Successfully logged in! \uD83C\uDF89\uD83C\uDF89\uD83C\uDF89",
|
||||
)
|
||||
snackbarHostState.showSnackbar(message = successfulLoginMessage)
|
||||
bottomSheetNavigator.hide()
|
||||
}
|
||||
}
|
||||
|
@ -14,6 +14,8 @@
|
||||
<string name="message_generic_error">Generic error</string>
|
||||
<string name="message_missing_field">Missing field</string>
|
||||
<string name="message_invalid_field">Invalid field</string>
|
||||
<string name="message_image_loading_error">⚠️ Image loading error ⚠️</string>
|
||||
<string name="message_login_successful">🎉 Login successful! 🎉</string>
|
||||
|
||||
<string name="button_confirm">Confirm</string>
|
||||
|
||||
|
@ -11,6 +11,8 @@
|
||||
<string name="message_generic_error">Errore generico</string>
|
||||
<string name="message_missing_field">Campo obbligatorio</string>
|
||||
<string name="message_invalid_field">Campo non valido</string>
|
||||
<string name="message_image_loading_error">⚠️ Errore caricamento immagine ⚠️</string>
|
||||
<string name="message_login_successful">🎉 Login effettuato con successo! 🎉</string>
|
||||
|
||||
<string name="button_confirm">Conferma</string>
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user