Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
34 changes: 34 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
ProjectName := gits
ComposeFile := docker-compose.yml
KeycloakContainer := keycloak
FrontendContainer := frontend

start-docker:
docker compose -f $(ComposeFile) --project-name $(ProjectName) up -d
build-docker:
docker compose -f $(ComposeFile) --project-name $(ProjectName) build
stop-docker:
docker compose -f $(ComposeFile) --project-name $(ProjectName) down
status-docker:
docker compose -f $(ComposeFile) --project-name $(ProjectName) ps
keycloak-start:
docker compose -f $(ComposeFile) --project-name $(ProjectName) up -d $(KeycloakContainer)
keycloak-build:
docker compose -f $(ComposeFile) --project-name $(ProjectName) build $(KeycloakContainer)
keycloak-stop:
docker compose -f $(ComposeFile) --project-name $(ProjectName) stop $(KeycloakContainer)
keycloak-theme-build:
npm install
npm run keycloak-build-theme
frontend-start:
docker compose -f $(ComposeFile) --project-name $(ProjectName) up -d $(FrontendContainer)
frontend-build:
docker compose -f $(ComposeFile) --project-name $(ProjectName) build $(FrontendContainer)
frontend-stop:
docker compose -f $(ComposeFile) --project-name $(ProjectName) stop $(FrontendContainer)
frontend-dev:
npm run dev
frontend-prepare:
npm install
npm run relay
npm run update-schema
8 changes: 4 additions & 4 deletions components/DialogBase.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import {
import { DatePicker } from "@mui/x-date-pickers/DatePicker";
import { Dayjs } from "dayjs";
import { FormikProps, useFormik } from "formik";
import { useEffect, useState } from "react";
import { ObjectSchema } from "yup";
import { Form, FormSection } from "./Form";
import { FormErrors } from "./FormErrors";
Expand All @@ -22,6 +21,7 @@ export type FieldOptions<T extends object> = {
} & (
| {
type: "text";
fullWidth?: boolean;
multiline?: boolean;
}
| {
Expand Down Expand Up @@ -73,9 +73,9 @@ export function DialogBase<T extends { [k in string]: any }>({
});

return (
<Dialog open={open} onClose={onClose} maxWidth="md">
<Dialog open={open} onClose={onClose} maxWidth="md" fullWidth>
<DialogTitle>{title}</DialogTitle>
<DialogContent className="relative">
<DialogContent className="relative full-width">
<FormErrors error={error} onClose={clearError} />
<Form>
{sections.map((section) => (
Expand Down Expand Up @@ -147,7 +147,7 @@ function Field<T extends object>({
helperText={errorText}
required={field.required}
multiline={field.multiline}
fullWidth={field.multiline}
fullWidth={field.fullWidth ? field.fullWidth : field.multiline}
/>
);
case "date":
Expand Down
4 changes: 3 additions & 1 deletion components/EditChapterButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import { useMemo, useState } from "react";
import { useFragment, useMutation } from "react-relay";
import { graphql } from "relay-runtime";

import { EditChapterButtonMutation } from "@/__generated__/EditChapterButtonMutation.graphql";
import { EditChapterButtonDeleteMutation } from "@/__generated__/EditChapterButtonDeleteMutation.graphql";
import { EditChapterButtonFragment$key } from "@/__generated__/EditChapterButtonFragment.graphql";
import { EditChapterButtonMutation } from "@/__generated__/EditChapterButtonMutation.graphql";
import { DialogBase } from "./DialogBase";
import { dialogSections, validationSchema } from "./dialogs/chapterDialog";

Expand Down Expand Up @@ -55,6 +55,7 @@ export default function EditChapterButton({
);

const [error, setError] = useState<any>(null);

const sections = useMemo(
() =>
dialogSections(
Expand All @@ -63,6 +64,7 @@ export default function EditChapterButton({
),
[chapter.course]
);

const schema = useMemo(
() => validationSchema(chapter.course.startDate, chapter.course.endDate),
[chapter.course]
Expand Down
4 changes: 2 additions & 2 deletions components/EditContentModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -313,8 +313,8 @@ export function EditContentModal({
})}
</List>
</DialogContent>

<DialogContent>
<DialogContent style={{ flex: "0 0 auto" }}>
{/* Add flex with 0 base to avoid a scrollbar at the Add content elements */}
{/* add flashcard button */}
<Button
onClick={() => setOpenFlashcardModal(true)}
Expand Down
2 changes: 2 additions & 0 deletions components/EditCourseModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ export function EditCourseModal({
<TextField
{...params}
required
fullWidth
error={startDate == null || !startDate.isValid()}
/>
)}
Expand All @@ -189,6 +190,7 @@ export function EditCourseModal({
<TextField
{...params}
required
fullWidth
error={endDate == null || !endDate.isValid()}
/>
)}
Expand Down
2 changes: 1 addition & 1 deletion components/Form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export function FormActions({

export function Form({ children }: { children: ReactNode }) {
return (
<div className="grid grid-cols-[max-content_auto] gap-3 gap-x-24 w-fit">
<div className="grid grid-cols-[max-content_auto] gap-3 gap-x-24 full-width">
{children}
</div>
);
Expand Down
29 changes: 28 additions & 1 deletion components/dialogs/chapterDialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export const dialogSections: (
label: "Title",
type: "text",
required: true,
fullWidth: true,
},
{
key: "description",
Expand Down Expand Up @@ -83,22 +84,48 @@ export const validationSchema: (
courseEnd: string
) => yup.ObjectSchema<ChapterData> = (courseStart, courseEnd) =>
// @ts-ignore
yup.object({
yup.object().shape<ChapterData>({
title: yup.string().required("Required"),
description: yup.string().optional(),
startDate: yup
.date()
.transform((value, originalValue) => {
// check if data is invalid
if (isNaN(value.getTime())) {
return null;
}
// make sure empty string or null stays as null
return originalValue === "" || originalValue === null ? null : value;
})
.required("Required")
.min(courseStart, "Must be after the course start date")
.max(courseEnd, "Must be before the course end date"),
suggestedStartDate: yup
.date()
.transform((value, originalValue) => {
// check if data is invalid
if (isNaN(value.getTime())) {
return null;
}
// make sure empty string or null stays as null
return originalValue === "" || originalValue === null ? null : value;
})
.required("Required")
.typeError("Please provide a valid date")
.min(yup.ref("startDate"), "Must be after the start date")
.max(courseEnd, "Must be before the end date"),
suggestedEndDate: yup
.date()
.transform((value, originalValue) => {
// check if data is invalid
if (isNaN(value.getTime())) {
return null;
}
// make sure empty string or null stays as null
return originalValue === "" || originalValue === null ? null : value;
})
.required("Required")
.typeError("Please provide a valid date")
.min(
yup.ref("suggestedStartDate"),
"Must be after the suggested start date"
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ services:
- dapr-network

keycloak:
image: quay.io/keycloak/keycloak:21.1.1
image: quay.io/keycloak/keycloak:26.2.5
ports:
- "9009:8080"
environment:
Expand Down
Loading
Loading