Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: preview 수정 및 state Hoisting 적용 #197

Open
wants to merge 42 commits into
base: refactor-state-hoisting
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
2dd43ad
refactor: NotificationScreenPreview 언어 한글로 변경 (#196)
pengcon Jan 9, 2025
841361a
refactor: CreateQuestionScreenPreview 오류 해결, 언어 한글로 변경 (#196)
pengcon Jan 9, 2025
e3fea50
refactor: CreateStudyScreenPreview 언어 한글로 변경 (#196)
pengcon Jan 9, 2025
6a5d795
refactor: QuestionDetailScreenPreview 오류 수정, 언어 한글로 변경 (#196)
pengcon Jan 9, 2025
87e723a
refactor: OwnerQuizResultScreenPreview 오류 수정, 언어 한글로 변경 (#196)
pengcon Jan 9, 2025
ad80fe5
refactor: GeneralQuizResultScreenPreview 오류 수정, 언어 한글로 변경 (#196)
pengcon Jan 9, 2025
265147d
feat: GeneralQuiz,OwnerQuiz의 Preview에 공통 활용되는 Questions 데이터 구성(#196)
pengcon Jan 9, 2025
2936826
refactor: ktlint 적용 (#196)
pengcon Jan 9, 2025
0c51c35
refactor: QuizOwnerDialogPreview 네이밍 수정, dark / light prievew 추가, 언어 …
pengcon Jan 14, 2025
062d882
refactor: QuizSolveTimeSliderPreview dark / light prievew 추가, 언어 ko로 …
pengcon Jan 14, 2025
5ab399c
feat: QuizTopAppBarPreview 추가 (#196)
pengcon Jan 14, 2025
69072de
feat: RadioTextButtonPreview 추가 (#196)
pengcon Jan 14, 2025
3c61d09
feat: RealTimeQuestionPreview 추가 (#196)
pengcon Jan 14, 2025
2904e28
feat: RealTimeQuizGuideContentPreview 추가 (#196)
pengcon Jan 14, 2025
f5692d0
refactor: quiz component internal keyword 적용(#196)
pengcon Jan 14, 2025
440830c
refactor: 미사용 컴포넌트 UserQuestion 삭제 (#196)
pengcon Jan 15, 2025
46f0778
refactor: CreateQuestionScreenPreview 다크모드 적용,showBackground 제거 (#196)
pengcon Jan 15, 2025
e3fb208
refactor: CreateStudyScreenPreview 다크모드 적용,showBackground 제거 (#196)
pengcon Jan 15, 2025
8ea1a00
refactor: GeneralQuizResultScreenPreview 다크모드 적용,showBackground 제거 (#…
pengcon Jan 15, 2025
6f87526
refactor: NotificationScreenPreview 다크모드 적용 (#196)
pengcon Jan 15, 2025
1414bfc
refactor: OwnerQuizResultScreenPreview 다크모드 적용,showBackground 제거 (#196)
pengcon Jan 15, 2025
a9bf2c7
refactor: QuestionDetailScreenPreview 다크모드 적용 (#196)
pengcon Jan 15, 2025
db1b518
refactor: quiz 컴포넌트 다크모드 적용 (RadioTextButton 제외) (#196)
pengcon Jan 15, 2025
7615e0c
refactor: OwnerQuizResultScreen import 정리 (#196)
pengcon Jan 15, 2025
f80ab93
Merge remote-tracking branch 'origin/refactor-state-hoisting' into re…
pengcon Jan 15, 2025
65aac5d
refactor: QuizOwnerDialogPreview에 PreviewKoLightDark 적용 (#196)
pengcon Jan 15, 2025
2f12d48
refactor: CreateQuestionScreenPreview에 PreviewKoLightDark 적용 (#196)
pengcon Jan 15, 2025
4570e47
refactor: CreateStudyScreenPreview에 PreviewKoLightDark 적용 (#196)
pengcon Jan 15, 2025
3f73f6d
refactor: GeneralQuizResultScreenPreview에 PreviewKoLightDark 적용 (#196)
pengcon Jan 15, 2025
d4a8ef6
refactor: NotificationScreenPreview에 PreviewKoLightDark 적용 (#196)
pengcon Jan 15, 2025
1a8ab39
refactor: OwnerQuizResultScreenPreview에 PreviewKoLightDark 적용 (#196)
pengcon Jan 15, 2025
4e9abb1
refactor: QuestionDetailScreenPreview에 PreviewKoLightDark 적용 (#196)
pengcon Jan 15, 2025
bac024e
refactor: QuizOwnerDialog import 정리 (#196)
pengcon Jan 15, 2025
2bcc528
refactor: preview에 private 키워드 추가 (#196)
pengcon Jan 15, 2025
812f957
refactor: QuestionDetailScreenPreviewParameterProvider에 internal 키워드 …
pengcon Jan 15, 2025
2ed58e1
refactor: Screen 내부에 접근 제한자 추가 (#196)
pengcon Jan 18, 2025
eea0fa4
refactor: QuestionDetailScreenPreview 에 사용되는 PreviewProvider를 Questio…
pengcon Jan 18, 2025
3f22a0e
feat: PreviewKoLightDarkBackground 어노테이션 추가 (#196)
pengcon Jan 18, 2025
3a7ffe2
refactor: 컴포넌트에 PreviewKoLightDarkBackground 어노테이션 적용 (#196)
pengcon Jan 18, 2025
a2bd89f
refactor: quizResultPreviewQuestions 변수 QuizResultParameterProvider로 …
pengcon Jan 18, 2025
0106bcd
refactor: QuizResultScreen에 quizResultPreviewQuestions 변수 삭제 (#196)
pengcon Jan 18, 2025
5b896a7
refactor: GeneralQuizResultScreen,QuizResultScreen import 정리 (#196)
pengcon Jan 18, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,7 @@ import androidx.compose.ui.tooling.preview.Preview
@Preview(locale = "ko")
@Preview(locale = "ko", uiMode = UI_MODE_NIGHT_YES)
annotation class PreviewKoLightDark

@Preview(locale = "ko", showBackground = true)
@Preview(locale = "ko", showBackground = true, uiMode = UI_MODE_NIGHT_YES)
annotation class PreviewKoLightDarkBackground
Comment on lines +9 to +12
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

굿입니다😄

Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.hilt.navigation.compose.hiltViewModel
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import kr.boostcamp_2024.course.designsystem.ui.annotation.PreviewKoLightDark
import kr.boostcamp_2024.course.designsystem.ui.theme.WeQuizTheme
import kr.boostcamp_2024.course.domain.model.Notification
import kr.boostcamp_2024.course.domain.model.NotificationWithGroupInfo
Expand All @@ -29,7 +29,7 @@ import kr.boostcamp_2024.course.main.component.NotificationTopAppBar
import kr.boostcamp_2024.course.main.viewmodel.NotificationViewModel

@Composable
fun NotificationScreen(
internal fun NotificationScreen(
viewModel: NotificationViewModel = hiltViewModel<NotificationViewModel>(),
onNavigationButtonClick: () -> Unit,
) {
Expand All @@ -54,7 +54,7 @@ fun NotificationScreen(

@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun NotificationScreen(
private fun NotificationScreen(
notificationInfos: List<NotificationWithGroupInfo>,
onRejectClick: (String) -> Unit,
onAcceptClick: (Notification) -> Unit,
Expand Down Expand Up @@ -98,7 +98,7 @@ fun NotificationScreen(
}
}

@Preview
@PreviewKoLightDark
@Composable
private fun NotificationScreenPreview() {
WeQuizTheme {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ package kr.boostcamp_2024.course.quiz.component
import androidx.compose.runtime.Composable
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
import kr.boostcamp_2024.course.designsystem.ui.annotation.PreviewKoLightDark
import kr.boostcamp_2024.course.designsystem.ui.theme.WeQuizTheme
import kr.boostcamp_2024.course.designsystem.ui.theme.component.WeQuizBaseDialog
import kr.boostcamp_2024.course.quiz.R

@Composable
fun QuizOwnerDialog(
internal fun QuizOwnerDialog(
isQuit: Boolean = false,
onDismissButtonClick: () -> Unit,
onFinishQuizButtonClick: () -> Unit,
Expand Down Expand Up @@ -37,14 +37,14 @@ fun QuizOwnerDialog(
}
}

@Preview
@PreviewKoLightDark
@Composable
fun OwnerQuitQuizDialogPreview() {
private fun QuizOwnerDialogPreview() {
WeQuizTheme {
QuizOwnerDialog(
isQuit = true,
onDismissButtonClick = { /* no-op */ },
onFinishQuizButtonClick = { /* no-op */ },
onDismissButtonClick = {},
onFinishQuizButtonClick = {},
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import kr.boostcamp_2024.course.designsystem.ui.annotation.PreviewKoLightDarkBackground

@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun QuizSolveTimeSlider(
internal fun QuizSolveTimeSlider(
value: Float,
steps: Int,
valueRange: ClosedFloatingPointRange<Float>,
Expand Down Expand Up @@ -48,9 +48,9 @@ fun QuizSolveTimeSlider(
)
}

@Preview(showBackground = true)
@PreviewKoLightDarkBackground
@Composable
fun QuizSolveTimeSliderPreview() {
private fun QuizSolveTimeSliderPreview() {
QuizSolveTimeSlider(
value = 0f,
steps = 10,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import kr.boostcamp_2024.course.designsystem.ui.annotation.PreviewKoLightDarkBackground
import kr.boostcamp_2024.course.designsystem.ui.theme.component.WeQuizBaseDialog
import kr.boostcamp_2024.course.domain.model.BaseQuiz
import kr.boostcamp_2024.course.domain.model.Category
Expand All @@ -31,7 +32,7 @@ import kr.boostcamp_2024.course.quiz.R

@Composable
@OptIn(ExperimentalMaterial3Api::class)
fun QuizTopAppBar(
internal fun QuizTopAppBar(
category: Category?,
quiz: BaseQuiz?,
currentUserId: String?,
Expand All @@ -57,11 +58,11 @@ fun QuizTopAppBar(
navigationIcon = {
IconButton(
onClick =
if (quiz is RealTimeQuiz && quiz.waitingUsers.contains(currentUserId) && quiz.isStarted.not()) {
{ showDialog = true }
} else {
{ onNavigationButtonClick() }
},
if (quiz is RealTimeQuiz && quiz.waitingUsers.contains(currentUserId) && quiz.isStarted.not()) {
{ showDialog = true }
} else {
{ onNavigationButtonClick() }
},
) {
Icon(
imageVector = Icons.AutoMirrored.Default.ArrowBack,
Expand Down Expand Up @@ -127,3 +128,30 @@ fun QuizTopAppBar(
)
}
}


@PreviewKoLightDarkBackground
@Composable
private fun QuizTopAppBarPreview() {
QuizTopAppBar(
category = Category(id = "", name = "", description = "", categoryImageUrl = "", quizzes = emptyList()),
quiz = RealTimeQuiz(
id = "",
title = "",
isStarted = false,
questions = emptyList(),
userOmrs = emptyList(),
currentQuestion = 0,
ownerId = "",
isFinished = false,
waitingUsers = emptyList(),
description = "",
quizImageUrl = null,
),
currentUserId = "",
onWaitingRealTimeQuizButtonClick = {},
onNavigationButtonClick = {},
onSettingMenuClick = { _, _ -> },
onDeleteMenuClick = { _, _ -> },
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import kr.boostcamp_2024.course.designsystem.ui.annotation.PreviewKoLightDarkBackground

@Composable
fun RadioTextButton(
internal fun RadioTextButton(
text: String,
selected: Boolean,
onclick: () -> Unit,
) {

Row(
modifier = Modifier
.fillMaxWidth()
Expand All @@ -41,3 +41,15 @@ fun RadioTextButton(
)
}
}



@PreviewKoLightDarkBackground
@Composable
private fun RadioTextButtonPreview() {
RadioTextButton(
text = "문제",
selected = true,
onclick = {},
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import kr.boostcamp_2024.course.designsystem.ui.annotation.PreviewKoLightDarkBackground

@Composable
fun RealTimeQuestion(
internal fun RealTimeQuestion(
isOwner: Boolean = false,
questions: List<String>,
selectedIndex: Int,
Expand Down Expand Up @@ -49,3 +50,12 @@ fun RealTimeQuestion(
}
}
}

@PreviewKoLightDarkBackground
@Composable
private fun RealTimeQuestionPreview() {
RealTimeQuestion(
questions = listOf("문제1", "문제2", "문제3", "문제4", "문제5"),
selectedIndex = 0,
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,13 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import kr.boostcamp_2024.course.designsystem.ui.annotation.PreviewKoLightDarkBackground
import kr.boostcamp_2024.course.designsystem.ui.theme.component.WeQuizLocalRoundedImage
import kr.boostcamp_2024.course.designsystem.ui.theme.component.WeQuizRightChatBubble
import kr.boostcamp_2024.course.quiz.R

@Composable
fun RealTimeQuizGuideContent(
internal fun RealTimeQuizGuideContent(
ownerName: String,
totalParticipants: Int,
submittedParticipants: Int,
Expand Down Expand Up @@ -52,3 +53,13 @@ fun RealTimeQuizGuideContent(
)
}
}

@PreviewKoLightDarkBackground
@Composable
private fun RealTimeQuizGuideContentPreview() {
RealTimeQuizGuideContent(
ownerName = "이훈",
totalParticipants = 10,
submittedParticipants = 5,
)
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ import androidx.compose.ui.platform.LocalLayoutDirection
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.input.ImeAction
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.hilt.navigation.compose.hiltViewModel
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import kr.boostcamp_2024.course.designsystem.ui.annotation.PreviewKoLightDark
import kr.boostcamp_2024.course.designsystem.ui.theme.WeQuizTheme
import kr.boostcamp_2024.course.quiz.R
import kr.boostcamp_2024.course.quiz.component.CreateBlankQuestionContent
Expand All @@ -58,7 +58,7 @@ import kr.boostcamp_2024.course.quiz.viewmodel.CreateQuestionUiState
import kr.boostcamp_2024.course.quiz.viewmodel.CreateQuestionViewModel

@Composable
fun CreateQuestionScreen(
internal fun CreateQuestionScreen(
onNavigationButtonClick: () -> Unit,
onCreateQuestionSuccess: () -> Unit,
viewModel: CreateQuestionViewModel = hiltViewModel(),
Expand Down Expand Up @@ -118,7 +118,7 @@ fun CreateQuestionScreen(

@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun CreateQuestionScreen(
private fun CreateQuestionScreen(
uiState: CreateQuestionUiState,
focusRequester: FocusRequester,
snackBarHostState: SnackbarHostState,
Expand Down Expand Up @@ -307,13 +307,46 @@ fun CreateQuestionScreen(
}
}

@Preview(showBackground = true)
@PreviewKoLightDark
@Composable
fun CreateQuestionScreenPreview() {
private fun CreateQuestionScreenPreview() {
val previewCreateQuestionUiState = CreateQuestionUiState(
isLoading = false,
showDialog = false,
snackBarMessage = null,
creationSuccess = false,
selectedQuestionTypeIndex = 0,
)
val previewOption = listOf(
stringResource(R.string.txt_create_general_question),
stringResource(R.string.txt_blank_question),
)

WeQuizTheme {
CreateQuestionScreen(
uiState = previewCreateQuestionUiState,
focusRequester = remember { FocusRequester() },
snackBarHostState = remember { SnackbarHostState() },
onTitleChanged = {},
onDescriptionChanged = {},
onSolutionChanged = {},
onNavigationButtonClick = {},
onCreateQuestionSuccess = {},
onChoiceTextChanged = { _, _ -> },
onSelectedChoiceNumChanged = {},
onCreateQuestionButtonClick = {},
onQuestionTypeIndexChange = {},
selectedQuestionTypeIndex = 0,
options = previewOption,
isBlankQuestion = false,
blankQuestionItems = listOf(),
onAddBlankItemButtonClick = {},
onAddTextItemButtonClick = {},
onBlankQuestionItemValueChanged = { _, _ -> },
onContentRemove = {},
onCreateBlankQuestionButtonClick = {},
isCreateBlankButtonValid = true,
isCreateTextButtonValid = true,
onShowDialog = {},
)
}
}
Loading