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 2d3612a commit 544b6d0
Show file tree
Hide file tree
Showing 19 changed files with 146 additions and 52 deletions.
8 changes: 6 additions & 2 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,12 @@ indent_size = 4

[*.{kt,kts}]
max_line_length = 120
ij_kotlin_allow_trailing_comma = false
ij_kotlin_allow_trailing_comma_on_call_site = false
ij_kotlin_packages_to_use_import_on_demand = unset
ij_kotlin_name_count_to_use_star_import = 99
ij_kotlin_name_count_to_use_star_import_for_members = 99
ij_kotlin_keep_line_breaks = true
ij_kotlin_call_parameters_new_line_after_left_paren = false
ij_kotlin_method_parameters_new_line_after_left_paren = false

[*.md]
trim_trailing_whitespace = false
50 changes: 50 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: CI/CD Pipeline

on:
push:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest
env:
ECR_CLUSTER: ${{ secrets.ECR_CLUSTER }}
ECR_SERVICE: ${{ secrets.ECR_SERVICE }}

steps:
- 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: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_REGION }}

- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2

- name: Build, tag, and push image to Amazon ECR
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY: ${{ secrets.ECR_REPOSITORY }}
IMAGE_TAG: ${{ github.sha }}
run: |
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
- name: Update image in AWS
run: |
aws apprunner create-service --service-name benatty-shop-web-client --source-configuration '{"ImageRepository": {"ImageIdentifier": "'"$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG"'", "ImageRepositoryType": "ECR"}}'
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,16 @@ package feature.shop.home
import component.localization.Strings
import component.localization.getString
import data.GetLandingConfigQuery
import data.GetLandingConfigQuery.SlideshowItem
import data.type.MediaType

object HomeContract {
data class State(
val isLoading: Boolean = true,

val landingConfig: GetLandingConfigQuery.GetLandingConfig = GetLandingConfigQuery.GetLandingConfig(
slideshowItems = listOf(), topCategoriesSection = GetLandingConfigQuery.TopCategoriesSection(
slideshowItems = listOf(),
topCategoriesSection = GetLandingConfigQuery.TopCategoriesSection(
left = GetLandingConfigQuery.Left(media = null, title = null),
middle = GetLandingConfigQuery.Middle(media = null, title = null),
right = GetLandingConfigQuery.Right(media = null, title = null)
Expand All @@ -21,6 +24,30 @@ object HomeContract {
val email: String = "",
val emailError: String? = null,

val slideshowItems: List<SlideshowItem> = listOf(
SlideshowItem(
id = "1",
title = "Fine details",
description = null,
media = GetLandingConfigQuery.Media(
keyName = "1",
url = "https://be-natty.co.uk/cdn/shop/files/Dolce_Theme_Slide_1.webp?v=1717262628&width=1200",
alt = "Hero 1",
type = MediaType.Image
),
),
SlideshowItem(
id = "2",
title = "Boho style",
description = null,
media = GetLandingConfigQuery.Media(
keyName = "1",
url = "https://be-natty.co.uk/cdn/shop/files/Dolce_Theme_Slide_3.webp?v=1717262705&width=1200",
alt = "Hero 1",
type = MediaType.Image
),
)
),
val categorySection: List<CategoryItem> = listOf(
CategoryItem(
url = "https://icon-shopify-theme.myshopify.com/cdn/shop/files/looks1.jpg?v=1614301039&width=600",
Expand Down Expand Up @@ -384,7 +411,7 @@ object HomeContract {
data object FetchLandingConfig : Inputs
data object FetchProducts : Inputs

data class OnCollageItemClick(val item: GetLandingConfigQuery.SlideshowItem) : Inputs
data class OnCollageItemClick(val item: SlideshowItem) : Inputs
data object OnPrivacyPolicyClick : Inputs
data object OnTermsOfServiceClick : Inputs
data class OnCategoryItemClick(val id: String) : Inputs
Expand Down
25 changes: 18 additions & 7 deletions apps/shop/web/.kobweb/server/logs/kobweb-server.log
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
2024-06-25 22:14:07.155 [main] DEBUG ktor.application - Java Home: /Users/adrianwitaszak/.sdkman/candidates/java
2024-06-25 22:14:07.156 [main] DEBUG ktor.application - Class Loader: jdk.internal.loader.ClassLoaders$AppClassLoader@1cf4f579: [file:/Users/adrianwitaszak/CharLEEX/BeNatty/kotlin/BeNatty-Client/apps/shop/web/.kobweb/server/server.jar!/ch]
2024-06-25 22:14:07.167 [main] INFO ktor.application - No API jar file specified in conf.yaml. Server API routes will not be available.
2024-06-25 22:14:07.197 [main] INFO ktor.application - Application started in 0.076 seconds.
2024-06-25 22:14:07.274 [main] INFO ktor.application - Responding at http://0.0.0.0:8080
2024-06-25 22:44:20.166 [kotlinx.coroutines.DefaultExecutor] INFO ktor.application - Kobweb server shutting down...
2024-06-25 22:44:22.248 [kotlinx.coroutines.DefaultExecutor] INFO ktor.application - Server finished shutting down.
2024-06-30 12:51:04.035 [main] DEBUG ktor.application - Java Home: /Users/adrianwitaszak/.sdkman/candidates/java
2024-06-30 12:51:04.036 [main] DEBUG ktor.application - Class Loader: jdk.internal.loader.ClassLoaders$AppClassLoader@1cf4f579: [file:/Users/adrianwitaszak/CharLEEX/BeNatty/kotlin/BeNatty-Client/apps/shop/web/.kobweb/server/server.jar!/ch]
2024-06-30 12:51:04.046 [main] INFO ktor.application - No API jar file specified in conf.yaml. Server API routes will not be available.
2024-06-30 12:51:04.076 [main] INFO ktor.application - Application started in 0.075 seconds.
2024-06-30 12:51:04.158 [main] INFO ktor.application - Responding at http://0.0.0.0:8080
2024-06-30 12:51:22.281 [eventLoopGroupProxy-4-1] DEBUG ktor.application - Served fallback index.html file in response to "/"
2024-06-30 12:51:23.489 [eventLoopGroupProxy-4-1] DEBUG ktor.application - Client connected and is requesting kobweb status events.
2024-06-30 12:53:10.508 [eventLoopGroupProxy-4-2] DEBUG ktor.application - Served fallback index.html file in response to "/"
2024-06-30 12:53:11.080 [eventLoopGroupProxy-4-1] DEBUG ktor.application - Stopped sending kobweb status events, probably because client disconnected or server is shutting down. (ChannelWriteException: Cannot write to a channel)
2024-06-30 12:53:12.311 [eventLoopGroupProxy-4-2] DEBUG ktor.application - Client connected and is requesting kobweb status events.
2024-06-30 12:53:19.500 [eventLoopGroupProxy-4-3] DEBUG ktor.application - Served fallback index.html file in response to "/"
2024-06-30 12:53:19.906 [eventLoopGroupProxy-4-2] DEBUG ktor.application - Stopped sending kobweb status events, probably because client disconnected or server is shutting down. (ChannelWriteException: Cannot write to a channel)
2024-06-30 12:53:21.113 [eventLoopGroupProxy-4-3] DEBUG ktor.application - Client connected and is requesting kobweb status events.
2024-06-30 12:53:32.050 [eventLoopGroupProxy-4-4] DEBUG ktor.application - Served fallback index.html file in response to "/"
2024-06-30 12:53:33.124 [eventLoopGroupProxy-4-4] DEBUG ktor.application - Client connected and is requesting kobweb status events.
2024-06-30 12:53:39.672 [eventLoopGroupProxy-4-3] DEBUG ktor.application - Stopped sending kobweb status events, probably because client disconnected or server is shutting down. (ChannelWriteException: Cannot write to a channel)
2024-06-30 12:54:26.951 [kotlinx.coroutines.DefaultExecutor] INFO ktor.application - Kobweb server shutting down...
2024-06-30 12:54:29.041 [kotlinx.coroutines.DefaultExecutor] INFO ktor.application - Server finished shutting down.
Binary file modified apps/shop/web/.kobweb/server/server.jar
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ private fun FollowUsSection(
) {
AppOutlinedTextField(
text = state.connectEmail,
onTextChanged = { vm.trySend(FooterContract.Inputs.SetConnectEmail(it)) },
onTextChange = { vm.trySend(FooterContract.Inputs.SetConnectEmail(it)) },
placeholder = getString(Strings.JoinOurEmailList),
autoComplete = AutoComplete.email,
modifier = Modifier
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ import com.varabyte.kobweb.compose.ui.modifiers.fillMaxWidth
import com.varabyte.kobweb.compose.ui.modifiers.height
import com.varabyte.kobweb.compose.ui.modifiers.lineHeight
import com.varabyte.kobweb.compose.ui.modifiers.padding
import com.varabyte.kobweb.silk.components.forms.InputDefaults
import com.varabyte.kobweb.silk.components.forms.TextInput
import com.varabyte.kobweb.silk.components.style.ComponentVariant
import com.varabyte.kobweb.silk.theme.colors.ColorMode
import com.varabyte.kobweb.silk.theme.colors.palette.background
import com.varabyte.kobweb.silk.theme.colors.palette.toPalette
Expand All @@ -25,9 +23,8 @@ import web.AppColors
@Composable
fun AppOutlinedTextField(
text: String,
onTextChanged: (String) -> Unit,
onTextChange: (String) -> Unit,
modifier: Modifier = Modifier,
variant: ComponentVariant? = InputDefaults.Variant,
placeholder: String? = null,
password: Boolean = false,
enabled: Boolean = true,
Expand All @@ -42,7 +39,7 @@ fun AppOutlinedTextField(
) {
TextInput(
text = text,
onTextChanged = onTextChanged,
onTextChange = onTextChange,
placeholder = placeholder,
spellCheck = spellCheck,
autoComplete = autoComplete,
Expand All @@ -53,7 +50,6 @@ fun AppOutlinedTextField(
readOnly = readOnly,
onCommit = onCommit,
ref = ref,
variant = variant,
focusBorderColor = AppColors.brandColor,
modifier = modifier
.fillMaxWidth()
Expand Down
2 changes: 1 addition & 1 deletion apps/shop/web/src/jsMain/kotlin/web/pages/RouterContent.kt
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ fun RouterContent(
isAuthenticated: Boolean,
onError: (String) -> Unit,
homeScreen: Screen = Screen.Home,
loginScreen: Screen = Screen.Login,
loginScreen: Screen = Screen.Home,
) {
val scope = rememberCoroutineScope()
val initialRoute = when (isAuthenticated) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,22 +69,22 @@ private fun PersonalDetails(vm: ProfileViewModel, state: ProfileContract.State)
}
AppOutlinedTextField(
text = state.detailsFirstName,
onTextChanged = { vm.trySend(ProfileContract.Inputs.SetDetailsFullName(it)) },
onTextChange = { vm.trySend(ProfileContract.Inputs.SetDetailsFullName(it)) },
placeholder = getString(Strings.FirstName),
autoComplete = AutoComplete.givenName,
modifier = Modifier.fillMaxWidth(),
)
AppOutlinedTextField(
text = state.email,
onTextChanged = { vm.trySend(ProfileContract.Inputs.SetEmail(it)) },
onTextChange = { vm.trySend(ProfileContract.Inputs.SetEmail(it)) },
placeholder = getString(Strings.Email),
required = true,
autoComplete = AutoComplete.email,
modifier = Modifier.fillMaxWidth(),
)
AppOutlinedTextField(
text = state.phone,
onTextChanged = { vm.trySend(ProfileContract.Inputs.SetPhone(it)) },
onTextChange = { vm.trySend(ProfileContract.Inputs.SetPhone(it)) },
placeholder = getString(Strings.Phone),
autoComplete = AutoComplete.tel,
modifier = Modifier.fillMaxWidth(),
Expand All @@ -103,13 +103,13 @@ fun Password(vm: ProfileViewModel, state: ProfileContract.State) {
)
AppOutlinedTextField(
text = state.oldPassword,
onTextChanged = { vm.trySend(ProfileContract.Inputs.SetOldPassword(it)) },
onTextChange = { vm.trySend(ProfileContract.Inputs.SetOldPassword(it)) },
placeholder = getString(Strings.OldPassword),
modifier = Modifier.fillMaxWidth(),
)
AppOutlinedTextField(
text = state.newPassword,
onTextChanged = { vm.trySend(ProfileContract.Inputs.SetNewPassword(it)) },
onTextChange = { vm.trySend(ProfileContract.Inputs.SetNewPassword(it)) },
placeholder = getString(Strings.NewPassword),
modifier = Modifier.fillMaxWidth(),
)
Expand All @@ -135,14 +135,14 @@ private fun Address(vm: ProfileViewModel, state: ProfileContract.State) {
}
AppOutlinedTextField(
text = state.address,
onTextChanged = { vm.trySend(ProfileContract.Inputs.SetAddress(it)) },
onTextChange = { vm.trySend(ProfileContract.Inputs.SetAddress(it)) },
placeholder = getString(Strings.Address),
autoComplete = AutoComplete.streetAddress,
modifier = Modifier.fillMaxWidth(),
)
AppOutlinedTextField(
text = state.additionalInformation,
onTextChanged = { vm.trySend(ProfileContract.Inputs.SetAdditionalInformation(it)) },
onTextChange = { vm.trySend(ProfileContract.Inputs.SetAdditionalInformation(it)) },
placeholder = getString(Strings.Company),
autoComplete = AutoComplete.ccAdditionalName,
modifier = Modifier.fillMaxWidth(),
Expand All @@ -154,14 +154,14 @@ private fun Address(vm: ProfileViewModel, state: ProfileContract.State) {
) {
AppOutlinedTextField(
text = state.postcode,
onTextChanged = { vm.trySend(ProfileContract.Inputs.SetPostcode(it)) },
onTextChange = { vm.trySend(ProfileContract.Inputs.SetPostcode(it)) },
placeholder = getString(Strings.PostCode),
autoComplete = AutoComplete.postalCode,
modifier = Modifier.weight(1f),
)
AppOutlinedTextField(
text = state.city,
onTextChanged = { vm.trySend(ProfileContract.Inputs.SetCity(it)) },
onTextChange = { vm.trySend(ProfileContract.Inputs.SetCity(it)) },
placeholder = getString(Strings.City),
autoComplete = AutoComplete.addressLevel2,
modifier = Modifier.weight(1f)
Expand All @@ -174,14 +174,14 @@ private fun Address(vm: ProfileViewModel, state: ProfileContract.State) {
) {
AppOutlinedTextField(
text = state.state,
onTextChanged = { vm.trySend(ProfileContract.Inputs.SetState(it)) },
onTextChange = { vm.trySend(ProfileContract.Inputs.SetState(it)) },
placeholder = getString(Strings.Apartment),
autoComplete = AutoComplete.addressLevel1,
modifier = Modifier.weight(1f),
)
AppOutlinedTextField(
text = state.country,
onTextChanged = { vm.trySend(ProfileContract.Inputs.SetCountry(it)) },
onTextChange = { vm.trySend(ProfileContract.Inputs.SetCountry(it)) },
placeholder = getString(Strings.Country),
autoComplete = AutoComplete.countryName,
modifier = Modifier.weight(1f)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ private fun ForgotPassword(
)
AppOutlinedTextField(
text = email,
onTextChanged = {
onTextChange = {
email = it
vm.trySend(ForgotPasswordContract.Inputs.SetEmail(it))
},
Expand Down
4 changes: 2 additions & 2 deletions apps/shop/web/src/jsMain/kotlin/web/pages/auth/LoginPage.kt
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ private fun FieldsSection(

AppOutlinedTextField(
text = email,
onTextChanged = {
onTextChange = {
email = it
vm.trySend(LoginContract.Inputs.SetEmail(it))
},
Expand All @@ -131,7 +131,7 @@ private fun FieldsSection(
)
AppOutlinedTextField(
text = password,
onTextChanged = {
onTextChange = {
password = it
vm.trySend(LoginContract.Inputs.SetPassword(it))
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ private fun FieldsSection(

AppOutlinedTextField(
text = name,
onTextChanged = {
onTextChange = {
name = it
vm.trySend(RegisterContract.Inputs.SetName(it))
},
Expand All @@ -119,7 +119,7 @@ private fun FieldsSection(
)
AppOutlinedTextField(
text = email,
onTextChanged = {
onTextChange = {
email = it
vm.trySend(RegisterContract.Inputs.SetEmail(it))
},
Expand All @@ -131,7 +131,7 @@ private fun FieldsSection(
)
AppOutlinedTextField(
text = password,
onTextChanged = {
onTextChange = {
password = it
vm.trySend(RegisterContract.Inputs.SetPassword(it))
},
Expand All @@ -143,7 +143,7 @@ private fun FieldsSection(
)
AppOutlinedTextField(
text = repeatPassword,
onTextChanged = {
onTextChange = {
repeatPassword = it
vm.trySend(RegisterContract.Inputs.SetRepeatPassword(it))
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ fun UpdatingPassword(

AppOutlinedTextField(
text = state.password,
onTextChanged = {
onTextChange = {
password = it
vm.trySend(UpdatePasswordContract.Inputs.SetPassword(it))
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ fun HomeSubscribe(
) {
AppOutlinedTextField(
text = state.email,
onTextChanged = { vm.trySend(HomeContract.Inputs.OnEmailChange(it)) },
onTextChange = { vm.trySend(HomeContract.Inputs.OnEmailChange(it)) },
placeholder = getString(Strings.EmailAddress),
autoComplete = AutoComplete.email,
modifier = Modifier
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ fun Slideshow(
state: HomeContract.State,
height: CSSLengthOrPercentageNumericValue = 800.px
) {
val items = state.landingConfig.slideshowItems
val items = state.slideshowItems

val slideshowModifier = Modifier
.fillMaxWidth()
Expand Down
Loading

0 comments on commit 544b6d0

Please sign in to comment.