Skip to content
This repository has been archived by the owner on Aug 26, 2024. It is now read-only.

Commit

Permalink
chore: made publishable
Browse files Browse the repository at this point in the history
  • Loading branch information
charlee-dev committed Jun 30, 2024
1 parent 544b6d0 commit 0083d67
Show file tree
Hide file tree
Showing 107 changed files with 2,806 additions and 2,211 deletions.
16 changes: 8 additions & 8 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ jobs:
- name: Checkout code
uses: actions/checkout@v2

- name: Set up JDK 17
uses: actions/setup-java@v2
with:
java-version: '17'
distribution: 'adopt'

- name: Build with Gradle
run: ./gradlew build
# - name: Set up JDK 17
# uses: actions/setup-java@v2
# with:
# java-version: '17'
# distribution: 'adopt'
#
# - name: Build with Gradle
# run: ./gradlew build

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,14 @@ internal class AdminCategoryCreateEventHandler(
) : EventHandler<
AdminCategoryCreateContract.Inputs,
AdminCategoryCreateContract.Events,
AdminCategoryCreateContract.State> {
AdminCategoryCreateContract.State,
> {
override suspend fun EventHandlerScope<
AdminCategoryCreateContract.Inputs,
AdminCategoryCreateContract.Events,
AdminCategoryCreateContract.State>.handleEvent(
event: AdminCategoryCreateContract.Events
AdminCategoryCreateContract.State,
>.handleEvent(
event: AdminCategoryCreateContract.Events,
) = when (event) {
is AdminCategoryCreateContract.Events.OnError -> onError(event.message)
is AdminCategoryCreateContract.Events.GoToCategory -> goToCategory(event.id)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,16 @@ import org.koin.core.component.inject
private typealias InputScope = InputHandlerScope<
AdminCategoryCreateContract.Inputs,
AdminCategoryCreateContract.Events,
AdminCategoryCreateContract.State>

internal class AdminCategoryCreateInputHandler : KoinComponent, InputHandler<
AdminCategoryCreateContract.Inputs,
AdminCategoryCreateContract.Events,
AdminCategoryCreateContract.State> {
AdminCategoryCreateContract.State,
>

internal class AdminCategoryCreateInputHandler :
KoinComponent,
InputHandler<
AdminCategoryCreateContract.Inputs,
AdminCategoryCreateContract.Events,
AdminCategoryCreateContract.State,
> {

private val categoryService: CategoryService by inject()
private val inputValidator: InputValidator by inject()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,121 +9,161 @@ object AdminConfigContract {
data class State(
val isLoading: Boolean = false,
val wasEdited: Boolean = false,

val original: GetConfigQuery.GetConfig = GetConfigQuery.GetConfig(
id = "",
updatedAt = "",
companyInfo = GetConfigQuery.CompanyInfo(
contactInfo = GetConfigQuery.ContactInfo(
companyName = "",
companyWebsite = null,
email = null,
phone = null
), openingTimes = GetConfigQuery.OpeningTimes(
close = null,
dayFrom = DayOfWeek.MONDAY,
dayTo = DayOfWeek.FRIDAY,
open = null
)
), footerConfig = GetConfigQuery.FooterConfig(
showStartChat = false,
showOpeningTimes = false,
showCareer = false,
showCyberSecurity = false,
showPress = false
), landingConfig = GetConfigQuery.LandingConfig(
slideshowItems = listOf(),
topCategoriesSection = GetConfigQuery.TopCategoriesSection(
left = GetConfigQuery.Left(media = null, title = null),
middle = GetConfigQuery.Middle(media = null, title = null),
right = GetConfigQuery.Right(media = null, title = null)
)
), catalogConfig = GetConfigQuery.CatalogConfig(
bannerConfig = GetConfigQuery.BannerConfig(
catalog = GetConfigQuery.Catalog(
title = "",
media = null
val original: GetConfigQuery.GetConfig =
GetConfigQuery.GetConfig(
id = "",
updatedAt = "",
companyInfo =
GetConfigQuery.CompanyInfo(
contactInfo =
GetConfigQuery.ContactInfo(
companyName = "",
companyWebsite = null,
email = null,
phone = null,
),
openingTimes =
GetConfigQuery.OpeningTimes(
close = null,
dayFrom = DayOfWeek.MONDAY,
dayTo = DayOfWeek.FRIDAY,
open = null,
),
),
footerConfig =
GetConfigQuery.FooterConfig(
showStartChat = false,
showOpeningTimes = false,
showCareer = false,
showCyberSecurity = false,
showPress = false,
),
landingConfig =
GetConfigQuery.LandingConfig(
slideshowItems = listOf(),
topCategoriesSection =
GetConfigQuery.TopCategoriesSection(
left = GetConfigQuery.Left(media = null, title = null),
middle = GetConfigQuery.Middle(media = null, title = null),
right = GetConfigQuery.Right(media = null, title = null),
),
sales = GetConfigQuery.Sales(title = "", media = null),
popular = GetConfigQuery.Popular(title = "", media = null),
mens = GetConfigQuery.Mens(title = "", media = null),
women = GetConfigQuery.Women(title = "", media = null),
kids = GetConfigQuery.Kids(title = "", media = null)
)
)

),
),
catalogConfig =
GetConfigQuery.CatalogConfig(
bannerConfig =
GetConfigQuery.BannerConfig(
catalog =
GetConfigQuery.Catalog(
title = "",
media = null,
),
sales = GetConfigQuery.Sales(title = "", media = null),
popular = GetConfigQuery.Popular(title = "", media = null),
mens = GetConfigQuery.Mens(title = "", media = null),
women = GetConfigQuery.Women(title = "", media = null),
kids = GetConfigQuery.Kids(title = "", media = null),
),
),
),
val current: GetConfigQuery.GetConfig = original,

val emailError: String? = null,
val phoneError: String? = null,
val companyWebsiteError: String? = null,
val openTimeError: String? = null,
val closeTimeError: String? = null,

val isPreviewDialogOpen: Boolean = false,
val previewDialogImage: ImagePreview? = null,

val deleteImageDialogOpen: Boolean = false,
val deleteImageDialogImageId: String? = null,

val collageMediaDropError: String? = null,
val isCollageImagesLoading: Boolean = false,

val bannerLeftMediaDropError: String? = null,
val isBannerLeftImagesLoading: Boolean = false,

val isBannerMiddleImagesLoading: Boolean = false,
val bannerMiddleMediaDropError: String? = null,

val bannerRightMediaDropError: String? = null,
val isBannerRightImagesLoading: Boolean = false,
)

sealed interface Inputs {
data object Init : Inputs

data object FetchConfig : Inputs

data class UploadCollageMedia(val imageId: String, val blob: String) : Inputs

data class UploadBannerMedia(val side: Side, val blob: String) : Inputs

data object OnSaveClick : Inputs

data object OnDiscardSaveClick : Inputs

data class OnOpenDayFromSelected(val day: DayOfWeek) : Inputs

data class OnOpenDayToSelected(val day: DayOfWeek) : Inputs

data class OnImageClick(val imagePreview: ImagePreview) : Inputs

data class OnImageDeleteClick(val imageId: String) : Inputs

data object OnImageDeleteYesClick : Inputs

data object OnImageDeleteNoClick : Inputs

data class OnCollageMediaDrop(val imageId: String, val blob: String) : Inputs

data class OnCollageItemTitleChanged(val imageId: String, val title: String) : Inputs

data class OnCollageItemDescriptionChanged(val imageId: String, val description: String) : Inputs

data class OnBannerLeftTitleChanged(val title: String) : Inputs

data class OnBannerLeftMediaDrop(val blob: String) : Inputs

data class OnBannerMiddleTitleChanged(val title: String) : Inputs

data class OnBannerMiddleMediaDrop(val blob: String) : Inputs

data class OnBannerRightTitleChanged(val title: String) : Inputs

data class OnBannerRightMediaDrop(val blob: String) : Inputs

data class SetPreviewDialogOpen(val isOpen: Boolean) : Inputs

data class SetDeleteImageDialogOpen(val isOpen: Boolean) : Inputs

data class SetLoading(val isLoading: Boolean) : Inputs

data class SetOriginalConfig(val config: GetConfigQuery.GetConfig) : Inputs

data class SetCurrentConfig(val config: GetConfigQuery.GetConfig) : Inputs

data class SetEmail(val email: String) : Inputs

data class SetPhone(val phone: String) : Inputs

data class SetCompanyWebsite(val companyWebsite: String) : Inputs

data class SetOpenTime(val openTime: String) : Inputs

data class SetCloseTime(val closeTime: String) : Inputs

data class SetUpdatedAt(val updatedAt: String) : Inputs

data class SetCollageImageDropError(val error: String?) : Inputs

data class SetCollageImagesLoading(val isLoading: Boolean) : Inputs

data class SetBannerLeftImageDropError(val error: String?) : Inputs

data class SetBannerLeftImagesLoading(val isLoading: Boolean) : Inputs

data class SetBannerMiddleImageDropError(val error: String?) : Inputs

data class SetBannerMiddleImagesLoading(val isLoading: Boolean) : Inputs

data class SetBannerRightImageDropError(val error: String?) : Inputs

data class SetBannerRightImagesLoading(val isLoading: Boolean) : Inputs
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ import com.copperleaf.ballast.EventHandlerScope
internal class AdminConfigEventHandler(
private val onError: suspend (String) -> Unit,
) : EventHandler<AdminConfigContract.Inputs, AdminConfigContract.Events, AdminConfigContract.State> {
override suspend fun EventHandlerScope<AdminConfigContract.Inputs, AdminConfigContract.Events, AdminConfigContract.State>.handleEvent(
override suspend fun EventHandlerScope<
AdminConfigContract.Inputs,
AdminConfigContract.Events,
AdminConfigContract.State,
>.handleEvent(
event: AdminConfigContract.Events,
) = when (event) {
is AdminConfigContract.Events.OnError -> onError(event.message)
Expand Down
Loading

0 comments on commit 0083d67

Please sign in to comment.