From 0759049c22e67ed7d5096c2c8c32ef913475c74c Mon Sep 17 00:00:00 2001 From: Yamada_Ika <73375669+Yamada-Ika@users.noreply.github.com> Date: Tue, 2 Jul 2024 00:09:59 +0900 Subject: [PATCH 01/22] feat: brush up bottom bar --- .../sessions/TimetableItemDetailScreen.kt | 26 +++------ .../TimetableItemDetailBottomAppBar.kt | 53 +++++++++++++++++++ 2 files changed, 61 insertions(+), 18 deletions(-) create mode 100644 feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimetableItemDetailBottomAppBar.kt diff --git a/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/TimetableItemDetailScreen.kt b/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/TimetableItemDetailScreen.kt index d69b359ac..6100d57a5 100644 --- a/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/TimetableItemDetailScreen.kt +++ b/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/TimetableItemDetailScreen.kt @@ -25,7 +25,6 @@ import androidx.compose.runtime.remember import androidx.compose.runtime.setValue import androidx.compose.ui.Modifier import androidx.compose.ui.input.nestedscroll.nestedScroll -import androidx.compose.ui.platform.testTag import androidx.navigation.NavController import androidx.navigation.NavGraphBuilder import androidx.navigation.compose.composable @@ -43,6 +42,7 @@ import io.github.droidkaigi.confsched.model.TimetableItem.Session import io.github.droidkaigi.confsched.model.fake import io.github.droidkaigi.confsched.sessions.TimetableItemDetailScreenUiState.Loaded import io.github.droidkaigi.confsched.sessions.TimetableItemDetailScreenUiState.Loading +import io.github.droidkaigi.confsched.sessions.component.TimetableItemDetailBottomAppBar import io.github.droidkaigi.confsched.ui.SnackbarMessageEffect import io.github.droidkaigi.confsched.ui.UserMessageStateHolder import io.github.droidkaigi.confsched.ui.UserMessageStateHolderImpl @@ -184,23 +184,13 @@ private fun TimetableItemDetailScreen( }, bottomBar = { if (uiState is Loaded) { - Column { - Button( - modifier = Modifier.testTag(TimetableItemDetailBookmarkIconTestTag), - onClick = { onBookmarkClick(uiState.timetableItem) }, - ) { - Text(text = "Bookmark: ${uiState.isBookmarked}") - } - Button( - - onClick = { onCalendarRegistrationClick(uiState.timetableItem) }, - ) { - Text(text = "Calendar") - } - Button(onClick = { onShareClick(uiState.timetableItem) }) { - Text(text = "Share") - } - } + TimetableItemDetailBottomAppBar( + timetableItem = uiState.timetableItem, + isBookmarked = uiState.isBookmarked, + onBookmarkClick = onBookmarkClick, + onCalendarRegistrationClick = onCalendarRegistrationClick, + onShareClick = onShareClick, + ) } }, snackbarHost = { SnackbarHost(hostState = snackbarHostState) }, diff --git a/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimetableItemDetailBottomAppBar.kt b/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimetableItemDetailBottomAppBar.kt new file mode 100644 index 000000000..387594e81 --- /dev/null +++ b/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimetableItemDetailBottomAppBar.kt @@ -0,0 +1,53 @@ +package io.github.droidkaigi.confsched.sessions.component + +import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.filled.Favorite +import androidx.compose.material.icons.outlined.EditCalendar +import androidx.compose.material.icons.outlined.FavoriteBorder +import androidx.compose.material.icons.outlined.Share +import androidx.compose.material3.BottomAppBar +import androidx.compose.material3.FloatingActionButton +import androidx.compose.material3.Icon +import androidx.compose.material3.IconButton +import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier +import androidx.compose.ui.platform.testTag +import io.github.droidkaigi.confsched.model.TimetableItem +import io.github.droidkaigi.confsched.sessions.TimetableItemDetailBookmarkIconTestTag + +@Composable +fun TimetableItemDetailBottomAppBar( + timetableItem: TimetableItem, + isBookmarked: Boolean, + onBookmarkClick: (TimetableItem) -> Unit, + onCalendarRegistrationClick: (TimetableItem) -> Unit, + onShareClick: (TimetableItem) -> Unit, +) { + BottomAppBar( + actions = { + IconButton(onClick = { onShareClick(timetableItem) }) { + Icon( + imageVector = Icons.Outlined.Share, + contentDescription = "Share", + ) + } + IconButton(onClick = { onCalendarRegistrationClick(timetableItem) }) { + Icon( + imageVector = Icons.Outlined.EditCalendar, + contentDescription = "Calendar", + ) + } + }, + floatingActionButton = { + FloatingActionButton( + modifier = Modifier.testTag(TimetableItemDetailBookmarkIconTestTag), + onClick = { onBookmarkClick(timetableItem) }, + ) { + Icon( + imageVector = if (isBookmarked) Icons.Filled.Favorite else Icons.Outlined.FavoriteBorder, + contentDescription = "Bookmarked", + ) + } + }, + ) +} From aa98d23f72240ada0092ad5022172317b9e2d354 Mon Sep 17 00:00:00 2001 From: Yamada_Ika <73375669+Yamada-Ika@users.noreply.github.com> Date: Tue, 2 Jul 2024 00:13:34 +0900 Subject: [PATCH 02/22] feat: brush up top bar --- .../sessions/TimetableItemDetailScreen.kt | 38 ++------- .../component/TimetableItemDetailTopAppBar.kt | 84 +++++++++++++++++++ 2 files changed, 91 insertions(+), 31 deletions(-) create mode 100644 feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimetableItemDetailTopAppBar.kt diff --git a/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/TimetableItemDetailScreen.kt b/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/TimetableItemDetailScreen.kt index 6100d57a5..e437216f6 100644 --- a/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/TimetableItemDetailScreen.kt +++ b/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/TimetableItemDetailScreen.kt @@ -5,12 +5,10 @@ import androidx.compose.animation.fadeIn import androidx.compose.animation.fadeOut import androidx.compose.foundation.background import androidx.compose.foundation.layout.Column -import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.padding import androidx.compose.material3.Button import androidx.compose.material3.ExperimentalMaterial3Api -import androidx.compose.material3.LargeTopAppBar import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Scaffold import androidx.compose.material3.SnackbarHost @@ -43,6 +41,7 @@ import io.github.droidkaigi.confsched.model.fake import io.github.droidkaigi.confsched.sessions.TimetableItemDetailScreenUiState.Loaded import io.github.droidkaigi.confsched.sessions.TimetableItemDetailScreenUiState.Loading import io.github.droidkaigi.confsched.sessions.component.TimetableItemDetailBottomAppBar +import io.github.droidkaigi.confsched.sessions.component.TimetableItemDetailTopAppBar import io.github.droidkaigi.confsched.ui.SnackbarMessageEffect import io.github.droidkaigi.confsched.ui.UserMessageStateHolder import io.github.droidkaigi.confsched.ui.UserMessageStateHolderImpl @@ -151,35 +150,12 @@ private fun TimetableItemDetailScreen( .nestedScroll(scrollBehavior.nestedScrollConnection), topBar = { if (uiState is Loaded) { - LargeTopAppBar(title = { - Row { - Button(onClick = { onNavigationIconClick() }) { - Text( - text = "Back", - style = MaterialTheme.typography.bodySmall, - ) - } - Text( - modifier = Modifier.weight(1F), - text = uiState.timetableItem.title.currentLangTitle, - style = MaterialTheme.typography.bodyLarge, - ) - if (uiState.isLangSelectable) { - Button(onClick = { onSelectedLanguage(JAPANESE) }) { - Text( - text = "日本語", - style = MaterialTheme.typography.bodySmall, - ) - } - Button(onClick = { onSelectedLanguage(Lang.ENGLISH) }) { - Text( - text = "English", - style = MaterialTheme.typography.bodySmall, - ) - } - } - } - }) + TimetableItemDetailTopAppBar( + isLangSelectable = uiState.isLangSelectable, + onNavigationIconClick = onNavigationIconClick, + onSelectedLanguage = onSelectedLanguage, + scrollBehavior = scrollBehavior, + ) } }, bottomBar = { diff --git a/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimetableItemDetailTopAppBar.kt b/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimetableItemDetailTopAppBar.kt new file mode 100644 index 000000000..c0131f819 --- /dev/null +++ b/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimetableItemDetailTopAppBar.kt @@ -0,0 +1,84 @@ +package io.github.droidkaigi.confsched.sessions.component + +import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.automirrored.outlined.ArrowBack +import androidx.compose.material.icons.outlined.GTranslate +import androidx.compose.material3.DropdownMenu +import androidx.compose.material3.DropdownMenuItem +import androidx.compose.material3.ExperimentalMaterial3Api +import androidx.compose.material3.Icon +import androidx.compose.material3.IconButton +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.Text +import androidx.compose.material3.TopAppBar +import androidx.compose.material3.TopAppBarScrollBehavior +import androidx.compose.runtime.Composable +import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.remember +import androidx.compose.runtime.setValue +import io.github.droidkaigi.confsched.model.Lang + +@OptIn(ExperimentalMaterial3Api::class) +@Composable +fun TimetableItemDetailTopAppBar( + isLangSelectable: Boolean, + onNavigationIconClick: () -> Unit, + onSelectedLanguage: (Lang) -> Unit, + scrollBehavior: TopAppBarScrollBehavior, +) { + TopAppBar( + title = {}, + navigationIcon = { + IconButton(onClick = { onNavigationIconClick() }) { + Icon( + imageVector = Icons.AutoMirrored.Outlined.ArrowBack, + contentDescription = "Back", + ) + } + }, + actions = { + if (isLangSelectable) { + var expanded by remember { mutableStateOf(false) } + + IconButton(onClick = { expanded = true }) { + Icon( + imageVector = Icons.Outlined.GTranslate, + contentDescription = "Select Language", + ) + } + + DropdownMenu( + expanded = expanded, + onDismissRequest = { expanded = false }, + ) { + DropdownMenuItem( + text = { + Text( + text = "日本語", + style = MaterialTheme.typography.bodySmall, + ) + }, + onClick = { + onSelectedLanguage(Lang.JAPANESE) + expanded = false + }, + ) + DropdownMenuItem( + text = { + Text( + text = "English", + style = MaterialTheme.typography.bodySmall, + ) + }, + onClick = { + onSelectedLanguage(Lang.ENGLISH) + expanded = false + }, + ) + } + } + }, + scrollBehavior = scrollBehavior, + ) +} From 64f84a9fc04872e64665e9a0b80c3286132438c6 Mon Sep 17 00:00:00 2001 From: Yamada_Ika <73375669+Yamada-Ika@users.noreply.github.com> Date: Tue, 2 Jul 2024 00:17:58 +0900 Subject: [PATCH 03/22] feat: brush up headline --- .../sessions/TimetableItemDetailScreen.kt | 28 ++----- .../component/TimeTableItemDetailHeadline.kt | 76 +++++++++++++++++++ 2 files changed, 84 insertions(+), 20 deletions(-) create mode 100644 feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimeTableItemDetailHeadline.kt diff --git a/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/TimetableItemDetailScreen.kt b/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/TimetableItemDetailScreen.kt index e437216f6..11ce50d4f 100644 --- a/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/TimetableItemDetailScreen.kt +++ b/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/TimetableItemDetailScreen.kt @@ -7,6 +7,7 @@ import androidx.compose.foundation.background import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.material3.Button import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.MaterialTheme @@ -40,6 +41,7 @@ import io.github.droidkaigi.confsched.model.TimetableItem.Session import io.github.droidkaigi.confsched.model.fake import io.github.droidkaigi.confsched.sessions.TimetableItemDetailScreenUiState.Loaded import io.github.droidkaigi.confsched.sessions.TimetableItemDetailScreenUiState.Loading +import io.github.droidkaigi.confsched.sessions.component.TimeTableItemDetailHeadline import io.github.droidkaigi.confsched.sessions.component.TimetableItemDetailBottomAppBar import io.github.droidkaigi.confsched.sessions.component.TimetableItemDetailTopAppBar import io.github.droidkaigi.confsched.ui.SnackbarMessageEffect @@ -172,27 +174,13 @@ private fun TimetableItemDetailScreen( snackbarHost = { SnackbarHost(hostState = snackbarHostState) }, ) { innerPadding -> if (uiState is Loaded) { - Column( - Modifier.padding( - top = innerPadding.calculateTopPadding(), - ), + LazyColumn( + modifier = Modifier.fillMaxSize().padding(innerPadding), ) { - val currentLang = uiState.currentLang ?: Lang.ENGLISH - fun MultiLangText.getByLang(lang: Lang): String { - return if (lang == JAPANESE) { - jaTitle - } else { - enTitle - } - } - Text( - text = when (val item = uiState.timetableItem) { - is TimetableItem.Session -> item.description.getByLang(currentLang) - is TimetableItem.Special -> item.description.getByLang(currentLang) - }, - ) - Button(onClick = { onLinkClick(uiState.timetableItem.url) }) { - Text(text = "Link") + item { + TimeTableItemDetailHeadline( + timetableItem = uiState.timetableItem, + ) } } } diff --git a/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimeTableItemDetailHeadline.kt b/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimeTableItemDetailHeadline.kt new file mode 100644 index 000000000..b7c969fbe --- /dev/null +++ b/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimeTableItemDetailHeadline.kt @@ -0,0 +1,76 @@ +package io.github.droidkaigi.confsched.sessions.component + +import androidx.compose.foundation.BorderStroke +import androidx.compose.foundation.Image +import androidx.compose.foundation.border +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.Row +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.foundation.layout.width +import androidx.compose.foundation.shape.CircleShape +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier +import androidx.compose.ui.draw.clip +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.unit.dp +import io.github.droidkaigi.confsched.model.TimetableItem +import io.github.droidkaigi.confsched.sessions.section.TagView +import io.github.droidkaigi.confsched.ui.rememberAsyncImagePainter + +@Composable +fun TimeTableItemDetailHeadline( + timetableItem: TimetableItem, +) { + Column { + Row { + TagView( + tagText = timetableItem.room.name.currentLangTitle, + tagColor = Color.White, + ) + timetableItem.language.labels.forEach { label -> + Spacer(modifier = Modifier.padding(4.dp)) + TagView( + tagText = label, + tagColor = Color.White, + ) + } + } + Spacer(modifier = Modifier.height(16.dp)) + Text( + text = timetableItem.title.currentLangTitle, + style = MaterialTheme.typography.headlineSmall, + ) + Spacer(modifier = Modifier.height(16.dp)) + timetableItem.speakers.forEach { speaker -> + Row { + Image( + painter = rememberAsyncImagePainter(speaker.iconUrl), + contentDescription = null, + modifier = Modifier + .border(border = BorderStroke(width = 1.dp, color = MaterialTheme.colorScheme.onSurfaceVariant), shape = CircleShape) + .clip(CircleShape) + .size(52.dp), + ) + Spacer(modifier = Modifier.width(8.dp)) + Column { + Text( + text = speaker.name, + style = MaterialTheme.typography.bodyLarge, + color = MaterialTheme.colorScheme.onSurface, + ) + Text( + text = speaker.tagLine, + style = MaterialTheme.typography.bodySmall, + color = MaterialTheme.colorScheme.onSurfaceVariant, + ) + } + } + Spacer(modifier = Modifier.height(16.dp)) + } + } +} From 5d7fb7d465ce2707e40e8878da5c12a31a254f60 Mon Sep 17 00:00:00 2001 From: Yamada_Ika <73375669+Yamada-Ika@users.noreply.github.com> Date: Tue, 2 Jul 2024 00:20:49 +0900 Subject: [PATCH 04/22] feat: add timetable summary --- .../sessions/TimetableItemDetailScreen.kt | 7 ++ .../TimeTableItemDetailSummaryCard.kt | 107 ++++++++++++++++++ 2 files changed, 114 insertions(+) create mode 100644 feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimeTableItemDetailSummaryCard.kt diff --git a/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/TimetableItemDetailScreen.kt b/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/TimetableItemDetailScreen.kt index 11ce50d4f..774b3f087 100644 --- a/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/TimetableItemDetailScreen.kt +++ b/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/TimetableItemDetailScreen.kt @@ -42,6 +42,7 @@ import io.github.droidkaigi.confsched.model.fake import io.github.droidkaigi.confsched.sessions.TimetableItemDetailScreenUiState.Loaded import io.github.droidkaigi.confsched.sessions.TimetableItemDetailScreenUiState.Loading import io.github.droidkaigi.confsched.sessions.component.TimeTableItemDetailHeadline +import io.github.droidkaigi.confsched.sessions.component.TimeTableItemDetailSummaryCard import io.github.droidkaigi.confsched.sessions.component.TimetableItemDetailBottomAppBar import io.github.droidkaigi.confsched.sessions.component.TimetableItemDetailTopAppBar import io.github.droidkaigi.confsched.ui.SnackbarMessageEffect @@ -182,6 +183,12 @@ private fun TimetableItemDetailScreen( timetableItem = uiState.timetableItem, ) } + + item { + TimeTableItemDetailSummaryCard( + timetableItem = uiState.timetableItem, + ) + } } } diff --git a/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimeTableItemDetailSummaryCard.kt b/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimeTableItemDetailSummaryCard.kt new file mode 100644 index 000000000..cf4862ef2 --- /dev/null +++ b/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimeTableItemDetailSummaryCard.kt @@ -0,0 +1,107 @@ +package io.github.droidkaigi.confsched.sessions.component + +import androidx.compose.foundation.border +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.Spacer +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.height +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.width +import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.outlined.Category +import androidx.compose.material.icons.outlined.Language +import androidx.compose.material.icons.outlined.LocationOn +import androidx.compose.material.icons.outlined.Schedule +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.graphics.vector.ImageVector +import androidx.compose.ui.unit.dp +import io.github.droidkaigi.confsched.model.Locale +import io.github.droidkaigi.confsched.model.TimetableItem +import io.github.droidkaigi.confsched.model.getDefaultLocale +import io.github.droidkaigi.confsched.model.nameAndFloor + +@Composable +fun TimeTableItemDetailSummaryCard( + timetableItem: TimetableItem, +) { + Column( + modifier = Modifier + .padding(bottom = 16.dp) + .border(width = 1.dp, color = Color.White, shape = RoundedCornerShape(4.dp)), + ) { + Spacer(Modifier.height(8.dp)) + SummaryCardRow( + modifier = Modifier + .fillMaxWidth() + .padding(horizontal = 16.dp, vertical = 8.dp), + imageVector = Icons.Outlined.Schedule, + contentDescription = "Schedule", + title = "日時", + description = timetableItem.formattedDateTimeString, + ) + SummaryCardRow( + modifier = Modifier + .fillMaxWidth() + .padding(horizontal = 16.dp, vertical = 8.dp), + imageVector = Icons.Outlined.LocationOn, + contentDescription = "Location", + title = "場所", + description = timetableItem.room.nameAndFloor, + ) + SummaryCardRow( + modifier = Modifier + .fillMaxWidth() + .padding(horizontal = 16.dp, vertical = 8.dp), + imageVector = Icons.Outlined.Language, + contentDescription = "Language", + title = "対応言語", + description = timetableItem.getSupportedLangString( + getDefaultLocale() == Locale.JAPAN + ), + ) + SummaryCardRow( + modifier = Modifier + .fillMaxWidth() + .padding(horizontal = 16.dp, vertical = 8.dp), + imageVector = Icons.Outlined.Category, + contentDescription = "Category", + title = "カテゴリ", + description = timetableItem.category.title.currentLangTitle, + ) + Spacer(Modifier.height(8.dp)) + } +} + +@Composable +private fun SummaryCardRow( + modifier: Modifier, + imageVector: ImageVector, + contentDescription: String, + title: String, + description: String, +) { + Row( + modifier = modifier, + verticalAlignment = Alignment.CenterVertically, + ) { + Icon(imageVector = imageVector, contentDescription = contentDescription) + Spacer(Modifier.width(8.dp)) + Text( + text = title, + style = MaterialTheme.typography.titleSmall, + ) + Spacer(Modifier.width(8.dp)) + Text( + text = description, + style = MaterialTheme.typography.bodyMedium, + ) + } +} From 62b5bf84281197ff709d009200550ab1ec5846cc Mon Sep 17 00:00:00 2001 From: Yamada_Ika <73375669+Yamada-Ika@users.noreply.github.com> Date: Tue, 2 Jul 2024 00:24:16 +0900 Subject: [PATCH 05/22] feat: add audience and archive section --- .../sessions/TimetableItemDetailScreen.kt | 13 +- .../component/TimeTableItemDetailContent.kt | 151 ++++++++++++++++++ 2 files changed, 159 insertions(+), 5 deletions(-) create mode 100644 feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimeTableItemDetailContent.kt diff --git a/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/TimetableItemDetailScreen.kt b/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/TimetableItemDetailScreen.kt index 774b3f087..31cac6940 100644 --- a/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/TimetableItemDetailScreen.kt +++ b/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/TimetableItemDetailScreen.kt @@ -4,18 +4,15 @@ import androidx.compose.animation.AnimatedVisibility import androidx.compose.animation.fadeIn import androidx.compose.animation.fadeOut import androidx.compose.foundation.background -import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.padding import androidx.compose.foundation.lazy.LazyColumn -import androidx.compose.material3.Button import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Scaffold import androidx.compose.material3.SnackbarHost import androidx.compose.material3.SnackbarHostState import androidx.compose.material3.Surface -import androidx.compose.material3.Text import androidx.compose.material3.TopAppBarDefaults import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue @@ -34,13 +31,12 @@ import io.github.droidkaigi.confsched.designsystem.preview.MultiLanguagePreviews import io.github.droidkaigi.confsched.designsystem.preview.MultiThemePreviews import io.github.droidkaigi.confsched.designsystem.theme.KaigiTheme import io.github.droidkaigi.confsched.model.Lang -import io.github.droidkaigi.confsched.model.Lang.JAPANESE -import io.github.droidkaigi.confsched.model.MultiLangText import io.github.droidkaigi.confsched.model.TimetableItem import io.github.droidkaigi.confsched.model.TimetableItem.Session import io.github.droidkaigi.confsched.model.fake import io.github.droidkaigi.confsched.sessions.TimetableItemDetailScreenUiState.Loaded import io.github.droidkaigi.confsched.sessions.TimetableItemDetailScreenUiState.Loading +import io.github.droidkaigi.confsched.sessions.component.TimeTableItemDetailContent import io.github.droidkaigi.confsched.sessions.component.TimeTableItemDetailHeadline import io.github.droidkaigi.confsched.sessions.component.TimeTableItemDetailSummaryCard import io.github.droidkaigi.confsched.sessions.component.TimetableItemDetailBottomAppBar @@ -189,6 +185,13 @@ private fun TimetableItemDetailScreen( timetableItem = uiState.timetableItem, ) } + + item { + TimeTableItemDetailContent( + timetableItem = uiState.timetableItem, + onLinkClick = onLinkClick, + ) + } } } diff --git a/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimeTableItemDetailContent.kt b/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimeTableItemDetailContent.kt new file mode 100644 index 000000000..a80f64850 --- /dev/null +++ b/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimeTableItemDetailContent.kt @@ -0,0 +1,151 @@ +package io.github.droidkaigi.confsched.sessions.component + +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.Spacer +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.height +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.width +import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.outlined.Description +import androidx.compose.material.icons.outlined.PlayCircle +import androidx.compose.material3.Button +import androidx.compose.material3.Icon +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.OutlinedButton +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.remember +import androidx.compose.runtime.setValue +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.text.style.TextOverflow +import androidx.compose.ui.unit.dp +import io.github.droidkaigi.confsched.designsystem.component.ClickableLinkText +import io.github.droidkaigi.confsched.model.TimetableItem +import io.github.droidkaigi.confsched.model.TimetableItem.Session +import io.github.droidkaigi.confsched.model.TimetableItem.Special + +@Composable +fun TimeTableItemDetailContent( + timetableItem: TimetableItem, + onLinkClick: (url: String) -> Unit, +) { + DescriptionSection( + timetableItem = timetableItem, + onLinkClick = onLinkClick, + ) + TargetAudienceSection(timetableItem = timetableItem) + if (timetableItem.asset.isAvailable) { + ArchiveSection( + timetableItem = timetableItem, + onViewSlideClick = onLinkClick, + onWatchVideoClick = onLinkClick, + ) + } +} + +@Composable +private fun DescriptionSection( + timetableItem: TimetableItem, + onLinkClick: (url: String) -> Unit, +) { + var isExpand by remember { mutableStateOf(false) } + Column( + modifier = Modifier + .fillMaxWidth() + .padding(bottom = 16.dp), + ) { + ClickableLinkText( + content = when(timetableItem) { + is Session -> timetableItem.description + is Special -> timetableItem.description + }.currentLangTitle, + regex = "(https)(://[\\w/:%#$&?()~.=+\\-]+)".toRegex(), + onLinkClick = onLinkClick, + style = MaterialTheme.typography.bodyLarge, + maxLines = if (isExpand) Int.MAX_VALUE else 7, + overflow = if (isExpand) TextOverflow.Clip else TextOverflow.Ellipsis, + ) + if (isExpand.not()) { + OutlinedButton( + modifier = Modifier + .fillMaxWidth() + .padding(vertical = 16.dp), + onClick = { isExpand = true }, + ) { + Text( + text = "続きを読む", + style = MaterialTheme.typography.labelLarge, + ) + } + } + } +} + +@Composable +private fun TargetAudienceSection( + timetableItem: TimetableItem, +) { + Text( + text = "対象者", + style = MaterialTheme.typography.titleLarge, + ) + Text( + modifier = Modifier.padding(vertical = 8.dp), + text = timetableItem.targetAudience, + style = MaterialTheme.typography.bodyLarge, + ) +} + +@Composable +private fun ArchiveSection( + timetableItem: TimetableItem, + onViewSlideClick: (url: String) -> Unit, + onWatchVideoClick: (url: String) -> Unit, +) { + Spacer(Modifier.height(16.dp)) + Text( + text = "アーカイブ", + style = MaterialTheme.typography.titleLarge, + ) + Spacer(Modifier.height(8.dp)) + Row( + verticalAlignment = Alignment.CenterVertically, + ) { + timetableItem.asset.slideUrl?.let { slideUrl -> + Button( + modifier = Modifier.weight(1f), + onClick = { onViewSlideClick(slideUrl) }, + ) { + Icon( + imageVector = Icons.Outlined.Description, + contentDescription = "Slide", + ) + Text( + text = "スライド", + style = MaterialTheme.typography.labelLarge, + ) + } + } + timetableItem.asset.videoUrl?.let { videoUrl -> + Spacer(modifier = Modifier.width(8.dp)) + Button( + modifier = Modifier.weight(1f), + onClick = { onWatchVideoClick(videoUrl) }, + ) { + Icon( + imageVector = Icons.Outlined.PlayCircle, + contentDescription = "Video", + ) + Text( + text = "動画", + style = MaterialTheme.typography.labelLarge, + ) + } + } + } +} From d30867ad0aa31b8ba21f22809c3a7319dfcee940 Mon Sep 17 00:00:00 2001 From: Yamada_Ika <73375669+Yamada-Ika@users.noreply.github.com> Date: Tue, 2 Jul 2024 02:34:39 +0900 Subject: [PATCH 06/22] fix: format --- .../component/TimeTableItemDetailContent.kt | 121 ++++++++++-------- .../component/TimeTableItemDetailHeadline.kt | 3 +- .../TimeTableItemDetailSummaryCard.kt | 7 +- .../TimetableItemDetailBottomAppBar.kt | 2 + .../component/TimetableItemDetailTopAppBar.kt | 3 + 5 files changed, 76 insertions(+), 60 deletions(-) diff --git a/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimeTableItemDetailContent.kt b/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimeTableItemDetailContent.kt index a80f64850..70db0181b 100644 --- a/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimeTableItemDetailContent.kt +++ b/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimeTableItemDetailContent.kt @@ -32,19 +32,22 @@ import io.github.droidkaigi.confsched.model.TimetableItem.Special @Composable fun TimeTableItemDetailContent( timetableItem: TimetableItem, + modifier: Modifier = Modifier, onLinkClick: (url: String) -> Unit, ) { - DescriptionSection( - timetableItem = timetableItem, - onLinkClick = onLinkClick, - ) - TargetAudienceSection(timetableItem = timetableItem) - if (timetableItem.asset.isAvailable) { - ArchiveSection( + Column(modifier = modifier) { + DescriptionSection( timetableItem = timetableItem, - onViewSlideClick = onLinkClick, - onWatchVideoClick = onLinkClick, + onLinkClick = onLinkClick, ) + TargetAudienceSection(timetableItem = timetableItem) + if (timetableItem.asset.isAvailable) { + ArchiveSection( + timetableItem = timetableItem, + onViewSlideClick = onLinkClick, + onWatchVideoClick = onLinkClick, + ) + } } } @@ -60,7 +63,7 @@ private fun DescriptionSection( .padding(bottom = 16.dp), ) { ClickableLinkText( - content = when(timetableItem) { + content = when (timetableItem) { is Session -> timetableItem.description is Special -> timetableItem.description }.currentLangTitle, @@ -89,62 +92,68 @@ private fun DescriptionSection( @Composable private fun TargetAudienceSection( timetableItem: TimetableItem, + modifier: Modifier = Modifier, ) { - Text( - text = "対象者", - style = MaterialTheme.typography.titleLarge, - ) - Text( - modifier = Modifier.padding(vertical = 8.dp), - text = timetableItem.targetAudience, - style = MaterialTheme.typography.bodyLarge, - ) + Column(modifier = modifier) { + Text( + text = "対象者", + style = MaterialTheme.typography.titleLarge, + ) + Text( + modifier = Modifier.padding(vertical = 8.dp), + text = timetableItem.targetAudience, + style = MaterialTheme.typography.bodyLarge, + ) + } } @Composable private fun ArchiveSection( timetableItem: TimetableItem, onViewSlideClick: (url: String) -> Unit, + modifier: Modifier = Modifier, onWatchVideoClick: (url: String) -> Unit, ) { - Spacer(Modifier.height(16.dp)) - Text( - text = "アーカイブ", - style = MaterialTheme.typography.titleLarge, - ) - Spacer(Modifier.height(8.dp)) - Row( - verticalAlignment = Alignment.CenterVertically, - ) { - timetableItem.asset.slideUrl?.let { slideUrl -> - Button( - modifier = Modifier.weight(1f), - onClick = { onViewSlideClick(slideUrl) }, - ) { - Icon( - imageVector = Icons.Outlined.Description, - contentDescription = "Slide", - ) - Text( - text = "スライド", - style = MaterialTheme.typography.labelLarge, - ) + Column(modifier = modifier) { + Spacer(Modifier.height(16.dp)) + Text( + text = "アーカイブ", + style = MaterialTheme.typography.titleLarge, + ) + Spacer(Modifier.height(8.dp)) + Row( + verticalAlignment = Alignment.CenterVertically, + ) { + timetableItem.asset.slideUrl?.let { slideUrl -> + Button( + modifier = Modifier.weight(1f), + onClick = { onViewSlideClick(slideUrl) }, + ) { + Icon( + imageVector = Icons.Outlined.Description, + contentDescription = "Slide", + ) + Text( + text = "スライド", + style = MaterialTheme.typography.labelLarge, + ) + } } - } - timetableItem.asset.videoUrl?.let { videoUrl -> - Spacer(modifier = Modifier.width(8.dp)) - Button( - modifier = Modifier.weight(1f), - onClick = { onWatchVideoClick(videoUrl) }, - ) { - Icon( - imageVector = Icons.Outlined.PlayCircle, - contentDescription = "Video", - ) - Text( - text = "動画", - style = MaterialTheme.typography.labelLarge, - ) + timetableItem.asset.videoUrl?.let { videoUrl -> + Spacer(modifier = Modifier.width(8.dp)) + Button( + modifier = Modifier.weight(1f), + onClick = { onWatchVideoClick(videoUrl) }, + ) { + Icon( + imageVector = Icons.Outlined.PlayCircle, + contentDescription = "Video", + ) + Text( + text = "動画", + style = MaterialTheme.typography.labelLarge, + ) + } } } } diff --git a/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimeTableItemDetailHeadline.kt b/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimeTableItemDetailHeadline.kt index b7c969fbe..5f23d8fd8 100644 --- a/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimeTableItemDetailHeadline.kt +++ b/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimeTableItemDetailHeadline.kt @@ -25,8 +25,9 @@ import io.github.droidkaigi.confsched.ui.rememberAsyncImagePainter @Composable fun TimeTableItemDetailHeadline( timetableItem: TimetableItem, + modifier: Modifier = Modifier, ) { - Column { + Column(modifier = modifier) { Row { TagView( tagText = timetableItem.room.name.currentLangTitle, diff --git a/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimeTableItemDetailSummaryCard.kt b/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimeTableItemDetailSummaryCard.kt index cf4862ef2..95a922030 100644 --- a/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimeTableItemDetailSummaryCard.kt +++ b/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimeTableItemDetailSummaryCard.kt @@ -31,9 +31,10 @@ import io.github.droidkaigi.confsched.model.nameAndFloor @Composable fun TimeTableItemDetailSummaryCard( timetableItem: TimetableItem, + modifier: Modifier = Modifier, ) { Column( - modifier = Modifier + modifier = modifier .padding(bottom = 16.dp) .border(width = 1.dp, color = Color.White, shape = RoundedCornerShape(4.dp)), ) { @@ -64,7 +65,7 @@ fun TimeTableItemDetailSummaryCard( contentDescription = "Language", title = "対応言語", description = timetableItem.getSupportedLangString( - getDefaultLocale() == Locale.JAPAN + getDefaultLocale() == Locale.JAPAN, ), ) SummaryCardRow( @@ -82,11 +83,11 @@ fun TimeTableItemDetailSummaryCard( @Composable private fun SummaryCardRow( - modifier: Modifier, imageVector: ImageVector, contentDescription: String, title: String, description: String, + modifier: Modifier = Modifier, ) { Row( modifier = modifier, diff --git a/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimetableItemDetailBottomAppBar.kt b/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimetableItemDetailBottomAppBar.kt index 387594e81..36782afdf 100644 --- a/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimetableItemDetailBottomAppBar.kt +++ b/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimetableItemDetailBottomAppBar.kt @@ -21,9 +21,11 @@ fun TimetableItemDetailBottomAppBar( isBookmarked: Boolean, onBookmarkClick: (TimetableItem) -> Unit, onCalendarRegistrationClick: (TimetableItem) -> Unit, + modifier: Modifier = Modifier, onShareClick: (TimetableItem) -> Unit, ) { BottomAppBar( + modifier = modifier, actions = { IconButton(onClick = { onShareClick(timetableItem) }) { Icon( diff --git a/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimetableItemDetailTopAppBar.kt b/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimetableItemDetailTopAppBar.kt index c0131f819..7d9dd4cd6 100644 --- a/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimetableItemDetailTopAppBar.kt +++ b/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimetableItemDetailTopAppBar.kt @@ -17,6 +17,7 @@ import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.runtime.setValue +import androidx.compose.ui.Modifier import io.github.droidkaigi.confsched.model.Lang @OptIn(ExperimentalMaterial3Api::class) @@ -26,8 +27,10 @@ fun TimetableItemDetailTopAppBar( onNavigationIconClick: () -> Unit, onSelectedLanguage: (Lang) -> Unit, scrollBehavior: TopAppBarScrollBehavior, + modifier: Modifier = Modifier, ) { TopAppBar( + modifier = modifier, title = {}, navigationIcon = { IconButton(onClick = { onNavigationIconClick() }) { From 24a039370b3e5bbefbc143d43f4d820398e321b1 Mon Sep 17 00:00:00 2001 From: Yamada_Ika <73375669+Yamada-Ika@users.noreply.github.com> Date: Tue, 2 Jul 2024 21:29:15 +0900 Subject: [PATCH 07/22] fix: minor refactor --- .../TimeTableItemDetailSummaryCard.kt | 26 +++++++------------ 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimeTableItemDetailSummaryCard.kt b/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimeTableItemDetailSummaryCard.kt index 95a922030..c13df5c85 100644 --- a/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimeTableItemDetailSummaryCard.kt +++ b/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimeTableItemDetailSummaryCard.kt @@ -35,32 +35,28 @@ fun TimeTableItemDetailSummaryCard( ) { Column( modifier = modifier - .padding(bottom = 16.dp) - .border(width = 1.dp, color = Color.White, shape = RoundedCornerShape(4.dp)), + .padding(8.dp) + .border(width = 1.dp, color = Color.White, shape = RoundedCornerShape(4.dp)) + .padding(12.dp), ) { - Spacer(Modifier.height(8.dp)) SummaryCardRow( - modifier = Modifier - .fillMaxWidth() - .padding(horizontal = 16.dp, vertical = 8.dp), + modifier = Modifier.fillMaxWidth(), imageVector = Icons.Outlined.Schedule, contentDescription = "Schedule", title = "日時", description = timetableItem.formattedDateTimeString, ) + Spacer(Modifier.height(8.dp)) SummaryCardRow( - modifier = Modifier - .fillMaxWidth() - .padding(horizontal = 16.dp, vertical = 8.dp), + modifier = Modifier.fillMaxWidth(), imageVector = Icons.Outlined.LocationOn, contentDescription = "Location", title = "場所", description = timetableItem.room.nameAndFloor, ) + Spacer(Modifier.height(8.dp)) SummaryCardRow( - modifier = Modifier - .fillMaxWidth() - .padding(horizontal = 16.dp, vertical = 8.dp), + modifier = Modifier.fillMaxWidth(), imageVector = Icons.Outlined.Language, contentDescription = "Language", title = "対応言語", @@ -68,16 +64,14 @@ fun TimeTableItemDetailSummaryCard( getDefaultLocale() == Locale.JAPAN, ), ) + Spacer(Modifier.height(8.dp)) SummaryCardRow( - modifier = Modifier - .fillMaxWidth() - .padding(horizontal = 16.dp, vertical = 8.dp), + modifier = Modifier.fillMaxWidth(), imageVector = Icons.Outlined.Category, contentDescription = "Category", title = "カテゴリ", description = timetableItem.category.title.currentLangTitle, ) - Spacer(Modifier.height(8.dp)) } } From 1bc6a4a9d1694497f079bb71cd351eff9f0beccf Mon Sep 17 00:00:00 2001 From: Yamada_Ika <73375669+Yamada-Ika@users.noreply.github.com> Date: Tue, 2 Jul 2024 21:35:59 +0900 Subject: [PATCH 08/22] fix: minor refactor --- .../sessions/component/TimeTableItemDetailContent.kt | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimeTableItemDetailContent.kt b/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimeTableItemDetailContent.kt index 70db0181b..d8f9b79e8 100644 --- a/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimeTableItemDetailContent.kt +++ b/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimeTableItemDetailContent.kt @@ -57,10 +57,9 @@ private fun DescriptionSection( onLinkClick: (url: String) -> Unit, ) { var isExpand by remember { mutableStateOf(false) } + Column( - modifier = Modifier - .fillMaxWidth() - .padding(bottom = 16.dp), + modifier = Modifier.padding(8.dp) ) { ClickableLinkText( content = when (timetableItem) { @@ -73,11 +72,10 @@ private fun DescriptionSection( maxLines = if (isExpand) Int.MAX_VALUE else 7, overflow = if (isExpand) TextOverflow.Clip else TextOverflow.Ellipsis, ) + Spacer(Modifier.height(16.dp)) if (isExpand.not()) { OutlinedButton( - modifier = Modifier - .fillMaxWidth() - .padding(vertical = 16.dp), + modifier = Modifier.fillMaxWidth(), onClick = { isExpand = true }, ) { Text( @@ -86,6 +84,7 @@ private fun DescriptionSection( ) } } + Spacer(Modifier.height(16.dp)) } } From 5378ef2f8e9848044b1914b7de4b5587ee533bf2 Mon Sep 17 00:00:00 2001 From: Yamada_Ika <73375669+Yamada-Ika@users.noreply.github.com> Date: Tue, 2 Jul 2024 21:49:33 +0900 Subject: [PATCH 09/22] fix: minor refactor --- .../sessions/component/TimeTableItemDetailContent.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimeTableItemDetailContent.kt b/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimeTableItemDetailContent.kt index d8f9b79e8..8b65aad50 100644 --- a/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimeTableItemDetailContent.kt +++ b/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimeTableItemDetailContent.kt @@ -93,16 +93,17 @@ private fun TargetAudienceSection( timetableItem: TimetableItem, modifier: Modifier = Modifier, ) { - Column(modifier = modifier) { + Column(modifier = modifier.padding(8.dp)) { Text( text = "対象者", style = MaterialTheme.typography.titleLarge, ) + Spacer(Modifier.height(8.dp)) Text( - modifier = Modifier.padding(vertical = 8.dp), text = timetableItem.targetAudience, style = MaterialTheme.typography.bodyLarge, ) + Spacer(Modifier.height(8.dp)) } } From cd83ca1f675531c17ef7d984c411eb25b6fa4d72 Mon Sep 17 00:00:00 2001 From: Yamada_Ika <73375669+Yamada-Ika@users.noreply.github.com> Date: Tue, 2 Jul 2024 21:51:30 +0900 Subject: [PATCH 10/22] fix: minor refactor --- .../confsched/sessions/component/TimeTableItemDetailContent.kt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimeTableItemDetailContent.kt b/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimeTableItemDetailContent.kt index 8b65aad50..2250696c8 100644 --- a/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimeTableItemDetailContent.kt +++ b/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimeTableItemDetailContent.kt @@ -114,8 +114,7 @@ private fun ArchiveSection( modifier: Modifier = Modifier, onWatchVideoClick: (url: String) -> Unit, ) { - Column(modifier = modifier) { - Spacer(Modifier.height(16.dp)) + Column(modifier = modifier.padding(8.dp)) { Text( text = "アーカイブ", style = MaterialTheme.typography.titleLarge, From b2b1e5b1c917c85d20df0362f15702005b0e10cc Mon Sep 17 00:00:00 2001 From: Yamada_Ika <73375669+Yamada-Ika@users.noreply.github.com> Date: Tue, 2 Jul 2024 21:59:58 +0900 Subject: [PATCH 11/22] fix: Special TimetableItem is not fixed --- .../component/TimeTableItemDetailContent.kt | 31 ++++++++++++------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimeTableItemDetailContent.kt b/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimeTableItemDetailContent.kt index 2250696c8..17c4734ce 100644 --- a/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimeTableItemDetailContent.kt +++ b/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimeTableItemDetailContent.kt @@ -36,18 +36,27 @@ fun TimeTableItemDetailContent( onLinkClick: (url: String) -> Unit, ) { Column(modifier = modifier) { - DescriptionSection( - timetableItem = timetableItem, - onLinkClick = onLinkClick, - ) - TargetAudienceSection(timetableItem = timetableItem) - if (timetableItem.asset.isAvailable) { - ArchiveSection( - timetableItem = timetableItem, - onViewSlideClick = onLinkClick, - onWatchVideoClick = onLinkClick, - ) + when (timetableItem) { + is Session -> { + DescriptionSection( + timetableItem = timetableItem, + onLinkClick = onLinkClick, + ) + TargetAudienceSection(timetableItem = timetableItem) + if (timetableItem.asset.isAvailable) { + ArchiveSection( + timetableItem = timetableItem, + onViewSlideClick = onLinkClick, + onWatchVideoClick = onLinkClick, + ) + } + } + + is Special -> { + Text("Special") + } } + } } From 1625b6787d46bde8483ab42ee8acc4fca9337872 Mon Sep 17 00:00:00 2001 From: Yamada_Ika <73375669+Yamada-Ika@users.noreply.github.com> Date: Tue, 2 Jul 2024 22:08:35 +0900 Subject: [PATCH 12/22] feat: switch timetable description language --- .../sessions/TimetableItemDetailScreen.kt | 1 + .../component/TimeTableItemDetailContent.kt | 20 +++++++++++++------ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/TimetableItemDetailScreen.kt b/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/TimetableItemDetailScreen.kt index 31cac6940..eb25d8100 100644 --- a/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/TimetableItemDetailScreen.kt +++ b/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/TimetableItemDetailScreen.kt @@ -189,6 +189,7 @@ private fun TimetableItemDetailScreen( item { TimeTableItemDetailContent( timetableItem = uiState.timetableItem, + currentLang = uiState.currentLang, onLinkClick = onLinkClick, ) } diff --git a/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimeTableItemDetailContent.kt b/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimeTableItemDetailContent.kt index 17c4734ce..4222dfaa2 100644 --- a/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimeTableItemDetailContent.kt +++ b/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimeTableItemDetailContent.kt @@ -25,6 +25,8 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.unit.dp import io.github.droidkaigi.confsched.designsystem.component.ClickableLinkText +import io.github.droidkaigi.confsched.model.Lang +import io.github.droidkaigi.confsched.model.MultiLangText import io.github.droidkaigi.confsched.model.TimetableItem import io.github.droidkaigi.confsched.model.TimetableItem.Session import io.github.droidkaigi.confsched.model.TimetableItem.Special @@ -32,14 +34,23 @@ import io.github.droidkaigi.confsched.model.TimetableItem.Special @Composable fun TimeTableItemDetailContent( timetableItem: TimetableItem, + currentLang: Lang?, modifier: Modifier = Modifier, onLinkClick: (url: String) -> Unit, ) { Column(modifier = modifier) { when (timetableItem) { is Session -> { + val currentLang = currentLang ?: Lang.ENGLISH + fun MultiLangText.getByLang(lang: Lang): String { + return if (lang == Lang.JAPANESE) { + jaTitle + } else { + enTitle + } + } DescriptionSection( - timetableItem = timetableItem, + description = timetableItem.description.getByLang(currentLang), onLinkClick = onLinkClick, ) TargetAudienceSection(timetableItem = timetableItem) @@ -62,7 +73,7 @@ fun TimeTableItemDetailContent( @Composable private fun DescriptionSection( - timetableItem: TimetableItem, + description: String, onLinkClick: (url: String) -> Unit, ) { var isExpand by remember { mutableStateOf(false) } @@ -71,10 +82,7 @@ private fun DescriptionSection( modifier = Modifier.padding(8.dp) ) { ClickableLinkText( - content = when (timetableItem) { - is Session -> timetableItem.description - is Special -> timetableItem.description - }.currentLangTitle, + content = description, regex = "(https)(://[\\w/:%#$&?()~.=+\\-]+)".toRegex(), onLinkClick = onLinkClick, style = MaterialTheme.typography.bodyLarge, From 26a40fcda8e350e3a29b3f58464666bbc550f245 Mon Sep 17 00:00:00 2001 From: Yamada_Ika <73375669+Yamada-Ika@users.noreply.github.com> Date: Tue, 2 Jul 2024 22:18:15 +0900 Subject: [PATCH 13/22] feat: apply color to headline --- .../sessions/component/TimeTableItemDetailHeadline.kt | 11 ++++++++--- .../component/TimetableItemDetailTopAppBar.kt | 8 ++++++++ 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimeTableItemDetailHeadline.kt b/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimeTableItemDetailHeadline.kt index 5f23d8fd8..dbe59c323 100644 --- a/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimeTableItemDetailHeadline.kt +++ b/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimeTableItemDetailHeadline.kt @@ -2,6 +2,7 @@ package io.github.droidkaigi.confsched.sessions.component import androidx.compose.foundation.BorderStroke import androidx.compose.foundation.Image +import androidx.compose.foundation.background import androidx.compose.foundation.border import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row @@ -27,17 +28,21 @@ fun TimeTableItemDetailHeadline( timetableItem: TimetableItem, modifier: Modifier = Modifier, ) { - Column(modifier = modifier) { + // TODO: switch color according to room type + Column(modifier = modifier + .background(Color(0xFF132417)) + .padding(8.dp), + ) { Row { TagView( tagText = timetableItem.room.name.currentLangTitle, - tagColor = Color.White, + tagColor = Color(0xFF45E761), ) timetableItem.language.labels.forEach { label -> Spacer(modifier = Modifier.padding(4.dp)) TagView( tagText = label, - tagColor = Color.White, + tagColor = MaterialTheme.colorScheme.onSurfaceVariant, ) } } diff --git a/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimetableItemDetailTopAppBar.kt b/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimetableItemDetailTopAppBar.kt index 7d9dd4cd6..be984424a 100644 --- a/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimetableItemDetailTopAppBar.kt +++ b/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimetableItemDetailTopAppBar.kt @@ -11,6 +11,8 @@ import androidx.compose.material3.IconButton import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.material3.TopAppBar +import androidx.compose.material3.TopAppBarColors +import androidx.compose.material3.TopAppBarDefaults import androidx.compose.material3.TopAppBarScrollBehavior import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue @@ -18,6 +20,7 @@ import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.runtime.setValue import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.Color import io.github.droidkaigi.confsched.model.Lang @OptIn(ExperimentalMaterial3Api::class) @@ -31,6 +34,11 @@ fun TimetableItemDetailTopAppBar( ) { TopAppBar( modifier = modifier, + // TODO: switch color according to room type + colors = TopAppBarDefaults.topAppBarColors().copy( + containerColor = Color(0xFF132417), + scrolledContainerColor = Color(0xFF132417), + ), title = {}, navigationIcon = { IconButton(onClick = { onNavigationIconClick() }) { From 1f73c0017fea4bb92dc604eb6a7a401abeae177f Mon Sep 17 00:00:00 2001 From: Yamada_Ika <73375669+Yamada-Ika@users.noreply.github.com> Date: Tue, 2 Jul 2024 22:27:04 +0900 Subject: [PATCH 14/22] fix: space size --- .../confsched/sessions/component/TimeTableItemDetailHeadline.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimeTableItemDetailHeadline.kt b/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimeTableItemDetailHeadline.kt index dbe59c323..f3189ccc1 100644 --- a/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimeTableItemDetailHeadline.kt +++ b/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimeTableItemDetailHeadline.kt @@ -76,7 +76,7 @@ fun TimeTableItemDetailHeadline( ) } } - Spacer(modifier = Modifier.height(16.dp)) + Spacer(modifier = Modifier.height(8.dp)) } } } From b454b2e883b96565080868b1366bba4bcbb492e3 Mon Sep 17 00:00:00 2001 From: Yamada_Ika <73375669+Yamada-Ika@users.noreply.github.com> Date: Tue, 2 Jul 2024 22:36:50 +0900 Subject: [PATCH 15/22] feat: apply color to summary card --- .../TimeTableItemDetailSummaryCard.kt | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimeTableItemDetailSummaryCard.kt b/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimeTableItemDetailSummaryCard.kt index c13df5c85..6dac674dd 100644 --- a/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimeTableItemDetailSummaryCard.kt +++ b/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimeTableItemDetailSummaryCard.kt @@ -20,7 +20,11 @@ import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier +import androidx.compose.ui.draw.drawBehind +import androidx.compose.ui.geometry.CornerRadius import androidx.compose.ui.graphics.Color +import androidx.compose.ui.graphics.PathEffect +import androidx.compose.ui.graphics.drawscope.Stroke import androidx.compose.ui.graphics.vector.ImageVector import androidx.compose.ui.unit.dp import io.github.droidkaigi.confsched.model.Locale @@ -33,10 +37,20 @@ fun TimeTableItemDetailSummaryCard( timetableItem: TimetableItem, modifier: Modifier = Modifier, ) { + // TODO: switch color according to room type Column( modifier = modifier .padding(8.dp) - .border(width = 1.dp, color = Color.White, shape = RoundedCornerShape(4.dp)) + .drawBehind { + drawRoundRect( + color = Color(0xFF45E761), + style = Stroke( + width = 2f, + pathEffect = PathEffect.dashPathEffect(floatArrayOf(5f, 5f), 0f) + ), + cornerRadius = CornerRadius(4.dp.toPx()), + ) + } .padding(12.dp), ) { SummaryCardRow( @@ -87,11 +101,12 @@ private fun SummaryCardRow( modifier = modifier, verticalAlignment = Alignment.CenterVertically, ) { - Icon(imageVector = imageVector, contentDescription = contentDescription) + Icon(imageVector = imageVector, contentDescription = contentDescription, tint = Color(0xFF45E761)) Spacer(Modifier.width(8.dp)) Text( text = title, style = MaterialTheme.typography.titleSmall, + color = Color(0xFF45E761), ) Spacer(Modifier.width(8.dp)) Text( From f3d0682242ecfcd07be2afbd5a48cb1030cb3b81 Mon Sep 17 00:00:00 2001 From: Yamada_Ika <73375669+Yamada-Ika@users.noreply.github.com> Date: Tue, 2 Jul 2024 22:38:38 +0900 Subject: [PATCH 16/22] fix: space size --- .../sessions/component/TimeTableItemDetailSummaryCard.kt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimeTableItemDetailSummaryCard.kt b/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimeTableItemDetailSummaryCard.kt index 6dac674dd..814e0b403 100644 --- a/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimeTableItemDetailSummaryCard.kt +++ b/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimeTableItemDetailSummaryCard.kt @@ -40,7 +40,12 @@ fun TimeTableItemDetailSummaryCard( // TODO: switch color according to room type Column( modifier = modifier - .padding(8.dp) + .padding( + start = 8.dp, + end = 8.dp, + top = 16.dp, + bottom = 8.dp, + ) .drawBehind { drawRoundRect( color = Color(0xFF45E761), From d1ed1fb0b98febb61fbe35d7df6d2605dd854d81 Mon Sep 17 00:00:00 2001 From: Yamada_Ika <73375669+Yamada-Ika@users.noreply.github.com> Date: Tue, 2 Jul 2024 22:43:55 +0900 Subject: [PATCH 17/22] feat: apply color to other section --- .../component/TimeTableItemDetailContent.kt | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimeTableItemDetailContent.kt b/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimeTableItemDetailContent.kt index 4222dfaa2..23edb87d2 100644 --- a/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimeTableItemDetailContent.kt +++ b/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimeTableItemDetailContent.kt @@ -11,6 +11,8 @@ import androidx.compose.material.icons.Icons import androidx.compose.material.icons.outlined.Description import androidx.compose.material.icons.outlined.PlayCircle import androidx.compose.material3.Button +import androidx.compose.material3.ButtonColors +import androidx.compose.material3.ButtonDefaults import androidx.compose.material3.Icon import androidx.compose.material3.MaterialTheme import androidx.compose.material3.OutlinedButton @@ -22,6 +24,7 @@ import androidx.compose.runtime.remember import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.Color import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.unit.dp import io.github.droidkaigi.confsched.designsystem.component.ClickableLinkText @@ -76,6 +79,7 @@ private fun DescriptionSection( description: String, onLinkClick: (url: String) -> Unit, ) { + // TODO: switch color according to room type var isExpand by remember { mutableStateOf(false) } Column( @@ -98,6 +102,7 @@ private fun DescriptionSection( Text( text = "続きを読む", style = MaterialTheme.typography.labelLarge, + color = Color(0xFF45E761), ) } } @@ -110,10 +115,12 @@ private fun TargetAudienceSection( timetableItem: TimetableItem, modifier: Modifier = Modifier, ) { + // TODO: switch color according to room type Column(modifier = modifier.padding(8.dp)) { Text( text = "対象者", style = MaterialTheme.typography.titleLarge, + color = Color(0xFF45E761), ) Spacer(Modifier.height(8.dp)) Text( @@ -131,10 +138,12 @@ private fun ArchiveSection( modifier: Modifier = Modifier, onWatchVideoClick: (url: String) -> Unit, ) { + // TODO: switch color according to room type Column(modifier = modifier.padding(8.dp)) { Text( text = "アーカイブ", style = MaterialTheme.typography.titleLarge, + color = Color(0xFF45E761), ) Spacer(Modifier.height(8.dp)) Row( @@ -144,6 +153,9 @@ private fun ArchiveSection( Button( modifier = Modifier.weight(1f), onClick = { onViewSlideClick(slideUrl) }, + colors = ButtonDefaults.buttonColors().copy( + containerColor = Color(0xFF45E761), + ), ) { Icon( imageVector = Icons.Outlined.Description, @@ -160,6 +172,9 @@ private fun ArchiveSection( Button( modifier = Modifier.weight(1f), onClick = { onWatchVideoClick(videoUrl) }, + colors = ButtonDefaults.buttonColors().copy( + containerColor = Color(0xFF45E761), + ), ) { Icon( imageVector = Icons.Outlined.PlayCircle, From 8944cb6880fea9bbefe1adfdec66b348fc14254c Mon Sep 17 00:00:00 2001 From: Yamada_Ika <73375669+Yamada-Ika@users.noreply.github.com> Date: Tue, 2 Jul 2024 22:46:59 +0900 Subject: [PATCH 18/22] fix: favorite color --- .../sessions/component/TimetableItemDetailBottomAppBar.kt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimetableItemDetailBottomAppBar.kt b/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimetableItemDetailBottomAppBar.kt index 36782afdf..57663caf8 100644 --- a/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimetableItemDetailBottomAppBar.kt +++ b/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimetableItemDetailBottomAppBar.kt @@ -9,6 +9,7 @@ import androidx.compose.material3.BottomAppBar import androidx.compose.material3.FloatingActionButton import androidx.compose.material3.Icon import androidx.compose.material3.IconButton +import androidx.compose.material3.MaterialTheme import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.platform.testTag @@ -44,6 +45,7 @@ fun TimetableItemDetailBottomAppBar( FloatingActionButton( modifier = Modifier.testTag(TimetableItemDetailBookmarkIconTestTag), onClick = { onBookmarkClick(timetableItem) }, + containerColor = MaterialTheme.colorScheme.secondaryContainer, ) { Icon( imageVector = if (isBookmarked) Icons.Filled.Favorite else Icons.Outlined.FavoriteBorder, From b691273f446cf1b5462faf158c01560197ba666d Mon Sep 17 00:00:00 2001 From: Yamada_Ika <73375669+Yamada-Ika@users.noreply.github.com> Date: Tue, 2 Jul 2024 23:11:31 +0900 Subject: [PATCH 19/22] fix: rename resource directory --- .../{res => composeResources}/drawable/calendar_add_on.xml | 0 .../{res => composeResources}/drawable/icon_droidkaigi_logo.xml | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename feature/sessions/src/commonMain/{res => composeResources}/drawable/calendar_add_on.xml (100%) rename feature/sessions/src/commonMain/{res => composeResources}/drawable/icon_droidkaigi_logo.xml (100%) diff --git a/feature/sessions/src/commonMain/res/drawable/calendar_add_on.xml b/feature/sessions/src/commonMain/composeResources/drawable/calendar_add_on.xml similarity index 100% rename from feature/sessions/src/commonMain/res/drawable/calendar_add_on.xml rename to feature/sessions/src/commonMain/composeResources/drawable/calendar_add_on.xml diff --git a/feature/sessions/src/commonMain/res/drawable/icon_droidkaigi_logo.xml b/feature/sessions/src/commonMain/composeResources/drawable/icon_droidkaigi_logo.xml similarity index 100% rename from feature/sessions/src/commonMain/res/drawable/icon_droidkaigi_logo.xml rename to feature/sessions/src/commonMain/composeResources/drawable/icon_droidkaigi_logo.xml From f4442d68cbdb920d50714fa7c34f6b79ecd62918 Mon Sep 17 00:00:00 2001 From: Yamada_Ika <73375669+Yamada-Ika@users.noreply.github.com> Date: Tue, 2 Jul 2024 23:11:57 +0900 Subject: [PATCH 20/22] fix: use calendar add icon --- .../sessions/component/TimetableItemDetailBottomAppBar.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimetableItemDetailBottomAppBar.kt b/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimetableItemDetailBottomAppBar.kt index 57663caf8..04e184fbf 100644 --- a/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimetableItemDetailBottomAppBar.kt +++ b/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimetableItemDetailBottomAppBar.kt @@ -2,7 +2,6 @@ package io.github.droidkaigi.confsched.sessions.component import androidx.compose.material.icons.Icons import androidx.compose.material.icons.filled.Favorite -import androidx.compose.material.icons.outlined.EditCalendar import androidx.compose.material.icons.outlined.FavoriteBorder import androidx.compose.material.icons.outlined.Share import androidx.compose.material3.BottomAppBar @@ -13,8 +12,11 @@ import androidx.compose.material3.MaterialTheme import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.platform.testTag +import conference_app_2024.feature.sessions.generated.resources.Res +import conference_app_2024.feature.sessions.generated.resources.calendar_add_on import io.github.droidkaigi.confsched.model.TimetableItem import io.github.droidkaigi.confsched.sessions.TimetableItemDetailBookmarkIconTestTag +import org.jetbrains.compose.resources.painterResource @Composable fun TimetableItemDetailBottomAppBar( @@ -36,7 +38,7 @@ fun TimetableItemDetailBottomAppBar( } IconButton(onClick = { onCalendarRegistrationClick(timetableItem) }) { Icon( - imageVector = Icons.Outlined.EditCalendar, + painter = painterResource(Res.drawable.calendar_add_on), contentDescription = "Calendar", ) } From a9c42d6f414c765834ad0babdc7e1ea6239e0934 Mon Sep 17 00:00:00 2001 From: Yamada_Ika <73375669+Yamada-Ika@users.noreply.github.com> Date: Tue, 2 Jul 2024 23:20:51 +0900 Subject: [PATCH 21/22] fix: format --- .../sessions/component/TimeTableItemDetailContent.kt | 6 +----- .../sessions/component/TimeTableItemDetailHeadline.kt | 7 ++++--- .../sessions/component/TimeTableItemDetailSummaryCard.kt | 4 +--- .../sessions/component/TimetableItemDetailTopAppBar.kt | 5 ++--- 4 files changed, 8 insertions(+), 14 deletions(-) diff --git a/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimeTableItemDetailContent.kt b/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimeTableItemDetailContent.kt index 23edb87d2..970ed4f31 100644 --- a/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimeTableItemDetailContent.kt +++ b/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimeTableItemDetailContent.kt @@ -11,7 +11,6 @@ import androidx.compose.material.icons.Icons import androidx.compose.material.icons.outlined.Description import androidx.compose.material.icons.outlined.PlayCircle import androidx.compose.material3.Button -import androidx.compose.material3.ButtonColors import androidx.compose.material3.ButtonDefaults import androidx.compose.material3.Icon import androidx.compose.material3.MaterialTheme @@ -70,7 +69,6 @@ fun TimeTableItemDetailContent( Text("Special") } } - } } @@ -82,9 +80,7 @@ private fun DescriptionSection( // TODO: switch color according to room type var isExpand by remember { mutableStateOf(false) } - Column( - modifier = Modifier.padding(8.dp) - ) { + Column(modifier = Modifier.padding(8.dp)) { ClickableLinkText( content = description, regex = "(https)(://[\\w/:%#$&?()~.=+\\-]+)".toRegex(), diff --git a/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimeTableItemDetailHeadline.kt b/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimeTableItemDetailHeadline.kt index f3189ccc1..89b363ff5 100644 --- a/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimeTableItemDetailHeadline.kt +++ b/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimeTableItemDetailHeadline.kt @@ -29,9 +29,10 @@ fun TimeTableItemDetailHeadline( modifier: Modifier = Modifier, ) { // TODO: switch color according to room type - Column(modifier = modifier - .background(Color(0xFF132417)) - .padding(8.dp), + Column( + modifier = modifier + .background(Color(0xFF132417)) + .padding(8.dp), ) { Row { TagView( diff --git a/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimeTableItemDetailSummaryCard.kt b/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimeTableItemDetailSummaryCard.kt index 814e0b403..ee136ff38 100644 --- a/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimeTableItemDetailSummaryCard.kt +++ b/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimeTableItemDetailSummaryCard.kt @@ -1,6 +1,5 @@ package io.github.droidkaigi.confsched.sessions.component -import androidx.compose.foundation.border import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Spacer @@ -8,7 +7,6 @@ import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.width -import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material.icons.Icons import androidx.compose.material.icons.outlined.Category import androidx.compose.material.icons.outlined.Language @@ -51,7 +49,7 @@ fun TimeTableItemDetailSummaryCard( color = Color(0xFF45E761), style = Stroke( width = 2f, - pathEffect = PathEffect.dashPathEffect(floatArrayOf(5f, 5f), 0f) + pathEffect = PathEffect.dashPathEffect(floatArrayOf(5f, 5f), 0f), ), cornerRadius = CornerRadius(4.dp.toPx()), ) diff --git a/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimetableItemDetailTopAppBar.kt b/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimetableItemDetailTopAppBar.kt index be984424a..40432ba86 100644 --- a/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimetableItemDetailTopAppBar.kt +++ b/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimetableItemDetailTopAppBar.kt @@ -11,7 +11,6 @@ import androidx.compose.material3.IconButton import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.material3.TopAppBar -import androidx.compose.material3.TopAppBarColors import androidx.compose.material3.TopAppBarDefaults import androidx.compose.material3.TopAppBarScrollBehavior import androidx.compose.runtime.Composable @@ -32,10 +31,10 @@ fun TimetableItemDetailTopAppBar( scrollBehavior: TopAppBarScrollBehavior, modifier: Modifier = Modifier, ) { + // TODO: switch color according to room type TopAppBar( modifier = modifier, - // TODO: switch color according to room type - colors = TopAppBarDefaults.topAppBarColors().copy( + colors = TopAppBarDefaults.topAppBarColors().copy( containerColor = Color(0xFF132417), scrolledContainerColor = Color(0xFF132417), ), From d0ef34ec417d459c03467aebe8b5522e4dbbef8f Mon Sep 17 00:00:00 2001 From: Yamada_Ika <73375669+Yamada-Ika@users.noreply.github.com> Date: Tue, 2 Jul 2024 23:32:38 +0900 Subject: [PATCH 22/22] fix: add preview --- .../component/TimeTableItemDetailContent.kt | 50 +++++++++++++++++++ .../component/TimeTableItemDetailHeadline.kt | 18 +++++++ .../TimeTableItemDetailSummaryCard.kt | 18 +++++++ .../TimetableItemDetailBottomAppBar.kt | 39 +++++++++++++++ .../component/TimetableItemDetailTopAppBar.kt | 38 ++++++++++++++ 5 files changed, 163 insertions(+) diff --git a/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimeTableItemDetailContent.kt b/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimeTableItemDetailContent.kt index 970ed4f31..dcbaea407 100644 --- a/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimeTableItemDetailContent.kt +++ b/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimeTableItemDetailContent.kt @@ -15,6 +15,7 @@ import androidx.compose.material3.ButtonDefaults import androidx.compose.material3.Icon import androidx.compose.material3.MaterialTheme import androidx.compose.material3.OutlinedButton +import androidx.compose.material3.Surface import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue @@ -27,11 +28,15 @@ import androidx.compose.ui.graphics.Color import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.unit.dp import io.github.droidkaigi.confsched.designsystem.component.ClickableLinkText +import io.github.droidkaigi.confsched.designsystem.preview.MultiLanguagePreviews +import io.github.droidkaigi.confsched.designsystem.preview.MultiThemePreviews +import io.github.droidkaigi.confsched.designsystem.theme.KaigiTheme import io.github.droidkaigi.confsched.model.Lang import io.github.droidkaigi.confsched.model.MultiLangText import io.github.droidkaigi.confsched.model.TimetableItem import io.github.droidkaigi.confsched.model.TimetableItem.Session import io.github.droidkaigi.confsched.model.TimetableItem.Special +import io.github.droidkaigi.confsched.model.fake @Composable fun TimeTableItemDetailContent( @@ -185,3 +190,48 @@ private fun ArchiveSection( } } } + +@Composable +@MultiThemePreviews +@MultiLanguagePreviews +fun TimeTableItemDetailContentPreview() { + KaigiTheme { + Surface { + TimeTableItemDetailContent( + timetableItem = Session.fake(), + currentLang = Lang.JAPANESE, + onLinkClick = {}, + ) + } + } +} + +@Composable +@MultiThemePreviews +@MultiLanguagePreviews +fun TimeTableItemDetailContentWithEnglishPreview() { + KaigiTheme { + Surface { + TimeTableItemDetailContent( + timetableItem = Session.fake(), + currentLang = Lang.ENGLISH, + onLinkClick = {}, + ) + } + } +} + +@Composable +@MultiThemePreviews +@MultiLanguagePreviews +fun TimeTableItemDetailContentWithMixedPreview() { + KaigiTheme { + Surface { + TimeTableItemDetailContent( + timetableItem = Session.fake(), + currentLang = Lang.MIXED, + onLinkClick = {}, + ) + } + } +} diff --git a/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimeTableItemDetailHeadline.kt b/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimeTableItemDetailHeadline.kt index 89b363ff5..ffc95dde3 100644 --- a/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimeTableItemDetailHeadline.kt +++ b/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimeTableItemDetailHeadline.kt @@ -13,13 +13,18 @@ import androidx.compose.foundation.layout.size import androidx.compose.foundation.layout.width import androidx.compose.foundation.shape.CircleShape import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.Surface import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip import androidx.compose.ui.graphics.Color import androidx.compose.ui.unit.dp +import io.github.droidkaigi.confsched.designsystem.preview.MultiLanguagePreviews +import io.github.droidkaigi.confsched.designsystem.preview.MultiThemePreviews +import io.github.droidkaigi.confsched.designsystem.theme.KaigiTheme import io.github.droidkaigi.confsched.model.TimetableItem +import io.github.droidkaigi.confsched.model.fake import io.github.droidkaigi.confsched.sessions.section.TagView import io.github.droidkaigi.confsched.ui.rememberAsyncImagePainter @@ -81,3 +86,16 @@ fun TimeTableItemDetailHeadline( } } } + +@Composable +@MultiThemePreviews +@MultiLanguagePreviews +fun TimeTableItemDetailHeadlinePreview() { + KaigiTheme { + Surface { + TimeTableItemDetailHeadline( + timetableItem = TimetableItem.Session.fake(), + ) + } + } +} diff --git a/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimeTableItemDetailSummaryCard.kt b/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimeTableItemDetailSummaryCard.kt index ee136ff38..3f1b24769 100644 --- a/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimeTableItemDetailSummaryCard.kt +++ b/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimeTableItemDetailSummaryCard.kt @@ -14,6 +14,7 @@ import androidx.compose.material.icons.outlined.LocationOn import androidx.compose.material.icons.outlined.Schedule import androidx.compose.material3.Icon import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.Surface import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment @@ -25,8 +26,12 @@ import androidx.compose.ui.graphics.PathEffect import androidx.compose.ui.graphics.drawscope.Stroke import androidx.compose.ui.graphics.vector.ImageVector import androidx.compose.ui.unit.dp +import io.github.droidkaigi.confsched.designsystem.preview.MultiLanguagePreviews +import io.github.droidkaigi.confsched.designsystem.preview.MultiThemePreviews +import io.github.droidkaigi.confsched.designsystem.theme.KaigiTheme import io.github.droidkaigi.confsched.model.Locale import io.github.droidkaigi.confsched.model.TimetableItem +import io.github.droidkaigi.confsched.model.fake import io.github.droidkaigi.confsched.model.getDefaultLocale import io.github.droidkaigi.confsched.model.nameAndFloor @@ -118,3 +123,16 @@ private fun SummaryCardRow( ) } } + +@Composable +@MultiThemePreviews +@MultiLanguagePreviews +fun TimeTableItemDetailSummaryCardPreview() { + KaigiTheme { + Surface { + TimeTableItemDetailSummaryCard( + timetableItem = TimetableItem.Session.fake(), + ) + } + } +} diff --git a/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimetableItemDetailBottomAppBar.kt b/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimetableItemDetailBottomAppBar.kt index 04e184fbf..1175aaa74 100644 --- a/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimetableItemDetailBottomAppBar.kt +++ b/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimetableItemDetailBottomAppBar.kt @@ -9,12 +9,17 @@ import androidx.compose.material3.FloatingActionButton import androidx.compose.material3.Icon import androidx.compose.material3.IconButton import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.Surface import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.platform.testTag import conference_app_2024.feature.sessions.generated.resources.Res import conference_app_2024.feature.sessions.generated.resources.calendar_add_on +import io.github.droidkaigi.confsched.designsystem.preview.MultiLanguagePreviews +import io.github.droidkaigi.confsched.designsystem.preview.MultiThemePreviews +import io.github.droidkaigi.confsched.designsystem.theme.KaigiTheme import io.github.droidkaigi.confsched.model.TimetableItem +import io.github.droidkaigi.confsched.model.fake import io.github.droidkaigi.confsched.sessions.TimetableItemDetailBookmarkIconTestTag import org.jetbrains.compose.resources.painterResource @@ -57,3 +62,37 @@ fun TimetableItemDetailBottomAppBar( }, ) } + +@Composable +@MultiThemePreviews +@MultiLanguagePreviews +fun TimetableItemDetailBottomAppBarPreview() { + KaigiTheme { + Surface { + TimetableItemDetailBottomAppBar( + timetableItem = TimetableItem.Session.fake(), + isBookmarked = false, + onBookmarkClick = {}, + onCalendarRegistrationClick = {}, + onShareClick = {}, + ) + } + } +} + +@Composable +@MultiThemePreviews +@MultiLanguagePreviews +fun TimetableItemDetailBottomAppBarBookmarkedPreview() { + KaigiTheme { + Surface { + TimetableItemDetailBottomAppBar( + timetableItem = TimetableItem.Session.fake(), + isBookmarked = true, + onBookmarkClick = {}, + onCalendarRegistrationClick = {}, + onShareClick = {}, + ) + } + } +} diff --git a/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimetableItemDetailTopAppBar.kt b/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimetableItemDetailTopAppBar.kt index 40432ba86..1585e26a6 100644 --- a/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimetableItemDetailTopAppBar.kt +++ b/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimetableItemDetailTopAppBar.kt @@ -9,6 +9,7 @@ import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.Icon import androidx.compose.material3.IconButton import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.Surface import androidx.compose.material3.Text import androidx.compose.material3.TopAppBar import androidx.compose.material3.TopAppBarDefaults @@ -20,6 +21,9 @@ import androidx.compose.runtime.remember import androidx.compose.runtime.setValue import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color +import io.github.droidkaigi.confsched.designsystem.preview.MultiLanguagePreviews +import io.github.droidkaigi.confsched.designsystem.preview.MultiThemePreviews +import io.github.droidkaigi.confsched.designsystem.theme.KaigiTheme import io.github.droidkaigi.confsched.model.Lang @OptIn(ExperimentalMaterial3Api::class) @@ -92,3 +96,37 @@ fun TimetableItemDetailTopAppBar( scrollBehavior = scrollBehavior, ) } + +@OptIn(ExperimentalMaterial3Api::class) +@Composable +@MultiThemePreviews +@MultiLanguagePreviews +fun TimetableItemDetailTopAppBarPreview() { + KaigiTheme { + Surface { + TimetableItemDetailTopAppBar( + isLangSelectable = true, + onNavigationIconClick = {}, + onSelectedLanguage = {}, + scrollBehavior = TopAppBarDefaults.exitUntilCollapsedScrollBehavior(), + ) + } + } +} + +@OptIn(ExperimentalMaterial3Api::class) +@Composable +@MultiThemePreviews +@MultiLanguagePreviews +fun TimetableItemDetailTopAppBarUnSelectablePreview() { + KaigiTheme { + Surface { + TimetableItemDetailTopAppBar( + isLangSelectable = false, + onNavigationIconClick = {}, + onSelectedLanguage = {}, + scrollBehavior = TopAppBarDefaults.exitUntilCollapsedScrollBehavior(), + ) + } + } +}