-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
38 changed files
with
1,324 additions
and
372 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
app/(pages)/@modal/(layout)/templates/training-plans/[templateId]/loading.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import PageModalLoading from '@/_components/page-modal-loading'; | ||
|
||
const Loading = PageModalLoading; | ||
|
||
export default Loading; |
55 changes: 55 additions & 0 deletions
55
app/(pages)/@modal/(layout)/templates/training-plans/[templateId]/page.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import * as Modal from '@/_components/modal'; | ||
import PageModalHeader from '@/_components/page-modal-header'; | ||
import TrainingPlanTemplateForm from '@/_components/training-plan-template-form'; | ||
import TemplateType from '@/_constants/enum-template-type'; | ||
import getTemplate from '@/_queries/get-template'; | ||
import listInputs from '@/_queries/list-inputs'; | ||
import listSubjectsByTeamId from '@/_queries/list-subjects-by-team-id'; | ||
import listTemplatesWithData from '@/_queries/list-templates-with-data'; | ||
|
||
interface PageProps { | ||
params: { | ||
templateId: string; | ||
}; | ||
} | ||
|
||
const Page = async ({ params: { templateId } }: PageProps) => { | ||
const [ | ||
{ data: availableInputs }, | ||
{ data: availableModuleTemplates }, | ||
{ data: availableSessionTemplates }, | ||
{ data: subjects }, | ||
{ data: template }, | ||
] = await Promise.all([ | ||
listInputs(), | ||
listTemplatesWithData({ type: TemplateType.Module }), | ||
listTemplatesWithData({ type: TemplateType.Session }), | ||
listSubjectsByTeamId(), | ||
getTemplate(templateId), | ||
]); | ||
|
||
if ( | ||
!availableInputs || | ||
!availableModuleTemplates || | ||
!availableSessionTemplates || | ||
!subjects || | ||
!template | ||
) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<Modal.Content> | ||
<PageModalHeader title="Edit training plan template" /> | ||
<TrainingPlanTemplateForm | ||
availableInputs={availableInputs} | ||
availableModuleTemplates={availableModuleTemplates} | ||
availableSessionTemplates={availableSessionTemplates} | ||
subjects={subjects} | ||
template={template} | ||
/> | ||
</Modal.Content> | ||
); | ||
}; | ||
|
||
export default Page; |
5 changes: 5 additions & 0 deletions
5
.../(layout)/templates/training-plans/create/from-training-plan/[trainingPlanId]/loading.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import PageModalLoading from '@/_components/page-modal-loading'; | ||
|
||
const Loading = PageModalLoading; | ||
|
||
export default Loading; |
69 changes: 69 additions & 0 deletions
69
...dal/(layout)/templates/training-plans/create/from-training-plan/[trainingPlanId]/page.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
import * as Modal from '@/_components/modal'; | ||
import PageModalHeader from '@/_components/page-modal-header'; | ||
import TrainingPlanTemplateForm from '@/_components/training-plan-template-form'; | ||
import TemplateType from '@/_constants/enum-template-type'; | ||
import getTrainingPlanForTemplate from '@/_queries/get-training-plan-for-template'; | ||
import listInputs from '@/_queries/list-inputs'; | ||
import listSubjectsByTeamId from '@/_queries/list-subjects-by-team-id'; | ||
import listTemplatesWithData from '@/_queries/list-templates-with-data'; | ||
|
||
interface PageProps { | ||
params: { | ||
trainingPlanId: string; | ||
}; | ||
} | ||
|
||
const Page = async ({ params: { trainingPlanId } }: PageProps) => { | ||
const [ | ||
{ data: availableInputs }, | ||
{ data: availableModuleTemplates }, | ||
{ data: availableSessionTemplates }, | ||
{ data: subjects }, | ||
{ data: trainingPlan }, | ||
] = await Promise.all([ | ||
listInputs(), | ||
listTemplatesWithData({ type: TemplateType.Module }), | ||
listTemplatesWithData({ type: TemplateType.Session }), | ||
listSubjectsByTeamId(), | ||
getTrainingPlanForTemplate(trainingPlanId), | ||
]); | ||
|
||
if ( | ||
!availableInputs || | ||
!availableModuleTemplates || | ||
!availableSessionTemplates || | ||
!subjects || | ||
!trainingPlan | ||
) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<Modal.Content> | ||
<PageModalHeader title="New training plan template" /> | ||
<TrainingPlanTemplateForm | ||
availableInputs={availableInputs} | ||
availableModuleTemplates={availableModuleTemplates} | ||
availableSessionTemplates={availableSessionTemplates} | ||
disableCache | ||
isDuplicate | ||
subjects={subjects} | ||
template={{ | ||
data: { | ||
sessions: trainingPlan.sessions.map((session) => ({ | ||
modules: session.modules.map((module) => ({ | ||
content: module.content, | ||
inputIds: module.inputs.map((input) => input.id), | ||
name: module.name, | ||
})), | ||
title: session.title, | ||
})), | ||
}, | ||
name: trainingPlan.name ?? '', | ||
}} | ||
/> | ||
</Modal.Content> | ||
); | ||
}; | ||
|
||
export default Page; |
5 changes: 5 additions & 0 deletions
5
app/(pages)/@modal/(layout)/templates/training-plans/create/loading.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import PageModalLoading from '@/_components/page-modal-loading'; | ||
|
||
const Loading = PageModalLoading; | ||
|
||
export default Loading; |
44 changes: 44 additions & 0 deletions
44
app/(pages)/@modal/(layout)/templates/training-plans/create/page.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import * as Modal from '@/_components/modal'; | ||
import PageModalHeader from '@/_components/page-modal-header'; | ||
import TrainingPlanTemplateForm from '@/_components/training-plan-template-form'; | ||
import TemplateType from '@/_constants/enum-template-type'; | ||
import listInputs from '@/_queries/list-inputs'; | ||
import listSubjectsByTeamId from '@/_queries/list-subjects-by-team-id'; | ||
import listTemplatesWithData from '@/_queries/list-templates-with-data'; | ||
|
||
const Page = async () => { | ||
const [ | ||
{ data: availableInputs }, | ||
{ data: availableModuleTemplates }, | ||
{ data: availableSessionTemplates }, | ||
{ data: subjects }, | ||
] = await Promise.all([ | ||
listInputs(), | ||
listTemplatesWithData({ type: TemplateType.Module }), | ||
listTemplatesWithData({ type: TemplateType.Session }), | ||
listSubjectsByTeamId(), | ||
]); | ||
|
||
if ( | ||
!availableInputs || | ||
!availableModuleTemplates || | ||
!availableSessionTemplates || | ||
!subjects | ||
) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<Modal.Content> | ||
<PageModalHeader title="New training plan template" /> | ||
<TrainingPlanTemplateForm | ||
availableInputs={availableInputs} | ||
availableModuleTemplates={availableModuleTemplates} | ||
availableSessionTemplates={availableSessionTemplates} | ||
subjects={subjects} | ||
/> | ||
</Modal.Content> | ||
); | ||
}; | ||
|
||
export default Page; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.