Skip to content

Commit

Permalink
remove frontend changes
Browse files Browse the repository at this point in the history
  • Loading branch information
MaHaWo committed Dec 8, 2024
1 parent 573c231 commit fc10729
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 324 deletions.
165 changes: 0 additions & 165 deletions frontend/src/lib/components/Admin/AgeIntervals.svelte

This file was deleted.

93 changes: 0 additions & 93 deletions frontend/src/lib/components/Admin/EditAgeIntervalModal.svelte

This file was deleted.

22 changes: 2 additions & 20 deletions frontend/src/lib/components/Admin/EditMilestoneModal.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@
<script lang="ts">
import { refreshMilestoneGroups } from "$lib/admin.svelte";
import {
type AgeInterval,
deleteMilestoneImage,
updateMilestone,
uploadMilestoneImage,
} from "$lib/client";
} from "$lib/client/services.gen";
import type { MilestoneAdmin } from "$lib/client/types.gen";
import CancelButton from "$lib/components/Admin/CancelButton.svelte";
import DeleteModal from "$lib/components/Admin/DeleteModal.svelte";
Expand All @@ -22,20 +21,14 @@ import {
Label,
Modal,
Range,
Select,
Textarea,
} from "flowbite-svelte";
import { _, locales } from "svelte-i18n";
let {
open = $bindable(false),
milestone = $bindable(null),
ageintervals = $bindable([]),
}: {
open: boolean;
milestone: MilestoneAdmin | null;
ageintervals: AgeInterval[];
} = $props();
}: { open: boolean; milestone: MilestoneAdmin | null } = $props();
let files: FileList | undefined = $state(undefined);
let images: Array<string> = $state([]);
let currentMilestoneImageId: number | null = $state(null as number | null);
Expand All @@ -44,13 +37,6 @@ let showMilestoneExpectedAgeModal: boolean = $state(false);
const textKeys = ["title", "desc", "obs", "help"];
function make_interval_items() {
return ageintervals.map((interval) => ({
value: interval.id,
name: `${interval.lower_limit}m - ${interval.upper_limit}m`,
}));
}
async function saveChanges() {
if (!milestone) {
return;
Expand Down Expand Up @@ -105,10 +91,6 @@ async function deleteMilestoneImageAndUpdate() {
{/each}
</div>
{/each}
<div class="mb-5">
<Label>{$_("admin.ageIntervals")}</Label>
<Select items = {make_interval_items()} bind:value={milestone.age_interval}/>
</div>
<div class="mb-5">
<Label>{`${$_("admin.expected-age")}: ${milestone.expected_age_months}m`}</Label>
<Range id="expected-age-months" min="1" max="72" bind:value={milestone.expected_age_months}/>
Expand Down
26 changes: 2 additions & 24 deletions frontend/src/lib/components/Admin/MilestoneGroups.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,13 @@ import {
refreshMilestoneGroups,
} from "$lib/admin.svelte";
import {
type AgeInterval,
createMilestone,
createMilestoneGroupAdmin,
deleteMilestone,
deleteMilestoneGroupAdmin,
getAgeIntervals,
orderMilestoneGroupsAdmin,
orderMilestonesAdmin,
} from "$lib/client";
} from "$lib/client/services.gen";
import type {
MilestoneAdmin,
MilestoneGroupAdmin,
Expand All @@ -39,7 +37,6 @@ import {
} from "flowbite-svelte";
import ChevronDownOutline from "flowbite-svelte-icons/ChevronDownOutline.svelte";
import ChevronUpOutline from "flowbite-svelte-icons/ChevronUpOutline.svelte";
import { onMount } from "svelte";
import { _, locale } from "svelte-i18n";
import AlertMessage from "../AlertMessage.svelte";
Expand All @@ -55,21 +52,6 @@ let showDeleteMilestoneModal = $state(false);
let currentOrderEndpoint = $state(orderMilestonesAdmin);
let currentOrderItems = $state([] as Array<{ id: number; text: string }>);
let showOrderItemsModal = $state(false);
let ageIntervals = $state([] as AgeInterval[]);
async function doGetAgeIntervals(): Promise<void> {
const response = await getAgeIntervals();
if (response.error) {
console.log(response.error);
return;
}
ageIntervals = response.data as AgeInterval[];
}
onMount(async () => {
await doGetAgeIntervals();
});
function toggleOpenGroupIndex(index: number) {
if (openMilestoneGroupIndex === index) {
Expand Down Expand Up @@ -114,9 +96,6 @@ async function doDeleteMilestoneGroup() {
async function addMilestone(milestoneGroupId: number) {
const { data, error } = await createMilestone({
path: { milestone_group_id: milestoneGroupId },
query: {
age_interval: 0,
},
});
if (error) {
console.log(error);
Expand Down Expand Up @@ -291,9 +270,8 @@ async function doDeleteMilestone() {
></DeleteModal>

{#key showEditMilestoneModal}
<EditMilestoneModal bind:open={showEditMilestoneModal} bind:milestone={currentMilestone} bind:ageintervals= {ageIntervals}
<EditMilestoneModal bind:open={showEditMilestoneModal} bind:milestone={currentMilestone}
></EditMilestoneModal>

{/key}
<DeleteModal bind:open={showDeleteMilestoneModal} onclick={doDeleteMilestone}></DeleteModal>

Expand Down
Loading

0 comments on commit fc10729

Please sign in to comment.