mirror of
https://github.com/msfjarvis/compose-lobsters
synced 2025-08-14 08:17:04 +05:30
common: add UserProfile composable and integrate navigation
This commit is contained in:
parent
c046036fdc
commit
5b024c8d6e
2 changed files with 31 additions and 0 deletions
|
@ -45,6 +45,7 @@ import dev.msfjarvis.claw.common.comments.LocalHTMLConverter
|
|||
import dev.msfjarvis.claw.common.res.ClawIcons
|
||||
import dev.msfjarvis.claw.common.theme.LobstersTheme
|
||||
import dev.msfjarvis.claw.common.urllauncher.UrlLauncher
|
||||
import dev.msfjarvis.claw.common.user.UserProfile
|
||||
import kotlinx.coroutines.launch
|
||||
import soup.compose.material.motion.materialElevationScaleIn
|
||||
import soup.compose.material.motion.materialElevationScaleOut
|
||||
|
@ -212,6 +213,22 @@ fun LobstersApp(
|
|||
postActions = postActions,
|
||||
)
|
||||
}
|
||||
composable(
|
||||
route = Destinations.User.getRoute("{username}"),
|
||||
arguments = listOf(navArgument("username") { type = NavType.StringType }),
|
||||
deepLinks = listOf(navDeepLink { uriPattern = "$uri/u/{username}" }),
|
||||
enterMotionSpec = { translateXIn { it } },
|
||||
exitMotionSpec = { materialElevationScaleOut() },
|
||||
popEnterMotionSpec = { materialElevationScaleIn() },
|
||||
popExitMotionSpec = { translateXOut { it } },
|
||||
) { backStackEntry ->
|
||||
val username = requireNotNull(backStackEntry.arguments?.getString("username"))
|
||||
UserProfile(
|
||||
username = username,
|
||||
getProfile = viewModel::getUserProfile,
|
||||
modifier = Modifier.navigationBarsPadding(),
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue