diff --git a/package.json b/package.json index b91f1bfa..08939ed8 100644 --- a/package.json +++ b/package.json @@ -65,6 +65,7 @@ "firebase": "^10.7.1", "firebase-admin": "^12.0.0", "formik": "^2.4.1", + "framer-motion": "^11.0.20", "fuse.js": "^7.0.0", "immer": "^10.0.2", "ioredis": "^5.3.2", diff --git a/packages/shared-ui/src/components/Timeline/index.tsx b/packages/shared-ui/src/components/Timeline/index.tsx index a7d7aebe..041ff2c7 100644 --- a/packages/shared-ui/src/components/Timeline/index.tsx +++ b/packages/shared-ui/src/components/Timeline/index.tsx @@ -106,7 +106,7 @@ export default function Timeline({
{/* */} -
+
import('@/features/Project/Team'), { loading: () => @@ -40,6 +42,29 @@ const AutomateMenu = dynamic( } ) +function AnimateView({ + visible, + children +}: { + visible: boolean + children: React.ReactNode +}) { + const id = useId() + return ( + + {visible ? ( + + {children} + + ) : null} + + ) +} + export default function ProjectTabContent() { const { loading } = useProjectViewStore() const { statusLoading } = useProjectStatusStore() @@ -65,14 +90,34 @@ export default function ProjectTabContent() {
) : null} - {type === 'NONE' && !isIgnored() && } - {isView(ProjectViewType.BOARD) && } - {/* {mode === 'board2' && } */} - {isView(ProjectViewType.LIST) && } - {isView(ProjectViewType.DASHBOARD) ? : null} - {isView(ProjectViewType.CALENDAR) ? : null} - {isView(ProjectViewType.TEAM) ? : null} - {isView(ProjectViewType.GOAL) ? : null} + + + + + + + + + + + + + + + + + + + + + + {/* {type === 'NONE' && !isIgnored() && } */} + {/* {isView(ProjectViewType.BOARD) && } */} + {/* {isView(ProjectViewType.LIST) && } */} + {/* {isView(ProjectViewType.DASHBOARD) ? : null} */} + {/* {isView(ProjectViewType.CALENDAR) ? : null} */} + {/* {isView(ProjectViewType.TEAM) ? : null} */} + {/* {isView(ProjectViewType.GOAL) ? : null} */} {mode === 'setting' && } {mode === 'automation-create' ? : null} {mode === 'automation' ? : null} diff --git a/packages/ui-app/app/_features/Project/Vision/VisionCreate.tsx b/packages/ui-app/app/_features/Project/Vision/VisionCreate.tsx index a34cab82..1245d8e9 100644 --- a/packages/ui-app/app/_features/Project/Vision/VisionCreate.tsx +++ b/packages/ui-app/app/_features/Project/Vision/VisionCreate.tsx @@ -27,8 +27,8 @@ export default function VisionCreate() { projectId, parentId: null, organizationId: orgID, - startDate: new Date(y, m, 1), - dueDate: new Date(y, m, 3) + startDate: new Date(y, m, 2), + dueDate: new Date(y, m, 5) } // ex: goal 12 /start-2 diff --git a/packages/ui-app/app/_features/Project/VisionTimeline/TimelineItem.tsx b/packages/ui-app/app/_features/Project/VisionTimeline/TimelineItem.tsx new file mode 100644 index 00000000..f6713a44 --- /dev/null +++ b/packages/ui-app/app/_features/Project/VisionTimeline/TimelineItem.tsx @@ -0,0 +1,66 @@ +import { ITimelineItem } from '@shared/ui' +import { useVisionContext } from '../Vision/context' +import { isSameDay } from 'date-fns' +import { HiOutlineFlag } from 'react-icons/hi2' +import { dateFormat } from '@shared/libs' +import MemberAvatar from '@/components/MemberAvatar' +import ProgressBar from '@/components/ProgressBar' + +export default function TimelineItem({ start, end, id, title }: ITimelineItem) { + const { getVisionProgress, getVisionData } = useVisionContext() + // {data => { + + const progress = getVisionProgress(id) + const visionData = getVisionData(id) + const assigneeIds = Array.from(new Set(visionData.assigneeIds)) + + const displayAssignees = assigneeIds.slice(0, 3) + const restAssignees = assigneeIds.slice(3).length + const isSame = isSameDay(start, end) + const hasTask = visionData.done || visionData.total + + return ( +
+
+
+
+ {title} +
+ +
{dateFormat(start, 'MMM dd')}
+ - +
{dateFormat(end, 'MMM dd')}
+
+
+
+ {displayAssignees.map(assigneeId => { + return ( + + ) + })} + + {restAssignees ? ( +
+ +3 +
+ ) : null} +
+
+ {hasTask ? ( +
+ +
+ {visionData.total} Total + {visionData.done} Done +
+
+ ) : null} +
+
+ ) + // }} +} diff --git a/packages/ui-app/app/_features/Project/VisionTimeline/index.tsx b/packages/ui-app/app/_features/Project/VisionTimeline/index.tsx index e2b2af90..3f9fd75b 100644 --- a/packages/ui-app/app/_features/Project/VisionTimeline/index.tsx +++ b/packages/ui-app/app/_features/Project/VisionTimeline/index.tsx @@ -1,38 +1,45 @@ import './style.css' import { useVisionContext } from '../Vision/context' -import VisionViewMode from '../Vision/VisionViewMode' -import { Avatar, Loading, Timeline } from '@shared/ui' -import VisionMonthNavigator from '../Vision/VisionMonthNavigator' -import MemberAvatar from '@/components/MemberAvatar' -import { HiOutlineFlag } from 'react-icons/hi2' -import { dateFormat } from '@shared/libs' -import ProgressBar from '@/components/ProgressBar' -import { isSameDay } from 'date-fns' +import { Timeline } from '@shared/ui' +import VisionCreate from '../Vision/VisionCreate' +import TimelineItem from './TimelineItem' +import { AnimatePresence, motion } from 'framer-motion' +import { useId } from 'react' -export default function VisionTimeline({ visible }: { visible: boolean }) { - const { - visions, - filter, - loading, - getVisionProgress, - getVisionData, - updateVision - } = useVisionContext() +function AnimateView({ + visible, + children +}: { + visible: boolean + children: React.ReactNode +}) { + const id = useId() + return ( + + {visible ? ( + + {children} + + ) : null} + + ) +} +export default function VisionTimeline({ visible }: { visible: boolean }) { + const { visions, filter, loading, updateVision } = useVisionContext() const ed = new Date() return (
- - {/*
*/} - {/*
*/} - {/* */} - {/*
*/} - {/* */} - {/*
*/} + className={`vision-timeline-container w-full px-3 pt-3 relative ${ + visible ? '' : 'hidden' + }`}> + {/* */} {data => { - const { start, end } = data - const progress = getVisionProgress(data.id) - const visionData = getVisionData(data.id) - const assigneeIds = Array.from(new Set(visionData.assigneeIds)) - - const displayAssignees = assigneeIds.slice(0, 3) - const restAssignees = assigneeIds.slice(3).length - const isSame = isSameDay(start, end) - const hasTask = visionData.done || visionData.total - return ( -
-
-
-
- {data.title} -
- -
{dateFormat(start, 'MMM dd')}
- - -
{dateFormat(end, 'MMM dd')}
-
-
-
- {displayAssignees.map(assigneeId => { - return ( - - ) - })} - - {restAssignees ? ( -
- +3 -
- ) : null} -
-
- {hasTask ? ( -
- -
- {visionData.total} Total - {visionData.done} Done -
-
- ) : null} -
-
+ + + ) }}
+
) } diff --git a/packages/ui-app/app/_features/TaskFilter/CalendarModeFilter.tsx b/packages/ui-app/app/_features/TaskFilter/CalendarModeFilter.tsx index 17a87d3f..42940015 100644 --- a/packages/ui-app/app/_features/TaskFilter/CalendarModeFilter.tsx +++ b/packages/ui-app/app/_features/TaskFilter/CalendarModeFilter.tsx @@ -50,7 +50,7 @@ const CalendarFilter = () => { { id: ICalendarView.WEEK, title: 'Week view' }, { id: ICalendarView.MONTH, title: 'Month view' }, ]} /> -
+ {/*
*/} {/*