Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
29 changes: 27 additions & 2 deletions .claude/settings.local.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,33 @@
{
"permissions": {
"allow": [
"Bash(rg:*)"
"Bash(rg:*)",
"Bash(./gradlew :composeApp:compileKotlinDesktop 2>&1 | tail -20)",
"Bash(./gradlew :composeApp:compileKotlinDesktop 2>&1 | grep -i \"error\\\\|Error\" | head -20)",
"Bash(./gradlew :composeApp:compileKotlinDesktop 2>&1 | grep -E \"\\\\.kt:\" | head -20)",
"Bash(./gradlew :composeApp:compileKotlinDesktop 2>&1 | tail -10)",
"Bash(./gradlew :composeApp:compileKotlinDesktop 2>&1 | tail -5)",
"Bash(git checkout:*)",
"Bash(git add:*)",
"Bash(git commit:*)",
"WebSearch",
"WebFetch(domain:github.com)",
"WebFetch(domain:central.sonatype.com)",
"WebFetch(domain:www.jetbrains.com)",
"WebFetch(domain:raw.githubusercontent.com)",
"WebFetch(domain:maven.pkg.jetbrains.space)",
"WebFetch(domain:plugins.gradle.org)",
"Bash(curl:*)",
"Bash(./gradlew build:*)",
"Bash(./gradlew :composeApp:compileCommonMainKotlinMetadata :composeApp:compileKotlinDesktop :composeApp:compileDebugKotlinAndroid 2>&1 | grep \"^e:\\\\|BUILD\")",
"Bash(./gradlew tasks:*)",
"mcp__ide__getDiagnostics",
"Bash(./gradlew :composeApp:testDebugUnitTest 2>&1)",
"WebFetch(domain:gitliveapp.github.io)",
"Bash(git fetch:*)",
"Bash(gh pr:*)",
"Bash(git push:*)"
],
"deny": []
}
}
}
6 changes: 2 additions & 4 deletions composeApp/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ plugins {
alias(libs.plugins.kotlinxSerialization)
alias(libs.plugins.google.services)
alias(libs.plugins.buildkonfig)
alias(libs.plugins.hotreload)
}

composeCompiler {
Expand Down Expand Up @@ -80,6 +79,7 @@ kotlin {

compilerOptions {
freeCompilerArgs.add("-Xexpect-actual-classes")
freeCompilerArgs.add("-opt-in=kotlin.time.ExperimentalTime")
}
androidTarget {
compilerOptions {
Expand All @@ -106,7 +106,6 @@ kotlin {


androidMain.dependencies {
implementation(libs.compose.ui.tooling.preview)
implementation(compose.preview)
implementation(libs.androidx.activity.compose)
implementation(libs.koin.android)
Expand All @@ -124,6 +123,7 @@ kotlin {
implementation(libs.kotlinx.datetime)
implementation(libs.kotlinx.couroutines.core)
implementation(libs.androidx.lifecycle.viewmodel)
implementation(libs.androidx.lifecycle.runtime.compose)
implementation(compose.materialIconsExtended)
implementation(libs.androidx.navigation)
implementation(libs.kotlinx.serialization.json)
Expand All @@ -135,8 +135,6 @@ kotlin {
implementation(libs.kermit)
}
desktopMain.dependencies {
// TODO delete when this pr is merged: https://github.com/GitLiveApp/firebase-java-sdk/pull/33
implementation("dev.gitlive:firebase-java-sdk:0.6.2")
implementation(compose.desktop.currentOs)
implementation(libs.kotlinx.coroutines.swing)
implementation(libs.pdfbox)
Expand Down
1 change: 1 addition & 0 deletions composeApp/src/androidMain/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

<application
android:allowBackup="true"
android:enableOnBackInvokedCallback="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import android.graphics.pdf.PdfDocument
import android.graphics.pdf.PdfDocument.Page
import android.os.Environment
import android.provider.MediaStore
import kotlinx.datetime.Clock
import kotlin.time.Clock
import kotlinx.datetime.LocalDate
import model.Material
import model.Meal
Expand Down
2 changes: 1 addition & 1 deletion composeApp/src/commonMain/kotlin/data/EventRepository.kt
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ interface EventRepository {
suspend fun getAllRecipes(): List<Recipe>
suspend fun getUserCreatedRecipes(): List<Recipe>
suspend fun getMealById(eventId: String, mealId: String): Meal
suspend fun getRecipeById(recipeId: String): Recipe
suspend fun getRecipeById(recipeId: String): Recipe?
suspend fun createRecipe(recipe: Recipe)
suspend fun updateRecipe(recipe: Recipe)
suspend fun deleteRecipe(recipeId: String)
Expand Down
12 changes: 7 additions & 5 deletions composeApp/src/commonMain/kotlin/data/FireBaseRepository.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import kotlinx.coroutines.async
import kotlinx.coroutines.awaitAll
import kotlinx.coroutines.coroutineScope
import kotlinx.coroutines.flow.flow
import kotlinx.datetime.Clock
import kotlin.time.Clock
import kotlinx.datetime.Instant
import kotlinx.datetime.LocalDate
import model.DailyShoppingList
Expand Down Expand Up @@ -365,13 +365,15 @@ class FireBaseRepository(private val loginAndRegister: LoginAndRegister) : Event
return recipes
}

override suspend fun getRecipeById(recipeId: String): Recipe {
val recipe = firestore
override suspend fun getRecipeById(recipeId: String): Recipe? {
val doc = firestore
.collection(RECIPES)
.document(recipeId)
.get()
.data<Recipe> {
}

if (!doc.exists) return null

val recipe = doc.data<Recipe>()

// Batch load all ingredients in a single request instead of individual requests
val ingredientRefs = recipe.shoppingIngredients.map { it.ingredientRef }.distinct()
Expand Down
2 changes: 1 addition & 1 deletion composeApp/src/commonMain/kotlin/model/Event.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package model

import kotlinx.datetime.Clock
import kotlin.time.Clock
import kotlinx.datetime.Instant
import kotlinx.serialization.Serializable
import view.shared.HelperFunctions
Expand Down
2 changes: 0 additions & 2 deletions composeApp/src/commonMain/kotlin/modules/ViewModelModules.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ package modules

import CategorizedShoppingListViewModel
import MaterialListViewModel
import androidx.lifecycle.viewmodel.compose.viewModel
import androidx.lifecycle.viewmodel.viewModelFactory
import org.koin.dsl.module
import view.admin.csv_import.CsvImportViewModel
import view.admin.new_participant.ViewModelNewParticipant
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package services.event

import kotlinx.datetime.Clock
import kotlin.time.Clock
import kotlinx.datetime.Instant


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import co.touchlab.kermit.Logger
import data.EventRepository
import kotlinx.coroutines.async
import kotlinx.coroutines.flow.merge
import kotlinx.datetime.Clock
import kotlin.time.Clock
import kotlinx.datetime.Instant
import kotlinx.datetime.LocalDate
import kotlinx.datetime.TimeZone
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
import data.csv.*
import view.shared.NavigationIconButton

enum class ImportStep {
FILE_SELECTION,
Expand Down Expand Up @@ -64,9 +65,7 @@ fun CsvImportWizard(
TopAppBar(
title = { Text("CSV Import") },
navigationIcon = {
IconButton(onClick = onClose) {
Icon(Icons.Default.FileUpload, contentDescription = "Schließen")
}
NavigationIconButton(onLeave = onClose)
}
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,15 +121,15 @@ private fun IngredientPickerContent(
),
placeholder = {
Text(
text = "Search",
text = "Suchen",
style = MaterialTheme.typography.bodyLarge,
color = MaterialTheme.colorScheme.onSurfaceVariant
)
},
leadingIcon = {
Icon(
imageVector = Icons.Default.Search,
contentDescription = "Search"
contentDescription = "Suchen"
)
},
trailingIcon = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
package view.admin.new_participant

import androidx.compose.foundation.clickable
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.gestures.detectTapGestures
import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.interaction.collectIsPressedAsState
import androidx.compose.foundation.layout.Box
Expand All @@ -14,6 +15,8 @@ import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.text.KeyboardActions
import androidx.compose.foundation.text.KeyboardOptions
import androidx.compose.foundation.verticalScroll
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Edit
Expand All @@ -33,13 +36,18 @@ import androidx.compose.material3.Text
import androidx.compose.material3.TextField
import androidx.compose.material3.TopAppBar
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.input.pointer.pointerInput
import androidx.compose.ui.focus.FocusDirection
import androidx.compose.ui.platform.LocalFocusManager
import androidx.compose.ui.text.input.ImeAction
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.dp
import androidx.lifecycle.compose.collectAsStateWithLifecycle
Expand Down Expand Up @@ -106,10 +114,15 @@ fun NewParicipant(
availableGroups: Set<String>
) {

val focusManager = LocalFocusManager.current

AppTheme {
Scaffold(
contentColor = MaterialTheme.colorScheme.onBackground,
modifier = Modifier.fillMaxSize(),
modifier = Modifier.fillMaxSize()
.pointerInput(Unit) {
detectTapGestures(onTap = { focusManager.clearFocus() })
},
topBar = {
TopAppBar(title = {
Text(text = "Teilnehmende hinzufügen")
Expand All @@ -132,7 +145,12 @@ fun NewParicipant(
onAction(ActionsNewParticipant.ChangeFirstName(it))
},
label = { Text("Vorname:") },
modifier = Modifier.padding(8.dp)
modifier = Modifier.padding(8.dp),
keyboardOptions = KeyboardOptions(imeAction = ImeAction.Next),
keyboardActions = KeyboardActions(onNext = {
focusManager.moveFocus(FocusDirection.Down)
}),
singleLine = true
)
}

Expand All @@ -141,7 +159,12 @@ fun NewParicipant(
value = state.data.lastName,
onValueChange = { onAction(ActionsNewParticipant.ChangeLastName(it)) },
label = { Text("Nachname:") },
modifier = Modifier.padding(8.dp)
modifier = Modifier.padding(8.dp),
keyboardOptions = KeyboardOptions(imeAction = ImeAction.Done),
keyboardActions = KeyboardActions(onDone = {
focusManager.clearFocus()
}),
singleLine = true
)
}
Row {
Expand Down Expand Up @@ -252,6 +275,7 @@ private fun AllergySelection(
selectedIngredients = state.allergies,
onSelected = { onAction(ActionsNewParticipant.AddOrRemoveAllergy(allergy = it.uid)) },
onDismiss = { showDialog = false },
multiSelect = true
)
}
}
Expand Down Expand Up @@ -301,9 +325,12 @@ private fun BirthdaySelectionField(
onAction: (ActionsNewParticipant) -> Unit
) {
val interactionSource = remember { MutableInteractionSource() }
val isPressed by interactionSource.collectIsPressedAsState()

if (interactionSource.collectIsPressedAsState().value) {
onAction(ActionsNewParticipant.ShowDatePicker)
LaunchedEffect(isPressed) {
if (isPressed) {
onAction(ActionsNewParticipant.ShowDatePicker)
}
}

DateInputField(
Expand Down
Loading
Loading