diff --git a/src/lib/components/Childrenpage.svelte b/src/lib/components/Childrenpage.svelte index d3891579..5d966d55 100644 --- a/src/lib/components/Childrenpage.svelte +++ b/src/lib/components/Childrenpage.svelte @@ -5,7 +5,7 @@ header: item.name, summary: item.info, image: item.image, - href: item.href ? item.href : '/' + href: `/childLand/${item.user}/${item.id}` }; }); @@ -20,6 +20,7 @@ // dynamically create the styles for individual gallery tiles based on the data. // The 'Neu' element needs to be styled differently in particular + // FIXME: this needs to go. styles have no business being defined in - - - Übersicht +Übersicht -
+
+ {#if loading} +

Daten werden geladen...

+ {:else}

Wählen sie ein Kind zur Beobachtung aus oder legen melden sie ein neues Kind an.

@@ -108,5 +91,5 @@ searchableCol={'header'} componentProps={createStyle(data)} /> -
- + {/if} +
diff --git a/src/lib/components/DataInput/AbstractDropdownItem.svelte b/src/lib/components/DataInput/AbstractDropdownItem.svelte index 031e9f05..4a86edb4 100644 --- a/src/lib/components/DataInput/AbstractDropdownItem.svelte +++ b/src/lib/components/DataInput/AbstractDropdownItem.svelte @@ -2,7 +2,6 @@ import { Select, Tooltip } from 'flowbite-svelte'; // have the data processing here to coerce the input into the format that the component expects - console.log($$props); const items = $$props.items.map((item) => ({ name: item, value: item })); diff --git a/src/lib/components/DataInput/AbstractRegistrationForm.svelte b/src/lib/components/DataInput/AbstractRegistrationForm.svelte index 58a70097..1be48c16 100644 --- a/src/lib/components/DataInput/AbstractRegistrationForm.svelte +++ b/src/lib/components/DataInput/AbstractRegistrationForm.svelte @@ -5,7 +5,6 @@ export let heading = null; export let buttons = null; export let description = null; - console.log('props: ', props);
diff --git a/src/lib/components/Frontpage.svelte b/src/lib/components/Frontpage.svelte index 885c0ef1..62fe9155 100644 --- a/src/lib/components/Frontpage.svelte +++ b/src/lib/components/Frontpage.svelte @@ -3,7 +3,7 @@ import CardDisplay from './DataDisplay/CardDisplay.svelte'; import GalleryDisplay from './DataDisplay/GalleryDisplay.svelte'; - export let getStarted = '/firstdropdown'; + export let getStarted = ''; export let items = [ { diff --git a/src/lib/stores/childrenStore.test.ts b/src/lib/stores/childrenStore.test.ts new file mode 100644 index 00000000..678a32be --- /dev/null +++ b/src/lib/stores/childrenStore.test.ts @@ -0,0 +1,216 @@ +import { get } from 'svelte/store'; +import { describe, expect, it } from 'vitest'; +import { + addChildData, + addChildObservation, + children, + fetchChildData, + fetchChildrenDataforUser, + fetchObservationData, + fetchObservationDataForUser, + removeChildData, + type ChildObject, + type ObservationData +} from './childrenStore'; + +describe('normal functionality', () => { + const mockObservationData: ObservationData = { + id: 'child1', + user: 'alpha', + current: ['a', 'b', 'c'], + summary: ['x', 'y'] + }; + const mockObservationData2: ObservationData = { + id: 'child1', + user: 'beta', + current: ['a', 'b', 'c'], + summary: ['x', 'y'] + }; + const mockChildData: ChildObject = { + childData: { + id: 'childfoo', + user: 'alpha', + name: 'foo', + age: 3, + nationality: 'turkish' + }, + observationData: mockObservationData + }; + const mockChildData2: ChildObject = { + childData: { + id: 'childbar', + user: 'alpha', + name: 'bar', + age: 5, + nationality: 'german' + }, + observationData: mockObservationData + }; + + const mockChildData3: ChildObject = { + childData: { + id: 'childbaz', + user: 'beta', + name: 'baz', + age: 2, + nationality: 'british' + }, + observationData: mockObservationData2 + }; + + function reset() { + children.set({ + alpha: { + childfoo: mockChildData, + childbar: mockChildData2 + }, + beta: { + childfoo: mockChildData3 + } + }); + } + + it('should add child successfully', async () => { + reset(); + await addChildData('alpha', 'childC', mockChildData3.childData); + expect(get(children)['alpha']['childC'].childData).toEqual(mockChildData3.childData); + }); + + it('should add child observationdata successfully', async () => { + reset(); + + await addChildData('alpha', 'childC', mockChildData3.childData); + await addChildObservation('alpha', 'childC', mockChildData3.observationData); + + expect(get(children)['alpha']['childC'].observationData).toEqual( + mockChildData3.observationData + ); + }); + + it('cannot assign observationdata when childData is missing', async () => { + reset(); + try { + await addChildObservation('alpha', 'childC', mockChildData3.observationData); + } catch (error: Error | unknown) { + expect((error as Error).message).toBe( + 'Child token childC does not exist for user token alpha' + ); + } + }); + + it('cannot assign observationdata for unknown user', async () => { + reset(); + try { + await addChildObservation('x', 'childC', mockChildData3.observationData); + } catch (error: Error | unknown) { + expect((error as Error).message).toBe('User token x not found'); + } + }); + + it('should remove child successfully', async () => { + reset(); + await removeChildData('beta', 'childfoo'); + expect(get(children)['beta']['childfoo']).toEqual(undefined); + }); + + it('should throw when adding with nonexistant user or existing child key', async () => { + reset(); + try { + await addChildData('alpha', 'childA', mockChildData3.childData); + } catch (error: Error | unknown) { + expect((error as Error).message).toBe( + 'Child token childA already exists for user token alpha' + ); + } + + try { + await addChildData('x', 'childA', mockChildData3.childData); + } catch (error: Error | unknown) { + expect((error as Error).message).toBe('User token x not found'); + } + }); + + it('should throw when removing with nonexistant user or nonexisting child key', async () => { + reset(); + try { + await removeChildData('x', 'childA'); + } catch (error: Error | unknown) { + expect((error as Error).message).toBe('User token x not found'); + } + + try { + await removeChildData('alpha', 'notthere'); + } catch (error: Error | unknown) { + expect((error as Error).message).toBe('Child token notthere not found for user token alpha'); + } + }); + + it('should fetch observation data', async () => { + reset(); + expect(await fetchObservationData('alpha', 'childfoo')).toEqual(mockObservationData); + }); + + it('should fetch child data', async () => { + reset(); + expect(await fetchChildData('alpha', 'childfoo')).toEqual({ + name: 'foo', + age: 3, + nationality: 'turkish', + id: 'childfoo', + user: 'alpha' + }); + }); + + it('cannot fetch from unknown keys', async () => { + reset(); + + try { + await fetchObservationData('x', 'childA'); + } catch (error: Error | unknown) { + expect((error as Error).message).toBe('No such user in the childrenstore'); + } + + try { + await fetchObservationData('alpha', 'unknown'); + } catch (error: Error | unknown) { + expect((error as Error).message).toBe('No such child in the childrenstore for user alpha'); + } + }); + + it('should fetch list of childrendata', async () => { + reset(); + const data = await fetchChildrenDataforUser('alpha'); + + expect(data).toEqual([mockChildData2.childData, mockChildData.childData]); + }); + + it('should fetch list of observationdata successfully', async () => { + reset(); + const data = await fetchObservationDataForUser('alpha'); + + expect(data).toEqual([ + ['childfoo', mockObservationData], + ['childbar', mockObservationData] + ]); + }); + + it('cannot fetch childrendata from uknown', async () => { + reset(); + + try { + await fetchChildrenDataforUser('x'); + } catch (error: Error | unknown) { + expect((error as Error).message).toBe('No such user in the childrenstore'); + } + }); + + it('cannot fetch observationdata from uknown', async () => { + reset(); + + try { + await fetchObservationDataForUser('x'); + } catch (error: Error | unknown) { + expect((error as Error).message).toBe('No such user in the childrenstore'); + } + }); +}); diff --git a/src/lib/stores/childrenStore.ts b/src/lib/stores/childrenStore.ts new file mode 100644 index 00000000..810393c3 --- /dev/null +++ b/src/lib/stores/childrenStore.ts @@ -0,0 +1,402 @@ +import { get, writable } from 'svelte/store'; + +// README: this API is experimental and not by any means a final design + +// Types: create interfaces for the elements that are stored and are expected to be returned from the 'backend' (or its mockup at the moment) +/** + * Interface for the observation data of a child + * @param id identifier of the child + * @param user user identifier + * @param summary summary of the observation: table that contains the status of the child for each survey for each date + * @param current current status of individual milestones for the currently open survey + */ +interface ObservationData { + id: string; + user: string; + summary: object; + current: object; +} + +/** + * Interface for the data of a child + * @param name name of the child + * @param id identifier of the child + * @param user user identifier + * @param image image of the child + * @param [key: string] further data elements + */ +interface ChildData { + name: string; + id: string; + user: string; + [key: string]: unknown; +} + +interface ChildObject { + childData: ChildData; + observationData: ObservationData | null; +} + +interface ChildrenList { + [usertoken: string]: { + [childtoken: string]: ChildObject; + }; +} + +// the store itself: README: TODO: Consider creating a derived store for maps that exposes some key-value retrieval functionality +const childrenlist: ChildrenList = {}; + +const children = writable(childrenlist); + +// addX and removeX are helper functions and can probably be removed once we have a proper backend +/** + * Add a new user with an empty children store + * @param usertoken the token of the user to add + */ +async function addUser(usertoken: string) { + children.update((childrenlist) => { + if (usertoken in childrenlist) { + throw new Error(`User token ${usertoken} already exists`); + } + + childrenlist[usertoken] = {}; + + return childrenlist; + }); +} + +/** + * Add new child data to the data of a user + * @param usertoken User identifier to add the child to + * @param childtoken Child identifier to add the child to + * @param data data of the child to add + */ +async function addChildData(usertoken: string, childtoken: string, data: ChildData) { + // /API calls/ fetch requests could go here. + + children.update((childrenlist) => { + if (!(usertoken in childrenlist)) { + throw new Error(`User token ${usertoken} not found`); + } + + if (childtoken in childrenlist[usertoken]) { + throw new Error(`Child token ${childtoken} already exists for user token ${usertoken}`); + } + + childrenlist[usertoken][childtoken] = { childData: data, observationData: null }; + + return childrenlist; + }); +} + +/** + * Add observation data to the data of a child + * @param usertoken User identifier to add the child to + * @param childtoken Child identifier to add observation data to + * @param observationData The observationdata to add + */ +async function addChildObservation( + usertoken: string, + childtoken: string, + observationData: ObservationData +) { + children.update((childrenlist) => { + if (!(usertoken in childrenlist)) { + throw new Error(`User token ${usertoken} not found`); + } + + if (!(childtoken in childrenlist[usertoken])) { + throw new Error(`Child token ${childtoken} does not exist for user token ${usertoken}`); + } + + childrenlist[usertoken][childtoken].observationData = observationData; + + return childrenlist; + }); +} + +/** + * Remove a child from the data of a user + * @param usertoken user identifer to remove the child from + * @param childtoken childidentifier to remove + */ +async function removeChildData(usertoken: string, childtoken: string) { + // /API calls/ fetch requests could go here. + + children.update((childrenlist) => { + if (!(usertoken in childrenlist)) { + throw new Error(`User token ${usertoken} not found`); + } + + if (!(childtoken in childrenlist[usertoken])) { + throw new Error(`Child token ${childtoken} not found for user token ${usertoken}`); + } + + delete childrenlist[usertoken][childtoken]; + + return childrenlist; + }); +} + +/** + * Retrieve the data of a child + * @param usertoken user to fetch child data from + * @param childtoken child identifier to fetch data from + * @returns ChildData of the child + */ +async function fetchChildData(usertoken: string, childtoken: string) { + // /API calls/ fetch requests could go here. + const contentData = get(children); + + if (!(usertoken in contentData)) { + throw new Error('No such user in the childrenstore'); + } + + if (!(childtoken in contentData[usertoken as keyof ChildrenList])) { + throw new Error('No such child in the childrenstore for user ' + usertoken); + } + + return contentData[usertoken as keyof ChildrenList][childtoken].childData; +} + +/** + * Retrieve the observation data of a child + * @param usertoken user to fetch child observations from + * @param childtoken child identifier to fetch observations from + * @returns ObservationData of the child + */ +async function fetchObservationData(usertoken: string, childtoken: string) { + // /API calls/ fetch requests could go here. + const contentData = get(children); + + if (!(usertoken in contentData)) { + throw new Error('No such user in the childrenstore'); + } + + if (!(childtoken in contentData[usertoken as keyof ChildrenList])) { + throw new Error('No such child in the childrenstore for user ' + usertoken); + } + + return contentData[usertoken as keyof ChildrenList][childtoken].observationData; +} + +/** + * fetch all the children data of a user + * @param usertoken User to fetch data for + * @returns a list of ChildData objects for the user, sorted alphabetically by child name. + */ +async function fetchChildrenDataforUser(usertoken: string) { + const contentData = get(children); + + if (!(usertoken in contentData)) { + throw new Error('No such user in the childrenstore'); + } + + // sort them alphabetically + return Object.keys(contentData[usertoken]) + .map((child) => { + return contentData[usertoken][child].childData; + }) + .sort((a, b) => a.name.localeCompare(b.name)); +} + +/** + * fetch all observationdata for all children of a user + * @param usertoken user to fetch data for + * @returns A list of tuples, where the first element is the child identifier and the second element is the observation data of the child + */ +async function fetchObservationDataForUser(usertoken: string) { + console.log('fetching observation data for user', usertoken); + const contentData = get(children); + console.log(contentData); + + if (!(usertoken in contentData)) { + throw new Error('No such user in the childrenstore'); + } + + return Object.keys(contentData[usertoken]).map((child) => { + return [child, contentData[usertoken][child].observationData]; + }); +} + +// --> README: +// hardcode dummy child data which later will live in the database on the server and be fetched from there via API calls +// the stuff below is therefore temporary and is an approximation of the datastructure that may be returned perhaps from the backend, +// and thus is subject to change + +/** + * helper function for generating random integers + * @param max the maximum value of the random integer (always starts from 0) + * @returns + */ +function getRandomInt(max: number) { + return Math.floor(Math.random() * max); +} + +/** + * helper function for choosing a random value from a list + * @param values list of values to choose from + * @returns + */ +function chooseRandom(values: string[]) { + return values[getRandomInt(values.length)]; +} + +/** + * create dummy data for the children store. This will later be + */ +async function createDummyData() { + if ('dummyUser' in childrenlist) { + return; + } + // add user + await addUser('dummyUser'); + + // create data + const values = ['good', 'warn', 'bad']; + const dates = [ + '05-11-2017', + '08-05-2016', + '22-07-2012', + '11-11-2020', + '30-03-2019', + '01-06-2022', + '30-12-2021', + '30-11-2021', + '30-10-2021' + ]; + const surveys: string[] = ['surveyA', 'surveyB', 'surveyC', 'surveyD', 'surveyE']; + + interface SummaryElement { + name: string; + [key: string]: unknown; + } + const summary: SummaryElement[] = []; + + for (const s of surveys) { + const element: SummaryElement = { name: s }; + + for (const date of dates) { + element[date] = chooseRandom(values); + } + summary.push(element); + } + + const current: { [survey: string]: { name: string; status: string }[] } = {}; + + const milestones = ['milestoneA', 'milestoneB', 'milestoneC', 'milestoneD', 'milestoneE']; + const completionValues = ['done', 'open', 'incomplete']; + + for (const survey of surveys) { + current[survey] = []; + for (const milestone of milestones) { + current[survey].push({ + name: milestone, + status: chooseRandom(completionValues) + }); + } + } + + await addChildData('dummyUser', 'childAnna', { + name: 'Anna', + id: 'childAnna', + user: 'dummyUser', + image: 'child_avatar.png', + info: 'Anna child that is doing good and developing according to their age.. Click to view more.' + }); + await addChildObservation('dummyUser', 'childAnna', { + id: 'childAnna', + user: 'dummyUser', + summary: summary, + current: current + }); + + await addChildData('dummyUser', 'childBen', { + name: 'Ben', + id: 'childBen', + user: 'dummyUser', + image: 'child_avatar.png', + info: 'Ben child that is doing good and developing according to their age.. Click to view more.' + }); + await addChildObservation('dummyUser', 'childBen', { + id: 'childAnna', + user: 'dummyUser', + summary: summary, + current: current + }); + + await addChildData('dummyUser', 'childC', { + name: 'C', + id: 'childC', + user: 'dummyUser', + image: 'children.png', + info: 'C child that is doing good and developing according to their age. Click to view more.' + }); + await addChildObservation('dummyUser', 'childC', { + id: 'childAnna', + user: 'dummyUser', + summary: summary, + current: current + }); + + await addChildData('dummyUser', 'childDora', { + name: 'Dora', + id: 'childDora', + user: 'dummyUser', + image: 'children.png', + info: 'Dora child that is doing good and developing according to their age.. Click to view more.' + }); + await addChildObservation('dummyUser', 'childDora', { + id: 'childAnna', + user: 'dummyUser', + summary: summary, + current: current + }); + + await addChildData('dummyUser', 'childE', { + name: 'E', + id: 'childE', + user: 'dummyUser', + image: 'children.png', + info: 'E child that is doing good and developing according to their age.. Click to view more.' + }); + await addChildObservation('dummyUser', 'childE', { + id: 'childAnna', + user: 'dummyUser', + summary: summary, + current: current + }); + + await addChildData('dummyUser', 'childF', { + name: 'F', + id: 'childF', + user: 'dummyUser', + image: 'children.png', + info: 'F child that is doing good and developing according to their age.. Click to view more.' + }); + await addChildObservation('dummyUser', 'childF', { + id: 'childAnna', + user: 'dummyUser', + summary: summary, + current: current + }); +} + +// <-- + +export { + addChildData, + addChildObservation, + addUser, + children, + createDummyData, + fetchChildData, + fetchChildrenDataforUser, + fetchObservationData, + fetchObservationDataForUser, + removeChildData, + type ChildData, + type ChildObject, + type ChildrenList, + type ObservationData +}; diff --git a/src/lib/stores/contentStore.ts b/src/lib/stores/contentStore.ts new file mode 100644 index 00000000..b850ed6f --- /dev/null +++ b/src/lib/stores/contentStore.ts @@ -0,0 +1,155 @@ +import { get, writable } from 'svelte/store'; + +// types. Create some interfaces to define the structure of the content and make clear what will be expected from API calls +interface MilestoneDef { + name: string; + items: string[]; + label: string; +} + +interface ContentNode { + milestones: MilestoneDef[]; + description: string; + last: string | null; + next: string | null; +} + +interface ContentList { + [name: string]: ContentNode; +} + +const contentlist: ContentList = {}; + +// README: perhaps put this into a derived store that is a map of keys to content nodes. This way we can have a single +// store that has an object which stores the content. +const content = writable(contentlist); + +/** + * Retrieve content from the store + * @param key identifier for the content to fetch + * @returns content element corresponding to the key + */ +async function fetchContent(key: string) { + // later: fetch stuff from server and write to store. For now, get from dummy data in store + const contentData = get(content); + + if (!(key in contentData)) { + throw new Error('No such key in the contentstore'); + } + + return contentData[key]; +} + +/** + * Create some dummy data to test the store + */ +async function createDummyData() { + const dummySurveys = { + surveyA: { + description: 'This is the first survey called A', + milestones: [ + { + name: 'Standing up', + items: ['not at all', 'to some extend', 'mostly', 'reliably'], + label: + 'How well can the child stand up from sitting or crawling around and how readily is it able to do so' + }, + { + name: 'Gripping a pen the right way', + items: ['not at all', 'to some extend', 'mostly', 'reliably'], + label: 'How well can the child hold a pen or pencil and how coordinated can it use it' + }, + { + name: 'Talking in full sentences', + items: ['not at all', 'to some extend', 'mostly', 'reliably'], + label: + 'How well articulated is the child in its speech and how well can it express itself' + } + ], + last: null, + next: 'surveyB' + }, + surveyB: { + description: 'This is another survey called B', + milestones: [ + { + name: 'Standing up', + label: 'How well can the child hold a pen or pencil and how coordinated can it use it', + items: ['not at all', 'to some extend', 'mostly', 'reliably'] + }, + { + name: 'Gripping a pen the right way', + items: ['not at all', 'to some extend', 'mostly', 'reliably'], + label: 'How well can the child hold a pen or pencil and how coordinated can it use it' + }, + { + name: 'Talking in full sentences', + items: ['not at all', 'to some extend', 'mostly', 'reliably'], + label: + 'How well articulated is the child in its speech and how well can it express itself' + }, + { + name: 'Counting to 10', + items: ['not at all', 'to some extend', 'mostly', 'reliably'], + label: + 'How well can the child count to 10 and how well does it understand numbers within that range' + } + ], + last: 'surveyA', + next: 'surveyC' + }, + surveyC: { + description: 'This is another survey called C', + milestones: [ + { + name: 'Solving a shape-sorting toy', + items: ['not at all', 'to some extend', 'mostly', 'reliably'], + label: 'How well can the child solve a shape-sorting toy' + }, + { + name: 'Counting to 10', + items: ['not at all', 'to some extend', 'mostly', 'reliably'], + label: + 'How well can the child count to 10 and how well does it understand numbers within that range' + } + ], + last: 'surveyB', + next: 'surveyD' + }, + surveyD: { + description: 'This is another survey called D', + milestones: [ + { + name: 'Solving a shape-sorting toy', + items: ['not at all', 'to some extend', 'mostly', 'reliably'], + label: 'How well can the child solve a shape-sorting toy' + }, + { + name: 'Counting to 10', + items: ['not at all', 'to some extend', 'mostly', 'reliably'], + label: + 'How well can the child count to 10 and how well does it understand numbers within that range' + }, + { + name: 'Counting to 20', + items: ['not at all', 'to some extend', 'mostly', 'reliably'], + label: + 'How well can the child count to 20 and how well does it understand numbers within that range' + } + ], + last: 'surveyC', + next: null + } + }; + + content.set(dummySurveys); +} + +export { + content, + createDummyData, + fetchContent, + type ContentList, + type ContentNode, + type MilestoneDef +}; diff --git a/src/routes/childLand/[userID]/[childID]/+page.js b/src/routes/childLand/[userID]/[childID]/+page.js new file mode 100644 index 00000000..67d75a5b --- /dev/null +++ b/src/routes/childLand/[userID]/[childID]/+page.js @@ -0,0 +1,20 @@ +import { fetchChildData, fetchObservationData } from '$lib/stores/childrenStore'; +import { error } from '@sveltejs/kit'; + +/** @type {import('./$types').PageLoad} */ +export async function load({ params }) { + // await createDummyData(); + + const observationData = await fetchObservationData(params.userID, params.childID); + const childData = await fetchChildData(params.userID, params.childID); + + if (observationData && childData) { + return { + observationData: observationData, + childData: childData + }; + } else { + error(404, 'Not Found'); + } +} +export const prerender = false; diff --git a/src/routes/childLand/[userID]/[childID]/+page.svelte b/src/routes/childLand/[userID]/[childID]/+page.svelte new file mode 100644 index 00000000..56d4a108 --- /dev/null +++ b/src/routes/childLand/[userID]/[childID]/+page.svelte @@ -0,0 +1,33 @@ + + + + + diff --git a/src/routes/dataAcquisition/[surveyName]/+page.js b/src/routes/dataAcquisition/[surveyName]/+page.js new file mode 100644 index 00000000..a0523ceb --- /dev/null +++ b/src/routes/dataAcquisition/[surveyName]/+page.js @@ -0,0 +1,16 @@ +import { createDummyData, fetchContent } from '$lib/stores/contentStore'; +import { error } from '@sveltejs/kit'; + +/** @type {import('./$types').PageLoad} */ +export async function load({ params }) { + createDummyData(); + const data = await fetchContent(params.surveyName); + if (!data) { + error(404, `Survey ${params.surveyName} not found`); + } + return { + surveyName: params.surveyName, + data: data + }; +} +export const prerender = false; diff --git a/src/routes/dataAcquisition/[surveyName]/+page.svelte b/src/routes/dataAcquisition/[surveyName]/+page.svelte new file mode 100644 index 00000000..1c8ca0ba --- /dev/null +++ b/src/routes/dataAcquisition/[surveyName]/+page.svelte @@ -0,0 +1,41 @@ + + + + + diff --git a/src/routes/firstdropdown/+page.svelte b/src/routes/firstdropdown/+page.svelte deleted file mode 100644 index 199050d3..00000000 --- a/src/routes/firstdropdown/+page.svelte +++ /dev/null @@ -1,48 +0,0 @@ - - - - - diff --git a/src/routes/nextdropdown/+page.svelte b/src/routes/nextdropdown/+page.svelte deleted file mode 100644 index 75463669..00000000 --- a/src/routes/nextdropdown/+page.svelte +++ /dev/null @@ -1,63 +0,0 @@ - - - - - diff --git a/src/routes/surveyfeedback/+page.svelte b/src/routes/surveyfeedback/+page.svelte index 75b61e9b..56bf71c2 100644 --- a/src/routes/surveyfeedback/+page.svelte +++ b/src/routes/surveyfeedback/+page.svelte @@ -22,8 +22,8 @@ - import AbstractContent from '$lib/components/AbstractContent.svelte'; - import TableDisplay from '$lib/components/DataDisplay/TableDisplay.svelte'; - - // this will be passed from the backend eventually - const data_to_display = [ - { - name: 'SurveyA', - '05-11-2017': 'good', - '08-05-2016': 'bad', - '22-07-2012': 'bad', - '11-11-2020': 'warn', - '30-03-2019': 'warn', - '01-06-2022': 'good', - '30-12-2021': 'bad', - '30-11-2021': 'good', - '30-10-2021': 'good' - }, - { - name: 'SurveyB', - '05-11-2017': 'bad', - '08-05-2016': 'warn', - '22-07-2012': 'bad', - '11-11-2020': 'warn', - '30-03-2019': 'good', - '01-06-2022': 'bad', - '30-12-2021': 'good', - '30-11-2021': 'good', - '30-10-2021': 'good' - }, - { - name: 'SurveyC', - '05-11-2017': 'warn', - '08-05-2016': 'warn', - '22-07-2012': 'bad', - '11-11-2020': 'warn', - '30-03-2019': 'bad', - '01-06-2022': 'good', - '30-12-2021': 'good', - '30-11-2021': 'good', - '30-10-2021': 'bad' - }, - { - name: 'SurveyD', - '05-11-2017': 'good', - '08-05-2016': 'good', - '22-07-2012': 'good', - '11-11-2020': 'warn', - '30-03-2019': 'good', - '01-06-2022': 'good', - '30-12-2021': 'good', - '30-11-2021': 'good', - '30-10-2021': 'good' - }, - { - name: 'SurveyE', - '05-11-2017': 'good', - '08-05-2016': 'warn', - '22-07-2012': 'warn', - '11-11-2020': 'warn', - '30-03-2019': 'good', - '01-06-2022': 'good', - '30-12-2021': 'good', - '30-11-2021': 'warn', - '30-10-2021': 'good' - } - ]; - - const statusIndicator = { - good: 'bg-green-500', - bad: 'bg-red-600', - warn: 'bg-yellow-300' - }; - - const searchableColumns = Object.keys(data_to_display[0]).filter((key) => key !== 'name'); - - const caption = - 'Here you see an overview of all completed and outstanding milestones for the current inventory.'; - - const statusColumns = Object.keys(data_to_display[0]).filter((key) => key !== 'name'); - - - - - diff --git a/svelte.config.js b/svelte.config.js index 76ada37d..fe8cf33d 100644 --- a/svelte.config.js +++ b/svelte.config.js @@ -13,7 +13,7 @@ const config = { // these options are set automatically — see below pages: 'build', assets: 'build', - fallback: undefined, + fallback: 'index.html', precompress: false, strict: true })