-
Notifications
You must be signed in to change notification settings - Fork 101
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
feat: improve the side navigation ui #650
base: develop
Are you sure you want to change the base?
Changes from all commits
beff1e6
d225988
3afdd1d
c8ed1dd
b5ccda0
58945da
1ee2f86
fbe18e8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
package apply.ui.admin | ||
|
||
import apply.application.RecruitmentService | ||
import apply.ui.admin.administrator.AdministratorsView | ||
import apply.ui.admin.cheater.CheatersView | ||
import apply.ui.admin.evaluation.EvaluationsView | ||
import apply.ui.admin.mail.MailsView | ||
import apply.ui.admin.mission.MissionsView | ||
import apply.ui.admin.recruitment.RecruitmentsView | ||
import apply.ui.admin.selections.SelectionView | ||
import apply.ui.admin.term.TermsView | ||
import com.vaadin.flow.component.orderedlayout.FlexComponent | ||
import com.vaadin.flow.component.orderedlayout.VerticalLayout | ||
import com.vaadin.flow.component.tabs.Tabs | ||
import support.views.createTabs | ||
|
||
private const val UNSELECT_ALL: Int = -1 | ||
|
||
class MenuLayout( | ||
private val recruitmentService: RecruitmentService | ||
) : VerticalLayout() { | ||
private val topMenu = createMenu(createTopMenuItems()) | ||
private val bottomMenu = createMenu(createBottomMenuItems()) | ||
Comment on lines
+22
to
+23
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. a: topMenu, bottomMenu 보다 더 직관적인 변수명으로 짓는 것이 어떨까요? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 지금은 선발진행관련 메뉴 아이템들이 해당 공간에 존재하지만 추후 어떤 메뉴 아이템이 들어올지 변경될 수 있고 그렇다면 네이밍 또한 변할 것 같아 이렇게 포괄적인 네이밍을 지었던 것 같습니다. |
||
|
||
init { | ||
setHeightFull() | ||
isPadding = false | ||
addMenuSelectSeparateEvent() | ||
add(createTopMenuLayer(), createBottomMenuLayer()) | ||
} | ||
|
||
private fun createMenu(list: List<MenuItem>): Tabs { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. a: 호출하는 메서드와 가깝게 두면 읽기가 더 편할 것 같아요! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 메서드 위치를 수정해보았습니다 😊 |
||
return createTabs(list.flatMap { it.toComponents() }) | ||
} | ||
|
||
private fun createTopMenuItems(): List<MenuItem> { | ||
val recruitments = recruitmentService.findAll() | ||
return listOf( | ||
"모집선택".createComboBoxTab( | ||
recruitments, | ||
listOf( | ||
"과제 관리" of MissionsView::class.java, | ||
"선발 과정" of SelectionView::class.java, | ||
) | ||
) | ||
) | ||
} | ||
|
||
private fun createBottomMenuItems(): List<MenuItem> { | ||
return listOf( | ||
createBorderItem(), | ||
"기수 관리" of TermsView::class.java, | ||
"모집 관리" of RecruitmentsView::class.java, | ||
"평가 관리" of EvaluationsView::class.java, | ||
createBorderItem(), | ||
"메일 관리" of MailsView::class.java, | ||
"부정행위자" of CheatersView::class.java, | ||
"관리자" of AdministratorsView::class.java | ||
) | ||
} | ||
|
||
private fun addMenuSelectSeparateEvent() { | ||
topMenu.addSelectedChangeListener { | ||
bottomMenu.selectedIndex = UNSELECT_ALL | ||
topMenu.selectedTab = it.selectedTab | ||
} | ||
bottomMenu.addSelectedChangeListener { | ||
topMenu.selectedIndex = UNSELECT_ALL | ||
bottomMenu.selectedTab = it.selectedTab | ||
} | ||
} | ||
|
||
private fun createTopMenuLayer(): VerticalLayout { | ||
return VerticalLayout().apply { | ||
isPadding = false | ||
add(topMenu) | ||
} | ||
} | ||
|
||
private fun createBottomMenuLayer(): VerticalLayout { | ||
return VerticalLayout().apply { | ||
isPadding = false | ||
setHeightFull() | ||
justifyContentMode = FlexComponent.JustifyContentMode.END | ||
add(bottomMenu) | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
UNSELECT_ALL 이라는 네이밍과 -1 이라는 값이 잘 이해가 가지 않아요.
사용하는 곳에서는
현재 선택된 INDEX
를 -1 로 바꾸로 바꾸는 용도로 사용하는 것 같아서요!a: 만약 다른 메뉴에서 현재 선택된 INDEX 를 -1로 바꾸는 것이면
UNSELECTED
정도가 괜찮지 않을까요?(제가 잘못 이해한 것일수도 있습니다. 😅)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
바딘에서 제공하는 Tabs에 나와있는 setSelectedIndex의 javaDocs에는
-1 to unselect all
이라고 적혀있어서 이를 참고해서 네이밍했습니다 😋