128 lines
3.2 KiB
TypeScript
128 lines
3.2 KiB
TypeScript
export const SELECTED_CLASS_ID = 987;
|
|
export const SELECTED_CLASS_ID_ENCODED = window.btoa(`SchoolClassNode:${SELECTED_CLASS_ID}`);
|
|
const selectedClass = {
|
|
id: SELECTED_CLASS_ID_ENCODED,
|
|
name: 'Moordale',
|
|
readOnly: false,
|
|
code: 'XXXX',
|
|
members: [],
|
|
};
|
|
|
|
let idIndex = 0;
|
|
|
|
function* idGenerator(entity: string) {
|
|
while (true) {
|
|
// console.log(`generating id for ${entity}, ${idIndex}`);
|
|
idIndex += 1;
|
|
yield window.btoa(`${entity}:${idIndex}`);
|
|
}
|
|
}
|
|
|
|
const classMemberIdIterator = idGenerator('ClassMemberNode');
|
|
const chapterIdIterator = idGenerator('ChapterNode');
|
|
const moduleIdIterator = idGenerator('ModuleNode');
|
|
const contentBlockIdIterator = idGenerator('ContentBlockNode');
|
|
const instrumentIdGenerator = idGenerator('InstrumentNode');
|
|
|
|
const getClassMemberId = () => classMemberIdIterator.next().value;
|
|
const getChapterId = () => chapterIdIterator.next().value;
|
|
const getModuleId = () => moduleIdIterator.next().value;
|
|
const getContentBlockId = () => contentBlockIdIterator.next().value;
|
|
const getInstrumentId = () => instrumentIdGenerator.next().value;
|
|
|
|
export default {
|
|
UUID: () => '123-456-789',
|
|
GenericStreamFieldType: () => ({ type: 'text_block', value: 'Generic Stream Field Type' }),
|
|
DateTime: () => '2021-01-01Z10:01:23',
|
|
SnapshotNode: () => ({
|
|
chapters: [],
|
|
title: 'MockSnapshotTitle',
|
|
metaTitle: 'MockSnapshotMetaTitle',
|
|
}),
|
|
ChapterNode: () => ({
|
|
slug: 'chapter-slug',
|
|
id: getChapterId(),
|
|
title: 'chapter-title',
|
|
description: 'chapter-description',
|
|
bookmark: null,
|
|
descriptionHiddenFor: [],
|
|
titleHiddenFor: [],
|
|
highlights: [],
|
|
}),
|
|
ContentBlockNode: () => ({
|
|
contents: [],
|
|
title: 'content-block-title',
|
|
slug: 'content-block-slug',
|
|
userCreated: false,
|
|
type: '',
|
|
instrumentCategory: null,
|
|
id: getContentBlockId(),
|
|
}),
|
|
AssignmentNode: () => ({
|
|
id: 'assignment-id',
|
|
title: 'Assignment Title',
|
|
assignment: 'Assignment Text',
|
|
solution: 'Assignment Solution',
|
|
}),
|
|
PrivateUserNode: () => ({
|
|
readOnly: false,
|
|
onboardingVisited: true,
|
|
selectedClass,
|
|
schoolClasses: [selectedClass],
|
|
recentModules: {
|
|
edges: [],
|
|
},
|
|
}),
|
|
SchoolClassNode: () => ({
|
|
readOnly: false,
|
|
}),
|
|
ClassMemberNode: () => ({
|
|
firstName: 'First Name',
|
|
lastName: 'Last Name',
|
|
active: true,
|
|
isTeacher: false,
|
|
isMe: false,
|
|
id: getClassMemberId(),
|
|
}),
|
|
ModuleNode: () => ({
|
|
title: 'Module Title',
|
|
slug: 'some-slug',
|
|
metaTitle: 'Meta Title',
|
|
heroImage: '',
|
|
heroSource: '',
|
|
teaser: '',
|
|
intro: '',
|
|
assignments: [],
|
|
highlights: [],
|
|
objectiveGroups: [],
|
|
id: getModuleId(),
|
|
bookmark: null,
|
|
}),
|
|
TopicNode: () => ({
|
|
modules: [],
|
|
}),
|
|
RoomNode: () => ({
|
|
title: 'A Room',
|
|
entryCount: 3,
|
|
appearance: 'blue',
|
|
description: 'A Room description',
|
|
schoolClass: {
|
|
id: SELECTED_CLASS_ID_ENCODED,
|
|
},
|
|
}),
|
|
RoomEntryNode: () => ({
|
|
title: 'A Room Entry',
|
|
contents: [],
|
|
}),
|
|
InstrumentNode: () => ({
|
|
contents: [],
|
|
title: 'instrument-title',
|
|
slug: 'instrument-slug',
|
|
id: getInstrumentId(),
|
|
bookmarks: null,
|
|
}),
|
|
HighlightNode: () => ({
|
|
note: null,
|
|
}),
|
|
};
|