-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: display no jobs message on worker home screen
This commit introduces a "No Jobs Message" component to be displayed on the worker home screen when no jobs are available. - Added a new composable function `NoJobsMessage` to display an informative message when no jobs are found. - Updated the `WorkerHomeScreenUiState` to include an error message field. - Modified the worker home screen to display the `NoJobsMessage` component when the list of jobs is empty.
- Loading branch information
1 parent
ae027a0
commit 955e382
Showing
3 changed files
with
60 additions
and
12 deletions.
There are no files selected for viewing
54 changes: 54 additions & 0 deletions
54
app/src/main/java/com/samuelokello/kazihub/presentation/common/components/NoJobsMessage.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
package com.samuelokello.kazihub.presentation.common.components | ||
|
||
import androidx.annotation.StringRes | ||
import androidx.compose.foundation.layout.Arrangement | ||
import androidx.compose.foundation.layout.Column | ||
import androidx.compose.foundation.layout.Spacer | ||
import androidx.compose.foundation.layout.height | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.foundation.layout.size | ||
import androidx.compose.material.icons.Icons | ||
import androidx.compose.material.icons.filled.Info | ||
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.graphics.Color | ||
import androidx.compose.ui.res.stringResource | ||
import androidx.compose.ui.text.style.TextAlign | ||
import androidx.compose.ui.unit.dp | ||
|
||
@Composable | ||
fun NoJobsMessage(@StringRes message: Int) { | ||
Column( | ||
modifier = | ||
Modifier | ||
.padding(8.dp), | ||
horizontalAlignment = Alignment.CenterHorizontally, | ||
verticalArrangement = Arrangement.Center, | ||
) { | ||
Icon( | ||
imageVector = Icons.Default.Info, | ||
contentDescription = null, | ||
modifier = Modifier.size(64.dp), | ||
tint = Color.Gray, | ||
) | ||
Spacer(modifier = Modifier.height(16.dp)) | ||
Text( | ||
text = "No jobs posted yet", | ||
style = MaterialTheme.typography.bodyLarge, | ||
color = Color.Gray, | ||
) | ||
Spacer(modifier = Modifier.height(8.dp)) | ||
Text( | ||
text = stringResource(message), | ||
style = MaterialTheme.typography.bodyLarge, | ||
color = Color.Gray, | ||
textAlign = TextAlign.Center, | ||
) | ||
|
||
Spacer(modifier = Modifier.height(32.dp)) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 2 additions & 6 deletions
8
...c/main/java/com/samuelokello/kazihub/presentation/worker/state/WorkerHomeScreenUiEvent.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,10 @@ | ||
package com.samuelokello.kazihub.presentation.worker.state | ||
|
||
import com.samuelokello.kazihub.domain.model.job.Job | ||
import com.samuelokello.kazihub.domain.model.job.data | ||
|
||
sealed interface WorkerHomeScreenUiEvent { | ||
data object OpenDrawer : WorkerHomeScreenUiEvent | ||
data object OnSearchClick : WorkerHomeScreenUiEvent | ||
data object OnPullToRefresh : WorkerHomeScreenUiEvent | ||
data class NavigateToJobDetails(val jobId: Int) : WorkerHomeScreenUiEvent | ||
data class SearchQueryChanged(val query: String) : WorkerHomeScreenUiEvent | ||
data object OnViewAllClick : WorkerHomeScreenUiEvent | ||
data object OnSHowAllClick : WorkerHomeScreenUiEvent | ||
data class JobSelected(val job: Job) : WorkerHomeScreenUiEvent | ||
data class JobSelected(val data: data) : WorkerHomeScreenUiEvent | ||
} |