@@ -118,8 +119,8 @@ const SubjectForm = ({ subject }: SubjectFormProps) => {
label="Note"
tooltip={
<>
- Add an optional note to be displayed at the top of the
- subject’s profile.
+ An optional note displayed at the top of the subject’s
+ profile.
>
}
{...field}
@@ -130,7 +131,7 @@ const SubjectForm = ({ subject }: SubjectFormProps) => {
Links
- Add optional links to be listed at the top of the subject’s
+ Optional links displayed at the top of the subject’s
profile.
diff --git a/app/_components/subject-layout.tsx b/app/_components/subject-layout.tsx
deleted file mode 100644
index 61a338a3..00000000
--- a/app/_components/subject-layout.tsx
+++ /dev/null
@@ -1,184 +0,0 @@
-import Avatar from '@/_components/avatar';
-import BackIconButton from '@/_components/back-icon-button';
-import Button from '@/_components/button';
-import DirtyHtml from '@/_components/dirty-html';
-import EventTypes from '@/_components/event-types';
-import ForwardSearchParamsButton from '@/_components/forward-search-params-button';
-import Missions from '@/_components/missions';
-import ScrollToTopHack from '@/_components/scroll-to-top-hack';
-import SubjectEventsDateFilter from '@/_components/subject-events-date-filter';
-import SubjectMenu from '@/_components/subject-menu';
-import Tip from '@/_components/tip';
-import getCurrentUser from '@/_queries/get-current-user';
-import getPublicSubject from '@/_queries/get-public-subject';
-import getSubject from '@/_queries/get-subject';
-import { SubjectDataJson } from '@/_types/subject-data-json';
-import ArrowLeftIcon from '@heroicons/react/24/outline/ArrowLeftIcon';
-import ArrowTopRightOnSquareIcon from '@heroicons/react/24/outline/ArrowTopRightOnSquareIcon';
-import Bars3Icon from '@heroicons/react/24/outline/Bars3Icon';
-import PlusIcon from '@heroicons/react/24/outline/PlusIcon';
-import { ReactNode } from 'react';
-import { twMerge } from 'tailwind-merge';
-
-interface SubjectLayoutProps {
- children: ReactNode;
- isPublic?: boolean;
- subjectId: string;
-}
-
-const SubjectLayout = async ({
- children,
- isPublic,
- subjectId,
-}: SubjectLayoutProps) => {
- const [{ data: subject }, user] = await Promise.all([
- isPublic ? getPublicSubject(subjectId) : getSubject(subjectId),
- getCurrentUser(),
- ]);
-
- if (!subject) return null;
- const isTeamMember = !!user && subject.team_id === user.id;
- const shareOrSubjects = isPublic ? 'share' : 'subjects';
- const subjectData = subject.data as SubjectDataJson;
-
- return (
-
-
-
-
- {!isPublic && (
- }
- label="Back"
- />
- )}
-
{subject.name}
-
- {isTeamMember ? (
-
-
-
- ) : (
-
- )}
-
- {!isPublic && (
-
- {!subject.archived && isTeamMember && (
-
-
-
- Event types{' '}
- define the events that can be recorded at any time.
-
-
- Training plans{' '}
- are long-term behavior modification plans for clients.
-
-
-
-
-
- )}
-
- {subjectData?.banner && (
-
- {subjectData?.banner}
-
- )}
- {!!subjectData?.links?.length && (
-
- )}
-
- {!subject.archived && (
- <>
-
-
- >
- )}
-
- )}
-
-
-
- Events
-
-
- Insights
-
-
-
-
- {children}
-
- );
-};
-
-export default SubjectLayout;
diff --git a/app/_components/subject-list.tsx b/app/_components/subject-list.tsx
index 3b367794..aaa37350 100644
--- a/app/_components/subject-list.tsx
+++ b/app/_components/subject-list.tsx
@@ -24,7 +24,7 @@ const SubjectList = async ({
>
@@ -83,5 +84,5 @@ const MissionForm = ({ mission, subjectId }: MissionFormProps) => {
);
};
-export type { MissionFormValues };
-export default MissionForm;
+export type { TrainingPlanFormValues };
+export default TrainingPlanForm;
diff --git a/app/_components/mission-menu.tsx b/app/_components/training-plan-menu.tsx
similarity index 85%
rename from app/_components/mission-menu.tsx
rename to app/_components/training-plan-menu.tsx
index e4a5f05c..51282a86 100644
--- a/app/_components/mission-menu.tsx
+++ b/app/_components/training-plan-menu.tsx
@@ -2,18 +2,18 @@
import Alert from '@/_components/alert';
import DropdownMenu from '@/_components/dropdown-menu';
-import deleteMission from '@/_mutations/delete-mission';
+import deleteTrainingPlan from '@/_mutations/delete-training-plan';
import EllipsisVerticalIcon from '@heroicons/react/24/outline/EllipsisVerticalIcon';
import PencilIcon from '@heroicons/react/24/outline/PencilIcon';
import TrashIcon from '@heroicons/react/24/outline/TrashIcon';
import { useToggle } from '@uidotdev/usehooks';
-interface MissionMenuProps {
+interface TrainingPlanMenuProps {
missionId: string;
subjectId: string;
}
-const MissionMenu = ({ missionId, subjectId }: MissionMenuProps) => {
+const TrainingPlanMenu = ({ missionId, subjectId }: TrainingPlanMenuProps) => {
const [deleteAlert, toggleDeleteAlert] = useToggle(false);
return (
@@ -46,10 +46,10 @@ const MissionMenu = ({ missionId, subjectId }: MissionMenuProps) => {
isConfirmingText="Deleting…"
isOpen={deleteAlert}
onClose={toggleDeleteAlert}
- onConfirm={() => deleteMission(missionId)}
+ onConfirm={() => deleteTrainingPlan(missionId)}
/>
>
);
};
-export default MissionMenu;
+export default TrainingPlanMenu;
diff --git a/app/_components/missions.tsx b/app/_components/training-plans.tsx
similarity index 82%
rename from app/_components/missions.tsx
rename to app/_components/training-plans.tsx
index fce66340..5fc3e8f8 100644
--- a/app/_components/missions.tsx
+++ b/app/_components/training-plans.tsx
@@ -1,6 +1,6 @@
import Button from '@/_components/button';
-import MissionMenu from '@/_components/mission-menu';
-import listSubjectMissions from '@/_queries/list-subject-missions';
+import TrainingPlanMenu from '@/_components/training-plan-menu';
+import listSubjectTrainingPlans from '@/_queries/list-subject-training-plans';
import ArrowUpRightIcon from '@heroicons/react/24/outline/ArrowUpRightIcon';
import { ReactElement } from 'react';
import { twMerge } from 'tailwind-merge';
@@ -10,8 +10,8 @@ interface MissionsProps {
subjectId: string;
}
-const Missions = async ({ isTeamMember, subjectId }: MissionsProps) => {
- const { data: missions } = await listSubjectMissions(subjectId);
+const TrainingPlans = async ({ isTeamMember, subjectId }: MissionsProps) => {
+ const { data: missions } = await listSubjectTrainingPlans(subjectId);
if (!missions) return null;
const listItems = missions.reduce((acc, mission) => {
@@ -53,7 +53,7 @@ const Missions = async ({ isTeamMember, subjectId }: MissionsProps) => {
)}
{isTeamMember && (
-