release: v2.14.0 — Day view on date-header tap #61

Merged
makiolaj merged 36 commits from release/v2.14.0 into main 2026-07-07 14:42:30 +00:00
3 changed files with 31 additions and 6 deletions
Showing only changes of commit 31f51554f9 - Show all commits

View File

@@ -284,6 +284,7 @@ fun CalendarHost(
CalendarView.Week -> WeekScreen( CalendarView.Week -> WeekScreen(
selectedView = currentView, selectedView = currentView,
onSelectView = onSelectView, onSelectView = onSelectView,
onOpenDay = onOpenDay,
onEventClick = onEventClick, onEventClick = onEventClick,
onOpenSettings = onOpenSettings, onOpenSettings = onOpenSettings,
onOpenSearch = onOpenSearch, onOpenSearch = onOpenSearch,
@@ -315,6 +316,7 @@ fun CalendarHost(
CalendarView.Agenda -> AgendaScreen( CalendarView.Agenda -> AgendaScreen(
selectedView = currentView, selectedView = currentView,
onSelectView = onSelectView, onSelectView = onSelectView,
onOpenDay = onOpenDay,
onEventClick = onEventClick, onEventClick = onEventClick,
onOpenSettings = onOpenSettings, onOpenSettings = onOpenSettings,
onOpenSearch = onOpenSearch, onOpenSearch = onOpenSearch,

View File

@@ -93,6 +93,7 @@ private val zone = TimeZone.currentSystemDefault()
fun AgendaScreen( fun AgendaScreen(
selectedView: CalendarView, selectedView: CalendarView,
onSelectView: (CalendarView) -> Unit, onSelectView: (CalendarView) -> Unit,
onOpenDay: (LocalDate) -> Unit,
onEventClick: (EventInstance) -> Unit, onEventClick: (EventInstance) -> Unit,
onOpenSettings: () -> Unit, onOpenSettings: () -> Unit,
onOpenSearch: () -> Unit, onOpenSearch: () -> Unit,
@@ -191,6 +192,7 @@ fun AgendaScreen(
pastDisplay = pastDisplay, pastDisplay = pastDisplay,
onRetry = viewModel::goToToday, onRetry = viewModel::goToToday,
onEventClick = onEventClick, onEventClick = onEventClick,
onOpenDay = onOpenDay,
modifier = Modifier modifier = Modifier
.weight(1f) .weight(1f)
.fillMaxWidth(), .fillMaxWidth(),
@@ -289,6 +291,7 @@ private fun AgendaContent(
pastDisplay: PastEventDisplay, pastDisplay: PastEventDisplay,
onRetry: () -> Unit, onRetry: () -> Unit,
onEventClick: (EventInstance) -> Unit, onEventClick: (EventInstance) -> Unit,
onOpenDay: (LocalDate) -> Unit,
modifier: Modifier = Modifier, modifier: Modifier = Modifier,
) { ) {
when (state) { when (state) {
@@ -318,6 +321,7 @@ private fun AgendaContent(
dimPast = pastDisplay == PastEventDisplay.DIM, dimPast = pastDisplay == PastEventDisplay.DIM,
now = now, now = now,
onEventClick = onEventClick, onEventClick = onEventClick,
onOpenDay = onOpenDay,
modifier = modifier, modifier = modifier,
) )
} }
@@ -333,6 +337,7 @@ private fun AgendaList(
dimPast: Boolean, dimPast: Boolean,
now: Instant, now: Instant,
onEventClick: (EventInstance) -> Unit, onEventClick: (EventInstance) -> Unit,
onOpenDay: (LocalDate) -> Unit,
modifier: Modifier = Modifier, modifier: Modifier = Modifier,
) { ) {
LazyColumn( LazyColumn(
@@ -342,7 +347,7 @@ private fun AgendaList(
) { ) {
days.forEach { day -> days.forEach { day ->
stickyHeader(key = "header-${day.date}") { stickyHeader(key = "header-${day.date}") {
AgendaDayHeader(date = day.date, today = today) AgendaDayHeader(date = day.date, today = today, onOpenDay = onOpenDay)
} }
itemsIndexed( itemsIndexed(
items = day.events, items = day.events,
@@ -362,10 +367,16 @@ private fun AgendaList(
} }
@Composable @Composable
private fun AgendaDayHeader(date: LocalDate, today: LocalDate) { private fun AgendaDayHeader(
date: LocalDate,
today: LocalDate,
onOpenDay: (LocalDate) -> Unit,
) {
Surface( Surface(
color = MaterialTheme.colorScheme.surface, color = MaterialTheme.colorScheme.surface,
modifier = Modifier.fillMaxWidth(), modifier = Modifier
.fillMaxWidth()
.clickable { onOpenDay(date) },
) { ) {
Text( Text(
text = agendaDayLabel(date, today), text = agendaDayLabel(date, today),

View File

@@ -128,6 +128,7 @@ private fun WeekUiState.Success.allDayStripHeight(): Dp {
fun WeekScreen( fun WeekScreen(
selectedView: CalendarView, selectedView: CalendarView,
onSelectView: (CalendarView) -> Unit, onSelectView: (CalendarView) -> Unit,
onOpenDay: (LocalDate) -> Unit,
onEventClick: (EventInstance) -> Unit, onEventClick: (EventInstance) -> Unit,
onOpenSettings: () -> Unit, onOpenSettings: () -> Unit,
onOpenSearch: () -> Unit, onOpenSearch: () -> Unit,
@@ -249,6 +250,7 @@ fun WeekScreen(
onSwipePrev = goPrev, onSwipePrev = goPrev,
onRetry = jumpToToday, onRetry = jumpToToday,
onEventClick = onEventClick, onEventClick = onEventClick,
onOpenDay = onOpenDay,
onCreateAt = { d, minutes -> onCreateEvent(d, minutes) }, onCreateAt = { d, minutes -> onCreateEvent(d, minutes) },
modifier = Modifier modifier = Modifier
.padding(innerPadding) .padding(innerPadding)
@@ -268,6 +270,7 @@ private fun WeekContent(
onSwipePrev: () -> Unit, onSwipePrev: () -> Unit,
onRetry: () -> Unit, onRetry: () -> Unit,
onEventClick: (EventInstance) -> Unit, onEventClick: (EventInstance) -> Unit,
onOpenDay: (LocalDate) -> Unit,
onCreateAt: (LocalDate, Int) -> Unit, onCreateAt: (LocalDate, Int) -> Unit,
modifier: Modifier = Modifier, modifier: Modifier = Modifier,
) { ) {
@@ -342,6 +345,7 @@ private fun WeekContent(
scrollState = scrollState, scrollState = scrollState,
allDayHeight = allDayHeight, allDayHeight = allDayHeight,
onEventClick = onEventClick, onEventClick = onEventClick,
onOpenDay = onOpenDay,
onCreateAt = onCreateAt, onCreateAt = onCreateAt,
) )
} }
@@ -355,6 +359,7 @@ private fun WeekSuccess(
scrollState: ScrollState, scrollState: ScrollState,
allDayHeight: Dp, allDayHeight: Dp,
onEventClick: (EventInstance) -> Unit, onEventClick: (EventInstance) -> Unit,
onOpenDay: (LocalDate) -> Unit,
onCreateAt: (LocalDate, Int) -> Unit, onCreateAt: (LocalDate, Int) -> Unit,
) { ) {
Column(modifier = Modifier.fillMaxSize()) { Column(modifier = Modifier.fillMaxSize()) {
@@ -363,7 +368,7 @@ private fun WeekSuccess(
.fillMaxWidth() .fillMaxWidth()
.background(topSectionColor), .background(topSectionColor),
) { ) {
WeekDayHeader(days = state.days, today = state.today) WeekDayHeader(days = state.days, today = state.today, onOpenDay = onOpenDay)
AllDayStrip(state = state, height = allDayHeight, onEventClick = onEventClick) AllDayStrip(state = state, height = allDayHeight, onEventClick = onEventClick)
} }
// Breathing room between the (colour-shifting) top section and the // Breathing room between the (colour-shifting) top section and the
@@ -427,7 +432,11 @@ private fun WeekTopBar(
} }
@Composable @Composable
private fun WeekDayHeader(days: List<LocalDate>, today: LocalDate) { private fun WeekDayHeader(
days: List<LocalDate>,
today: LocalDate,
onOpenDay: (LocalDate) -> Unit,
) {
val locale = currentLocale() val locale = currentLocale()
val weekStart = days.first() val weekStart = days.first()
val weekNumber = remember(weekStart) { val weekNumber = remember(weekStart) {
@@ -453,7 +462,10 @@ private fun WeekDayHeader(days: List<LocalDate>, today: LocalDate) {
val javaDow = java.time.DayOfWeek.of(date.dayOfWeek.ordinal + 1) val javaDow = java.time.DayOfWeek.of(date.dayOfWeek.ordinal + 1)
val isToday = date == today val isToday = date == today
Column( Column(
modifier = Modifier.weight(1f), modifier = Modifier
.weight(1f)
.clip(RoundedCornerShape(12.dp))
.clickable { onOpenDay(date) },
horizontalAlignment = Alignment.CenterHorizontally, horizontalAlignment = Alignment.CenterHorizontally,
) { ) {
Text( Text(