Skip to content

Commit

Permalink
Add event map to tabs
Browse files Browse the repository at this point in the history
  • Loading branch information
takahirom committed Jun 18, 2024
1 parent d94fe4e commit 6b04a11
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 19 deletions.
1 change: 1 addition & 0 deletions app-android/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ dependencies {
implementation(projects.feature.main)
implementation(projects.feature.contributors)
implementation(projects.feature.sessions)
implementation(projects.feature.eventmap)
implementation(projects.core.model)
implementation(projects.core.data)
implementation(projects.core.designsystem)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,13 @@ import com.google.android.gms.oss.licenses.OssLicensesMenuActivity
import io.github.droidkaigi.confsched.contributors.contributorsScreenRoute
import io.github.droidkaigi.confsched.contributors.contributorsScreens
import io.github.droidkaigi.confsched.designsystem.theme.KaigiTheme
import io.github.droidkaigi.confsched.eventmap.eventMapScreens
import io.github.droidkaigi.confsched.eventmap.navigateEventMapScreen
import io.github.droidkaigi.confsched.main.MainNestedGraphStateHolder
import io.github.droidkaigi.confsched.main.MainScreenTab
import io.github.droidkaigi.confsched.main.MainScreenTab.About
import io.github.droidkaigi.confsched.main.MainScreenTab.Achievements
import io.github.droidkaigi.confsched.main.MainScreenTab.FloorMap
import io.github.droidkaigi.confsched.main.MainScreenTab.EventMap
import io.github.droidkaigi.confsched.main.MainScreenTab.ProfileCard
import io.github.droidkaigi.confsched.main.MainScreenTab.Timetable
import io.github.droidkaigi.confsched.main.mainScreen
import io.github.droidkaigi.confsched.main.mainScreenRoute
Expand Down Expand Up @@ -109,6 +111,10 @@ private fun NavGraphBuilder.mainScreen(
onTimetableItemClick = navController::navigateToTimetableItemDetailScreen,
contentPadding = contentPadding,
)
eventMapScreens(
onNavigationIconClick = navController::popBackStack,
onEventMapItemClick = externalNavController::navigate,
)
},
)
}
Expand All @@ -129,9 +135,9 @@ class KaigiAppMainNestedGraphStateHolder : MainNestedGraphStateHolder {
) {
when (tab) {
Timetable -> mainNestedNavController.navigateTimetableScreen()
EventMap -> mainNestedNavController.navigateEventMapScreen()
About -> TODO()
FloorMap -> TODO()
Achievements -> TODO()
ProfileCard -> TODO()
}
}
}
Expand Down
1 change: 1 addition & 0 deletions app-ios-shared/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ kotlin {
api(projects.core.ui)
api(projects.feature.main)
api(projects.feature.sessions)
api(projects.feature.eventmap)
api(projects.feature.contributors)
implementation(libs.kotlinxCoroutinesCore)
implementation(libs.skieAnnotation)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@ import io.github.droidkaigi.confsched.contributors.ContributorsScreen
import io.github.droidkaigi.confsched.contributors.contributorsScreenRoute
import io.github.droidkaigi.confsched.data.Repositories
import io.github.droidkaigi.confsched.designsystem.theme.KaigiTheme
import io.github.droidkaigi.confsched.eventmap.navigateEventMapScreen
import io.github.droidkaigi.confsched.main.MainNestedGraphStateHolder
import io.github.droidkaigi.confsched.main.MainScreenTab
import io.github.droidkaigi.confsched.main.MainScreenTab.About
import io.github.droidkaigi.confsched.main.MainScreenTab.Achievements
import io.github.droidkaigi.confsched.main.MainScreenTab.FloorMap
import io.github.droidkaigi.confsched.main.MainScreenTab.EventMap
import io.github.droidkaigi.confsched.main.MainScreenTab.ProfileCard
import io.github.droidkaigi.confsched.main.MainScreenTab.Timetable
import io.github.droidkaigi.confsched.main.mainScreen
import io.github.droidkaigi.confsched.main.mainScreenRoute
Expand Down Expand Up @@ -138,9 +139,9 @@ class KaigiAppMainNestedGraphStateHolder : MainNestedGraphStateHolder {
) {
when (tab) {
Timetable -> mainNestedNavController.navigateTimetableScreen()
EventMap -> mainNestedNavController.navigateEventMapScreen()
About -> TODO()
FloorMap -> TODO()
Achievements -> TODO()
ProfileCard -> TODO()
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ class KaigiAppRobot @Inject constructor(

fun goToFloorMap() {
composeTestRule
.onNode(hasTestTag(MainScreenTab.FloorMap.testTag))
.onNode(hasTestTag(MainScreenTab.About.testTag))
.performClick()
waitUntilIdle()
}

fun goToAchievements() {
composeTestRule
.onAllNodes(
matcher = hasTestTag(MainScreenTab.Achievements.testTag),
matcher = hasTestTag(MainScreenTab.ProfileCard.testTag),
useUnmergedTree = true,
)
.onFirst()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.input.nestedscroll.nestedScroll
import androidx.compose.ui.platform.LocalLifecycleOwner
import androidx.compose.ui.platform.testTag
import androidx.navigation.NavController
import androidx.navigation.NavGraph.Companion.findStartDestination
import androidx.navigation.NavGraphBuilder
import androidx.navigation.compose.composable
import co.touchlab.kermit.Logger
Expand All @@ -38,7 +40,7 @@ const val EventMapScreenTestTag = "EventMapScreenTestTag"

fun NavGraphBuilder.eventMapScreens(
onNavigationIconClick: () -> Unit,
onContributorItemClick: (url: String) -> Unit,
onEventMapItemClick: (url: String) -> Unit,
) {
composable(eventMapScreenRoute) {
val lifecycleOwner = LocalLifecycleOwner.current
Expand All @@ -49,11 +51,21 @@ fun NavGraphBuilder.eventMapScreens(
onNavigationIconClick,
)
},
onEventMapItemClick = onContributorItemClick,
onEventMapItemClick = onEventMapItemClick,
)
}
}

fun NavController.navigateEventMapScreen() {
navigate(eventMapScreenRoute) {
popUpTo(route = checkNotNull(graph.findStartDestination().route)) {
saveState = true
}
launchSingleTop = true
restoreState = true
}
}

data class EventMapUiState(
val eventMap: PersistentList<EventMapEvent>,
val userMessageStateHolder: UserMessageStateHolder,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,15 +130,15 @@ enum class MainScreenTab(
),

@OptIn(ExperimentalResourceApi::class)
FloorMap(
EventMap(
icon = IconRepresentation.Vector(Icons.Outlined.Map),
selectedIcon = IconRepresentation.Drawable(drawableId = Res.drawable.icon_map_fill),
label = MainStrings.FloorMap.asString(),
contentDescription = MainStrings.FloorMap.asString(),
label = MainStrings.EventMap.asString(),
contentDescription = MainStrings.EventMap.asString(),
),

@OptIn(ExperimentalResourceApi::class)
Achievements(
ProfileCard(
icon = IconRepresentation.Drawable(drawableId = Res.drawable.icon_achievement_outline),
selectedIcon = IconRepresentation.Drawable(drawableId = Res.drawable.icon_achievement_fill),
label = MainStrings.Achievements.asString(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import io.github.droidkaigi.confsched.designsystem.strings.StringsBindings

sealed class MainStrings : Strings<MainStrings>(Bindings) {
data object Timetable : MainStrings()
data object FloorMap : MainStrings()
data object EventMap : MainStrings()
data object Achievements : MainStrings()
data object About : MainStrings()
data object Contributors : MainStrings()
Expand All @@ -16,7 +16,7 @@ sealed class MainStrings : Strings<MainStrings>(Bindings) {
Lang.Japanese to { item, _ ->
when (item) {
Timetable -> "Timetable"
FloorMap -> "Floor Map"
EventMap -> "Event Map"
Achievements -> "Achievements"
About -> "About"
Contributors -> "Contributors"
Expand All @@ -26,7 +26,7 @@ sealed class MainStrings : Strings<MainStrings>(Bindings) {
Lang.English to { item, bindings ->
when (item) {
Timetable -> "Timetable"
FloorMap -> "Floor Map"
EventMap -> "Event Map"
Achievements -> "Achievements"
About -> "About"
Contributors -> "Contributors"
Expand Down

0 comments on commit 6b04a11

Please sign in to comment.