Skip to content

Commit

Permalink
refactoring and cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
danieldietzler committed Jun 30, 2024
1 parent 282c4d8 commit 05a8759
Show file tree
Hide file tree
Showing 32 changed files with 103 additions and 64 deletions.
4 changes: 3 additions & 1 deletion web/.eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,6 @@ node_modules
pnpm-lock.yaml
package-lock.json
yarn.lock
src/lib/sdk

src/lib/sdk
src/lib/elements/ui
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script lang="ts">
import Ellipsis from 'lucide-svelte/icons/ellipsis';
import * as DropdownMenu from '$lib/elements/ui/dropdown-menu';
import { Button } from '$lib/elements/ui/button';
import * as Button from '$lib/elements/ui/button';
export let id: string;
</script>
Expand Down
6 changes: 3 additions & 3 deletions web/src/lib/elements/ui/dataTable/data-table.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@
import { Button } from '$lib/elements/ui/button';
import ArrowUpDown from 'lucide-svelte/icons/arrow-up-down';
import ChevronDown from 'lucide-svelte/icons/chevron-down';
import { Input } from '$lib/elements/ui/input';
import * as Input from '$lib/elements/ui/input';
import * as DropdownMenu from '$lib/elements/ui/dropdown-menu';
import DataTableCheckbox from './data-table-checkbox.svelte';
interface DataItem {
id: string;
[key: string]: string;
[key: string]: string | string[] | number;
}
export let data: DataItem[];
Expand Down Expand Up @@ -89,7 +89,7 @@
header: '',
id: 'actions',
cell: ({ value }) => {
return createRender(DataTableActions, { id: value });
return createRender(DataTableActions, { id: value.toString() });
},
plugins: {
sort: {
Expand Down
6 changes: 3 additions & 3 deletions web/src/lib/elements/ui/timetable/timetable.svelte
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script lang="ts">
export let begin: string = '7:45';
export let end: string = '8:30';
export let index: string = '1.';
// export let begin: string = '7:45';
// export let end: string = '8:30';
// export let index: string = '1.';
</script>
6 changes: 5 additions & 1 deletion web/src/lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ type FlyAndScaleParams = {

export const flyAndScale = (
node: Element,
// eslint-disable-next-line unicorn/no-object-as-default-parameter
params: FlyAndScaleParams = { y: -8, x: 0, start: 0.95, duration: 150 },
): TransitionConfig => {
const style = getComputedStyle(node);
Expand All @@ -32,8 +33,11 @@ export const flyAndScale = (
};

const styleToString = (style: Record<string, number | string | undefined>): string => {
// eslint-disable-next-line unicorn/no-array-reduce
return Object.keys(style).reduce((str, key) => {
if (style[key] === undefined) return str;
if (style[key] === undefined) {
return str;
}
return str + `${key}:${style[key]};`;
}, '');
};
Expand Down
4 changes: 2 additions & 2 deletions web/src/routes/+layout.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { LayoutLoad, PageLoad } from './$types';
import type { LayoutLoad } from './$types';

export const load = (async () => {
export const load = (() => {
return {
meta: {
title: 'UFTOS',
Expand Down
2 changes: 1 addition & 1 deletion web/src/routes/+page.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { PageLoad } from './$types';

export const load = (async () => {
export const load = (() => {
return {
meta: {
title: 'UFTOS',
Expand Down
14 changes: 5 additions & 9 deletions web/src/routes/admin/(resources)/+layout.svelte
Original file line number Diff line number Diff line change
@@ -1,26 +1,22 @@
<script lang="ts">
import ChevronLeft from 'lucide-svelte/icons/chevron-left';
import { Button } from '$lib/elements/ui/button/index.js';
import pageName from './pageName';
let heading: String;
pageName.subscribe((text) => {
heading = text;
});
import { page } from '$app/stores';
import { goto } from '$app/navigation';
</script>

<div class="flex flex-row justify-start bg-foreground md:p-4 text-white">
<Button
on:click={() => {
window.history.back(); //not the best solution to go back to previous page (href="../" doesnt seem to work)
on:click={async () => {
await goto('/admin');
}}
variant="secondary"
size="icon"
class="rounded-full bg-accent mr-6"
>
<ChevronLeft class="h-5 w-5 text-white" />
</Button>
<h1 class="font-bold text-xl mt-1">{heading}</h1>
<h1 class="font-bold text-xl mt-1">{$page.data['meta']['title']}</h1>
</div>

<slot />
6 changes: 4 additions & 2 deletions web/src/routes/admin/(resources)/curriculums/+page.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
export const load = async () => {
import type { PageLoad } from './$types';

export const load = (() => {
return {
meta: {
title: 'Curriculums',
},
};
};
}) satisfies PageLoad;
2 changes: 1 addition & 1 deletion web/src/routes/admin/(resources)/curriculums/[id]/+page.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { PageLoad } from '../$types';

export const load = (async ({ params }) => {
export const load = (({ params }) => {
return {
id: params.id,
meta: {
Expand Down
3 changes: 0 additions & 3 deletions web/src/routes/admin/(resources)/pageName.ts

This file was deleted.

3 changes: 0 additions & 3 deletions web/src/routes/admin/(resources)/rooms/+page.svelte
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<script lang="ts">
import pageName from '../pageName';
import DataTable from '$lib/elements/ui/dataTable/data-table.svelte';
let columnNames = ['Name', 'Gebäude', 'Kapazität', 'test'];
Expand All @@ -18,8 +17,6 @@
email: ['test1', 'test2'],
},
];
pageName.set('Raummanagment');
</script>

<!--not yet formatted-->
Expand Down
8 changes: 5 additions & 3 deletions web/src/routes/admin/(resources)/rooms/+page.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
export const load = async () => {
import type { PageLoad } from './$types';

export const load = (() => {
return {
meta: {
title: 'Rooms',
title: 'Raummangement',
},
};
};
}) satisfies PageLoad;
2 changes: 1 addition & 1 deletion web/src/routes/admin/(resources)/rooms/[id]/+page.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { PageLoad } from '../$types';

export const load = (async ({ params }) => {
export const load = (({ params }) => {
return {
id: params.id,
meta: {
Expand Down
6 changes: 4 additions & 2 deletions web/src/routes/admin/(resources)/studentGroups/+page.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
export const load = async () => {
import type { PageLoad } from './$types';

export const load = (() => {
return {
meta: {
title: 'Student Groups',
},
};
};
}) satisfies PageLoad;
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { PageLoad } from '../$types';

export const load = (async ({ params }) => {
export const load = (({ params }) => {
return {
id: params.id,
meta: {
Expand Down
6 changes: 4 additions & 2 deletions web/src/routes/admin/(resources)/students/+page.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
export const load = async () => {
import type { PageLoad } from './$types';

export const load = (() => {
return {
meta: {
title: 'Students',
},
};
};
}) satisfies PageLoad;
2 changes: 1 addition & 1 deletion web/src/routes/admin/(resources)/students/[id]/+page.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { PageLoad } from '../$types';

export const load = (async ({ params }) => {
export const load = (({ params }) => {
return {
id: params.id,
meta: {
Expand Down
2 changes: 1 addition & 1 deletion web/src/routes/admin/(resources)/subjects/[id]/+page.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { PageLoad } from '../$types';

export const load = (async ({ params }) => {
export const load = (({ params }) => {
return {
id: params.id,
meta: {
Expand Down
6 changes: 4 additions & 2 deletions web/src/routes/admin/(resources)/tags/+page.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
export const load = async () => {
import type { PageLoad } from './$types';

export const load = (() => {
return {
meta: {
title: 'Tags',
},
};
};
}) satisfies PageLoad;
2 changes: 1 addition & 1 deletion web/src/routes/admin/(resources)/tags/[id]/+page.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { PageLoad } from '../$types';

export const load = (async ({ params }) => {
export const load = (({ params }) => {
return {
id: params.id,
meta: {
Expand Down
6 changes: 4 additions & 2 deletions web/src/routes/admin/(resources)/teachers/+page.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
export const load = async () => {
import type { PageLoad } from './$types';

export const load = (() => {
return {
meta: {
title: 'Teachers',
},
};
};
}) satisfies PageLoad;
2 changes: 1 addition & 1 deletion web/src/routes/admin/(resources)/teachers/[id]/+page.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { PageLoad } from '../$types';

export const load = (async ({ params }) => {
export const load = (({ params }) => {
return {
id: params.id,
meta: {
Expand Down
6 changes: 4 additions & 2 deletions web/src/routes/admin/constraints/+page.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
export const load = async () => {
import type { PageLoad } from './$types';

export const load = (() => {
return {
meta: {
title: 'Constraints',
},
};
};
}) satisfies PageLoad;
2 changes: 1 addition & 1 deletion web/src/routes/admin/constraints/[id]/+page.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { PageLoad } from '../$types';

export const load = (async ({ params }) => {
export const load = (({ params }) => {
return {
id: params.id,
meta: {
Expand Down
6 changes: 4 additions & 2 deletions web/src/routes/admin/editor/+page.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
export const load = async () => {
import type { PageLoad } from '../../$types';

export const load = (() => {
return {
meta: {
title: 'UCDL Editor',
},
};
};
}) satisfies PageLoad;
6 changes: 4 additions & 2 deletions web/src/routes/admin/settings/+page.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
export const load = async () => {
import type { PageLoad } from '../../$types';

export const load = (() => {
return {
meta: {
title: 'Einstellungen',
},
};
};
}) satisfies PageLoad;
6 changes: 4 additions & 2 deletions web/src/routes/timetable/class/+page.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
export const load = async () => {
import type { PageLoad } from '../../$types';

export const load = (() => {
return {
meta: {
title: 'Class timetable',
},
};
};
}) satisfies PageLoad;
6 changes: 4 additions & 2 deletions web/src/routes/timetable/student/+page.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
export const load = async () => {
import type { PageLoad } from '../../$types';

export const load = (() => {
return {
meta: {
title: 'Student timetable',
},
};
};
}) satisfies PageLoad;
2 changes: 1 addition & 1 deletion web/src/routes/timetable/teacher/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import * as Select from '$lib/elements/ui/select';
import Lesson from '$lib/components/ui/lesson/lesson.svelte';
import Timeslot from '$lib/elements/ui/timeslot/timeslot.svelte';
import * as Tabs from '$lib/elements/ui/tabs';
import * as Tabs from '$lib/elements/ui/tabs/index';
const classes = [
{ value: '5A', label: '5A' },
Expand Down
6 changes: 4 additions & 2 deletions web/src/routes/timetable/teacher/+page.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
export const load = async () => {
import type { PageLoad } from '../../$types';

export const load = (() => {
return {
meta: {
title: 'Teacher timetable',
},
};
};
}) satisfies PageLoad;
Loading

0 comments on commit 05a8759

Please sign in to comment.