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

Merged
merged 44 commits into from
Jan 19, 2025
Merged
Show file tree
Hide file tree
Changes from 35 commits
Commits
Show all changes
44 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
e6131c4
refactor: QuizResultParameterProvider 제거 후 quizResultPreviewQuestions…
pengcon Jan 19, 2025
d705552
refactor: 파라미터 Preview WeQuizTheme 적용 (#196)
pengcon Jan 19, 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
Copy link
Collaborator

Choose a reason for hiding this comment

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

접근 제한자를 붙이지 않은 이유가 따로 있으실까요?

fun NotificationScreen(
    notificationInfos: List<NotificationWithGroupInfo>,
    onRejectClick: (String) -> Unit,
    onAcceptClick: (Notification) -> Unit,
    onNavigationButtonClick: () -> Unit,
    snackBarHostState: SnackbarHostState,
) 

fun QuestionResultItem(
    questionResult: QuestionResult,
    onQuestionClick: (String) -> Unit,
)

fun CreateStudyScreen(
    isEditMode: Boolean,
    defaultStudyImageUri: String?,
    currentStudyImage: ByteArray?,
    ... 생략
    onStudyEditButtonClick: () -> Unit,
    onCreationButtonClick: () -> Unit,
    onCurrentStudyImageChanged: (ByteArray) -> Unit,
)

Copy link
Collaborator Author

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 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
@@ -1,5 +1,7 @@
package kr.boostcamp_2024.course.quiz.component

import android.content.res.Configuration.UI_MODE_NIGHT_YES
import android.content.res.Configuration.UI_MODE_TYPE_NORMAL
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.defaultMinSize
Expand All @@ -18,7 +20,7 @@ import androidx.compose.ui.unit.dp

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

@Preview(showBackground = true)
@Preview(showBackground = true, locale = "ko")
@Preview(uiMode = UI_MODE_NIGHT_YES or UI_MODE_TYPE_NORMAL, locale = "ko")
@Composable
fun QuizSolveTimeSliderPreview() {
private fun QuizSolveTimeSliderPreview() {
QuizSolveTimeSlider(
value = 0f,
steps = 10,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package kr.boostcamp_2024.course.quiz.component

import android.content.res.Configuration.UI_MODE_NIGHT_YES
import android.content.res.Configuration.UI_MODE_TYPE_NORMAL
import androidx.activity.compose.BackHandler
import androidx.compose.foundation.background
import androidx.compose.material.icons.Icons
Expand All @@ -23,6 +25,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 androidx.compose.ui.tooling.preview.Preview
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 +34,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 +60,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 +130,31 @@ fun QuizTopAppBar(
)
}
}


@Preview(showBackground = true, locale = "ko")
@Preview(uiMode = UI_MODE_NIGHT_YES or UI_MODE_TYPE_NORMAL, locale = "ko")
@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 @@ -10,15 +10,15 @@ import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp

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

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



@Preview(showBackground = true, locale = "ko")
@Composable
private fun RadioTextButtonPreview() {
RadioTextButton(
text = "문제",
selected = true,
onclick = {},
)
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package kr.boostcamp_2024.course.quiz.component

import android.content.res.Configuration.UI_MODE_NIGHT_YES
import android.content.res.Configuration.UI_MODE_TYPE_NORMAL
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
Expand All @@ -11,10 +13,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.tooling.preview.Preview
import androidx.compose.ui.unit.dp

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

@Preview(showBackground = true, locale = "ko")
@Preview(uiMode = UI_MODE_NIGHT_YES or UI_MODE_TYPE_NORMAL, locale = "ko")
@Composable
private fun RealTimeQuestionPreview() {
RealTimeQuestion(
questions = listOf("문제1", "문제2", "문제3", "문제4", "문제5"),
selectedIndex = 0,
)
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package kr.boostcamp_2024.course.quiz.component

import android.content.res.Configuration.UI_MODE_NIGHT_YES
import android.content.res.Configuration.UI_MODE_TYPE_NORMAL
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
Expand All @@ -11,13 +13,14 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
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 +55,14 @@ fun RealTimeQuizGuideContent(
)
}
}

@Preview(showBackground = true, locale = "ko")
@Preview(uiMode = UI_MODE_NIGHT_YES or UI_MODE_TYPE_NORMAL, locale = "ko")
@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 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