@tumaet/prompt-shared-state 0.0.11 → 0.0.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7,7 +7,10 @@ export interface Course {
7
7
  courseType: string;
8
8
  ects: number;
9
9
  semesterTag: string;
10
- metaData: {
10
+ restrictedData: {
11
+ [key: string]: any;
12
+ };
13
+ studentReadableData: {
11
14
  [key: string]: any;
12
15
  };
13
16
  coursePhases: Array<CoursePhaseWithType>;
@@ -1,5 +1,8 @@
1
1
  export interface UpdateCourseData {
2
- metaData?: {
2
+ restrictedData?: {
3
+ [key: string]: any;
4
+ };
5
+ studentReadableData?: {
3
6
  [key: string]: any;
4
7
  };
5
8
  }
@@ -2,7 +2,10 @@ export interface CoursePhaseWithMetaData {
2
2
  id: string;
3
3
  courseID: string;
4
4
  name: string;
5
- metaData: {
5
+ restrictedData: {
6
+ [key: string]: any;
7
+ };
8
+ studentReadableData: {
6
9
  [key: string]: any;
7
10
  };
8
11
  isInitialPhase: boolean;
@@ -1,7 +1,10 @@
1
1
  export interface UpdateCoursePhase {
2
2
  id: string;
3
3
  name?: string;
4
- metaData?: {
4
+ restrictedData?: {
5
+ [key: string]: any;
6
+ };
7
+ studentReadableData?: {
5
8
  [key: string]: any;
6
9
  };
7
10
  }
@@ -4,10 +4,13 @@ export interface CoursePhaseParticipationWithStudent {
4
4
  id: string;
5
5
  passStatus: PassStatus;
6
6
  courseParticipationID: string;
7
- metaData: {
7
+ restrictedData: {
8
8
  [key: string]: any;
9
9
  };
10
- prevMetaData: {
10
+ studentReadableData: {
11
+ [key: string]: any;
12
+ };
13
+ prevData: {
11
14
  [key: string]: any;
12
15
  };
13
16
  student: Student;
@@ -4,7 +4,10 @@ export interface UpdateCoursePhaseParticipation {
4
4
  coursePhaseID: string;
5
5
  courseParticipationID: string;
6
6
  passStatus?: PassStatus;
7
- metaData: {
7
+ restrictedData: {
8
+ [key: string]: any;
9
+ };
10
+ studentReadableData: {
8
11
  [key: string]: any;
9
12
  };
10
13
  }
@@ -2,10 +2,13 @@ import { Course } from '../interfaces/course/course';
2
2
  interface CourseStoreState {
3
3
  selectedCourse?: Course;
4
4
  courses: Course[];
5
+ ownCourseIDs: string[];
5
6
  }
6
7
  interface CourseStoreAction {
7
8
  setSelectedCourse: (selectedCourse?: Course) => void;
8
9
  setCourses: (courses: Course[]) => void;
10
+ setOwnCourseIDs: (ownCourseIDs: string[]) => void;
11
+ isStudentOfCourse: (courseID: string) => boolean;
9
12
  }
10
13
  export declare const useCourseStore: import("zustand").UseBoundStore<import("zustand").StoreApi<CourseStoreState & CourseStoreAction>>;
11
14
  export {};
@@ -1,6 +1,7 @@
1
1
  import { create } from 'zustand';
2
2
  export const useCourseStore = create((set) => ({
3
3
  courses: [],
4
+ ownCourseIDs: [],
4
5
  setSelectedCourse: (selectedCourse) => {
5
6
  if (selectedCourse) {
6
7
  localStorage.setItem('selected-course', selectedCourse.id);
@@ -11,5 +12,9 @@ export const useCourseStore = create((set) => ({
11
12
  set({ selectedCourse });
12
13
  },
13
14
  setCourses: (courses) => set({ courses }),
15
+ setOwnCourseIDs: (ownCourseIDs) => set({ ownCourseIDs }),
16
+ isStudentOfCourse: (courseID) => {
17
+ return useCourseStore.getState().ownCourseIDs.includes(courseID);
18
+ },
14
19
  }));
15
20
  //# sourceMappingURL=useCourseStore.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useCourseStore.js","sourceRoot":"","sources":["../../src/zustand/useCourseStore.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAahC,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAuC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;IACnF,OAAO,EAAE,EAAE;IACX,iBAAiB,EAAE,CAAC,cAAuB,EAAE,EAAE;QAC7C,IAAI,cAAc,EAAE,CAAC;YACnB,YAAY,CAAC,OAAO,CAAC,iBAAiB,EAAE,cAAc,CAAC,EAAE,CAAC,CAAA;QAC5D,CAAC;aAAM,CAAC;YACN,YAAY,CAAC,UAAU,CAAC,iBAAiB,CAAC,CAAA;QAC5C,CAAC;QAED,GAAG,CAAC,EAAE,cAAc,EAAE,CAAC,CAAA;IACzB,CAAC;IACD,UAAU,EAAE,CAAC,OAAiB,EAAE,EAAE,CAAC,GAAG,CAAC,EAAE,OAAO,EAAE,CAAC;CACpD,CAAC,CAAC,CAAA"}
1
+ {"version":3,"file":"useCourseStore.js","sourceRoot":"","sources":["../../src/zustand/useCourseStore.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAgBhC,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAuC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;IACnF,OAAO,EAAE,EAAE;IACX,YAAY,EAAE,EAAE;IAChB,iBAAiB,EAAE,CAAC,cAAuB,EAAE,EAAE;QAC7C,IAAI,cAAc,EAAE,CAAC;YACnB,YAAY,CAAC,OAAO,CAAC,iBAAiB,EAAE,cAAc,CAAC,EAAE,CAAC,CAAA;QAC5D,CAAC;aAAM,CAAC;YACN,YAAY,CAAC,UAAU,CAAC,iBAAiB,CAAC,CAAA;QAC5C,CAAC;QAED,GAAG,CAAC,EAAE,cAAc,EAAE,CAAC,CAAA;IACzB,CAAC;IACD,UAAU,EAAE,CAAC,OAAiB,EAAE,EAAE,CAAC,GAAG,CAAC,EAAE,OAAO,EAAE,CAAC;IACnD,eAAe,EAAE,CAAC,YAAsB,EAAE,EAAE,CAAC,GAAG,CAAC,EAAE,YAAY,EAAE,CAAC;IAClE,iBAAiB,EAAE,CAAC,QAAgB,EAAW,EAAE;QAC/C,OAAO,cAAc,CAAC,QAAQ,EAAE,CAAC,YAAY,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAA;IAClE,CAAC;CACF,CAAC,CAAC,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tumaet/prompt-shared-state",
3
- "version": "0.0.11",
3
+ "version": "0.0.13",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/ls1intum/prompt-lib.git"