Skip to content

Commit

Permalink
revise default color behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
MaHaWo committed Dec 20, 2024
1 parent 6819ee4 commit d357b87
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 15 deletions.
13 changes: 2 additions & 11 deletions frontend/src/lib/components/ChildrenGallery.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,6 @@ import { Heading, Spinner } from "flowbite-svelte";
import { _ } from "svelte-i18n";
import AlertMessage from "./AlertMessage.svelte";
function makeChildClass(childdata: CardElement): string {
if (childdata.image !== null && childdata.image !== undefined) {
return "";
}
const classstr =
"hover:cursor-pointer m-2 max-w-prose text-gray-700 hover:text-white dark:text-white hover:dark:text-gray-400 hover:bg-primary-800 dark:hover:bg-primary-700";
return classstr;
}
function createStyle(data: CardElement[]): CardStyle[] {
return data.map((item) => ({
card:
Expand All @@ -31,7 +21,8 @@ function createStyle(data: CardElement[]): CardStyle[] {
horizontal: false,
}
: {
class: makeChildClass(item),
class:
"hover:cursor-pointer m-2 max-w-prose text-gray-700 hover:text-white dark:text-white hover:dark:text-gray-400 hover:bg-primary-800 dark:hover:bg-primary-700",
style: item.color ? `background-color: ${item.color};` : "",
horizontal: false,
},
Expand Down
6 changes: 4 additions & 2 deletions frontend/src/lib/components/ChildrenRegistration.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ async function submitChildData(): Promise<void> {
birth_year: birthyear,
birth_month: birthmonth,
has_image: image !== null,
color: color,
color: image !== null ? null : color,
} as ChildCreate,
});
Expand All @@ -163,6 +163,8 @@ async function submitChildData(): Promise<void> {
}
currentChild.id = new_child.data.id;
} else {
console.log("updating existing child");
// update existing child
const response = await updateChild({
body: {
Expand Down Expand Up @@ -341,7 +343,7 @@ async function submitData(): Promise<void> {
label={$_("childData.childColor")}
required={false}
placeholder={$_("childData.chooseColor")}
disabled={image!==null || disableEdit}
disabled={disableEdit}
id="child_color"
kwargs = {{type: "color"}}
componentClass="w-1/4 h-12 rounded"
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/locales/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@
"noFileChosen": "Keine Datei ausgewählt",
"deleteImageButton": "Bild löschen",
"nextButtonLabel": "Weiter zu Meilensteinen",
"childColor": "Hintergrundfarbe für Icon wenn kein Bild benutzt werden soll",
"childColor": "Hintergrundfarbe für Icon wählen",
"chooseColor": "Farbe wählen"
},
"forgotPw": {
Expand Down
2 changes: 1 addition & 1 deletion mondey_backend/src/mondey_backend/models/children.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class ChildBase(SQLModel):
name: str = ""
birth_year: int
birth_month: int
color: str = "#ffffff"
color: str | None = None


class Child(ChildBase, table=True):
Expand Down

0 comments on commit d357b87

Please sign in to comment.