Skip to content

Commit

Permalink
[Feature]: 관계등록 ui 로직 구현 (#48)
Browse files Browse the repository at this point in the history
* [Fix]: 오류 수정

* [Feat]: 1차 수정

* [Fix]: 오류 & 구조 수정
  • Loading branch information
jinuemong authored Feb 6, 2024
1 parent 3a16c08 commit cec7303
Show file tree
Hide file tree
Showing 13 changed files with 573 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,5 @@ fun FieldSubject(
)
}
}
Spacer(
modifier = Modifier.height(18.dp)
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import ac.dnd.bookkeeping.android.presentation.common.theme.Body1
import ac.dnd.bookkeeping.android.presentation.common.theme.Caption2
import ac.dnd.bookkeeping.android.presentation.common.theme.Gray000
import ac.dnd.bookkeeping.android.presentation.common.theme.Gray300
import ac.dnd.bookkeeping.android.presentation.common.theme.Gray400
import ac.dnd.bookkeeping.android.presentation.common.theme.Gray700
import ac.dnd.bookkeeping.android.presentation.common.theme.Gray800
import ac.dnd.bookkeeping.android.presentation.common.theme.Headline2
Expand Down Expand Up @@ -84,9 +85,10 @@ fun ConfirmButton(
bottom = 0.dp,
end = paddingHorizontal
),
colors = ButtonDefaults.textButtonColors(
backgroundColor = backgroundColor
),
colors = ButtonDefaults
.textButtonColors(
backgroundColor = backgroundColor
),
border = border,
elevation = ButtonDefaults.elevation(0.dp, 0.dp, 0.dp, 0.dp, 0.dp),
onClick = onClick,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ fun TypingPriceField(
}
) {
fieldSubjectContent()
Spacer(modifier = Modifier.height(18.dp))
BasicTextField(
value = TextFieldValue(
text = textValue,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package ac.dnd.bookkeeping.android.presentation.ui.main.home.common.relation.add

object AddRelationConstant {
const val ROUTE: String = "addName"

const val ROUTE_ARGUMENT_MODEL = "relation"
const val CONTAIN_RELATION = "${ROUTE}/{${ROUTE_ARGUMENT_MODEL}}"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package ac.dnd.bookkeeping.android.presentation.ui.main.home.common.relation.add

import ac.dnd.bookkeeping.android.presentation.common.util.ErrorObserver
import ac.dnd.bookkeeping.android.presentation.ui.main.ApplicationState
import androidx.compose.runtime.getValue
import androidx.hilt.navigation.compose.hiltViewModel
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import androidx.navigation.NavGraphBuilder
import androidx.navigation.compose.composable

fun NavGraphBuilder.AddRelationDestination(
appState: ApplicationState
) {

composable(
route = AddRelationConstant.ROUTE
) {
val viewModel: AddRelationViewModel = hiltViewModel()

val model: AddRelationModel = let {
val state by viewModel.state.collectAsStateWithLifecycle()
val groups by viewModel.groups.collectAsStateWithLifecycle()

AddRelationModel(
state = state,
groups = groups
)
}

ErrorObserver(viewModel)

AddRelationScreen(
appState = appState,
model = model,
event = viewModel.event,
intent = viewModel::onIntent,
handler = viewModel.handler
)
}

composable(
route = AddRelationConstant.CONTAIN_RELATION
) {
// TODO Edit relation
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package ac.dnd.bookkeeping.android.presentation.ui.main.home.common.relation.add

sealed interface AddRelationEvent {
sealed interface Submit : AddRelationEvent {
data object Success : Submit
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package ac.dnd.bookkeeping.android.presentation.ui.main.home.common.relation.add

sealed interface AddRelationIntent {
data class OnClickSubmit(
val groupId: Long,
val name: String,
val imageUrl: String,
val memo: String
) : AddRelationIntent
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package ac.dnd.bookkeeping.android.presentation.ui.main.home.common.relation.add

import ac.dnd.bookkeeping.android.domain.model.feature.group.Group
import androidx.compose.runtime.Immutable

@Immutable
data class AddRelationModel(
val state: AddRelationState,
val groups: List<Group>
)
Loading

0 comments on commit cec7303

Please sign in to comment.