Skip to content
This repository was archived by the owner on Feb 21, 2025. It is now read-only.

Commit 08c6a35

Browse files
authored
Merge pull request #127 from PRIME-TU-Delft/development
Development
2 parents 7d239e6 + 2aa470a commit 08c6a35

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+1473
-1472
lines changed
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
/*
2+
Warnings:
3+
4+
- You are about to drop the column `unchanged` on the `Course` table. All the data in the column will be lost.
5+
- You are about to drop the column `unchanged` on the `Domain` table. All the data in the column will be lost.
6+
- You are about to drop the column `domainName` on the `Graph` table. All the data in the column will be lost.
7+
- You are about to drop the column `lectureName` on the `Graph` table. All the data in the column will be lost.
8+
- You are about to drop the column `subjectName` on the `Graph` table. All the data in the column will be lost.
9+
- You are about to drop the column `unchanged` on the `Graph` table. All the data in the column will be lost.
10+
- You are about to drop the column `unchanged` on the `Lecture` table. All the data in the column will be lost.
11+
- You are about to drop the column `unchanged` on the `Link` table. All the data in the column will be lost.
12+
- You are about to drop the column `unchanged` on the `Program` table. All the data in the column will be lost.
13+
- You are about to drop the column `unchanged` on the `Subject` table. All the data in the column will be lost.
14+
- The primary key for the `_AdminRelation` table will be changed. If it partially fails, the table could be left without primary key constraint.
15+
- The primary key for the `_CourseToProgram` table will be changed. If it partially fails, the table could be left without primary key constraint.
16+
- The primary key for the `_DomainRelation` table will be changed. If it partially fails, the table could be left without primary key constraint.
17+
- The primary key for the `_EditorRelation` table will be changed. If it partially fails, the table could be left without primary key constraint.
18+
- The primary key for the `_LectureToSubject` table will be changed. If it partially fails, the table could be left without primary key constraint.
19+
- The primary key for the `_SubjectRelation` table will be changed. If it partially fails, the table could be left without primary key constraint.
20+
- A unique constraint covering the columns `[A,B]` on the table `_AdminRelation` will be added. If there are existing duplicate values, this will fail.
21+
- A unique constraint covering the columns `[A,B]` on the table `_CourseToProgram` will be added. If there are existing duplicate values, this will fail.
22+
- A unique constraint covering the columns `[A,B]` on the table `_DomainRelation` will be added. If there are existing duplicate values, this will fail.
23+
- A unique constraint covering the columns `[A,B]` on the table `_EditorRelation` will be added. If there are existing duplicate values, this will fail.
24+
- A unique constraint covering the columns `[A,B]` on the table `_LectureToSubject` will be added. If there are existing duplicate values, this will fail.
25+
- A unique constraint covering the columns `[A,B]` on the table `_SubjectRelation` will be added. If there are existing duplicate values, this will fail.
26+
27+
*/
28+
-- AlterTable
29+
ALTER TABLE "Course" DROP COLUMN "unchanged";
30+
31+
-- AlterTable
32+
ALTER TABLE "Domain" DROP COLUMN "unchanged";
33+
34+
-- AlterTable
35+
ALTER TABLE "Graph" DROP COLUMN "domainName",
36+
DROP COLUMN "lectureName",
37+
DROP COLUMN "subjectName",
38+
DROP COLUMN "unchanged";
39+
40+
-- AlterTable
41+
ALTER TABLE "Lecture" DROP COLUMN "unchanged",
42+
ALTER COLUMN "order" DROP DEFAULT;
43+
44+
-- AlterTable
45+
ALTER TABLE "Link" DROP COLUMN "unchanged";
46+
47+
-- AlterTable
48+
ALTER TABLE "Program" DROP COLUMN "unchanged";
49+
50+
-- AlterTable
51+
ALTER TABLE "Subject" DROP COLUMN "unchanged";
52+
53+
-- AlterTable
54+
ALTER TABLE "_AdminRelation" DROP CONSTRAINT "_AdminRelation_AB_pkey";
55+
56+
-- AlterTable
57+
ALTER TABLE "_CourseToProgram" DROP CONSTRAINT "_CourseToProgram_AB_pkey";
58+
59+
-- AlterTable
60+
ALTER TABLE "_DomainRelation" DROP CONSTRAINT "_DomainRelation_AB_pkey";
61+
62+
-- AlterTable
63+
ALTER TABLE "_EditorRelation" DROP CONSTRAINT "_EditorRelation_AB_pkey";
64+
65+
-- AlterTable
66+
ALTER TABLE "_LectureToSubject" DROP CONSTRAINT "_LectureToSubject_AB_pkey";
67+
68+
-- AlterTable
69+
ALTER TABLE "_SubjectRelation" DROP CONSTRAINT "_SubjectRelation_AB_pkey";
70+
71+
-- CreateIndex
72+
CREATE UNIQUE INDEX "_AdminRelation_AB_unique" ON "_AdminRelation"("A", "B");
73+
74+
-- CreateIndex
75+
CREATE UNIQUE INDEX "_CourseToProgram_AB_unique" ON "_CourseToProgram"("A", "B");
76+
77+
-- CreateIndex
78+
CREATE UNIQUE INDEX "_DomainRelation_AB_unique" ON "_DomainRelation"("A", "B");
79+
80+
-- CreateIndex
81+
CREATE UNIQUE INDEX "_EditorRelation_AB_unique" ON "_EditorRelation"("A", "B");
82+
83+
-- CreateIndex
84+
CREATE UNIQUE INDEX "_LectureToSubject_AB_unique" ON "_LectureToSubject"("A", "B");
85+
86+
-- CreateIndex
87+
CREATE UNIQUE INDEX "_SubjectRelation_AB_unique" ON "_SubjectRelation"("A", "B");

prisma/schema.prisma

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ model VerificationToken {
8585

8686
model Program {
8787
id Int @id @default(autoincrement())
88-
unchanged Boolean @default(true)
8988
name String
9089
9190
courses Course[]
@@ -103,7 +102,6 @@ enum CourseType {
103102

104103
model Course {
105104
id Int @id @default(autoincrement())
106-
unchanged Boolean @default(true)
107105
type CourseType @default(COURSE)
108106
code String @unique
109107
name String
@@ -120,7 +118,6 @@ model Course {
120118

121119
model Graph {
122120
id Int @id @default(autoincrement())
123-
unchanged Boolean @default(true)
124121
name String
125122
courseId Int
126123
@@ -149,7 +146,6 @@ enum DomainStyle {
149146

150147
model Domain {
151148
id Int @id @default(autoincrement())
152-
unchanged Boolean @default(true)
153149
name String @default("")
154150
style DomainStyle?
155151
order Int
@@ -165,7 +161,6 @@ model Domain {
165161

166162
model Subject {
167163
id Int @id @default(autoincrement())
168-
unchanged Boolean @default(true)
169164
name String @default("")
170165
x Int @default(0)
171166
y Int @default(0)
@@ -181,9 +176,8 @@ model Subject {
181176

182177
model Lecture {
183178
id Int @id @default(autoincrement())
184-
unchanged Boolean @default(true)
185179
name String @default("")
186-
order Int @default(-1)
180+
order Int
187181
graphId Int
188182
189183
graph Graph @relation(fields: [graphId], references: [id], onDelete: Cascade)
@@ -192,7 +186,6 @@ model Lecture {
192186

193187
model Link {
194188
id Int @id @default(autoincrement())
195-
unchanged Boolean @default(true)
196189
name String @default("")
197190
courseId Int
198191
graphId Int?

src/lib/components/Feedback.svelte

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
// Functions
1414
function onMouseEnter() {
1515
timeout = setTimeout(() => {
16-
show_dropdown = data.errors.length + data.warnings.length > 1 || compact
16+
show_dropdown = !disable_dropdown
1717
}, settings.UNIVERSAL_HOVER_DELAY)
1818
}
1919
@@ -23,8 +23,12 @@
2323
}
2424
2525
function setDropdown(value?: boolean) {
26-
if (value !== undefined) lock_dropdown = value
27-
else lock_dropdown = !lock_dropdown && (data.errors.length + data.warnings.length > 1 || compact)
26+
if (value !== undefined) {
27+
lock_dropdown = value
28+
} else {
29+
lock_dropdown = !lock_dropdown
30+
}
31+
2832
show_dropdown = lock_dropdown
2933
clearTimeout(timeout)
3034
}
@@ -50,10 +54,10 @@
5054
: data.warnings.length > 1 ? `${data.warnings[0].short} (${data.warnings.length - 1} more)`
5155
: data.warnings[0].short
5256
53-
$: disable_toggle = !compact && data.errors.length + data.warnings.length < 2
54-
|| compact && data.errors.length + data.warnings.length < 1
57+
$: disable_dropdown = !compact && data.errors.length + data.warnings.length < 2
58+
|| compact && data.errors.length + data.warnings.length < 1
5559
56-
$: if (disable_toggle) setDropdown(false)
60+
$: if (disable_dropdown) setDropdown(false)
5761
5862
</script>
5963

@@ -65,7 +69,7 @@
6569
on:mouseenter={ onMouseEnter }
6670
on:mouseleave={ onMouseLeave }
6771
on:click={ () => setDropdown() }
68-
disabled={ disable_toggle }
72+
disabled={ disable_dropdown }
6973
>
7074
{#if show_error_icon}
7175
<img

src/lib/components/FormModal.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777
on:click={ async () => await submit() }
7878
disabled={ submitting || controller.validate().severity === Severity.error }
7979
> <slot name="submit" /> </Button>
80-
<Feedback animate data={ controller.validate() } />
80+
<Feedback data={ controller.validate() } />
8181
</div>
8282
</form>
8383
</dialog>

src/lib/components/Graph.svelte

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,10 @@
142142
top: 0.75rem + $card-thin-padding - math.div($dropdown-icon-size, 4)
143143
border-width: 0 1px 1px 0
144144
145+
&:focus-visible
146+
outline: $default-outline
147+
border-color: $white
148+
145149
.title
146150
padding-right: $card-thin-padding + 1rem
147151
@@ -172,6 +176,7 @@
172176
width: 1.75rem
173177
height: 1.75rem
174178
padding: $input-icon-padding
179+
border-radius: $default-border-radius
175180
176181
cursor: pointer
177182
@@ -182,6 +187,9 @@
182187
transform-origin: center
183188
pointer-events: none
184189
190+
&:focus-visible
191+
outline: $default-outline
192+
185193
&:hover img
186194
scale: $scale-on-hover
187195
</style>

src/lib/components/LinkButton.svelte

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
export let href: string | undefined = undefined
66
export let submit: boolean = false
77
export let disabled: boolean = false
8+
export let thin: boolean = false
89
910
</script>
1011

@@ -15,6 +16,7 @@
1516
<button
1617
class="link-button"
1718
class:disabled
19+
class:thin
1820
disabled={ disabled }
1921
type={ submit ? 'submit' : 'button' }
2022
on:click
@@ -28,6 +30,7 @@
2830
href={ disabled ? '' : href }
2931
class="link-button"
3032
class:disabled
33+
class:thin
3134
>
3235
<slot />
3336
</a>
@@ -60,6 +63,9 @@
6063
pointer-events: none
6164
6265
// Styling options
66+
&.thin
67+
padding: $input-thin-padding
68+
6369
&.disabled
6470
color: $gray
6571
pointer-events: none

src/lib/components/SaveStatus.svelte

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,34 +3,48 @@
33
44
import success_icon from '$assets/success-icon.svg'
55
import warning_icon from '$assets/warning-icon.svg'
6+
import error_icon from '$assets/error-icon.svg'
67
7-
export function setSaving(value: boolean) {
8-
saving = value
8+
export function setSaving() {
9+
if (timer) clearTimeout(timer)
10+
timer = setTimeout(() => timer = undefined, MIN_SAVE_TIME)
11+
saving = true
12+
}
913
10-
if (value) {
11-
unsaved = false
12-
if (timer) clearTimeout(timer)
13-
timer = setTimeout(() => timer = undefined, MIN_SAVE_TIME)
14-
}
14+
export function setIdle() {
15+
error = undefined
16+
unsaved = false
17+
saving = false
1518
}
1619
1720
export function setUnsaved() {
21+
error = undefined
1822
unsaved = true
1923
}
2024
25+
export function setError(message: string) {
26+
error = message
27+
}
28+
2129
const MIN_SAVE_TIME = 1000
2230
2331
let timer: NodeJS.Timeout | undefined
32+
let error: string | undefined
2433
let unsaved = false
2534
let saving = false
2635
2736
</script>
2837

2938
<!-- Markdown -->
3039

31-
<div class="saving">
40+
<div class="save-status">
41+
42+
{#if error}
43+
44+
<img src={ error_icon } alt="">
45+
{ error }
3246

33-
{#if saving || timer !== undefined}
47+
{:else if saving || timer !== undefined}
3448

3549
<span class="spinner" />
3650
Saving...
@@ -59,13 +73,14 @@
5973
$spinner-size: 1rem
6074
$spinner-width: 1.5px
6175
62-
.saving
76+
.save-status
6377
display: flex
6478
flex-flow: row nowrap
6579
align-items: center
6680
gap: $form-small-gap
6781
6882
width: max-content
83+
margin-bottom: $form-small-gap - 2rem
6984
color: $gray
7085
7186
img

src/lib/components/SortableList.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
5959
// Main
6060
type T = $$Generic
61-
export let list: T[] & { uuid: string, validate: (strict: boolean) => Validation }[]
61+
export let list: T[] & { id: number, validate: (strict: boolean) => Validation }[]
6262
let origin: number | null = null // Index of the element being dragged
6363
6464
const dispatch = createEventDispatcher<{rearrange: T[]}>()
@@ -69,7 +69,7 @@
6969

7070
<!-- svelte-ignore a11y-no-static-element-interactions -->
7171
<div class="list" on:dragover|preventDefault>
72-
{#each list as item, index (item.uuid)}
72+
{#each list as item, index (item.id)}
7373

7474
<div
7575
class="row"

0 commit comments

Comments
 (0)